Quellcode durchsuchen

修复点击连续触发bug

wkw vor 6 Monaten
Ursprung
Commit
3e1c0f90e0
1 geänderte Dateien mit 36 neuen und 18 gelöschten Zeilen
  1. 36 18
      pages/my/jobApplicant/welcomePage.vue

+ 36 - 18
pages/my/jobApplicant/welcomePage.vue

@@ -168,7 +168,7 @@
                   无跨境电商工作经验
                 </view>
               </view>
-              <view class="next-page" @click="goWord"
+              <view class="next-page" @click="goWord" :class="{disabledStyle: isDis}"
                 >下一步
                 <image src="@/static/images/jobApplicant/next.svg" mode="scaleToFill" />
               </view>
@@ -212,6 +212,7 @@ export default {
       draggingThumb: null, // 'left' 或 'right' 或 null
       startX: 0,
       startValue: 0,
+	    isDis:false
     };
   },
   computed: {
@@ -418,7 +419,12 @@ export default {
 			industryName:this.jobTitle
 		}
 		var that=this
-		this.$Request.postJson("/app/userFirst/regist", data).then((res) => {
+		if(this.isDis){
+			return;
+		}
+		this.isDis = true;
+		this.$Request.postJson("/app/userFirst/regist", data)
+		.then((res) => {
 		  if (res.code == 0) {
 		    that.saveExpect()
 		  } else {
@@ -427,25 +433,33 @@ export default {
 		      icon: "none",
 		    });
 		  }
-		}); 
-		
+		})
+		.catch(err => {
+		  console.error(err);
+		  uni.showToast({ title: '网络异常', icon: 'none' });
+		})
+		.finally(() => {
+		  setTimeout(()=>{
+			  that.isDis = false;
+		  },3000)
+		});
     },
 	saveExpect(){
 		let data={
-						intentionId:"",
-						ruleClassifyId:this.jobId,
-						ruleClassifyName:this.jobTitle,
-						citys:this.city,
-						salaryRange:this.minSalary+'-'+this.maxSalary,
-						postType:'',
-						industry:'',
-						"createTime": "",
-						  "industryId": 201,
-						  "industryOneId": 200,
-						  "classifyOneId": 0,
-						  "classifyTwoId": 0,
-						  "isDefault": 1
-					}
+			intentionId:"",
+			ruleClassifyId:this.jobId,
+			ruleClassifyName:this.jobTitle,
+			citys:this.city,
+			salaryRange:this.minSalary+'-'+this.maxSalary,
+			postType:'',
+			industry:'',
+			"createTime": "",
+			  "industryId": 201,
+			  "industryOneId": 200,
+			  "classifyOneId": 0,
+			  "classifyTwoId": 0,
+			  "isDefault": 1
+		}
 		this.$Request.postJson("/app/intention/saveUpdate", data).then((res) => {
 		  if (res.code == 0) {
 		      uni.showToast({ title: "保存成功", icon: "none" });
@@ -771,4 +785,8 @@ export default {
     }
   }
 }
+.disabledStyle {
+  opacity: 0.6;
+  pointer-events: none;
+}
 </style>