简单验证登录接口
This commit is contained in:
parent
2864a04f24
commit
209d318f09
@ -57,6 +57,8 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { validMobile } from '@/utils/validate'
|
import { validMobile } from '@/utils/validate'
|
||||||
|
// 导入登录api
|
||||||
|
import { login } from '@/api/user'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'Login',
|
name: 'Login',
|
||||||
@ -125,19 +127,26 @@ export default {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
handleLogin() {
|
handleLogin() {
|
||||||
this.$refs.loginForm.validate(valid => {
|
// this.$refs.loginForm.validate(valid => {
|
||||||
if (valid) {
|
// if (valid) {
|
||||||
this.loading = true
|
// this.loading = true
|
||||||
this.$store.dispatch('user/login', this.loginForm).then(() => {
|
// this.$store.dispatch('user/login', this.loginForm).then(() => {
|
||||||
this.$router.push({ path: this.redirect || '/' })
|
// this.$router.push({ path: this.redirect || '/' })
|
||||||
this.loading = false
|
// this.loading = false
|
||||||
}).catch(() => {
|
// }).catch(() => {
|
||||||
this.loading = false
|
// this.loading = false
|
||||||
})
|
// })
|
||||||
} else {
|
// } else {
|
||||||
console.log('error submit!!')
|
// console.log('error submit!!')
|
||||||
return false
|
// return false
|
||||||
}
|
// }
|
||||||
|
// })
|
||||||
|
|
||||||
|
login({
|
||||||
|
mobile: '13800000002',
|
||||||
|
password: '123456'
|
||||||
|
}).then(res => {
|
||||||
|
console.log(res.data)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user