mirror of
http://112.124.100.131/GFRS/ebiz-h5.git
synced 2025-12-10 12:46:43 +08:00
feature: 白名单管理
1. 自助入司白名单校验
This commit is contained in:
@@ -79,19 +79,38 @@
|
||||
size="large"
|
||||
>提交</van-button
|
||||
>
|
||||
|
||||
<!-- 短信验证弹窗 -->
|
||||
<van-dialog v-model="isCaptchaModalShow" title="提示" show-cancel-button :before-close="onCaptchaConfirm" @cancel="onCaptchaCancel">
|
||||
<van-field v-model="code" type="number" :maxlength="6" center clearable label="短信验证码" placeholder="请输入短信验证码">
|
||||
<template #button>
|
||||
<van-button size="small" type="danger" :disabled="countDownNum !== 0" @click="getCaptcha">{{
|
||||
countDownNum === 0 ? '获取验证码' : countDownNum | countDownText
|
||||
}}</van-button>
|
||||
</template>
|
||||
</van-field>
|
||||
</van-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { Field, Icon, Button, Dialog } from 'vant'
|
||||
import { agreementQuery, signAgreement } from '@/api/ebiz/agentEenter/agentEenter.js'
|
||||
// import { weixinShare } from '@/assets/js/utils/wxShare.js'
|
||||
import { checkSignInvalid, getSignInvalid } from '@/api/ebiz/sale/sale'
|
||||
import { checkSignInvalid, getSignInvalid, getAuthCode, autchCodeCheck } from '@/api/ebiz/sale/sale'
|
||||
import { getWhitelist } from '@/api/ebiz/whitelist'
|
||||
import { filtSignList } from './js/methods'
|
||||
export default {
|
||||
data() {
|
||||
let isWeixin = this.$utils.device().isWeixin //判断环境
|
||||
return {
|
||||
// 人脸验证次数
|
||||
faceAuthCount: 0,
|
||||
isCaptchaModalShow: false,
|
||||
code: '',
|
||||
sid: '',
|
||||
countDownNum: 0,
|
||||
countDownTimer: null,
|
||||
authCode: '',
|
||||
// 是否在微信
|
||||
isWeixin,
|
||||
// 微信分享链接是否失效 false 为未失效 true为已失效
|
||||
@@ -99,9 +118,9 @@ export default {
|
||||
// 微信分享校验值
|
||||
signInvalid: '',
|
||||
agentInfo: {
|
||||
name: '皮伟',
|
||||
idNo: '422801199210070412',
|
||||
createdDate: '2019-09-21'
|
||||
name: '',
|
||||
idNo: '',
|
||||
createdDate: ''
|
||||
},
|
||||
referrerInfo: {
|
||||
orgLabel: ''
|
||||
@@ -117,14 +136,73 @@ export default {
|
||||
created() {
|
||||
this.init()
|
||||
},
|
||||
mounted() {
|
||||
document.body.style.backgroundColor = '#fff'
|
||||
},
|
||||
beforeRouteLeave(to, from, next) {
|
||||
document.body.style.backgroundColor = ''
|
||||
next()
|
||||
},
|
||||
methods: {
|
||||
async onCaptchaConfirm(action, done) {
|
||||
if (!this.sid) {
|
||||
done(false)
|
||||
return
|
||||
}
|
||||
if (!this.code.trim()) {
|
||||
done(false)
|
||||
return this.$toast('请输入验证码')
|
||||
}
|
||||
try {
|
||||
let res = await autchCodeCheck({
|
||||
smsId: this.sid,
|
||||
code: this.code
|
||||
})
|
||||
console.log(this.sid, this.code)
|
||||
if (res.result === '0') {
|
||||
this.goUrl(this.authCode)
|
||||
} else {
|
||||
this.$toast(res.resultMessage)
|
||||
}
|
||||
} catch (error) {
|
||||
this.$toast('网络异常')
|
||||
console.log(error)
|
||||
}
|
||||
this.onCaptchaCancel()
|
||||
done()
|
||||
},
|
||||
onCaptchaCancel() {
|
||||
this.isCaptchaModalShow = false
|
||||
clearInterval(this.countDownTimer)
|
||||
this.countDownTimer = null
|
||||
this.countDownNum = 0
|
||||
this.sid = ''
|
||||
this.code = ''
|
||||
},
|
||||
async getCaptcha() {
|
||||
let data = {
|
||||
operateType: 'appntInfoEntry',
|
||||
type: 'H5',
|
||||
operateCode: this.agentInfo.mobile,
|
||||
system: 'agentApp',
|
||||
operateCodeType: '0'
|
||||
}
|
||||
//获取验证码
|
||||
try {
|
||||
let res = await getAuthCode(data)
|
||||
console.log(res)
|
||||
if (res.result === '0') {
|
||||
this.$toast(res.resultMessage)
|
||||
this.sid = res.sessionId
|
||||
this.countDownNum = 60
|
||||
this.countDownTimer = setInterval(() => {
|
||||
this.countDownNum--
|
||||
if (this.countDownNum <= 0) {
|
||||
clearInterval(this.countDownTimer)
|
||||
this.countDownTimer = null
|
||||
}
|
||||
}, 1000)
|
||||
} else {
|
||||
this.$toast(res.resultMessage)
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
this.$toast('网络异常')
|
||||
}
|
||||
},
|
||||
//初始化信息
|
||||
async init() {
|
||||
if (this.isWeixin) {
|
||||
@@ -254,37 +332,80 @@ export default {
|
||||
})
|
||||
})
|
||||
},
|
||||
faceAuth(code) {
|
||||
let that = this
|
||||
async faceAuth(code) {
|
||||
this.authCode = code
|
||||
localStorage.idNo = this.agentInfo.idNo
|
||||
localStorage.idName = this.agentInfo.name
|
||||
if (code == '0') {
|
||||
if (that.agentInfo.idType == '1') {
|
||||
if (this.agentInfo.idType == '1') {
|
||||
// 人脸识别次数小于3次
|
||||
this.$toast.loading({
|
||||
duration: 0, // 持续展示 toast
|
||||
forbidClick: true, // 禁用背景点击
|
||||
loadingType: 'spinner',
|
||||
message: '加载中……'
|
||||
})
|
||||
// eslint-disable-next-line no-undef
|
||||
EWebBridge.webCallAppInJs('face_auth', {
|
||||
businessSource: '2', //业务来源:1-电投,2-入司,3-理赔,4-保全
|
||||
number: that.agentInfo.idNo, //身份证号码
|
||||
name: that.agentInfo.name //姓名
|
||||
}).then(data => {
|
||||
console.log(data)
|
||||
this.$toast.clear()
|
||||
if (JSON.parse(data).state == '1') {
|
||||
that.goUrl(code)
|
||||
}
|
||||
// 判断是否在白名单, 在白名单无需人脸
|
||||
const res = await getWhitelist({
|
||||
idNo: this.agentInfo.idNo,
|
||||
name: this.agentInfo.name,
|
||||
whiteType: 'enter_agent_face_show'
|
||||
})
|
||||
console.log(res.content)
|
||||
if (res.result === '0') {
|
||||
// 用户在白名单内
|
||||
if (res.content && res.content.length) {
|
||||
this.goUrl(code)
|
||||
}
|
||||
// 不再白名单内
|
||||
else {
|
||||
if (this.faceAuthCount < 3) {
|
||||
try {
|
||||
// eslint-disable-next-line no-undef
|
||||
// const authRes = await EWebBridge.webCallAppInJs('face_auth', {
|
||||
// businessSource: '2', //业务来源:1-电投,2-入司,3-理赔,4-保全
|
||||
// number: this.agentInfo.idNo, //身份证号码
|
||||
// name: this.agentInfo.name //姓名
|
||||
// })
|
||||
const authRes = await this.fakeFaceAuth(true)
|
||||
console.log(authRes)
|
||||
if (authRes.state == '1') {
|
||||
this.goUrl(code)
|
||||
} else {
|
||||
this.$toast('人脸识别失败')
|
||||
// 人脸验证失败更新faceAuthCount
|
||||
this.faceAuthCount++
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
}
|
||||
} else {
|
||||
this.isCaptchaModalShow = true
|
||||
}
|
||||
}
|
||||
} else {
|
||||
this.$toast(res.resultMessage)
|
||||
}
|
||||
} else {
|
||||
that.goUrl(code)
|
||||
this.goUrl(code)
|
||||
}
|
||||
} else {
|
||||
that.goUrl(code)
|
||||
this.goUrl(code)
|
||||
}
|
||||
},
|
||||
fakeFaceAuth(expect) {
|
||||
console.log('模拟调用人脸识别')
|
||||
return new Promise(function(resolve, reject) {
|
||||
setTimeout(() => {
|
||||
console.log('模拟人脸识别完成')
|
||||
if (expect) {
|
||||
resolve({ state: '0' })
|
||||
} else {
|
||||
reject({ state: '0' })
|
||||
}
|
||||
}, 2000)
|
||||
})
|
||||
},
|
||||
goUrl(code) {
|
||||
let path = ''
|
||||
if (code == '0') {
|
||||
@@ -341,11 +462,23 @@ export default {
|
||||
[Field.name]: Field,
|
||||
[Icon.name]: Icon,
|
||||
[Button.name]: Button
|
||||
},
|
||||
filters: {
|
||||
countDownText(val) {
|
||||
if (isNaN(parseFloat(val))) {
|
||||
return val
|
||||
} else {
|
||||
return `${val} s`
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
#app .van-cell:not(:last-child)::after {
|
||||
border: none;
|
||||
}
|
||||
.signContract-container {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user