bill 1 سال پیش
والد
کامیت
7d9451cb30
4فایلهای تغییر یافته به همراه20 افزوده شده و 16 حذف شده
  1. 1 1
      src/components/tagging/sign.vue
  2. 12 1
      src/store/guide.ts
  3. 2 12
      src/views/guide/edit-paths.vue
  4. 5 2
      src/views/guide/index.vue

+ 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>

+ 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()
+  },
 })

+ 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)
 }