Browse Source

修改倒计时功能

zengyicheng 2 years ago
parent
commit
74ed926643
1 changed files with 13 additions and 1 deletions
  1. 13 1
      src/components/pages/race/addRace.vue

+ 13 - 1
src/components/pages/race/addRace.vue

@@ -135,7 +135,9 @@
           <img src="../../../assets/icon/success.png" alt="" />
         </div>
         <div class="cresteMessage">
-          您确定要跳过网页端填写吗?<span style="color: #ccc">( {{ lastTime }}秒自动关闭 )</span>
+          您确定要跳过网页端填写吗?<span style="color: #ccc"
+            >( {{ lastTime }}秒自动关闭 )</span
+          >
           <div style="color: #9a9a9a; line-height: 25px">
             本次案例征集必填内容已提交,为实现更佳的展示效果,建议您根据平台指引完成网页端资料填写。
           </div>
@@ -254,6 +256,11 @@ export default {
       this.$router.push(path);
     },
     setTime() {
+      if (this.timer) {
+        clearInterval(this.timer);
+      }
+      this.timer = null;
+      this.lastTime = 5;
       this.dialogVisible1 = true;
       this.timeLoading();
       this.timer = setInterval(() => {
@@ -372,6 +379,11 @@ export default {
             this.$message.error("案例组别不能为空");
             return;
           } else if (t == 2) {
+            if (this.timer) {
+              clearInterval(this.timer);
+            }
+            this.timer = null;
+            this.lastTime = 5;
             this.dialogVisible1 = true;
             this.setTime();
             // setTimeout(() => {