guhongwei 4 роки тому
батько
коміт
989ad3c3b7
1 змінених файлів з 11 додано та 32 видалено
  1. 11 32
      src/views/live/detailtwo.vue

+ 11 - 32
src/views/live/detailtwo.vue

@@ -4,7 +4,7 @@
       <el-col :span="24" class="main">
       <el-col :span="24" class="main">
         <el-col :span="24" class="video">
         <el-col :span="24" class="video">
           <el-link :underline="false" class="back" @click="back()"><i class="el-icon-arrow-left"></i></el-link>
           <el-link :underline="false" class="back" @click="back()"><i class="el-icon-arrow-left"></i></el-link>
-          <el-col :span="24" class="videoone" v-if="videodock.file_path != null || ''">
+          <el-col :span="24" class="videoone" v-if="videodock.file_path != 'video'">
             <video :src="videodock.file_path" autoplay="" controls="controls">
             <video :src="videodock.file_path" autoplay="" controls="controls">
               您的浏览器不支持 video 标签。
               您的浏览器不支持 video 标签。
             </video>
             </video>
@@ -93,8 +93,6 @@ export default {
       dock_id: '',
       dock_id: '',
       // 视频信息
       // 视频信息
       videodock: {},
       videodock: {},
-      // 倒计时查询详情
-      times: 5,
       //展会详情
       //展会详情
       dockinfo: [],
       dockinfo: [],
       // 聊天
       // 聊天
@@ -125,6 +123,9 @@ export default {
     await this.search();
     await this.search();
     await this.seachLunbo();
     await this.seachLunbo();
   },
   },
+  mounted() {
+    this.channel();
+  },
   methods: {
   methods: {
     ...dock({ dockQuery: 'query', dockFetch: 'fetch' }),
     ...dock({ dockQuery: 'query', dockFetch: 'fetch' }),
     ...exportuser({ expertQuery: 'query' }),
     ...exportuser({ expertQuery: 'query' }),
@@ -166,25 +167,13 @@ export default {
         this.$set(this, `lunboList`, res.data);
         this.$set(this, `lunboList`, res.data);
       }
       }
     },
     },
-    //倒计时查询展会视频详情
-    counttime() {
-      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.dock_id}`]: this.onMessage,
+      });
     },
     },
-    async searchvideo() {
-      if (this.dock_id) {
-        let res = await this.dockFetch(this.dock_id);
-        if (this.$checkRes(res)) {
-          // 对接会详情
-          this.$set(this, `videodock`, res.data);
-        }
-      }
+    onMessage(message) {
+      this.$set(this.dockInfo, `file_path`, message.body);
     },
     },
     // 专家详情
     // 专家详情
     expertBtn(data) {
     expertBtn(data) {
@@ -201,17 +190,7 @@ export default {
       return this.$route.query.id;
       return this.$route.query.id;
     },
     },
   },
   },
-  watch: {
-    times: {
-      immediate: true,
-      deep: true,
-      handler(val) {
-        if (val && val == 5) {
-          this.counttime();
-        }
-      },
-    },
-  },
+  watch: {},
   metaInfo() {
   metaInfo() {
     return { title: this.$route.meta.title };
     return { title: this.$route.meta.title };
   },
   },