Browse Source

修改bug

bill 2 years ago
parent
commit
76c20356d3

+ 2 - 0
src/api/guide-path.ts

@@ -15,6 +15,7 @@ interface ServiceGuidePath {
   position: string
   target: string
   time: number
+  sort: number
   speed: number
   cover: string
 }
@@ -25,6 +26,7 @@ export interface GuidePath {
   position: SceneLocalPos
   target: SceneLocalPos
   time: number
+  sort: number
   speed: number
   cover: string
 }

+ 6 - 27
src/api/instance.ts

@@ -10,6 +10,7 @@ const instance = axiosFactory()
 export const {
   axios,
   addUnsetTokenURLS,
+  delUnsetTokenURLS,
   addReqErrorHandler,
   addResErrorHandler,
   delReqErrorHandler,
@@ -29,16 +30,14 @@ addReqErrorHandler(err => {
 
 addResErrorHandler(
   (response, data) => {
-    if (response.status !== 200) {
+    if (response && response.status !== 200) {
       Message.error(response.statusText)
     } else if (data) {
       const msg = data.code && ResCodeDesc[data.code] ? ResCodeDesc[data.code] : (data?.message || data?.msg)
-      Message.error(msg)
-
       if (data.code === ResCode.TOKEN_INVALID) {
-        setTimeout(() => {
-          location.href = '/'
-        }, 2000)
+        location.href = '/'
+      } else {
+        Message.error(msg)
       }
     }
   }
@@ -49,34 +48,14 @@ addHook({
     if (config.url !== URL.RECORD_STATUS) {
       showLoad()
     }
-    const isShare = Number(params.share)
-    if (config.headers) {
-      config.headers.share = isShare
-    } else {
-      config.headers = { share: isShare }
-    }
   }, 
   after: (config) => {
-    if (config.url !== URL.RECORD_STATUS) {
+    if (!config || config.url !== URL.RECORD_STATUS) {
       hideLoad()
     }
   } 
 })
 
-addUnsetTokenURLS(
-  // URL.FUSE_MODEL_LIST,
-  // URL.FUSE_UPDATE_MODEL,
-  // URL.FUSE_INSERT_MODEL,
-  // URL.FUSE_DELETE_MODEL,
-  // URL.TAGGING_LIST,
-  // URL.DELETE_TAGGING,
-  // URL.INSERT_TAGGING,
-  // URL.UPDATE_TAGGING,
-  // URL.TAGGING_POINT_LIST,
-  // URL.INSERT_TAGGING_POINT,
-  // URL.UPDATE_TAGGING_POINT,
-  // URL.DELETE_TAGGING_POINT,
-)
 setDefaultURI(baseURL)
 params.token && setToken(params.token)
 

+ 13 - 12
src/api/setup.ts

@@ -7,8 +7,8 @@ export type ResErrorHandler = <D, T extends ResData<D>>(response: AxiosResponse<
 export type ReqErrorHandler = <T>(err: Error, response: AxiosRequestConfig<T>) => void
 export type ResData<T> = { code: ResCode, message: string, data: T, msg: string }
 export type Hook = {
-  before: (config: AxiosRequestConfig) => void
-  after: (config: AxiosRequestConfig) => void
+  before?: (config: AxiosRequestConfig) => void
+  after?: (config: AxiosRequestConfig) => void
 }
 
 export const axiosFactory = () => {
@@ -114,7 +114,7 @@ export const axiosFactory = () => {
   }
 
   const matchURL = (urls: string[], config: AxiosRequestConfig<any>) => 
-    config.url && urls.includes(config.url)
+    config && config.url && urls.includes(config.url)
 
   const callErrorHandler = (key: 'req' | 'res', ...args: any[]) => {
     Promise.resolve()
@@ -127,16 +127,17 @@ export const axiosFactory = () => {
   axiosRaw.interceptors.request.use(
     config => {
       for (const hook of axiosConfig.hook) {
-        hook.before(config)
+        hook.before && hook.before(config)
       }
 
       if (!matchURL(axiosConfig.unTokenSet, config)) {
         if (!axiosConfig.token) {
-          // if (!matchURL(axiosConfig.unReqErrorSet, config)) {
-          //   const error = new Error('缺少token')
-          //   callErrorHandler('req', error, config)
-          //   throw error
-          // }
+          if (!matchURL(axiosConfig.unReqErrorSet, config)) {
+            console.log(config.url)
+            const error = new Error('缺少token')
+            callErrorHandler('req', error, config)
+            throw error
+          }
         } else {
           config.headers = {
             ...config.headers,
@@ -151,7 +152,7 @@ export const axiosFactory = () => {
   axiosRaw.interceptors.response.use(
     (response: AxiosResponse<ResData<any>>) => {
       for (const hook of axiosConfig.hook) {
-        hook.after(response.config)
+        hook.after && hook.after(response.config)
       }
 
       if (matchURL(axiosConfig.unResErrorSet, response.config)) {
@@ -173,12 +174,12 @@ export const axiosFactory = () => {
     },
     (err) => {
       for (const hook of axiosConfig.hook) {
-        hook.after(err.config)
+        hook.after && hook.after(err.config)
       }
       if (!matchURL(axiosConfig.unResErrorSet, err.config)) {
         callErrorHandler('res', err.response)
       }
-      throw new Error(err.response.statusText)
+      throw new Error(err.response && err.response.statusText)
     }
   )
 

+ 3 - 1
src/api/tagging-style.ts

@@ -1,6 +1,7 @@
 import axios from './instance'
 import { TAGGING_STYLE_LIST, INSERT_TAGGING_STYLE, DELETE_TAGGING_STYLE, UPLOAD_HEADS } from './constant'
 import { jsonToForm } from '@/utils'
+import { params } from '@/env'
 interface ServiceStyle {
   iconId: number,
   iconTitle: string,
@@ -37,7 +38,8 @@ const toService = (style: TaggingStyle): ServiceStyle => ({
 export type TaggingStyles = TaggingStyle[]
 
 export const fetchTaggingStyles = async () => {
-  const data = await axios.get<ServiceStyle[]>(TAGGING_STYLE_LIST)
+  const reqParams = params.share ? { caseId: params.caseId } : { }
+  const data = await axios.get<ServiceStyle[]>(TAGGING_STYLE_LIST, { params: reqParams })
   return data.map(toLocal)
 }
 

+ 12 - 3
src/app.vue

@@ -17,9 +17,12 @@
 </template>
 
 <script lang="ts" setup>
-import { custom } from '@/env'
-import { computed } from 'vue'
-import { isEdit, appEl } from '@/store'
+import { custom, params } from '@/env'
+import { computed, watchEffect } from 'vue'
+import { isEdit, appEl, prefix } from '@/store'
+import { addHook, addUnsetTokenURLS, delHook, getCaseInfo, delUnsetTokenURLS } from '@/api'
+import { currentLayout, RoutesName } from './router';
+import * as URL from '@/api/constant'
 
 const layoutClassNames = computed(() => {
   return {
@@ -42,6 +45,12 @@ const layoutStyles = computed(() => {
   return styles
 })
 
+watchEffect(() => {
+  if (currentLayout.value) {
+    getCaseInfo().then(ecase => prefix.value = `${ecase.caseTitle} | `)  
+  }
+})
+
 </script>
 
 <style scoped lang="scss">

+ 4 - 4
src/components/actions/index.vue

@@ -13,7 +13,8 @@
 </template>
 
 <script lang="ts" setup>
-import { ref, toRaw, watchEffect, onBeforeUnmount, nextTick } from 'vue'
+import { useActive } from '@/hook';
+import { ref, toRaw, watchEffect, onBeforeUnmount, nextTick, watch } from 'vue'
 
 export type ActionsItem<T = any> = { 
   icon: string, 
@@ -34,13 +35,12 @@ const clickHandler = (select: ActionsItem) => {
     nextTick(() => selected.value && clickHandler(selected.value))
   }
 }
-
-watchEffect((onCleanup) => {
+watch(selected, (_n, _o, onCleanup) => {
   if (selected.value?.action) {
     const cleanup = selected.value.action()
     cleanup && onCleanup(cleanup)
   }
-})
+}, { flush: 'sync' })
 
 onBeforeUnmount(() => {
   selected.value = null

+ 1 - 1
src/components/bill-ui/assets/scss/components/_input.scss

@@ -278,7 +278,7 @@
         display: flex;
         padding: 0 10px;
         align-items: center;
-        justify-content: space-between;
+        justify-content: end;
 
       }
 

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

@@ -22,13 +22,8 @@
 </template>
 
 <script setup lang="ts">
-import { computed, ref } from 'vue'
+import { computed } from 'vue'
 import { isEdit, title, isOld, leave, save } from '@/store'
-import { getCaseInfo } from '@/api'
-
-const prefix = ref('')
-getCaseInfo()
-  .then(ecase => prefix.value = `${ecase.caseTitle} | `)
 
 const props = defineProps<{ title?: string }>()
 const sysTitle = computed(() => props.title || title.value)

+ 8 - 4
src/layout/edit/scene-select.vue

@@ -102,14 +102,19 @@ const okHandler = createLoadPack(async () => {
     .map(addFuseModel)
 
   await Promise.all(addPromises)
-
+  console.log('111')
   await new Promise<void>((resolve) => {
     nextTick(() => {
       const stop = watchEffect(() => {
+        console.log('222')
         if (fuseModelsLoaded.value) {
-          nextTick(() => stop())
-          resolve()
+          nextTick(() => {
+            stop()
+            resolve()
+            console.log('333')
+          })
         }
+        
       })
     })
   })
@@ -121,7 +126,6 @@ watch(visible, (visible, oldvisible) => {
   if (visible !== oldvisible) {
     keyword.value = ''
     selects.value = selectIds.value
-    console.log(selects.value)
 
     visible && initialScenes()
   }

+ 2 - 2
src/layout/model-list/sign.vue

@@ -19,14 +19,14 @@
     </div>
     <div class="model-desc"  v-if="active">
       <p><span>数据来源:</span>{{ SceneTypeDesc[model.type] }}</p>
-      <p><span>数据大小:</span>{{ model.size }}</p>
+      <p v-if="model.type !== SceneType.SWSS"><span>数据大小:</span>{{ model.size }}</p>
       <p><span>拍摄时间:</span>{{ model.time }}</p>
     </div>
   </div>
 </template>
 
 <script lang="ts" setup>
-import { getFuseModelShowVariable, SceneTypeDesc } from '@/store'
+import { getFuseModelShowVariable, SceneTypeDesc, SceneType } from '@/store'
 import { custom } from '@/env'
 
 import type { FuseModel } from '@/store'

+ 46 - 1
src/main.ts

@@ -1,12 +1,57 @@
-import { createApp } from 'vue'
+import { createApp, watchEffect } from 'vue'
 import './style.scss'
 import App from './app.vue'
 import Components from 'bill/index'
 import router from './router'
+import { params } from '@/env'
+import { addHook, addUnsetTokenURLS, delHook, delUnsetTokenURLS } from '@/api'
+import { currentLayout, RoutesName } from './router';
+import * as URL from '@/api/constant'
 
 const app = createApp(App)
 app.use(Components)
 app.use(router)
 app.mount('#app')
 
+
+watchEffect((onCleanup) => {
+  if (currentLayout.value === RoutesName.show) {
+    const untokenURLS = params.share 
+      ? [
+          URL.FUSE_MODEL_LIST,
+          URL.MODEL_LIST,
+          URL.TAGGING_LIST,
+          URL.TAGGING_POINT_LIST,
+          URL.TAGGING_STYLE_LIST,
+          URL.MESASURE_LIST,
+          URL.GUIDE_LIST,
+          URL.GUIDE_PATH_LIST,
+          URL.RECORD_LIST,
+          URL.RECORD_FRAGMENT_LIST,
+          URL.VIEW_LIST,
+          URL.FOLDER_TYPE_LIST,
+          URL.FLODER_LIST,
+          URL.MODEL_SIGN
+        ]
+      : []
+      
+    const apiHook = {
+      before(config: any) {
+        const isShare = Number(params.share)
+        if (config.headers) {
+          config.headers.share = isShare
+        } else {
+          config.headers = { share: isShare }
+        }
+      }
+    }
+    addHook(apiHook)
+    addUnsetTokenURLS(...untokenURLS)
+    onCleanup(() => {
+      delHook(apiHook)
+      delUnsetTokenURLS(...untokenURLS)
+    })
+  }
+}, { flush: 'sync' })
+
 export default app

+ 1 - 1
src/model/app.vue

@@ -40,7 +40,7 @@ export const Model = defineComponent({
         [SceneType.SWKK]: `/swkk/spg.html?m=${scene.value.num}`,
         [SceneType.SWKJ]: `/swkk/spg.html?m=${scene.value.num}`,
         [SceneType.SWSS]: `/swss/index.html?m=${scene.value.num}`,
-        [SceneType.SWMX]: `index.html?caseId=${params.caseId}&modelId=${scene.value.num}&token=${params.token}#sign-model`
+        [SceneType.SWMX]: `index.html?caseId=${params.caseId}&modelId=${scene.value.num}&share=1#sign-model`
       }
       return urls[type]
     })

+ 1 - 2
src/router/index.ts

@@ -31,13 +31,12 @@ export const currentRouteNames = computed(() => {
 
 export const currentLayout = computed(() => {
   const names = currentRouteNames.value
-  const layoutNames = [RoutesName.fuseEditSwitch] as const
+  const layoutNames = [RoutesName.fuseEditSwitch, RoutesName.show] as const
   return layoutNames.find(name => names.includes(name))
 })
 
 export const currentMeta = computed(() => {
   const currentName = router.currentRoute.value.name
-  console.error(currentName, metas)
   if (currentName && currentName in metas) {
     return (metas as any )[currentName] as ((typeof metas)[keyof typeof metas])
   }

+ 4 - 5
src/store/fuse-model.ts

@@ -1,4 +1,4 @@
-import { computed, ref, watch, watchEffect, watchPostEffect } from 'vue'
+import { computed, reactive, ref, watch, watchEffect, watchPostEffect } from 'vue'
 import { autoSetModeCallback, unSetModelUpdate, createTemploraryID } from './sys'
 import { custom } from '@/env'
 import { 
@@ -74,7 +74,6 @@ watchPostEffect(() => {
   fuseModelsLoaded.value = loaded
 })
 
-
 let bcModels: FuseModels = []
 export const getBackupFuseModels = () => bcModels
 export const backupFuseModels = () => {
@@ -84,7 +83,7 @@ export const backupFuseModels = () => {
     position: {...model.position},
   }))
 }
-watchEffect(() => {
+watch(fuseModels, () => {
   for (const model of bcModels) {
     const newModel = getFuseModel(model.id)
     if (newModel) {
@@ -93,7 +92,7 @@ watchEffect(() => {
       model.loaded = newModel.loaded
     }
   }
-})
+}, { deep: true })
 
 const serviceToLocal = (model: SModel): FuseModel => ({
   ...model, 
@@ -117,7 +116,7 @@ export const recoverFuseModels = () => {
 export const updateFuseModel = updateStoreItem(fuseModels, postUpdateFuseModels)
 export const deleteFuseModel = deleteStoreItem(fuseModels, postDeleteFuseModel)
 export const addFuseModel = async (model: FuseModel) => {
-  const addModel = serviceToLocal(await postAddFuseModel(model))
+  const addModel = reactive(serviceToLocal(await postAddFuseModel(model)))
   initFuseModel(addModel)
   unSetModelUpdate(() => fuseModels.value.push(addModel))
 }

+ 16 - 1
src/store/guide-path.ts

@@ -31,6 +31,7 @@ export const createGuidePath = (path: Partial<GuidePath> = {}): GuidePath => ({
   guideId: '',
   cover: '',
   time: 1,
+  sort: 999,
   speed: 1,
   position: {x: 0, y: 0, z: 0},
   target: {x: 0, y: 0, z: 0},
@@ -61,7 +62,7 @@ export const initialGuidePathsByGuide = async (guide: Guide) => {
   backupGuidePaths()
 }
 
-export const saveGuidePaths = saveStoreItems(
+const _saveGuidePaths = saveStoreItems(
   guidePaths,
   getBackupGuidePaths,
   {
@@ -70,6 +71,20 @@ export const saveGuidePaths = saveStoreItems(
     delete: deleteGuidePath,
   }
 )
+
+export const saveGuidePaths = async () => {
+  await _saveGuidePaths()
+  backupGuidePaths()
+  const sortMaps = new Map<GuidePath['guideId'], number>()
+
+  guidePaths.value.forEach((path) => {
+    const sort = (sortMaps.get(path.guideId) || 0) + 1
+    path.sort = sort
+    sortMaps.set(path.guideId, sort)
+  })
+  console.log(guidePaths.value)
+  await _saveGuidePaths()
+}
 export const autoSaveGuidePaths = autoSetModeCallback(guidePaths, {
   backup: backupGuidePaths,
   recovery: recoverGuidePaths,

+ 10 - 2
src/store/measure.ts

@@ -20,6 +20,7 @@ import {
 } from '@/api'
 
 import type { Measure as SMeasure } from '@/api'
+import { Message } from 'bill/index'
 
 export type Measure<T extends MeasureType = MeasureType> = SMeasure<T> & { selected?: boolean }
 export type Measures = Measure[]
@@ -41,7 +42,7 @@ export const getMeasureIsShow = (measure: Measure) =>
 export const createMeasure = (measure: Partial<Measure> = {}): Measure => ({
   id: createTemploraryID(),
   fusionId: fuseModels.value[0].fusionId,
-  title: `测量${measures.value.length + 1}`,
+  title: MeasureTypeMeta[measure.type || MeasureType.free].unitDesc,
   positions: [],
   desc: '',
   type: MeasureType.free,
@@ -82,7 +83,14 @@ export const autoSaveMeasures = autoSetModeCallback(measures, {
   },
   backup: backupMeasures,
   recovery: recoverMeasures,
-  save: saveMeasures
+  save: async () => {
+    if (!measures.value.every(record => record.title)) {
+      Message.warning('视频名称不可为空')
+      throw '视频名称不可为空'
+    }
+
+    await saveMeasures
+  }
 })
 
 export type { MeasurePosition } from '@/api'

+ 1 - 5
src/store/sys.ts

@@ -21,10 +21,7 @@ export const isLogin = computed(() => !!(mode.value & Flags.LOGIN))
 export const isOld = computed(() => !(mode.value & Flags.NOW))
 export const isNow = computed(() => !!(mode.value & Flags.NOW))
 export const appEl = ref<HTMLDivElement | null>(null)
-
-
-const prefix = ref('')
-getCaseInfo().then(ecase => prefix.value = `${ecase.caseTitle} | `)
+export const prefix = ref('')
 
 export const title = computed(() => {
   if (currentMeta.value && 'sysTitle' in currentMeta.value) {
@@ -92,7 +89,6 @@ export type AutoSetModeSetting<T> = {
 
 let isUnset = false
 export const unSetModelUpdate = (run: () => void) => {
-  console.error('unset')
   isUnset = true
   run()
   nextTick(() => isUnset = false)

+ 0 - 2
src/utils/store-help.ts

@@ -152,8 +152,6 @@ export const saveStoreItems = <T extends {id: any}>(
   }
 ) => () => {
   const oldItems = getOldItem()
-  console.error('save save')
-  console.log(oldItems)
   const {
     deleted,
     updated,

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

@@ -8,7 +8,7 @@
         </ui-button>
       </template>
     </ui-group>
-    <ui-group title="导览列表">
+    <ui-group title="路径列表">
       <GuideSign 
         v-for="guide in guides" 
         :key="guide.id" 

+ 1 - 1
src/views/guide/show.vue

@@ -1,5 +1,5 @@
 <template>
-  <ui-group title="导览列表" class="show-guides">
+  <ui-group title="路径列表" class="show-guides">
     <GuideSign 
       v-for="guide in guides" 
       :key="guide.id" 

+ 1 - 0
src/views/measure/index.vue

@@ -25,6 +25,7 @@
         :key="measure.id" 
         :measure="measure" 
         @delete="deleteMeasure(measure)"
+        @updateTitle="title => measure.title = title"
       />
     </ui-group>
   </RightFillPano>

+ 44 - 6
src/views/measure/sign.vue

@@ -7,14 +7,30 @@
   >
     <div class="info">
       <ui-icon :type="MeasureTypeMeta[measure.type].icon" class="type" />
-      <div>
-        <p>{{ desc }} {{ MeasureTypeMeta[measure.type].unit }}</p>
-        <span>{{ MeasureTypeMeta[measure.type].unitDesc }}</span>
+      <div v-show="!isEditTitle">
+        <p>{{ measure.title || MeasureTypeMeta[measure.type].unitDesc }}</p>
+        <span>{{ desc }} {{ MeasureTypeMeta[measure.type].unit }}</span>
       </div>
+      <ui-input 
+        class="view-title-input"
+        type="text" 
+        :modelValue="measure.title" 
+        :maxlength="15"
+        @update:modelValue="(title: string) => $emit('updateTitle', title.trim())"
+        v-show="isEditTitle" 
+        ref="inputRef" 
+        height="28px" 
+      />
     </div>
     <div class="actions" @click.stop>
-      <ui-icon type="del" ctrl @click.stop="$emit('delete')" v-if="edit" />
+      <!-- <ui-icon type="del" ctrl @click.stop="$emit('delete')" v-if="edit" /> -->
       <ui-icon type="pin" ctrl @click.stop="fly" :class="{disabled: !getMeasureIsShow(measure)}" />
+      <ui-more 
+        v-if="edit"
+        :options="menus" 
+        style="margin-left: 20px" 
+        @click="(action: keyof typeof actions) => actions[action]()" 
+      />
     </div>
   </ui-group-option>
 </template>
@@ -22,16 +38,38 @@
 <script setup lang="ts">
 import { MeasureTypeMeta, getMeasureIsShow } from '@/store'
 import { getSceneMeasure, getSceneMeasureDesc } from '@/sdk'
+import { useFocus } from 'bill/hook/useFocus'
 
 import type { Measure } from '@/store'
-import { computed } from 'vue';
+import { computed, ref, watchEffect } from 'vue';
+import { Message } from 'bill/index';
 
 const props = withDefaults(
   defineProps<{ measure: Measure, edit?: boolean }>(),
   { edit: true }
 )
+const emit = defineEmits<{ 
+  (e: 'delete'): void,
+  (e: 'updateTitle', title: string): void,
+}>()
 
-defineEmits<{ (e: 'delete'): void }>()
+const inputRef = ref()
+const isEditTitle = useFocus(computed(() => inputRef.value?.vmRef.root))
+const menus = [
+  { label: '重命名', value: 'rename' },
+  { label: '删除', value: 'delete' },
+]
+const actions = {
+  delete: () => emit('delete'),
+  rename: () => isEditTitle.value = true
+}
+
+watchEffect(() => {
+  if (!isEditTitle.value && !props.measure.title.length) {
+    isEditTitle.value = true
+    Message.warning('视图名称不可为空')
+  }
+})
 
 const fly = () => {
   getSceneMeasure(props.measure)?.fly()

+ 4 - 5
src/views/merge/index.vue

@@ -92,13 +92,17 @@ const actionItems: ActionsProps['items'] = [
     icon: 'flip',
     text: '旋转',
     action: () => {
+      console.log('enter')
       getSceneModel(custom.currentModel)?.enterRotateMode()
       return () => {
+        console.log('leave la ')
         getSceneModel(custom.currentModel)?.leaveTransform()
       }
     }
   },
 ]
+
+
 const currentItem = ref<ActionsItem | null>(null)
 watchEffect(() => {
   if (!custom.currentModel) {
@@ -113,8 +117,6 @@ const reset = async () => {
     custom.currentModel && (custom.currentModel.bottom = 0)
   }
 }
-
-
 useViewStack(() => togetherCallback([
   showLeftPanoStack.push(ref(true)),
   showRightPanoStack.push(computed(() => !!custom.currentModel)),
@@ -122,9 +124,6 @@ useViewStack(() => togetherCallback([
   () => currentItem.value = null
 ]))
 useViewStack(autoSaveFuseModels)
-watchEffect(() => {
-  console.error(custom.showRightPano)
-}, { flush: 'sync' })
 </script>
 
 <style lang="scss">

+ 3 - 1
src/views/tagging-position/index.vue

@@ -1,6 +1,6 @@
 <template>
   <RightFillPano>
-    <ui-group :title="`标注${tagging?.title}`" class="position-group">
+    <ui-group :title="`标注${tagging?.title}放置位置`" class="position-group">
       <PositionSign 
         v-for="(position, i) in positions" 
         :key="position.id" 
@@ -93,7 +93,9 @@ watchEffect((onCleanup) => {
 })
 useViewStack(autoSaveTaggings)
 useViewStack(() => {
+  const hide = Message.show({ msg: '请在模型上单击选择标注位置', type: 'warning' })
   enterEdit(() => router.back())
+  return hide
 })
 </script>
 

+ 10 - 2
src/views/tagging/edit.vue

@@ -100,7 +100,7 @@
 <script lang="ts" setup>
 import StylesManage from './styles.vue'
 import Images from './images.vue'
-import { computed, ref } from 'vue';
+import { computed, ref, watchEffect } from 'vue';
 import { Dialog, Message } from 'bill/index';
 import { 
   taggingStyles,
@@ -108,7 +108,8 @@ import {
   getTaggingStyle, 
   TaggingStyle,
   taggings,
-  isTemploraryID
+  isTemploraryID,
+defaultStyle
 } from '@/store'
 
 export type EditProps = {
@@ -118,6 +119,13 @@ export type EditProps = {
 const props = defineProps<EditProps>()
 const emit = defineEmits<{ (e: 'quit'): void, (e: 'save', data: Tagging): void }>()
 const tagging = ref<Tagging>({...props.data, images: [...props.data.images]})
+const activeStyle = computed(() => getTaggingStyle(tagging.value.styleId))
+
+watchEffect(() => {
+  if (!activeStyle.value && defaultStyle.value) {
+    tagging.value.styleId = defaultStyle.value.id
+  }
+})
 
 const submitHandler = () => {
   if (!tagging.value.title.trim()) {

+ 1 - 1
src/views/tagging/index.vue

@@ -8,7 +8,7 @@
         </ui-button>
       </template>
     </ui-group>
-    <ui-group title="标注">
+    <ui-group title="标注列表">
       <template #icon>
         <ui-icon 
           ctrl

+ 1 - 1
src/views/view/sign.vue

@@ -52,7 +52,7 @@ const emit = defineEmits<{
 }>()
 
 const menus = [
-  { label: '编辑', value: 'rename' },
+  { label: '重命名', value: 'rename' },
   { label: '删除', value: 'delete' },
 ]