|
|
@@ -136,6 +136,15 @@ export default {
|
|
|
callback();
|
|
|
}
|
|
|
};
|
|
|
+ const identifyCodeValidator = (rule, value, callback) => {
|
|
|
+ if (value.length !== 6) {
|
|
|
+ this.shakeElem("auth-card-code-verifier");
|
|
|
+ callback(new Error("请输入短信验证码"));
|
|
|
+ } else {
|
|
|
+ this.cardVerified = true;
|
|
|
+ callback();
|
|
|
+ }
|
|
|
+ };
|
|
|
return {
|
|
|
cardType: "login",
|
|
|
cardButtonDisabled: false,
|
|
|
@@ -205,11 +214,8 @@ export default {
|
|
|
}
|
|
|
],
|
|
|
identifyCode: [
|
|
|
- { required: true, message: "请输入短信验证码", trigger: "blur" },
|
|
|
{
|
|
|
- min: 6,
|
|
|
- max: 6,
|
|
|
- message: "短信验证码长度有误",
|
|
|
+ validator: identifyCodeValidator,
|
|
|
trigger: "blur",
|
|
|
}
|
|
|
]
|
|
|
@@ -304,8 +310,7 @@ export default {
|
|
|
};
|
|
|
this.$apis.loginAPI(params)
|
|
|
.then((res) => {
|
|
|
- // if (res.data.code === 0) {
|
|
|
- if (res.data.code === -1) {
|
|
|
+ if (res.data.code === 0) {
|
|
|
localStorage.phone = this.cardForm.phone;
|
|
|
if (this.rememberPassword) {
|
|
|
localStorage.password = this.cardForm.password;
|
|
|
@@ -314,6 +319,7 @@ export default {
|
|
|
localStorage.removeItem("password");
|
|
|
localStorage.removeItem("rememberPassword");
|
|
|
}
|
|
|
+ this.$store.commit("set_user", res.data.data);
|
|
|
this.$message({
|
|
|
showClose: true,
|
|
|
message: "登录成功",
|