|
@@ -7,19 +7,19 @@
|
|
</h3>
|
|
</h3>
|
|
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()"
|
|
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()"
|
|
status-icon>
|
|
status-icon>
|
|
- <el-form-item prop="userName">
|
|
|
|
- <el-input v-model="dataForm.userName" placeholder="帐号"></el-input>
|
|
|
|
|
|
+ <el-form-item prop="userPhone">
|
|
|
|
+ <el-input type="tel" v-model="dataForm.userPhone" placeholder="帐号"></el-input>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
- <el-form-item prop="password">
|
|
|
|
- <el-input v-model="dataForm.password" type="password" placeholder="密码"></el-input>
|
|
|
|
|
|
+ <el-form-item prop="userPassword">
|
|
|
|
+ <el-input v-model="dataForm.userPassword" type="password" placeholder="密码"></el-input>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
<el-form-item prop="captcha">
|
|
<el-form-item prop="captcha">
|
|
<el-row :gutter="20">
|
|
<el-row :gutter="20">
|
|
<el-col :span="17">
|
|
<el-col :span="17">
|
|
- <el-input v-model="dataForm.captcha" placeholder="验证码">
|
|
|
|
|
|
+ <el-input v-model="dataForm.captcha" placeholder="图形验证码">
|
|
</el-input>
|
|
</el-input>
|
|
</el-col>
|
|
</el-col>
|
|
- <el-col :span="7" class="login-captcha">
|
|
|
|
|
|
+ <el-col :span="7" class="captcha">
|
|
<img :src="captchaPath" @click="getCaptcha()" alt="">
|
|
<img :src="captchaPath" @click="getCaptcha()" alt="">
|
|
</el-col>
|
|
</el-col>
|
|
</el-row>
|
|
</el-row>
|
|
@@ -41,23 +41,24 @@ export default {
|
|
data () {
|
|
data () {
|
|
return {
|
|
return {
|
|
dataForm: {
|
|
dataForm: {
|
|
- userName: '',
|
|
|
|
- password: '',
|
|
|
|
|
|
+ userPhone: '18768452697',
|
|
|
|
+ userPassword: '123456',
|
|
uuid: '',
|
|
uuid: '',
|
|
- captcha: ''
|
|
|
|
|
|
+ captcha: '123456'
|
|
},
|
|
},
|
|
dataRule: {
|
|
dataRule: {
|
|
- userName: [
|
|
|
|
|
|
+ userPhone: [
|
|
{ required: true, message: '帐号不能为空', trigger: 'blur' }
|
|
{ required: true, message: '帐号不能为空', trigger: 'blur' }
|
|
],
|
|
],
|
|
- password: [
|
|
|
|
|
|
+ userPassword: [
|
|
{ required: true, message: '密码不能为空', trigger: 'blur' }
|
|
{ required: true, message: '密码不能为空', trigger: 'blur' }
|
|
],
|
|
],
|
|
captcha: [
|
|
captcha: [
|
|
{ required: true, message: '验证码不能为空', trigger: 'blur' }
|
|
{ required: true, message: '验证码不能为空', trigger: 'blur' }
|
|
]
|
|
]
|
|
},
|
|
},
|
|
- captchaPath: ''
|
|
|
|
|
|
+ captchaPath: '',
|
|
|
|
+ isDisabled: false
|
|
}
|
|
}
|
|
},
|
|
},
|
|
created () {
|
|
created () {
|
|
@@ -66,26 +67,39 @@ export default {
|
|
methods: {
|
|
methods: {
|
|
// 提交表单
|
|
// 提交表单
|
|
dataFormSubmit () {
|
|
dataFormSubmit () {
|
|
- // this.$router.replace({ name: 'home' })
|
|
|
|
|
|
+ const { userPhone, userPassword, uuid, captcha } = this.dataForm
|
|
|
|
+ const postData = {
|
|
|
|
+ 'userPhone': userPhone,
|
|
|
|
+ 'userPassword': userPassword,
|
|
|
|
+ 'uuid': uuid,
|
|
|
|
+ 'captcha': captcha
|
|
|
|
+ }
|
|
this.$refs['dataForm'].validate((valid) => {
|
|
this.$refs['dataForm'].validate((valid) => {
|
|
if (valid) {
|
|
if (valid) {
|
|
|
|
+ if (this.isDisabled) {
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ this.isDisabled = true
|
|
this.$http({
|
|
this.$http({
|
|
- url: this.$http.adornUrl('/sys/login'),
|
|
|
|
|
|
+ url: this.$http.adornUrl('/user/login11'),
|
|
method: 'post',
|
|
method: 'post',
|
|
- data: this.$http.adornData({
|
|
|
|
- 'username': this.dataForm.userName,
|
|
|
|
- 'password': this.dataForm.password,
|
|
|
|
- 'uuid': this.dataForm.uuid,
|
|
|
|
- 'captcha': this.dataForm.captcha
|
|
|
|
- })
|
|
|
|
|
|
+ data: this.$http.adornData(postData)
|
|
}).then(({ data }) => {
|
|
}).then(({ data }) => {
|
|
- if (data && data.code === 0) {
|
|
|
|
- this.$cookie.set('token', data.token)
|
|
|
|
|
|
+ this.isDisabled = false
|
|
|
|
+ if (data.status) {
|
|
|
|
+ const { token } = data.data
|
|
|
|
+ this.$cookie.set('token', token)
|
|
this.$router.replace({ name: 'home' })
|
|
this.$router.replace({ name: 'home' })
|
|
- } else {
|
|
|
|
- this.getCaptcha()
|
|
|
|
- this.$message.error(data.msg)
|
|
|
|
|
|
+ return
|
|
}
|
|
}
|
|
|
|
+ this.$message.error(data.msg)
|
|
|
|
+ }).catch((err) => {
|
|
|
|
+ this.isDisabled = false
|
|
|
|
+ this.$message({
|
|
|
|
+ message: JSON.stringify(err),
|
|
|
|
+ type: 'error',
|
|
|
|
+ duration: 2000
|
|
|
|
+ })
|
|
})
|
|
})
|
|
}
|
|
}
|
|
})
|
|
})
|
|
@@ -93,7 +107,7 @@ export default {
|
|
// 获取验证码
|
|
// 获取验证码
|
|
getCaptcha () {
|
|
getCaptcha () {
|
|
this.dataForm.uuid = getUUID()
|
|
this.dataForm.uuid = getUUID()
|
|
- this.captchaPath = this.$http.adornUrl(`/captcha.jpg?uuid=${this.dataForm.uuid}`)
|
|
|
|
|
|
+ this.captchaPath = this.$http.adornUrl(`/api/captcha?uuid=${this.dataForm.uuid}`)
|
|
},
|
|
},
|
|
gotoRegister () {
|
|
gotoRegister () {
|
|
this.$router.push({
|
|
this.$router.push({
|
|
@@ -153,7 +167,7 @@ export default {
|
|
margin: 0 auto;
|
|
margin: 0 auto;
|
|
}
|
|
}
|
|
|
|
|
|
-.login-captcha {
|
|
|
|
|
|
+.captcha {
|
|
display: flex;
|
|
display: flex;
|
|
justify-content: flex-end;
|
|
justify-content: flex-end;
|
|
align-items: center;
|
|
align-items: center;
|