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

更新直播间数据 重置

yuhongqi пре 1 месец
родитељ
комит
4be5a14d59

+ 5 - 2
src/components/VideoUpload/index.vue

@@ -226,6 +226,9 @@ export default {
       },
     };
   },
+  mounted() {
+    this.reset();
+  },
   watch: {
     localUploadType(newType) {
       this.$emit("update:uploadType", newType);
@@ -341,11 +344,11 @@ export default {
     handleRemove(file, fileList) {
       console.log(file, fileList.length);
     },
-    resetUpload() {
+    reset() {
       // 重置内部状态
       this.txProgress = 0;
-      this.hwProgress = 0;
       this.fileList = [];
+      this.$refs.upload.clearFiles();
       this.uploadKey++;
     },
     /** 查询视频库列表 */

+ 7 - 3
src/views/live/live/index.vue

@@ -250,6 +250,7 @@
           <video-upload :fileKey.sync="form.fileKey" :fileSize.sync="form.fileSize"
                         :videoUrl.sync="form.videoUrl" :fileName.sync="form.fileName" :line_1.sync="form.lineOne"
                         :uploadType.sync="form.uploadType" :isTranscode.sync="form.isTranscode"
+                        ref="videoUpload"
                         :transcodeFileKey.sync="form.transcodeFileKey" @video-duration="handleVideoDuration"
                         @change="handleVideoChange"></video-upload>
         </el-form-item>
@@ -639,10 +640,12 @@ export default {
     handleAdd() {
       this.reset();
       this.open = true;
+
       setTimeout(() => {
         this.$refs.myeditor.setText("");
+        this.$refs.videoUpload.reset();
       }, 100);
-      this.title = "添加直播";
+      this.title = "添加直播";
     },
     updateText(text){
       this.form.liveDesc=text
@@ -653,19 +656,20 @@ export default {
       const liveId = row.liveId || this.ids
       getLive(liveId).then(response => {
         this.form = response.data;
-        this.videoUrl = this.form.videoUrl;
         if(this.form.duration){
           this.form.durationTime = this.secondsToTime(this.form.duration)
         }
+
         setTimeout(() => {
           if(this.form.liveDesc==null){
             this.$refs.myeditor.setText("");
           }else{
             this.$refs.myeditor.setText(this.form.liveDesc);
           }
+          this.form.videoUrl = row.videoUrl
         }, 1);
         this.open = true;
-        this.title = "修改直播";
+        this.title = "修改直播";
       });
     },
     /** 提交按钮 */

+ 3 - 0
src/views/live/liveVideo/index.vue

@@ -214,6 +214,9 @@ export default {
       this.reset();
       this.open = true;
       this.title = "添加直播视频";
+      setTimeout(() => {
+        this.$refs.videoUpload.reset();
+      }, 500);
     },
     /** 修改按钮操作 */
     handleUpdate(row) {