yuhongqi 3 mesiacov pred
rodič
commit
060b7c729f

+ 12 - 2
src/components/LiveVideoUpload/index.vue

@@ -149,15 +149,24 @@ export default {
   },
   watch: {
     localUploadType(newType) {
+      this.reset()
       this.$emit("update:uploadType", newType);
-      this.$emit("change");
     },
     uploadType(newType) {
       this.localUploadType = newType;
     },
   },
+  mounted() {
+    this.reset()
+  },
   methods: {
-
+// 提供重置方法供父组件调用
+    reset() {
+      this.txProgress = 0;
+      this.fileList = [];
+      this.$refs.upload.clearFiles();
+      // 重置其他状态...
+    },
     handleChange(file, fileList) {
       this.fileList = fileList;
       this.getVideoDuration(file.raw);
@@ -221,6 +230,7 @@ export default {
         console.log("组装URL========>", line_1);
         this.$emit("update:videoUrl", line_1);
         this.$emit("update:line_1", line_1);
+        this.$emit("change", line_1,line_1);
         // this.$emit("update:line_2", line_2);
         this.$message.success("线路一上传成功");
       } catch (error) {

+ 12 - 17
src/views/live/live/index.vue

@@ -215,6 +215,7 @@
           :videoUrl.sync="videoUrl"
           :fileName.sync="form.fileName"
           :line_2.sync="form.lineTwo"
+          :line_1.sync="form.lineOne"
           :thumbnail.sync="form.thumbnail"
           :uploadType.sync="form.uploadType"
           :isTranscode.sync="form.isTranscode"
@@ -229,12 +230,12 @@
                           v-model="form.startTime"
                           @change="timeChange"
                           type="datetime"
-                          format="yyyy-MM-dd HH:mm"
+                          format="yyyy-MM-dd HH:mm:ss"
                           value-format="yyyy-MM-dd HH:mm:ss"
                           :picker-options="{
                             timePickerOptions: {
-                              selectableRange: '00:00 - 23:59',
-                              format: 'HH:mm'
+                              selectableRange: '00:00:00 - 23:59:59',
+                              format: 'HH:mm:ss'
                             }
                           }"
                           placeholder="选择开始时间">
@@ -244,12 +245,12 @@
           <el-date-picker size="small"
                           v-model="form.finishTime"
                           type="datetime"
-                          format="yyyy-MM-dd HH:mm"
+                          format="yyyy-MM-dd HH:mm:ss"
                           value-format="yyyy-MM-dd HH:mm:ss"
                           :picker-options="{
                             timePickerOptions: {
-                              selectableRange: '00:00 - 23:59',
-                              format: 'HH:mm'
+                              selectableRange: '00:00:00 - 23:59:59',
+                              format: 'HH:mm:ss'
                             }
                           }"
                           placeholder="视屏播放结束">
@@ -342,7 +343,7 @@ export default {
       },
       // 表单参数
       form: {
-        uploadType: 2,
+        uploadType: 1,
         isTranscode:0,
         transcodeFileKey:null
       },
@@ -405,16 +406,9 @@ export default {
     handleVideoDuration(duration) {
       this.form.duration = duration;
     },
-    handleVideoChange(){
-      console.log(this.videoUrl)
-      if(this.form.uploadType==1){
-        this.videoUrl = this.form.lineOne;
-      }else if(this.form.uploadType==2){
-        this.videoUrl = this.form.lineTwo;
-        this.form.videoUrl = this.form.lineTwo;
-      }else if(this.form.uploadType==3){
-        this.videoUrl = this.form.lineThree;
-      }
+    handleVideoChange(videoUrl,lineOne){
+      this.videoUrl = videoUrl;
+      this.form.videoUrl = videoUrl;
       console.log(this.videoUrl)
     },
     showLivingUrl(row){
@@ -582,6 +576,7 @@ export default {
         showType: 1,
         liveType: 2,
         isShow: 1,
+        uploadType:1,
         isTranscode:0,
         transcodeFileKey:null
       };

+ 25 - 9
src/views/live/liveConfig/goods.vue

@@ -257,6 +257,23 @@ export default {
       }
     };
   },
+  watch: {
+    // 监听路由的 query 参数变化
+    '$route.query': {
+      handler(newQuery) {
+        if (this.$route.params.liveId) {
+          this.liveId = this.$route.params.liveId;
+        }else {
+          this.liveId = this.$route.query.liveId;
+        }
+        this.goodsParams.liveId = this.liveId
+        this.getLiveGoodsList();
+        this.socket = this.$store.state.liveWs[this.liveId]
+      },
+      // 初始化时立即执行一次
+      immediate: true
+    }
+  },
   created() {
     if (this.$route.params.liveId) {
       this.liveId = this.$route.params.liveId;
@@ -277,16 +294,15 @@ export default {
           row.isShow = res.isShow
           if (res.msg == "目前仅支持单一物品展示") {
             this.$message.error(res.msg)
-          } else if(res.isShow){
-            if (this.socket == null) {
-              this.$message.error("请从直播间开启展示状态!");
-            } else {
-              const msg = {
-                cmd: 'goods',
-                data: {"liveId":this.liveId,"goodsId":goodsList[0]}
-              }
-              this.$store.state.liveWs[this.liveId].send(JSON.stringify(msg));
+          }
+          if (this.socket == null) {
+            this.$message.error("请从直播间开启展示状态!");
+          } else {
+            const msg = {
+              cmd: 'goods',
+              data: {"liveId":this.liveId,"goodsId":goodsList[0],"status":targetStatus ? 1 : 0}
             }
+            this.$store.state.liveWs[this.liveId].send(JSON.stringify(msg));
           }
         }
       })

+ 22 - 0
src/views/live/liveConfig/liveLotteryConf.vue

@@ -451,6 +451,28 @@ export default {
       }
     };
   },
+  watch: {
+    // 监听路由的 query 参数变化
+    '$route.query': {
+      handler(newQuery) {
+        if (this.$route.params.liveId) {
+          this.liveId = this.$route.params.liveId;
+        }else {
+          this.liveId = this.$route.query.liveId;
+        }
+        this.parentLiveId = this.liveId;
+        this.queryParams.liveId = this.parentLiveId;
+        if(this.queryParams.liveId){
+          this.form.liveId = this.parentLiveId;
+          //设置查询条件直播间ID不可修改
+          this.canLiveId = true;
+        }
+        this.getList();
+      },
+      // 初始化时立即执行一次
+      immediate: true
+    }
+  },
   created() {
     this.getDicts("sys_live_lottery_require").then(response => {
       this.requireOptions = response.data;

+ 22 - 0
src/views/live/liveConfig/liveRedConf.vue

@@ -265,6 +265,28 @@ export default {
       liveId: null,
     };
   },
+  watch: {
+    // 监听路由的 query 参数变化
+    '$route.query': {
+      handler(newQuery) {
+        if (this.$route.params.liveId) {
+          this.liveId = this.$route.params.liveId;
+        }else {
+          this.liveId = this.$route.query.liveId;
+        }
+        this.queryParams.liveId = this.liveId;
+        this.parentLiveId = this.liveId;
+        if(this.queryParams.liveId){
+          this.form.liveId = this.parentLiveId;
+          //设置查询条件直播间ID不可修改
+          this.canLiveId = true;
+        }
+        this.getList();
+      },
+      // 初始化时立即执行一次
+      immediate: true
+    }
+  },
   created() {
     this.getDicts("sys_live_red_status").then(response => {
       this.redStatusOptions = response.data;

+ 10 - 4
src/views/live/liveConfig/task.vue

@@ -165,6 +165,7 @@
         </el-form-item>
         <el-form-item label="触发时间" prop="content">
           <el-time-picker
+            default-value="2025-01-01 00:00:00"
             v-model="form.triggerValue"
             :picker-options="{
       selectableRange: '00:00:00 - 23:59:59'
@@ -208,7 +209,7 @@ export default {
     return {
       taskTypeOptions:[
         {
-          value: "1",
+          value: 1,
           label: "定时卡片推荐商品"
         },
         // {
@@ -492,13 +493,18 @@ export default {
       this.title = "添加直播间自动化任务配置";
     },
     /** 修改按钮操作 */
-    handleUpdate(row) {
+    async handleUpdate(row) {
       this.reset();
+      if(row.taskType == 1){
+        await this.addGoodsList();
+      }
       const id = row.id || this.ids
       getTask(id).then(response => {
         this.form = response.data;
-        this.form.content = null;
-        this.form.taskType = null;
+        if (this.form.taskType == 1) {
+          let content = JSON.parse( response.data.content)
+          this.form.content = content.goodsId;
+        }
         this.open = true;
         this.title = "修改直播间自动化任务配置";
       });

+ 2 - 0
src/views/live/liveConsole/index.vue

@@ -341,6 +341,7 @@ export default {
     }
   },
   mounted() {
+
     this.$nextTick(() => {
       this.restoreChatScrollPosition();
     });
@@ -521,6 +522,7 @@ export default {
           }
           if (res.data.liveType == 1) {
             this.livingUrl = res.data.flvHlsUrl
+            this.livingUrl = this.livingUrl.replace("flv","m3u8")
             this.$nextTick(() => {
               this.initPlayer()
             })