Browse Source

修改bug

bill 2 years ago
parent
commit
de99861342

+ 2 - 2
src/api/record.ts

@@ -14,7 +14,7 @@ export interface Record {
   id: string
   cover: string
   title: string
-  url: string
+  url: string | null
   sort: number
   status: RecordStatus
 }
@@ -23,7 +23,7 @@ interface ServiceRecord {
   videoFolderId: number,
   videoFolderName: string,
   videoFolderCover: string,
-  videoMergeUrl: string,
+  videoMergeUrl: string | null,
   sort: number,
   uploadStatus: RecordStatus
 }

+ 1 - 1
src/env/index.ts

@@ -13,7 +13,7 @@ export const showRightCtrlPanoStack = stackFactory(ref<boolean>(true))
 export const showBottomBarStack = stackFactory(ref<boolean>(false), true)
 export const bottomBarHeightStack = stackFactory(ref<string>('60px'))
 export const showTaggingsStack = stackFactory(ref<boolean>(true))
-export const showMeasuresStack = stackFactory(ref<boolean>(false))
+export const showMeasuresStack = stackFactory(ref<boolean>(true))
 export const currentModelStack = stackFactory(ref<FuseModel | null>(null))
 export const showModelsMapStack = stackFactory(ref<WeakMap<FuseModel, boolean>>(new WeakMap()), true)
 export const modelsChangeStoreStack = stackFactory(ref<boolean>(false))

+ 10 - 2
src/layout/show/index.vue

@@ -29,7 +29,11 @@ import {
   initialRecords, 
   initialScenes, 
   initialViews,
-  defTitle
+  defTitle,
+  initialTaggingStyles,
+  initialTaggings,
+  initialMeasures,
+  initialGuides
 } from '@/store'
 
 const loaded = ref(false)
@@ -40,8 +44,12 @@ const initialSys = async () => {
     initialViews(),
     initialRecords(),
     initialFloders(),
-    initialFloderTypes()
+    initialFloderTypes(),
+    initialTaggingStyles(),
+    initialTaggings(),
+    initialGuides()
   ])
+  await initialMeasures()
   loaded.value = true
   loadModel(fuseModel)
   custom.showLeftPano = true

+ 3 - 3
src/sdk/association.ts

@@ -28,8 +28,10 @@ import {
   MeasureType,
   measures,
   fuseModelsLoaded,
-  getMeasureIsShow
+  getMeasureIsShow,
+  SceneStatus
 } from '@/store'
+import { currentLayout, RoutesName } from '@/router'
 
 import TaggingComponent from '@/components/tagging/list.vue'
 
@@ -41,8 +43,6 @@ import type {
   ModelAttrRange, 
   Measure as SceneMeasure 
 } from '.'
