[fix][V]:完善login提交表单操作,完成对接login接口

master
Romesum 5 years ago
parent 368427f8fe
commit 93b03a473f

@ -49,6 +49,7 @@
<script>
import {get, post} from "~/utils";
import {showFail, showSuccess} from "~/utils/dialog";
export default {
name: "login",
@ -62,12 +63,10 @@
character: [{
label: '超级管理员',
value: '3'
},
{
}, {
label: '管理员',
value: '2'
},
{
}, {
label: '老师',
value: '1'
}
@ -89,16 +88,24 @@
}
},
methods: {
submitForm (formName) {
submitForm(formName) {
this.$refs[formName].validate(async (valid) => {
if (valid) {
await post('lb/user/login', {
auth: this.ruleForm.identity,
username: this.ruleForm.account,
password: this.ruleForm.psw
})
}).then(res => {
showSuccess("登录成功", this)
//
await this.$router.push('/teacher')
setTimeout(() => {
if (this.ruleForm.identity === '1') this.$router.push('/teacher')
else if (this.ruleForm.identity === '2') this.$router.push('/manager')
else if (this.ruleForm.identity === '3') this.$router.push('/supManager')
}, 1000)
}).catch(e => {
showFail(e.msg, this)
})
} else {
console.log('error submit!!');
return false;

Loading…
Cancel
Save