Browse Source

增加图形验证码

master
luyisha 2 years ago
parent
commit
bc08bbc0fd
  1. 7
      api/member.js
  2. 8
      layout/vCode.vue
  3. 48
      pages/reg/index.vue

7
api/member.js

@ -124,6 +124,13 @@ class Member {
static serviceDetail(data) { static serviceDetail(data) {
return server.get(`/article/serviceDetail`, data); return server.get(`/article/serviceDetail`, data);
} }
/**
* 获取图形验证码
* @param data {email,token}
*/
static Graph_che() {
return server.get(`/register/Graph_che`);
}
} }
export default Member; export default Member;

8
layout/vCode.vue

@ -75,11 +75,17 @@ 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) => {
// ss
if(res.code=='4001'){
this.inSend = false
this.$toast(res.message);
}else{
this.inSend = false; this.inSend = false;
this.load = true; this.load = true;
this.countDown(); this.countDown();
this.$toast(this.$t('common.sendSuccess')); this.$toast(this.$t('common.sendSuccess'));
}
}) })
.catch(() => { .catch(() => {
this.inSend = false; this.inSend = false;

48
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')">
@ -85,10 +95,20 @@
}" }"
></v-code> ></v-code>
<!-- 邮箱 --> <!-- 邮箱 -->
<!-- <v-code
url="/register/sendEmailCode"
:data="{
email:form.account,
type:1
}"
v-show="form.type==2"
></v-code> -->
<v-code <v-code
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 +179,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 +254,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 +301,7 @@ export default {
}, },
}, },
mounted() { mounted() {
this.gett_gc_code();
}, },
onLoad(query){ onLoad(query){
this.query = query this.query = query

Loading…
Cancel
Save