Skip to content

Commit

Permalink
支持下单强制需要用户进行实名认证
Browse files Browse the repository at this point in the history
  • Loading branch information
gooking committed Nov 9, 2020
1 parent 1ecad85 commit 95ad16d
Show file tree
Hide file tree
Showing 4 changed files with 79 additions and 0 deletions.
54 changes: 54 additions & 0 deletions pages/idCheck/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
const WXAPI = require('apifm-wxapi')
Page({
data: {

},
onLoad: function (options) {

},
onShow: function () {

},
async submit() {
if (!this.data.name) {
wx.showToast({
title: '请输入姓名',
icon: 'none'
})
return
}
if (!this.data.idcard) {
wx.showToast({
title: '请输入身份证号码',
icon: 'none'
})
return
}
wx.showLoading({
title: '',
})
this.setData({
loading: true
})
const res = await WXAPI.idcardCheck(wx.getStorageSync('token'), this.data.name, this.data.idcard)
wx.hideLoading({
success: (res) => {},
})
this.setData({
loading: false
})
if (res.code != 0) {
wx.showToast({
title: res.msg,
icon: 'none'
})
return
}
wx.showToast({
title: '认证通过',
})
setTimeout(() => {
wx.navigateBack()
}, 1000);
},
})
3 changes: 3 additions & 0 deletions pages/idCheck/index.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"navigationBarTitleText": "实名认证"
}
18 changes: 18 additions & 0 deletions pages/idCheck/index.wxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<van-field
label="姓名"
size="large"
model:value="{{ name }}"
placeholder="请输入姓名"
required
/>
<van-field
label="身份证号码"
type="idcard"
size="large"
model:value="{{ idcard }}"
placeholder="请输入身份证号码"
required
/>
<view class="btn">
<van-button type="primary" block loading="{{loading}}" bind:click="submit">立即认证</van-button>
</view>
4 changes: 4 additions & 0 deletions pages/idCheck/index.wxss
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.btn {
width: 700rpx;
margin: 64rpx auto;
}

0 comments on commit 95ad16d

Please sign in to comment.