guhongwei 4 jaren geleden
bovenliggende
commit
326044f1db

+ 17 - 5
src/views/halltwo/directTwo.vue

@@ -356,6 +356,9 @@ export default {
     await this.searchInfo();
     await this.searchVideo();
   },
+  // beforeDestroy() {
+  //   this.clearInterval(this.timer);
+  // },
   methods: {
     ...dock({ dockQuery: 'query', dockFetch: 'fetch', goodsquery: 'goodsquery' }),
     ...expertsuser({ expertQuery: 'query' }),
@@ -404,10 +407,6 @@ export default {
             let techolfourList = techol.filter(i => i.field == '新能源及节能技术');
             this.$set(this, `techolfourList`, techolfourList);
           }
-          // 倒计时
-          this.timer = setInterval(() => {
-            this.setTime(res.data.start_time);
-          }, 1000);
         }
       }
       // 查询专家
@@ -455,6 +454,12 @@ export default {
         this.$set(this.statNum, `zhxh`, zhxh.total);
       }
     },
+    seachtime() {
+      // 倒计时
+      // this.timer = setInterval(() => {
+      //   this.setTime(this.dockInfo.start_time);
+      // }, 1000);
+    },
     // 倒计时
     setTime(end) {
       let now = moment().format('YYYY-MM-DD HH:mm:ss');
@@ -494,7 +499,7 @@ export default {
       this.timer = setInterval(() => {
         this.times--;
         if (this.times === 0) {
-          this.searchVideo();
+          this.searchInfo();
           this.times = 5;
           clearInterval(this.timer);
         }
@@ -524,6 +529,13 @@ export default {
       },
       immediate: true,
     },
+    dockInfo: {
+      immediate: true,
+      deep: true,
+      handler(val) {
+        this.seachtime();
+      },
+    },
   },
 };
 </script>

+ 15 - 5
src/views/halltwo/expertxmcg.vue

@@ -134,10 +134,6 @@ export default {
         let res = await this.dockFetch(this.dock_id);
         if (this.$checkRes(res)) {
           this.$set(this, `dockInfo`, res.data);
-          // 倒计时
-          this.timer = setInterval(() => {
-            this.setTime(res.data.start_time);
-          }, 1000);
         }
       }
       //查询专家列表
@@ -147,6 +143,12 @@ export default {
         this.$set(this, `total`, res.total);
       }
     },
+    seachtime() {
+      // 倒计时
+      this.timer = setInterval(() => {
+        this.setTime(this.dockInfo.start_time);
+      }, 1000);
+    },
     // 倒计时
     setTime(end) {
       let now = moment().format('YYYY-MM-DD HH:mm:ss');
@@ -175,7 +177,15 @@ export default {
       return this.$route.query.dock_id;
     },
   },
-  watch: {},
+  watch: {
+    dockInfo: {
+      immediate: true,
+      deep: true,
+      handler(val) {
+        this.seachtime();
+      },
+    },
+  },
 };
 </script>
 

+ 13 - 4
src/views/halltwo/schoolMore.vue

@@ -154,14 +154,16 @@ export default {
         if (this.$checkRes(res)) {
           this.$set(this, `dockInfo`, res.data);
         }
-        // 倒计时
-        this.timer = setInterval(() => {
-          this.setTime(res.data.start_time);
-        }, 1000);
         //学校列表
         this.total = this.schoolList.length;
       }
     },
+    seachtime() {
+      // 倒计时
+      this.timer = setInterval(() => {
+        this.setTime(this.dockInfo.start_time);
+      }, 1000);
+    },
     // 倒计时
     setTime(end) {
       let now = moment().format('YYYY-MM-DD HH:mm:ss');
@@ -205,6 +207,13 @@ export default {
         this.searchPage();
       },
     },
+    dockInfo: {
+      immediate: true,
+      deep: true,
+      handler(val) {
+        this.seachtime();
+      },
+    },
   },
 };
 </script>

+ 15 - 4
src/views/halltwo/shoolDetail.vue

@@ -112,10 +112,6 @@ export default {
         if (this.$checkRes(res)) {
           this.$set(this, `dockInfo`, res.data);
         }
-        // 倒计时
-        this.timer = setInterval(() => {
-          this.setTime(res.data.start_time);
-        }, 1000);
       }
       if (this.name) {
         let list = this.schoolList.find(i => i.name == this.name);
@@ -123,6 +119,12 @@ export default {
         this.schoolList = list;
       }
     },
+    seachtime() {
+      // 倒计时
+      this.timer = setInterval(() => {
+        this.setTime(this.dockInfo.start_time);
+      }, 1000);
+    },
     // 倒计时
     setTime(end) {
       let now = moment().format('YYYY-MM-DD HH:mm:ss');
@@ -151,6 +153,15 @@ export default {
       return this.$route.query.name;
     },
   },
+  watch: {
+    dockInfo: {
+      immediate: true,
+      deep: true,
+      handler(val) {
+        this.seachtime();
+      },
+    },
+  },
 };
 </script>
 

+ 13 - 4
src/views/halltwo/xmcg.vue

@@ -156,13 +156,15 @@ export default {
           let achieve = czxmNew.filter(i => i.type == '1');
           this.$set(this, `list`, achieve);
           this.$set(this, `total`, achieve.length);
-          // 倒计时
-          this.timer = setInterval(() => {
-            this.setTime(res.data.start_time);
-          }, 1000);
         }
       }
     },
+    seachtime() {
+      // 倒计时
+      this.timer = setInterval(() => {
+        this.setTime(this.dockInfo.start_time);
+      }, 1000);
+    },
     // 倒计时
     setTime(end) {
       let now = moment().format('YYYY-MM-DD HH:mm:ss');
@@ -226,6 +228,13 @@ export default {
         this.searchPage();
       },
     },
+    dockInfo: {
+      immediate: true,
+      deep: true,
+      handler(val) {
+        this.seachtime();
+      },
+    },
   },
 };
 </script>

+ 15 - 5
src/views/halltwo/xmdj.vue

@@ -188,13 +188,15 @@ export default {
             this.$set(this, `productList`, czxmNew);
             this.searchProduct();
           }
-          // 倒计时
-          this.timer = setInterval(() => {
-            this.setTime(res.data.start_time);
-          }, 1000);
         }
       }
     },
+    seachtime() {
+      // 倒计时
+      this.timer = setInterval(() => {
+        this.setTime(this.dockInfo.start_time);
+      }, 1000);
+    },
     // 倒计时
     setTime(end) {
       let now = moment().format('YYYY-MM-DD HH:mm:ss');
@@ -318,7 +320,15 @@ export default {
       return this.$route.query.type;
     },
   },
-  watch: {},
+  watch: {
+    dockInfo: {
+      immediate: true,
+      deep: true,
+      handler(val) {
+        this.seachtime();
+      },
+    },
+  },
 };
 </script>