no message

Former-commit-id: 487ad37396f6f4c6afda02ba5388968fd16c2323
Former-commit-id: 48aeae5cb653e147b29bb61fe7f93e5450f672f4
Former-commit-id: c1dc76f850cd0447620be74f7835bab7e38bf060
This commit is contained in:
李杨
2018-01-22 13:49:11 +08:00
parent 4f92a792f9
commit da0c3647c5
3 changed files with 57 additions and 3 deletions

View File

@@ -70,10 +70,26 @@ export default {
submit () {
this.$refs.loginForm.validate((valid) => {
if (valid) {
alert('submit!');
this.$axios({
method: 'post',
url: '/login',
data: {
username: this.formLogin.username,
password: this.formLogin.password
}
})
.then (res => {
if (res.data.code === 0) {
this.$message.success(res.data.msg)
setTimeout(() => {
this.$router.push('index')
}, 300);
} else {
this.$message.error(res.data.msg)
}
})
} else {
console.log('error submit!!');
return false;
return false
}
})
}