vue-admin-template 目录
登录名校验规则

登录事件
handleLogin() {
this.$refs.loginForm.validate(valid => {
if (valid) {
this.loading = true
// this.$store.dispatch('user/login', this.loginForm).then(() => {
// this.$router.push({ path: this.redirect || '/' })
// this.loading = false
// }).catch(() => {
// this.loading = false
// })
axios.defaults.withCredentials = true;//带cookie
axios.post('http://localhost:8080/login',
// {
// "username":this.loginForm.username,
// "password":this.loginForm.password
// }
this.loginForm
)
.then((res) => {
console.log(res);
console.log(res.data)
if(res.data.status == 0){
this.$router.push({ path: this.redirect || '/' })
}else{
this.$message.error(res.data.message);
}
this.loading = false
})
.catch(function (error) {// 请求失败处理
console.log(error);
this.loading = false
});
} else {
console.log('error submit!!')
return false
}
})
}