diff --git a/src/views/common/login.vue b/src/views/common/login.vue
index ec01ff0..7683459 100644
--- a/src/views/common/login.vue
+++ b/src/views/common/login.vue
@@ -23,7 +23,12 @@
-
+
@@ -31,7 +36,12 @@
- 登录
+ 登录
@@ -47,6 +57,7 @@ import { apiLogin } from '@/api/api_sys'
export default {
data () {
return {
+ isloading: false,
dataForm: {
username: '',
password: '',
@@ -73,13 +84,21 @@ export default {
// 登录提交表单
handleLogin () {
let param = Object.assign(this.dataForm, { 'uuid': this.dataForm.uuid })
- apiLogin(param).then(res => {
- if (res && res.code === 0) {
- this.$cookie.set('token', res.token)
- this.$router.replace({ name: 'home' })
+ this.$refs.dataForm.validate((valid) => {
+ if (valid) {
+ this.isloading = true
+ apiLogin(param).then(res => {
+ this.isloading = false
+ if (res && res.code === 0) {
+ this.$cookie.set('token', res.token)
+ this.$router.replace({ name: 'home' })
+ } else {
+ this.$message.error(res.msg)
+ this.handleGetImgCaptcha()
+ }
+ })
} else {
- this.$message.error(res.msg)
- this.handleGetImgCaptcha()
+ return false
}
})
}