fix: alert issue on Windows by using native messageBox (#509)

* Fix alert issue on Windows by using native messageBox

* Update related docs for alert fix

* Remove unlocalized hint
This commit is contained in:
Ethan Wong 2021-04-04 21:00:11 +08:00 committed by GitHub
parent 025e28399e
commit 1e7274e97f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 42 additions and 8 deletions

View file

@ -96,6 +96,7 @@ import { loginWithPhone, loginWithEmail } from "@/api/auth";
import { setCookies } from "@/utils/auth";
import md5 from "crypto-js/md5";
import { mapMutations } from "vuex";
import nativeAlert from "@/utils/nativeAlert";
export default {
name: "Login",
@ -130,7 +131,7 @@ export default {
this.phone === "" ||
this.password === ""
) {
alert("国家区号或手机号不正确");
nativeAlert("国家区号或手机号不正确");
this.processing = false;
return false;
}
@ -143,7 +144,7 @@ export default {
this.password === "" ||
!emailReg.test(this.email)
) {
alert("邮箱不正确");
nativeAlert("邮箱不正确");
return false;
}
return true;
@ -161,7 +162,7 @@ export default {
.then(this.handleLoginResponse)
.catch((error) => {
this.processing = false;
alert(`发生错误,请检查你的账号密码是否正确\n${error}`);
nativeAlert(`发生错误,请检查你的账号密码是否正确\n${error}`);
});
} else {
this.processing = this.validateEmail();
@ -174,7 +175,7 @@ export default {
.then(this.handleLoginResponse)
.catch((error) => {
this.processing = false;
alert(`发生错误,请检查你的账号密码是否正确\n${error}`);
nativeAlert(`发生错误,请检查你的账号密码是否正确\n${error}`);
});
}
},
@ -191,7 +192,7 @@ export default {
} else {
this.processing = false;
console.log(data.msg);
alert(data.msg ?? data.message ?? "账号或密码错误,请检查");
nativeAlert(data.msg ?? data.message ?? "账号或密码错误,请检查");
}
},
},