Browse Source

修改bug

bill 2 years ago
parent
commit
10cc44cb83

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

@@ -113,11 +113,9 @@ watch(visible, (visible, oldvisible) => {
     keyword.value = ''
     selects.value = selectIds.value
     console.log(selects.value)
-  }
-})
 
-useViewStack(() => {
-  initialScenes()
+    visible && initialScenes()
+  }
 })
 </script>
 

+ 6 - 0
src/store/record.ts

@@ -31,6 +31,7 @@ import {
 } from './record-fragment'
 
 import type { Record as SRecord } from '@/api'
+import { Message } from "bill/index";
 
 export type Record = LocalMode<SRecord, 'cover'> 
 export type Records = Record[]
@@ -115,6 +116,11 @@ export const autoSaveRecords = autoSetModeCallback(
     backup: togetherCallback([backupRecordFragments, backupRecords]),
     recovery: togetherCallback([recoverRecordFragments, recoverRecords]),
     save: async () => {
+      if (!records.value.every(record => record.title)) {
+        Message.warning('视频名称不可为空')
+        throw '视频名称不可为空'
+      }
+
       for (let i = 0; i < records.value.length; i++) {
         records.value[i].sort = i
       }

+ 11 - 2
src/views/record/sign.vue

@@ -14,7 +14,7 @@
       <ui-input 
         type="text" 
         :modelValue="record.title" 
-        @update:modelValue="(title: string) => $emit('updateTitle', title)"
+        @update:modelValue="(title: string) => $emit('updateTitle', title.trim())"
         v-show="isEditTitle" 
         ref="inputRef" 
         height="28px" 
@@ -50,7 +50,7 @@
 </template>
 
 <script lang="ts">
-import { defineComponent, ref, computed } from 'vue'
+import { defineComponent, ref, computed, watchEffect } from 'vue'
 import { getFileUrl } from '@/utils'
 import { useFocus } from 'bill/hook/useFocus'
 import { RecordStatus, createRecordFragment, getRecordFragmentBlobs, recordFragments } from '@/store'
@@ -62,6 +62,7 @@ import Shot from './shot.vue'
 import type { PropType } from 'vue'
 import type { RecordProcess } from './help'
 import { isTemploraryID } from '@/store'
+import { Message } from 'bill/index'
 
 export default defineComponent({
   props: {
@@ -97,6 +98,14 @@ export default defineComponent({
     const isShot = ref<boolean>(false)
     const inputRef = ref()
     const isEditTitle = useFocus(computed(() => inputRef.value?.vmRef.root))
+
+    watchEffect(() => {
+      if (!isEditTitle.value && !props.record.title.length) {
+        isEditTitle.value = true
+        Message.warning('视频名称不可为空')
+      }
+    })
+
     const isPlayVideo = ref(false)
     const actions = {
       continue: () => isShot.value = true,

+ 3 - 2
src/views/tagging/index.vue

@@ -68,7 +68,8 @@ import {
   getTaggingPositions,
   taggingPositions,
   isOld,
-  save
+  save,
+getTagging
 } from '@/store'
 
 const showSearch = ref(false)
@@ -78,7 +79,7 @@ const filterTaggings = computed(() => taggings.value.filter(tagging => tagging.t
 const editTagging = ref<Tagging | null>(null)
 const saveHandler = (tagging: Tagging) => {
   if (!editTagging.value) return;
-  if (isTemploraryID(editTagging.value.id)) {
+  if (!getTagging(editTagging.value.id)) {
     taggings.value.push(tagging)
   } else {
     Object.assign(editTagging.value, tagging)

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

@@ -21,6 +21,6 @@ initialViews()
 
 <style lang="scss" scoped>
 .pano-group {
-  padding: 0 20px;
+  padding: 0 20px 40px;
 }
 </style>