61,129
社区成员




<block wx:if="{{isrenzheng===0}}">
<!-- 是否有必要把条件渲染写在组件里 -->
<view class="verify-container">
<mp-dialog mask-closable="{{flase}}" title="提示信息" show="{{dialogShow}}" bindbuttontap="_tapDialogButton"
buttons="{{buttons}}">
<view>{{textContent}}</view>
</mp-dialog>
<view class="flex-center-center shibie-text-icon">
<image src="{{iconString}}"></image>
<!-- <text class="icon icon-renlianshibie1"></text> -->
<text>请进行人脸识别登录</text>
</view>
<form catchsubmit="formSubmit">
<view class="page-body">
<view class="page-section">
<view class="weui-cells__title">姓名</view>
<view class="weui-cells weui-cells_after-title">
<view class="weui-cell weui-cell_input">
<input class="weui-input" name="username" maxlength="10" placeholder-style="color:#F76260"
placeholder="请输入姓名" />
</view>
</view>
</view>
<view class="page-section">
<view class="weui-cells__title">身份证</view>
<view class="weui-cells weui-cells_after-title">
<view class="weui-cell weui-cell_input">
<input class="weui-input" type="idcard" name="useridCard" maxlength="18" placeholder-style="color:#F76260"
placeholder="请输入身份证" />
</view>
</view>
</view>
</view>
<view class="btn-area">
<button disabled="{{disabled}}" type="primary" formType="submit" style="background:#2792ff">下一步</button>
</view>
</form>
</view>
</block>
<block wx:elif="{{isrenzheng===1}}">
<slot name="detail"></slot>
</block>
// components/verify/verify.js
var serv = require('../../libs/call-service.js');
const app = getApp();
Component({
options: {
multipleSlots: true
},
/**
* 组件的属性列表
*/
properties: {
// isrenzheng:{ type:String,value:""}
},
/**
* 组件的初始数据
*/
data: {
isrenzheng: app.globalData.isCert,
iconString: "",
dialogShow: true,
textContent: "本次操作需要您进行登录验证",
buttons: [{ text: '取消' }, { text: '确定' }],
disabled: false
},
/**
* 组件的方法列表
*/
methods: {
formSubmit(e) {
console.log(e)
console.log("用户的人脸识别是否通过" + app.globalData.isCert)
var _this = this
var username = e.detail.value.username
var useridcard = e.detail.value.useridCard
if (username == '' || useridcard == '') {
wx.showToast({
title: '请输入信息',
icon: "none"
})
return
} else {
console.log("跳转到人脸识页面")
var param = {
IdCard: useridcard,
Name: username,
openId: app.globalData.openerId,
isCert: 1
}
var _this = this
serv.get('byWxIntf/getBizToken.do', param, function (res) {
//console.log("getBizToken");
console.log(res.data);
var result = res.data;
//console.log("result:"+result);
console.log("url:" + result.Url);
console.log("BizToken:" + result.BizToken);
if (true) {
let BizToken = result.BizToken;
// 调用实名核身功能
wx.startVerify({
data: {
token: BizToken // BizToken
},
success: (res) => { // 验证成功后触发
// res 包含验证成功的token, 这里需要加500ms延时,防止iOS下不执行后面的逻辑
setTimeout(() => {
// 验证成功后,拿到token后的逻辑处理,具体以客户自身逻辑为准
console.info("----------yes-----------success!----")
wx.showModal({
title: "提示",
content: "恭喜你,验证成功!",
showCancel: false,
success(res) {
if (res.confirm) {
console.log('用户点击确定')
// _this.triggerEvent("formSubmit", { isrenzheng: 1 })
_this.setData({
isrenzheng: 1
})
}
}
})
serv.get('byWxIntf/updateWxUserIdent.do', param, function (res) {
console.log("updateWxUserIdent:" + res.data);
})
app.globalData.isCert = 1;
}, 500);
},
fail: (err) => { // 验证失败时触发
// err 包含错误码,错误信息,弹窗提示错误
setTimeout(() => {
wx.showModal({
title: "提示",
content: err.ErrorMsg,
showCancel: false
})
}, 500);
}
});
}
});
}
},
_tapDialogButton: function (e) {
// console.log(e)
var index = e.detail.index
if (index == 0) {
wx.navigateBack({//返回
delta: 1
})
}
this.setData({
dialogShow: false
})
},
}
})