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); return server.post(`/register/sendEmailCode`, data);
} }
/**
* 获取图形验证码
* @param data {email,token}
*/
static Graph_che() {
return server.get(`/register/Graph_che`);
}
/** /**
* 获取国家区号 * 获取国家区号
* @param {object} data * @param {object} data

17
layout/vCode.vue

@ -75,11 +75,18 @@ export default {
if (this.load) return; if (this.load) return;
this.inSend = true; this.inSend = true;
serve.post(this.url, this.data) serve.post(this.url, this.data)
.then(() => { .then((res) => {
this.inSend = false; // check res.code value
this.load = true; if(res.code=='4001'){
this.countDown(); this.inSend = false
this.$toast(this.$t('common.sendSuccess')); this.$toast(res.message);
}else{
this.inSend = false;
this.load = true;
this.countDown();
this.$toast(this.$t('common.sendSuccess'));
}
}) })
.catch(() => { .catch(() => {
this.inSend = false; this.inSend = false;

40
pages/reg/index.vue

@ -70,6 +70,16 @@
</view> </view>
</template> </template>
</view> </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="form-item border-b m-b-md p-b-xs">
<view class="label m-b-xs">{{$t('reg.a6')}}</view> <view class="label m-b-xs">{{$t('reg.a6')}}</view>
<v-input class="color-light" v-model="form.code" :placeholder="$t('reg.a7')"> <v-input class="color-light" v-model="form.code" :placeholder="$t('reg.a7')">
@ -89,6 +99,8 @@
url="/register/sendEmailCode" url="/register/sendEmailCode"
:data="{ :data="{
email:form.account, email:form.account,
gc_code: form.gr_code,
gc_key: gc_key,
type:1 type:1
}" }"
v-show="form.type==2" v-show="form.type==2"
@ -159,7 +171,11 @@ export default {
password: "", password: "",
password_confirmation: "", password_confirmation: "",
invite_code: "", invite_code: "",
gr_code: "",
}, },
captcha: '',
Graph_che:'',
gc_key:'', // tuxiangyanzheng key
check: false, check: false,
agreement: {}, agreement: {},
country_code:'' country_code:''
@ -230,6 +246,28 @@ export default {
this.$toast(this.$t('reg.c5')); 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(){ login(){
let data={type: 2,account:this.form.account,password: this.form.password} let data={type: 2,account:this.form.account,password: this.form.password}
@ -255,7 +293,7 @@ export default {
}, },
}, },
mounted() { mounted() {
this.gett_gc_code();
}, },
onLoad(query){ onLoad(query){
this.query = query this.query = query

Loading…
Cancel
Save