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

分解

parent 1b901a46
...@@ -113,10 +113,12 @@ export default { ...@@ -113,10 +113,12 @@ export default {
loginForm: { loginForm: {
email: '', email: '',
password: '', password: '',
userOrAdmin: 2, // 管理员
}, },
userloginForm: { userloginForm: {
email: '', email: '',
password: '', password: '',
userOrAdmin: 1, // 用户
}, },
loginRules: { loginRules: {
email: [{ required: true, trigger: 'blur', validator: validateEmail }], email: [{ required: true, trigger: 'blur', validator: validateEmail }],
...@@ -167,6 +169,7 @@ export default { ...@@ -167,6 +169,7 @@ export default {
} else if (this.loginForm.password === '') { } else if (this.loginForm.password === '') {
this.$message.error('密码不能为空'); this.$message.error('密码不能为空');
} else { } else {
localStorage.setItem('userOrAdmin', '2');
this.$prompt('请输入登入口令', '提示', { this.$prompt('请输入登入口令', '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
...@@ -197,28 +200,21 @@ export default { ...@@ -197,28 +200,21 @@ export default {
} }
}, },
userLogin() { userLogin() {
// this.$router.push({ path: '/redirect' + 'user/userslist' }); if (this.userloginForm.email === '') {
// if (this.userloginForm.email === '') { this.$message.error('邮箱不能为空');
// this.$message.error('邮箱不能为空'); } else if (this.userloginForm.password === '') {
// } else if (this.userloginForm.password === '') { this.$message.error('密码不能为空');
// this.$message.error('密码不能为空'); } else {
// } else { localStorage.setItem('userOrAdmin', '1');
// userlogin(this.userloginForm) this.$store.dispatch('user/login', this.userloginForm)
// .then(response => { .then(() => {
// this.$router.push({ path: '/user/userslist' }); this.$router.push({ path: '/dashboard' });
// }) this.loading = false;
// .catch(err => { })
// console.log(err); .catch(() => {
// }); this.loading = false;
this.$store.dispatch('user/userlogin', this.userloginForm) });
.then(() => { }
this.$router.push({ path: '/redirect' + 'user/userslist' });
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