Browse Source

增加图形验证

master
453530270@qq.com 2 years ago
parent
commit
a19a089ec5
  1. 8
      api/member.js
  2. 17
      layout/vCode.vue
  3. 40
      pages/reg/index.vue

8
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

17
layout/vCode.vue

@ -75,11 +75,18 @@ 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) => {
// check res.code value
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;

40
pages/reg/index.vue

@ -70,6 +70,16 @@
</view>
</template>
</view>
<!--图形验证码-->
<view class="form-item border-b m-b-md p-b-xs">
<view class="label m-b-xs">Captcha</view>
<v-input class="color-light" v-model="form.gr_code" placeholder='Please enter graphic results'>
<template #right>
<!-- 邮箱 -->
<img :src="Graph_che" @click="gett_gc_code">
</template>
</v-input>
</view>
<view class="form-item border-b m-b-md p-b-xs">
<view class="label m-b-xs">{{$t('reg.a6')}}</view>
<v-input class="color-light" v-model="form.code" :placeholder="$t('reg.a7')">
@ -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

Loading…
Cancel
Save