-import { SceneStatus } from '@/api'
-import { currentLayout, RoutesName } from '@/router'
 
 let isUnSet = false
 const unSet = ((fn: () => void) => {

+ 2 - 2
src/store/record.ts

@@ -87,14 +87,14 @@ export const initialRecords = async () => {
 }
 
 export const addRecord = addStoreItem(records, async (record) => {
-  const cover = await uploadFile(record.cover)
+  const cover = record.cover ? await uploadFile(record.cover) : record.cover
   const serviceRecord = await postAddRecord({ ...record, cover }, getRecordMergeFiles(record))
   record.id = serviceRecord.id
   await postUpdateRecord(record as SRecord)
   return record
 })
 export const updateRecord = updateStoreItem(records, async (record) => {
-  const cover = await uploadFile(record.cover)
+  const cover = record.cover ? await uploadFile(record.cover) : record.cover
   return await postUpdateRecord({ ...record, cover })
 })
 export const deleteRecord = deleteStoreItem(records, async record => {

+ 1 - 0
src/utils/video-cover.ts

@@ -38,6 +38,7 @@ export const getVideoCover = (data: string | Blob,  seekTo: number = 0.0, width?
         const dataURL = canvas.toDataURL('image/jpeg') 
 
         if (typeof data !== 'string') {
+          video.pause()
           URL.revokeObjectURL(url)
         }
         resolve(dataURL)

+ 17 - 15
src/views/folder/index.vue

@@ -1,23 +1,25 @@
 <template>
   <LeftPano>
-    <div v-for="item in types" :key="item.id" class="types">
-      <h2 @click="item.show.value = !item.show.value">
-        {{item.title}}
-        <ui-icon :type="`pull-${item.show.value ? 'up' : 'down'}`" class="icon" ctrl />
-      </h2>
+    <template v-for="item in types">
+      <div :key="item.id" class="types" v-if="item.floders.length">
+        <h2 @click="item.show.value = !item.show.value">
+          {{item.title}}
+          <ui-icon :type="`pull-${item.show.value ? 'up' : 'down'}`" class="icon" ctrl />
+        </h2>
 
-      <div class="floders"  v-if="item.show.value">
-        <div 
-          v-for="floder in item.floders" 
-          :key="floder.filesId" 
-          class="fun-ctrl" 
-          @click="preview(floder)"
-        >
-          <ui-icon :type="typeIcons[floder.metaType]" v-if="floder.metaType" />
-          <p>{{ floder.filesTitle }}</p>
+        <div class="floders"  v-if="item.show.value">
+          <div 
+            v-for="floder in item.floders" 
+            :key="floder.filesId" 
+            class="fun-ctrl" 
+            @click="preview(floder)"
+          >
+            <ui-icon :type="typeIcons[floder.metaType]" v-if="floder.metaType" />
+            <p>{{ floder.filesTitle }}</p>
+          </div>
         </div>
       </div>
-    </div>
+    </template>
   </LeftPano>
 
   <Preview :items="[currentFile]" v-if="currentFile" @close="currentFile = null" />

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

@@ -11,9 +11,8 @@
 
 <script setup lang="ts">
 import GuideSign from '@/views/guide/sign.vue'
-import { guides, initialGuides } from '@/store'
+import { guides } from '@/store'
 
-initialGuides()
 </script>
 
 

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

@@ -46,7 +46,7 @@ import Actions from '@/components/actions/index.vue'
 import EditMeasure from './edit.vue'
 import { RightFillPano } from '@/layout'
 import { computed, ref } from 'vue';
-import { custom, showMeasuresStack } from '@/env'
+import { custom } from '@/env'
 import { measures, MeasureTypeMeta, MeasureType, createMeasure, autoSaveMeasures } from '@/store'
 import { useViewStack } from '@/hook'
 
@@ -84,7 +84,6 @@ const deleteMeasure = (measure: Measure) => {
   measures.value.splice(index, 1)
 }
 
-useViewStack(() => showMeasuresStack.push(ref(true)))
 useViewStack(autoSaveMeasures)
 </script>
 

+ 2 - 6
src/views/measure/show.vue

@@ -18,13 +18,9 @@
 
 <script setup lang="ts">
 import MeasureSign from '@/views/measure/sign.vue'
-import { ref } from 'vue'
-import { measures, initialMeasures } from '@/store'
-import { custom, showMeasuresStack } from '@/env'
-import { useViewStack } from '@/hook'
+import { measures } from '@/store'
+import { custom } from '@/env'
 
-initialMeasures() 
-useViewStack(() => showMeasuresStack.push(ref(true)))
 </script>
 
 

+ 1 - 0
src/views/record/shot.vue

@@ -112,6 +112,7 @@ export default defineComponent({
     }
 
     const pause = () => {
+      console.error('停止了')
       if (countdown.value === 0 && recordIng) {
         videoRecorder.endRecord()
         recordIng = false

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

@@ -43,7 +43,7 @@
       :record="record" />
     <Preview 
       v-if="isPlayVideo" 
-      :items="[{ type: MediaType.video, url: record.url }]"
+      :items="[{ type: MediaType.video, url: record.url! }]"
       @close="isPlayVideo = false" 
     />
   </ui-group-option>
@@ -113,7 +113,7 @@ export default defineComponent({
       rename: () => isEditTitle.value = true,
       play: () => isPlayVideo.value = true,
       download() {
-        const url = getResource(props.record.url)
+        const url = getResource(props.record.url!)
         const ext = getExtname(url) || 'mp4'
         loadPack(saveAs(url, `${props.record.title}.${ext}`))
       },

+ 1 - 4
src/views/tagging/show.vue

@@ -23,13 +23,10 @@
 import { ref } from 'vue'
 import { custom } from '@/env'
 import TaggingSign from './sign.vue'
-import { taggings, initialTaggings, initialTaggingStyles } from '@/store'
+import { taggings } from '@/store'
 
 import type { Tagging } from '@/store'
 
-initialTaggingStyles()
-initialTaggings() 
-
 const selectTagging = ref<Tagging | null>(null)
 </script>