guhongwei 4 năm trước cách đây
mục cha
commit
9a0c035280

+ 1 - 1
src/views/adminCenter/dockInfo/parts/dockInfo.vue

@@ -153,7 +153,7 @@ export default {
       this.$set(this.form, `${type}`, data.uri);
     },
     uploadDelete(index) {
-      this.$set(this.form, `file_path`, null);
+      this.$set(this.form, `file_path`, 'video');
     },
   },
   computed: {

+ 10 - 30
src/views/halltwo/directTwo.vue

@@ -98,7 +98,7 @@
           <div class="w_1200">
             <el-col :span="24" class="three1">
               <el-col :span="12" class="left">
-                <video :src="dockInfo.file_path" autoplay="autoplay" controls="controls" v-if="dockInfo.file_path != null || ''">
+                <video :src="dockInfo.file_path" autoplay="autoplay" controls="controls" v-if="dockInfo.file_path != 'video'">
                   您的浏览器不支持 video 标签。
                 </video>
                 <div class="videointro" v-else>
@@ -347,14 +347,13 @@ export default {
       statNum: {},
       // 倒计时
       djs: '',
-      // 展会视频设置
-      dockvideoInfo: {},
-      times: 5,
     };
   },
   async created() {
     await this.searchInfo();
-    await this.searchVideo();
+  },
+  mounted() {
+    this.channel();
   },
   methods: {
     ...dock({ dockQuery: 'query', dockFetch: 'fetch', goodsquery: 'goodsquery' }),
@@ -491,24 +490,13 @@ export default {
     liveCenBtn() {
       this.$router.push({ path: '/halltwo/liveCenter', query: { dock_id: this.id } });
     },
-    // 倒计时视频管理
-    searchTimes() {
-      this.timer = setInterval(() => {
-        this.times--;
-        if (this.times === 0) {
-          this.searchVideo();
-          this.times = 5;
-          clearInterval(this.timer);
-        }
-      }, 1000);
+    channel() {
+      this.$stomp({
+        [`/exchange/dock_video/${this.id}`]: this.onMessage,
+      });
     },
-    // 查询视频
-    async searchVideo() {
-      let res = await this.dockFetch(this.id);
-      if (this.$checkRes(res)) {
-        // 对接会详情
-        this.$set(this, `dockInfo`, res.data);
-      }
+    onMessage(message) {
+      this.$set(this.dockInfo, `file_path`, message.body);
     },
   },
   computed: {
@@ -518,14 +506,6 @@ export default {
     },
   },
   watch: {
-    times: {
-      handler(val) {
-        if (val == 5) {
-          this.searchTimes();
-        }
-      },
-      immediate: true,
-    },
     dockInfo: {
       immediate: true,
       deep: true,