|
|
|
@ -130,8 +130,8 @@ export default {
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
created() {
|
|
|
|
|
this.getCode();
|
|
|
|
|
this.getCookie();
|
|
|
|
|
// this.getCode();
|
|
|
|
|
// this.getCookie();
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
getCode() {
|
|
|
|
@ -158,31 +158,33 @@ export default {
|
|
|
|
|
handleLogin() {
|
|
|
|
|
this.$refs.loginForm.validate((valid) => {
|
|
|
|
|
if (valid) {
|
|
|
|
|
this.loading = true;
|
|
|
|
|
if (this.loginForm.rememberMe) {
|
|
|
|
|
Cookies.set("username", this.loginForm.username, { expires: 30 });
|
|
|
|
|
Cookies.set("password", encrypt(this.loginForm.password), {
|
|
|
|
|
expires: 30,
|
|
|
|
|
});
|
|
|
|
|
Cookies.set("rememberMe", this.loginForm.rememberMe, {
|
|
|
|
|
expires: 30,
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
Cookies.remove("username");
|
|
|
|
|
Cookies.remove("password");
|
|
|
|
|
Cookies.remove("rememberMe");
|
|
|
|
|
}
|
|
|
|
|
this.$store
|
|
|
|
|
.dispatch("Login", this.loginForm)
|
|
|
|
|
.then(() => {
|
|
|
|
|
this.$router.push({ path: this.redirect || "/" }).catch(() => {});
|
|
|
|
|
})
|
|
|
|
|
.catch(() => {
|
|
|
|
|
this.loading = false;
|
|
|
|
|
if (this.captchaEnabled) {
|
|
|
|
|
this.getCode();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
// this.loading = true;
|
|
|
|
|
this.$router.push({ path: "/home" }).catch(() => {});
|
|
|
|
|
|
|
|
|
|
// if (this.loginForm.rememberMe) {
|
|
|
|
|
// Cookies.set("username", this.loginForm.username, { expires: 30 });
|
|
|
|
|
// Cookies.set("password", encrypt(this.loginForm.password), {
|
|
|
|
|
// expires: 30,
|
|
|
|
|
// });
|
|
|
|
|
// Cookies.set("rememberMe", this.loginForm.rememberMe, {
|
|
|
|
|
// expires: 30,
|
|
|
|
|
// });
|
|
|
|
|
// } else {
|
|
|
|
|
// Cookies.remove("username");
|
|
|
|
|
// Cookies.remove("password");
|
|
|
|
|
// Cookies.remove("rememberMe");
|
|
|
|
|
// }
|
|
|
|
|
// this.$store
|
|
|
|
|
// .dispatch("Login", this.loginForm)
|
|
|
|
|
// .then(() => {
|
|
|
|
|
// this.$router.push({ path: this.redirect || "/" }).catch(() => {});
|
|
|
|
|
// })
|
|
|
|
|
// .catch(() => {
|
|
|
|
|
// this.loading = false;
|
|
|
|
|
// if (this.captchaEnabled) {
|
|
|
|
|
// this.getCode();
|
|
|
|
|
// }
|
|
|
|
|
// });
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|