Преглед изворни кода

fix(deploy): ixed the playback duration when there is only a single material

use event duration
Casper Dai пре 3 година
родитељ
комит
922fbf1c2b
1 измењених фајлова са 8 додато и 3 уклоњено
  1. 8 3
      src/views/screen/deploy/ratio/index.vue

+ 8 - 3
src/views/screen/deploy/ratio/index.vue

@@ -135,6 +135,7 @@ import {
   parseTime,
   parseTime,
   getAssetDuration
   getAssetDuration
 } from '@/utils'
 } from '@/utils'
+import { toDate } from '@/utils/event'
 import { publish } from '@/api/platform'
 import { publish } from '@/api/platform'
 import { assetTableMixin } from '@/mixins/asset-table'
 import { assetTableMixin } from '@/mixins/asset-table'
 import Draggable from 'vuedraggable'
 import Draggable from 'vuedraggable'
@@ -250,6 +251,12 @@ export default {
       if (this.startDate === this.endDate) {
       if (this.startDate === this.endDate) {
         return this.onError('开始时间与结束时间不能一样')
         return this.onError('开始时间与结束时间不能一样')
       }
       }
+      const sources = this.assets.map(({ tag, type, keyName, duration, size, md5 }) => {
+        return { tag, type, keyName, duration, size, md5 }
+      })
+      if (sources.length === 1) {
+        sources.duration = Math.floor((toDate(this.endDate) - toDate(this.startDate)) / 1000)
+      }
       return Promise.resolve({
       return Promise.resolve({
         type: PublishTargetType.EVENT,
         type: PublishTargetType.EVENT,
         detail: {
         detail: {
@@ -259,9 +266,7 @@ export default {
           priority: this.priority,
           priority: this.priority,
           target: {
           target: {
             type: EventTarget.ASSETS,
             type: EventTarget.ASSETS,
-            sources: this.assets.map(({ tag, type, keyName, duration, size, md5 }) => {
-              return { tag, type, keyName, duration, size, md5 }
-            })
+            sources
           }
           }
         }
         }
       })
       })