bill 8 months ago
parent
commit
261235e4f9

+ 4 - 3
src/api/tagging-position.ts

@@ -18,7 +18,7 @@ interface ServicePosition {
   "tagPoint": string,
   normal: string
   
-  show3dTitle: number
+  globalVisibility: number
   type: string,
   mat: string
   fontSize: number,
@@ -54,7 +54,7 @@ const serviceToLocal = (position: ServicePosition, taggingId?: Tagging['id']): T
   taggingId: taggingId || position.tagId.toString(),
   localPos: JSON.parse(position.tagPoint),
   type: (position.type || TaggingPositionType['2d']) as TaggingPositionType,
-  globalVisibility: Boolean(position.show3dTitle),
+  globalVisibility: Boolean(position.globalVisibility),
   normal: position.normal ? JSON.parse(position.normal) : { x: 0, y: 0, z: 1 },
   mat: position.mat ? JSON.parse(position.mat) : {
     scale: 1,
@@ -70,7 +70,7 @@ const localToService = (position: TaggingPosition, update = false): PartialProps
   "tagId": Number(position.taggingId),
   "fusionNumId": Number(position.modelId),
   "tagPoint": JSON.stringify(position.localPos),
-  show3dTitle: Number(position.globalVisibility),
+  globalVisibility: Number(position.globalVisibility),
   type: position.type,
   mat: position.mat && JSON.stringify(position.mat),
   normal: JSON.stringify(position.normal),
@@ -86,6 +86,7 @@ export const fetchTaggingPositions = async (taggingId: Tagging['id']) => {
 }
 
 export const postAddTaggingPosition = async (position: TaggingPosition) => {
+  console.log(localToService(position))
   const servicePosition = await axios.post<ServicePosition>(INSERT_TAGGING_POINT, localToService(position))
   return serviceToLocal(servicePosition)
 }

+ 26 - 3
src/components/bill-ui/components/icon/iconfont/demo_index.html

@@ -55,6 +55,12 @@
           <ul class="icon_lists dib-box">
           
             <li class="dib">
+              <span class="icon iconfont">&#xe778;</span>
+                <div class="name">pic_path</div>
+                <div class="code-name">&amp;#xe778;</div>
+              </li>
+          
+            <li class="dib">
               <span class="icon iconfont">&#xe776;</span>
                 <div class="name">list_s</div>
                 <div class="code-name">&amp;#xe776;</div>
@@ -594,9 +600,9 @@
 <pre><code class="language-css"
 >@font-face {
   font-family: 'iconfont';
-  src: url('iconfont.woff2?t=1734504872176') format('woff2'),
-       url('iconfont.woff?t=1734504872176') format('woff'),
-       url('iconfont.ttf?t=1734504872176') format('truetype');
+  src: url('iconfont.woff2?t=1734660652855') format('woff2'),
+       url('iconfont.woff?t=1734660652855') format('woff'),
+       url('iconfont.ttf?t=1734660652855') format('truetype');
 }
 </code></pre>
           <h3 id="-iconfont-">第二步:定义使用 iconfont 的样式</h3>
@@ -623,6 +629,15 @@
         <ul class="icon_lists dib-box">
           
           <li class="dib">
+            <span class="icon iconfont icon-pic_path"></span>
+            <div class="name">
+              pic_path
+            </div>
+            <div class="code-name">.icon-pic_path
+            </div>
+          </li>
+          
+          <li class="dib">
             <span class="icon iconfont icon-list_s"></span>
             <div class="name">
               list_s
@@ -1434,6 +1449,14 @@
           
             <li class="dib">
                 <svg class="icon svg-icon" aria-hidden="true">
+                  <use xlink:href="#icon-pic_path"></use>
+                </svg>
+                <div class="name">pic_path</div>
+                <div class="code-name">#icon-pic_path</div>
+            </li>
+          
+            <li class="dib">
+                <svg class="icon svg-icon" aria-hidden="true">
                   <use xlink:href="#icon-list_s"></use>
                 </svg>
                 <div class="name">list_s</div>

+ 7 - 3
src/components/bill-ui/components/icon/iconfont/iconfont.css

@@ -1,8 +1,8 @@
 @font-face {
   font-family: "iconfont"; /* Project id 4647199 */
-  src: url('iconfont.woff2?t=1734504872176') format('woff2'),
-       url('iconfont.woff?t=1734504872176') format('woff'),
-       url('iconfont.ttf?t=1734504872176') format('truetype');
+  src: url('iconfont.woff2?t=1734660652855') format('woff2'),
+       url('iconfont.woff?t=1734660652855') format('woff'),
+       url('iconfont.ttf?t=1734660652855') format('truetype');
 }
 
 .iconfont {
@@ -13,6 +13,10 @@
   -moz-osx-font-smoothing: grayscale;
 }
 
+.icon-pic_path:before {
+  content: "\e778";
+}
+
 .icon-list_s:before {
   content: "\e776";
 }

File diff suppressed because it is too large
+ 1 - 1
src/components/bill-ui/components/icon/iconfont/iconfont.js


+ 7 - 0
src/components/bill-ui/components/icon/iconfont/iconfont.json

@@ -6,6 +6,13 @@
   "description": "",
   "glyphs": [
     {
+      "icon_id": "42880568",
+      "name": "pic_path",
+      "font_class": "pic_path",
+      "unicode": "e778",
+      "unicode_decimal": 59256
+    },
+    {
       "icon_id": "42851849",
       "name": "list_s",
       "font_class": "list_s",

BIN
src/components/bill-ui/components/icon/iconfont/iconfont.ttf


BIN
src/components/bill-ui/components/icon/iconfont/iconfont.woff


BIN
src/components/bill-ui/components/icon/iconfont/iconfont.woff2


+ 2 - 2
src/components/path/sign.vue

@@ -66,7 +66,7 @@ path.bus.on("changePoints", (points) => {
   currentPoints = points.map((p, ndx) => ({
     name: p.name,
     position: { ...p.position },
-    modelId: p.modelId,
+    modelId: p.modelId.toString(),
   }));
   emit("updatePoints", currentPoints);
 });
@@ -117,7 +117,7 @@ watch(
 path.bus.on("linePositionChange", (position) => {
   const p = {
     position: { ...position.pos },
-    modelId: position.modelId,
+    modelId: position.modelId.toString(),
   };
   currentLine = { ...getLineProps(), ...p };
   emit("updateLinePosition", p);

+ 2 - 0
src/store/path.ts

@@ -29,11 +29,13 @@ export const paths = ref<Paths>([])
 export const getPath = (id: Path['id']) => paths.value.find(path => path.id === id)
 
 export const getPathIsShow = (path: Path) => {
+  if (!custom.showPaths && custom.showPath !== path.id) return false;
   const modelIds = path.points.map(item => item.modelId)
   if (path.linePosition?.modelId) {
     modelIds.push(path.linePosition.modelId)
   }
   return modelIds.every(modelId =>  {
+    if (modelId === '-100') return true;
     const model = getFuseModel(modelId)
     return model && getFuseModelShowVariable(model).value
   })

+ 1 - 0
src/views/guide/guide/edit.vue

@@ -14,6 +14,7 @@
       :guide="guide"
       @edit="edit(guide)"
       @delete="deleteGuide(guide)"
+      @updateTitle="(title) => (guide.title = title)"
     />
   </ui-group>
   <Teleport to="#layout-app">

+ 35 - 4
src/views/guide/guide/sign.vue

@@ -12,7 +12,17 @@
         />
       </div>
       <div>
-        <p>{{ guide.title }}</p>
+        <p v-show="!isEditTitle">{{ guide.title }}</p>
+        <ui-input
+          class="view-title-input"
+          type="text"
+          :modelValue="guide.title"
+          :maxlength="15"
+          @update:modelValue="(title: string) => $emit('updateTitle', title.trim())"
+          v-show="isEditTitle"
+          ref="inputRef"
+          height="28px"
+        />
       </div>
     </div>
     <div class="actions" v-if="edit">
@@ -29,27 +39,42 @@
 import { Guide, getGuidePaths } from "@/store";
 import { getFileUrl, saveAs } from "@/utils";
 import { getResource } from "@/env";
-import { computed, watchEffect, nextTick } from "vue";
+import { computed, watchEffect, nextTick, ref } from "vue";
 import { playSceneGuide, isScenePlayIng, pauseSceneGuide } from "@/sdk";
 import { VideoRecorder } from "simaqcore";
+import useFocus from "bill/hook/useFocus";
+import { Message } from "bill/expose-common";
 
 const props = withDefaults(defineProps<{ guide: Guide; edit?: boolean }>(), {
   edit: true,
 });
 
+const inputRef = ref();
+const isEditTitle = useFocus(computed(() => inputRef.value?.vmRef.root));
+watchEffect(() => {
+  if (!isEditTitle.value && !props.guide.title.length) {
+    isEditTitle.value = true;
+    Message.warning("测量名称不可为空");
+  }
+});
+
 const emit = defineEmits<{
+  (e: "updateTitle", t: string): void;
   (e: "delete"): void;
   (e: "play"): void;
   (e: "edit"): void;
 }>();
 
 const menus = [
+  { label: "重命名", value: "editTitle" },
   { label: "编辑", value: "edit" },
-  // { label: "下载", value: "download" },
   { label: "删除", value: "delete" },
 ];
 const actions = {
   edit: () => emit("edit"),
+  editTitle: () => {
+    isEditTitle.value = true;
+  },
   delete: () => emit("delete"),
   download: () => {
     const config: any = {
@@ -150,7 +175,7 @@ const paths = computed(() => getGuidePaths(props.guide));
       }
     }
 
-    div {
+    div:not(.view-title-input) {
       margin-left: 10px;
 
       p {
@@ -166,3 +191,9 @@ const paths = computed(() => getGuidePaths(props.guide));
   }
 }
 </style>
+
+<style>
+.view-title-input.ui-input .text.suffix input {
+  padding-right: 50px;
+}
+</style>

+ 4 - 4
src/views/guide/index.vue

@@ -24,14 +24,14 @@ import PathEdit from "./path/edit.vue";
 import { reactive, ref, watchEffect } from "vue";
 import { guides, isEdit, paths } from "@/store";
 
-const current = ref("guide");
+const current = ref("path");
 const tabs = reactive([
-  { key: "guide", text: "导览()" },
   { key: "path", text: "路线()" },
+  { key: "guide", text: "导览()" },
 ]);
 watchEffect(() => {
-  tabs[0].text = `导览(${guides.value.length})`;
-  tabs[1].text = `路线(${paths.value.length})`;
+  tabs[1].text = `导览(${guides.value.length})`;
+  tabs[0].text = `路线(${paths.value.length})`;
 });
 </script>
 

+ 9 - 2
src/views/guide/path/sign.vue

@@ -2,7 +2,9 @@
   <ui-group-option class="sign-guide">
     <div class="info">
       <div class="guide-cover">
-        <span class="img"></span>
+        <span class="img">
+          <ui-icon type="pic_path" class="path-icon" />
+        </span>
         <!-- @click="playSceneGuide(paths, undefined, true)" -->
         <ui-icon
           type="preview"
@@ -85,13 +87,18 @@ const actions = {
         font-size: 16px;
       }
 
+      .path-icon {
+        color: rgba(255, 255, 255, 0.2);
+        font-size: 30px;
+      }
+
       .img {
         width: 48px;
         height: 48px;
         object-fit: cover;
         border-radius: 4px;
         overflow: hidden;
-        background-color: rgba(255, 255, 255, 0.6);
+        background-color: #535555;
         display: block;
       }
     }

+ 10 - 2
src/views/guide/show.vue

@@ -18,6 +18,13 @@
         </template>
       </Dropdown>
     </template>
+    <template #icon v-if="currentKey === 'path'">
+      <ui-icon
+        ctrl
+        :type="custom.showPaths ? 'eye-s' : 'eye-n'"
+        @click="custom.showPaths = !custom.showPaths"
+      />
+    </template>
     <div class="show-guides">
       <Guide v-if="currentKey === 'guide'" />
       <Path v-if="currentKey === 'path'" />
@@ -32,11 +39,12 @@ import Path from "./path/show.vue";
 import { guides, paths } from "@/store";
 import { Menu, Dropdown } from "ant-design-vue";
 import { DownOutlined } from "@ant-design/icons-vue";
+import { custom } from "@/env";
 
-const currentKey = ref("guide");
+const currentKey = ref("path");
 const tabs = computed(() => [
-  { key: "guide", text: "导览", count: guides.value.length },
   { key: "path", text: "路线", count: paths.value.length },
+  { key: "guide", text: "导览", count: guides.value.length },
 ]);
 const current = computed(() => tabs.value.find((i) => i.key === currentKey.value)!);
 const items = computed(() => {