mirror of
https://gitee.com/liweiyi/ChestnutCMS.git
synced 2025-12-07 00:48:23 +08:00
注册页面报错修正
This commit is contained in:
parent
425da53ad6
commit
8514dcada4
@ -128,7 +128,7 @@ export default {
|
|||||||
this.loginForm.captcha = data;
|
this.loginForm.captcha = data;
|
||||||
},
|
},
|
||||||
handleLogin() {
|
handleLogin() {
|
||||||
if (!this.loginForm.captcha) {
|
if (this.captchaConfig.enabled && !this.loginForm.captcha) {
|
||||||
this.$modal.msgError(this.$t('Login.CaptchaRuleTip'));
|
this.$modal.msgError(this.$t('Login.CaptchaRuleTip'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -30,9 +30,8 @@
|
|||||||
</el-input>
|
</el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item v-if="captchaConfig.enabled">
|
<el-form-item v-if="captchaConfig.enabled">
|
||||||
<text-captcha v-if="captchaConfig.type=='Text'" ref="textCaptcha" @change="handleTextCaptchaSuccess"></text-captcha>
|
<text-captcha v-if="captchaConfig.type=='Text'" ref="textCaptcha" @change="handleCaptchaSuccess"></text-captcha>
|
||||||
<math-captcha v-if="captchaConfig.type=='Math'" ref="mathCaptcha" @change="handleMathCaptchaSuccess"></math-captcha>
|
<math-captcha v-if="captchaConfig.type=='Math'" ref="mathCaptcha" @change="handleCaptchaSuccess"></math-captcha>
|
||||||
<slider-captcha v-if="captchaConfig.type=='Slider'" @success="handleSliderCaptchaSuccess"></slider-captcha>
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item style="width:100%;">
|
<el-form-item style="width:100%;">
|
||||||
<el-button
|
<el-button
|
||||||
@ -59,7 +58,6 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { getLoginCaptchaConfig, register } from "@/api/login";
|
import { getLoginCaptchaConfig, register } from "@/api/login";
|
||||||
import SliderCaptcha from './components/captcha/slider'
|
|
||||||
import MathCaptcha from './components/captcha/math'
|
import MathCaptcha from './components/captcha/math'
|
||||||
import TextCaptcha from './components/captcha/text'
|
import TextCaptcha from './components/captcha/text'
|
||||||
|
|
||||||
@ -115,28 +113,14 @@ export default {
|
|||||||
this.captchaConfig = res.data;
|
this.captchaConfig = res.data;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
handleSliderCaptchaSuccess(data) {
|
handleCaptchaSuccess(data) {
|
||||||
this.registerForm.captcha = {
|
this.registerForm.captcha = data;
|
||||||
type: this.captchaConfig.type,
|
|
||||||
token: data.token,
|
|
||||||
data: data.captcha
|
|
||||||
}
|
|
||||||
},
|
|
||||||
handleMathCaptchaSuccess(data) {
|
|
||||||
this.registerForm.captcha = {
|
|
||||||
type: this.captchaConfig.type,
|
|
||||||
token: data.token,
|
|
||||||
data: data.captcha
|
|
||||||
}
|
|
||||||
},
|
|
||||||
handleTextCaptchaSuccess(data) {
|
|
||||||
this.registerForm.captcha = {
|
|
||||||
type: this.captchaConfig.type,
|
|
||||||
token: data.token,
|
|
||||||
data: data.captcha
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
handleRegister() {
|
handleRegister() {
|
||||||
|
if (this.captchaConfig.enabled && !this.registerForm.captcha) {
|
||||||
|
this.$modal.msgError(this.$t('Login.CaptchaRuleTip'));
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.$refs.registerForm.validate(valid => {
|
this.$refs.registerForm.validate(valid => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
@ -150,8 +134,8 @@ export default {
|
|||||||
}).catch(() => {});
|
}).catch(() => {});
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
if (this.captchaEnabled) {
|
if (this.captchaConfig.enabled) {
|
||||||
this.getCode();
|
this.$refs[this.captchaConfig.type+'Captcha'].reloadCaptcha();
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user