flx:防止连续点击登录

This commit is contained in:
X_Rian 2024-06-24 15:05:55 +08:00
parent 2f5f2f7c89
commit b37a486a1f

View File

@ -152,6 +152,7 @@
:disabled="pass" :disabled="pass"
class="logo_btn" class="logo_btn"
@click="loginFn" @click="loginFn"
:loading="isLoadingBtn"
>{{ $t("message.login.login") }} >{{ $t("message.login.login") }}
</el-button> </el-button>
</div> </div>
@ -422,6 +423,7 @@ export default {
components: { getcode, LoginInfo }, components: { getcode, LoginInfo },
data() { data() {
return { return {
isLoadingBtn: false,
isShowContent: false, isShowContent: false,
addPasswordDialog: false, addPasswordDialog: false,
passwordForm: { passwordForm: {
@ -817,6 +819,7 @@ export default {
this.$refs["LoginInfo"].$refs["form"].validate((valid) => { this.$refs["LoginInfo"].$refs["form"].validate((valid) => {
// console.log("this.$refs['LoginInfo']:", this.$refs["LoginInfo"]); // console.log("this.$refs['LoginInfo']:", this.$refs["LoginInfo"]);
if (valid) { if (valid) {
this.isLoadingBtn = true;
if (LOGINTYPE == 1) { if (LOGINTYPE == 1) {
loginApi(this.form).then((res) => { loginApi(this.form).then((res) => {
console.log("--------------------么么儿们10"); console.log("--------------------么么儿们10");
@ -837,6 +840,8 @@ export default {
} }
this.parseLoginData(res.result); this.parseLoginData(res.result);
this.getDetail(this.headquartersSnData); this.getDetail(this.headquartersSnData);
}).finally(() => {
this.isLoadingBtn = false;
}); });
} else if (LOGINTYPE == 2) { } else if (LOGINTYPE == 2) {
console.log(2222222222222); console.log(2222222222222);
@ -856,9 +861,12 @@ export default {
} }
this.parseLoginData(res.result); this.parseLoginData(res.result);
this.getDetail(this.headquartersSnData); this.getDetail(this.headquartersSnData);
}).finally(() => {
this.isLoadingBtn = false;
}); });
} else if (LOGINTYPE == 5) { } else if (LOGINTYPE == 5) {
console.log("中建四局项目账号"); console.log("中建四局项目账号");
this.isLoadingBtn = false;
} else if (LOGINTYPE == 3) { } else if (LOGINTYPE == 3) {
console.log(333333333); console.log(333333333);
@ -878,6 +886,8 @@ export default {
} }
this.parseLoginData(res.result); this.parseLoginData(res.result);
this.getDetail(this.headquartersSnData); this.getDetail(this.headquartersSnData);
}).finally(() => {
this.isLoadingBtn = false;
}); });
} }
} else { } else {
@ -888,6 +898,7 @@ export default {
} else if (this.projectType == "common") { } else if (this.projectType == "common") {
this.$refs["form"].validate((valid) => { this.$refs["form"].validate((valid) => {
if (valid) { if (valid) {
this.isLoadingBtn = true;
if (LOGINTYPE == 1) { if (LOGINTYPE == 1) {
let timestamp = Date.now(); let timestamp = Date.now();
let md5Password = MD5( let md5Password = MD5(
@ -922,6 +933,8 @@ export default {
this.parseLoginData(res.result); this.parseLoginData(res.result);
this.getDetail(this.headquartersSnData); this.getDetail(this.headquartersSnData);
} }
}).finally(() => {
this.isLoadingBtn = false;
}); });
} else if (LOGINTYPE == 2) { } else if (LOGINTYPE == 2) {
console.log(2222222222222); console.log(2222222222222);
@ -942,6 +955,8 @@ export default {
} }
this.parseLoginData(res.result); this.parseLoginData(res.result);
this.getDetail(this.headquartersSnData); this.getDetail(this.headquartersSnData);
}).finally(() => {
this.isLoadingBtn = false;
}); });
} else if (LOGINTYPE == 3) { } else if (LOGINTYPE == 3) {
console.log(333333333); console.log(333333333);
@ -962,6 +977,8 @@ export default {
} }
this.parseLoginData(res.result); this.parseLoginData(res.result);
this.getDetail(this.headquartersSnData); this.getDetail(this.headquartersSnData);
}).finally(() => {
this.isLoadingBtn = false;
}); });
} }
} else { } else {
@ -974,6 +991,7 @@ export default {
} else { } else {
this.$refs["form2"].validate((valid) => { this.$refs["form2"].validate((valid) => {
if (valid) { if (valid) {
this.isLoadingBtn = true;
loginPhoneApi(this.form2).then((res) => { loginPhoneApi(this.form2).then((res) => {
// () // ()
if (this.loginType == 1 && res.result.accountType == 11) { if (this.loginType == 1 && res.result.accountType == 11) {
@ -985,6 +1003,8 @@ export default {
return; return;
} }
this.parseLoginData(res.result); this.parseLoginData(res.result);
}).finally(() => {
this.isLoadingBtn = false;
}); });
} else { } else {
console.log("error submit!!"); console.log("error submit!!");