提交代码
This commit is contained in:
@@ -22,7 +22,7 @@
|
||||
</span>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item prop="captcha">
|
||||
<!-- <el-form-item prop="captcha">
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="14">
|
||||
<el-input v-model="dataForm.captcha" :placeholder="$t('login.captcha')">
|
||||
@@ -35,7 +35,7 @@
|
||||
<img :src="captchaPath" @click="getCaptcha()">
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form-item>
|
||||
</el-form-item> -->
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="dataFormSubmitHandle()" class="w-percent-100">{{ $t('login.title') }}</el-button>
|
||||
</el-form-item>
|
||||
@@ -52,7 +52,7 @@
|
||||
<script>
|
||||
import Cookies from 'js-cookie'
|
||||
import debounce from 'lodash/debounce'
|
||||
import { getUUID } from '@/utils'
|
||||
// import { getUUID } from '@/utils'
|
||||
export default {
|
||||
data () {
|
||||
return {
|
||||
@@ -74,36 +74,36 @@ export default {
|
||||
password: [
|
||||
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }
|
||||
],
|
||||
captcha: [
|
||||
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }
|
||||
]
|
||||
// captcha: [
|
||||
// { required: true, message: this.$t('validate.required'), trigger: 'blur' }
|
||||
// ]
|
||||
}
|
||||
}
|
||||
},
|
||||
created () {
|
||||
this.getCaptcha()
|
||||
// this.getCaptcha()
|
||||
},
|
||||
methods: {
|
||||
// 获取验证码
|
||||
getCaptcha () {
|
||||
this.dataForm.uuid = getUUID()
|
||||
this.captchaPath = `${window.SITE_CONFIG['apiURL']}/captcha?uuid=${this.dataForm.uuid}`
|
||||
},
|
||||
// getCaptcha () {
|
||||
// // this.dataForm.uuid = getUUID()
|
||||
// this.captchaPath = `${window.SITE_CONFIG['apiURL']}/captcha?uuid=${this.dataForm.uuid}`
|
||||
// },
|
||||
// 表单提交
|
||||
dataFormSubmitHandle: debounce(function () {
|
||||
this.$refs['dataForm'].validate((valid) => {
|
||||
if (!valid) {
|
||||
return false
|
||||
}
|
||||
// this.$refs['dataForm'].validate((valid) => {
|
||||
// if (!valid) {
|
||||
// return false
|
||||
// }
|
||||
this.$http.post('/login', this.dataForm).then(({ data: res }) => {
|
||||
if (res.code !== 0) {
|
||||
this.getCaptcha()
|
||||
// this.getCaptcha()
|
||||
return this.$message.error(res.msg)
|
||||
}
|
||||
Cookies.set('token', res.data.token)
|
||||
this.$router.replace({ name: 'home' })
|
||||
}).catch(() => {})
|
||||
})
|
||||
// })
|
||||
}, 1000, { 'leading': true, 'trailing': false })
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user