Browse Source

feat: 增加loading效果,并防止重复请求

million 1 year ago
parent
commit
7d5e1f4d2a
1 changed files with 15 additions and 2 deletions
  1. 15 2
      front/admin-front/src/views/autoplay/index.vue

+ 15 - 2
front/admin-front/src/views/autoplay/index.vue

@@ -819,7 +819,10 @@
           <el-input type="password" :show-password="true" v-model="password"
                     placeholder="输入钱包密码"></el-input>
           <div class="confirm" @click="batchExecutionTask">
-            <img src="../../assets/autoplay/check1.svg" alt="check1">
+            <img v-if="!confirmLoading" src="../../assets/autoplay/check1.svg" alt="check1">
+            <div v-if="confirmLoading" style="width: 20px;height: 20px;margin-top: -2px">
+              <Loading/>
+            </div>
             确认
           </div>
           <div class="tip">
@@ -920,8 +923,10 @@ import {getInteractionRecord, retryFailed} from "@/api/record";
 import {projectPage} from "@/api/project";
 import CryptoJS from "crypto-js";
 import Web3 from 'web3'
+import Loading from "@/components/Loading";
 
 export default {
+  components: {Loading},
   data() {
     return {
       missionData: [],
@@ -989,7 +994,8 @@ export default {
         projectName: '',
         taskCode: ''
       },
-      addTaskProjectData: []
+      addTaskProjectData: [],
+      confirmLoading:false
     }
   },
   mounted() {
@@ -1042,6 +1048,10 @@ export default {
       })
     },
     batchExecutionTask() {
+      if (this.confirmLoading){
+        return
+      }
+      this.confirmLoading = true
       // 要加密的数据
       const dataToEncrypt = this.password;
       // console.log('输入的密码:', dataToEncrypt);
@@ -1059,7 +1069,10 @@ export default {
       batchExecution(this.batchExecutionParams).then(() => {
         this.accountPassword = false
         this.drawerStrategy = false
+        this.confirmLoading = false
         this.getTaskList()
+      }).catch(()=>{
+        this.confirmLoading = false
       })
     },
     // 获取当前北京时间并格式化为 YYYYMMDD