From ca6317b529e681cf413357a1f07f2d8b0e05d739 Mon Sep 17 00:00:00 2001 From: "453530270@qq.com" Date: Sat, 7 Oct 2023 11:59:51 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E9=AA=8C=E8=AF=81=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/member.js | 8 ++++++++ layout/vCode.vue | 17 +++++++++++------ pages/reg/index.vue | 40 +++++++++++++++++++++++++++++++++++++++- 3 files changed, 58 insertions(+), 7 deletions(-) diff --git a/api/member.js b/api/member.js index 26724bd..0ba4782 100644 --- a/api/member.js +++ b/api/member.js @@ -26,6 +26,14 @@ class Member { return server.post(`/register/sendEmailCode`, data); } + /** + * 获取图形验证码 + * @param data {email,token} + */ + static Graph_che() { + return server.get(`/register/Graph_che`); + } + /** * 获取国家区号 * @param {object} data diff --git a/layout/vCode.vue b/layout/vCode.vue index b7574fe..28a1bbb 100644 --- a/layout/vCode.vue +++ b/layout/vCode.vue @@ -74,12 +74,17 @@ export default { } if (this.load) return; this.inSend = true; - serve.post(this.url, this.data) - .then(() => { - this.inSend = false; - this.load = true; - this.countDown(); - this.$toast(this.$t('common.sendSuccess')); + .then((res) => { + // ss + if(res.code=='4001'){ + this.inSend = false + this.$toast(res.message); + }else{ + this.inSend = false; + this.load = true; + this.countDown(); + this.$toast(this.$t('common.sendSuccess')); + } }) .catch(() => { this.inSend = false; diff --git a/pages/reg/index.vue b/pages/reg/index.vue index fded946..e5ad718 100644 --- a/pages/reg/index.vue +++ b/pages/reg/index.vue @@ -70,6 +70,16 @@ + + + Captcha + + + + {{$t('reg.a6')}} @@ -89,6 +99,8 @@ url="/register/sendEmailCode" :data="{ email:form.account, + gc_code: form.gr_code, + gc_key: gc_key, type:1 }" v-show="form.type==2" @@ -159,7 +171,11 @@ export default { password: "", password_confirmation: "", invite_code: "", + gr_code: "", }, + captcha: '', + Graph_che:'', + gc_key:'', // tuxiangyanzheng key check: false, agreement: {}, country_code:'' @@ -230,6 +246,28 @@ export default { this.$toast(this.$t('reg.c5')); }); }, + + //获取图形验证码 + refreshCaptcha() { + axios.get('/register/Graph_che') + .then(response => { + // 重新加载验证码图片 + }) + .catch(error => { + console.log(error); + }); + }, + + gett_gc_code(){ + Member.Graph_che().then((res)=>{ + console.log("gc",res.data.img) + this.Graph_che = res.data.img; + this.gc_key= res.data.key; + }); + //this.Graph_che = gc + + }, + //注册完成后登录 login(){ let data={type: 2,account:this.form.account,password: this.form.password} @@ -255,7 +293,7 @@ export default { }, }, mounted() { - + this.gett_gc_code(); }, onLoad(query){ this.query = query