Commit 1249f85b authored by 冯超鹏's avatar 冯超鹏

分解

parent 1b901a46
......@@ -113,10 +113,12 @@ export default {
loginForm: {
email: '',
password: '',
userOrAdmin: 2, // 管理员
},
userloginForm: {
email: '',
password: '',
userOrAdmin: 1, // 用户
},
loginRules: {
email: [{ required: true, trigger: 'blur', validator: validateEmail }],
......@@ -167,6 +169,7 @@ export default {
} else if (this.loginForm.password === '') {
this.$message.error('密码不能为空');
} else {
localStorage.setItem('userOrAdmin', '2');
this.$prompt('请输入登入口令', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
......@@ -197,28 +200,21 @@ export default {
}
},
userLogin() {
// this.$router.push({ path: '/redirect' + 'user/userslist' });
// if (this.userloginForm.email === '') {
// this.$message.error('邮箱不能为空');
// } else if (this.userloginForm.password === '') {
// this.$message.error('密码不能为空');
// } else {
// userlogin(this.userloginForm)
// .then(response => {
// this.$router.push({ path: '/user/userslist' });
// })
// .catch(err => {
// console.log(err);
// });
this.$store.dispatch('user/userlogin', this.userloginForm)
if (this.userloginForm.email === '') {
this.$message.error('邮箱不能为空');
} else if (this.userloginForm.password === '') {
this.$message.error('密码不能为空');
} else {
localStorage.setItem('userOrAdmin', '1');
this.$store.dispatch('user/login', this.userloginForm)
.then(() => {
this.$router.push({ path: '/redirect' + 'user/userslist' });
this.$router.push({ path: '/dashboard' });
this.loading = false;
})
.catch(() => {
this.loading = false;
});
// }
}
},
},
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment