Sfoglia il codice sorgente

Merge branch 'local' of http://192.168.0.115:3000/bill/fuse-code into local

xzw 1 anno fa
parent
commit
e0a3e1bd19

+ 9 - 0
src/components/bill-ui/components/message/index.js

@@ -37,6 +37,15 @@ Message.use = function use(app) {
 
     const existsShows = []
     const oneShow = config => {
+        console.log(config)
+        if (config === null) {
+            config = 'null'
+        } else if (typeof config === 'string') {
+            config = {
+                msg: 'string',
+                type: 'warning'
+            }
+        }
         const key = config.type + config.msg
         if (!existsShows.includes(key)) {
             const index = existsShows.length

+ 1 - 1
src/components/tagging/sign.vue

@@ -24,7 +24,7 @@
       >
         <h2>{{ tagging.title }} </h2>
         <div class="content">
-          <p><span>特征描述:</span>{{ tagging.desc }}</p>
+          <p><span>特征描述:</span><div v-html="tagging.desc"></div></p>
           <p><span>遗留部位:</span>{{ tagging.part }}</p>
           <p><span>提取方法:</span>{{ tagging.method }}</p>
           <p><span>提取人:</span>{{ tagging.principal }}</p>

+ 1 - 1
src/layout/header/index.vue

@@ -1,7 +1,7 @@
 <template>
   <ui-editor-head class="header">
     <div class="main">
-      <span class="title">{{ sysTitle }}</span>
+      <span class="title"> </span>
     </div>
 
     <div class="control">

+ 26 - 5
src/sdk/association.ts

@@ -8,7 +8,8 @@ import {
   arrayChildEffectScope,
   togetherCallback,
   showLoad,
-  hideLoad
+  hideLoad,
+  round
 } from '@/utils'
 import SDKApp from './index.vue'
 import Components from 'bill/index'
@@ -50,18 +51,37 @@ const associationModels = (sdk: SDK) => {
       })
       sceneModelMap.set(itemRaw, sceneModel)
 
+      let delyLoad = true
+      setTimeout(() => {
+        delyLoad = false
+      }, 3000)
       sceneModel.bus.on('transformChanged', transform => {
         setTimeout(() => {
           selfUpdate = true
           const data = transform;
           if (transform.rotation) {
             data.rotation = {
-              x: transform.rotation.x,
-              y: transform.rotation.y,
-              z: transform.rotation.z
+              x: round(transform.rotation.x, 5),
+              y: round(transform.rotation.y, 5),
+              z: round(transform.rotation.z, 5)
             }
           }
-          Object.assign(item, data)
+          if (transform.position) {
+            data.position = {
+              x: transform.position.x,
+              y: round(transform.position.y, 5),
+              z: round(transform.position.z, 5)
+            }
+          }
+          if (transform.bottom) {
+            data.bottom = round(transform.bottom,5)
+          }
+          if (transform.scale) {
+            data.scale = round(transform.scale,5)
+          }
+          console.log(delyLoad,{...item}, data)
+
+          Object.assign(delyLoad ? toRaw(item) : item, data)
           nextTick(() => selfUpdate = false)
         })
       })
@@ -109,6 +129,7 @@ const associationModels = (sdk: SDK) => {
           }, {flush: 'sync'})
           watchEffect(() => {
             item.position
+            selfUpdate || console.log('change position')
             selfUpdate || getSceneModel(item)?.changePosition(item.position)
           }, {flush: 'sync'})
           watchEffect(() => {

+ 12 - 1
src/store/guide.ts

@@ -18,6 +18,7 @@ import {
 } from '@/utils'
 
 import type { GuidePath as SGuidePath, Guide as SGuide } from '@/api'
+import { Dialog } from 'bill/index'
 
 export type GuidePath = LocalMode<SGuidePath, 'cover'>
 export type GuidePaths = GuidePath[]
@@ -96,5 +97,15 @@ export const saveGuides = saveStoreItems(
 export const autoSaveGuides = autoSetModeCallback(guides, {
   backup: backupGuides,
   recovery: recoverGuides,
-  save: saveGuides,
+  save: async () => {
+    guides.value.forEach((guide) => {
+      if (!guide.paths.length) {
+        Dialog.alert('无法保存空路径导览!')
+        throw '无法保存空路径导览!'
+      }
+
+      guide.cover = guide.paths[0].cover
+    })
+    await saveGuides()
+  },
 })

+ 4 - 0
src/utils/loading.ts

@@ -10,6 +10,10 @@ export const loadPack = <T, K extends (...args: any) => Promise<T>>(fn: K | Prom
     return ret
 }
 
+export const round = (num: number, index: number = 2) => {
+  const s = Math.pow(10, index)
+  return Math.round(num * s) / s
+}
 export const createLoadPack = <T, K extends (...args: any) => Promise<T>>(fn: K): K => 
   ((...args) => loadPack(() => fn(...args))) as K
 

+ 2 - 12
src/views/guide/edit-paths.vue

@@ -64,7 +64,6 @@
               width="54px" 
               height="26px" 
               v-model="path.time" 
-              :modelValue="path.time" 
               @update:modelValue="(val: number) => updatePathInfo(i, { time: val })"
               :ctrl="false" 
               :min="0.1" 
@@ -95,7 +94,7 @@ import type { Guide, GuidePaths, GuidePath } from '@/store'
 import type { CalcPathProps } from '@/sdk'
 
 const props = defineProps< { data: Guide }>()
-const paths = ref<GuidePaths>([...props.data.paths])
+const paths = ref<GuidePaths>(props.data.paths)
 const current = ref<GuidePath>(paths.value[0])
 
 const updatePathInfo = (index: number, calcInfo: CalcPathProps[1]) => {
@@ -104,7 +103,6 @@ const updatePathInfo = (index: number, calcInfo: CalcPathProps[1]) => {
     calcInfo
   )
   Object.assign(paths.value[index], info)
-  console.log(info)
 }
 
 useViewStack(() => 
@@ -116,17 +114,9 @@ useViewStack(() =>
   ])
 );
 
+
 useAutoSetMode(paths, {
   save() {
-    if (!paths.value.length) {
-      Dialog.alert('无法保存空路径导览!')
-      throw '无法保存空路径导览!'
-    }
-    props.data.paths = paths.value
-    props.data.cover = paths.value[0].cover
-    if (isTemploraryID(props.data.id)) {
-      guides.value.push(props.data)
-    }
   }
 })
 

+ 5 - 2
src/views/guide/index.vue

@@ -2,7 +2,7 @@
   <RightFillPano>
     <ui-group borderBottom>
       <template #header>
-        <ui-button @click="edit(createGuide())">
+        <ui-button @click="edit(createGuide(), true)">
           <ui-icon type="add" />
           新增 
         </ui-button>
@@ -36,9 +36,12 @@ import { playSceneGuide } from '@/sdk'
 
 const currentGuide = ref<Guide | null>()
 const leaveEdit = () => currentGuide.value = null
-const edit = (guide: Guide) => {
+const edit = (guide: Guide, insert = false) => {
   currentGuide.value = guide
   enterEdit()
+  if (insert) {
+    guides.value.push(guide)
+  }
   sysBus.on('leave', leaveEdit)
 }