|
|
@@ -24,6 +24,21 @@
|
|
|
</template>
|
|
|
</van-field>
|
|
|
|
|
|
+ <van-field
|
|
|
+ name="图形验证码"
|
|
|
+ placeholder="请输入图形验证码"
|
|
|
+ v-model="form.captcha"
|
|
|
+ :maxlength="6"
|
|
|
+ :rules="[{ required: true, message: '请输入图形验证码' }]"
|
|
|
+ >
|
|
|
+ <template #left-icon>
|
|
|
+ <img :src="require('@assets/svgs/login_icon_code.svg')" class="icon" />
|
|
|
+ </template>
|
|
|
+ <template #button>
|
|
|
+ <van-image @click="getCode" :src="codeImg" width="68" height="32" fit="contain" />
|
|
|
+ </template>
|
|
|
+ </van-field>
|
|
|
+
|
|
|
<van-field
|
|
|
type="digit"
|
|
|
name="验证码"
|
|
|
@@ -135,15 +150,43 @@ export default {
|
|
|
password: '',
|
|
|
password2: '',
|
|
|
code: '',
|
|
|
- inviteCode: this.$store.state.inviteCode || ''
|
|
|
+ inviteCode: this.$store.state.inviteCode || '',
|
|
|
+ captchaKey: '',
|
|
|
+ captcha: ''
|
|
|
},
|
|
|
+ codeImg: '',
|
|
|
checked: false
|
|
|
};
|
|
|
},
|
|
|
+ mounted() {
|
|
|
+ this.getCode();
|
|
|
+ },
|
|
|
methods: {
|
|
|
+ getCode() {
|
|
|
+ this.$http.get('/captcha/get').then(res => {
|
|
|
+ this.form.captchaKey = res.key;
|
|
|
+ this.codeImg = res.image;
|
|
|
+ });
|
|
|
+ },
|
|
|
sendPhone() {
|
|
|
- this.$refs.form.validate('手机号码').then(() => {
|
|
|
- this.sendMsg(this.form.phone);
|
|
|
+ this.$refs.form.validate(['手机号码', '图形验证码']).then(() => {
|
|
|
+ // this.sendMsg(this.form.phone);
|
|
|
+ this.$http
|
|
|
+ .get('/sms/sendCaptchaVerify', {
|
|
|
+ phone: this.form.phone,
|
|
|
+ captchaKey: this.form.captchaKey,
|
|
|
+ captcha: this.form.captcha
|
|
|
+ })
|
|
|
+ .then(res => {
|
|
|
+ this.isSend = true;
|
|
|
+ this.setTime(60);
|
|
|
+ this.msgCode = res;
|
|
|
+ this.$toast.success('发送成功');
|
|
|
+ })
|
|
|
+ .catch(e => {
|
|
|
+ this.$toast(e.error);
|
|
|
+ this.setTime(0);
|
|
|
+ });
|
|
|
});
|
|
|
},
|
|
|
submit() {
|
|
|
@@ -164,7 +207,7 @@ export default {
|
|
|
.then(() => {
|
|
|
this.$toast.success('注册成功');
|
|
|
setTimeout(() => {
|
|
|
- this.$router.back();
|
|
|
+ this.$router.push('/home');
|
|
|
}, 1500);
|
|
|
})
|
|
|
.catch(e => {
|