lijinlong
杜函宇 1 year ago
parent 81b8397e47
commit d5b926ca80

@ -9,7 +9,11 @@ import { isRelogin } from "@/utils/request";
NProgress.configure({ showSpinner: false });
const whiteList = [
'/toLogin'
'/toLogin',
'/home',
'/planManage',
"/enforcing",
"/focusEnter"
];
router.beforeEach((to, from, next) => {

@ -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();
// }
// });
}
});
},

Loading…
Cancel
Save