白名单+短信

This commit is contained in:
mengxiaolong
2020-12-10 11:56:59 +08:00
parent f4c17d6e63
commit 5dee06bdb8
3 changed files with 112 additions and 23 deletions

View File

@@ -9,17 +9,36 @@
</div>
<div class="bg-white bottom-btn"><van-button type="danger" size="large" @click="nextStep" v-no-more-click="2000">客户确认</van-button></div>
<!-- 短信验证弹窗 -->
<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 utilsAge from '@/assets/js/utils/age'
import { getAuthCode, autchCodeCheck } from '@/api/ebiz/sale/sale'
import { getWhitelist } from '@/api/ebiz/whitelist'
export default {
name: 'HandleResult',
data() {
return {
// 人脸验证次数
faceAuthCount: 0,
isCaptchaModalShow: false,
code: '',
sid: '',
countDownNum: 0,
countDownTimer: null,
path: '', //页面跳转路径
srcSuccess: this.$assetsUrl + 'images/success.png',
entry: '',
@@ -66,6 +85,72 @@ export default {
document.getElementsByTagName('body')[0].classList.remove('bg-white')
},
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.jumpNextPage(this.path)
} 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('网络异常')
}
},
nextStep() {
if (this.entry != 'BC') {
// 如果 保全项不是 受益人变更、则 在证件类型为身份证时 直接接入人脸识别
@@ -136,20 +221,25 @@ export default {
} else {
this.$toast(res.resultMessage)
}
// eslint-disable-next-line no-undef
EWebBridge.webCallAppInJs('face_auth', config)
// 跳过人脸识别
// new Promise(resolve => {
// console.log('--跳过人脸识别--返回识别成功')
// resolve(JSON.stringify({ state: '1' }))
.then(data => {
if (JSON.parse(data).state == '1') {
this.jumpNextPage(this.path)
} else {
// eslint-disable-next-line no-undef
EWebBridge.webCallAppInJs('webview_toast', '人脸检测失败')
}
})
if (this.faceAuthCount < 3) {
// eslint-disable-next-line no-undef
EWebBridge.webCallAppInJs('face_auth', config)
// 跳过人脸识别
// new Promise(resolve => {
// console.log('--跳过人脸识别--返回识别成功')
// resolve(JSON.stringify({ state: '1' }))
.then(data => {
if (JSON.parse(data).state == '1') {
this.jumpNextPage(this.path)
} else {
// eslint-disable-next-line no-undef
EWebBridge.webCallAppInJs('webview_toast', '人脸检测失败')
this.faceAuthCount++
}
})
} else {
this.isCaptchaModalShow = true
}
}
}
}