|
@@ -32,6 +32,9 @@
|
|
<!-- #ifdef MP-ALIPAY -->
|
|
<!-- #ifdef MP-ALIPAY -->
|
|
<!-- 支付宝在上传完身份证照片后会跳转到人脸检测页面 -->
|
|
<!-- 支付宝在上传完身份证照片后会跳转到人脸检测页面 -->
|
|
<view class="step-one" v-else-if="step==='uploadCard' && !shootCard">
|
|
<view class="step-one" v-else-if="step==='uploadCard' && !shootCard">
|
|
|
|
+ <view class="tips" v-if="!name">
|
|
|
|
+ <u-text align="center" color="#333333" text="根据《治安管理处罚法》要求所有入住宾客和访客必须一人一证实名登记"></u-text>
|
|
|
|
+ </view>
|
|
<view class="upload-container">
|
|
<view class="upload-container">
|
|
<image :src="idCardFrontPicPath" mode="aspectFit" @click="handleUploadFront" :style="imageStyle">
|
|
<image :src="idCardFrontPicPath" mode="aspectFit" @click="handleUploadFront" :style="imageStyle">
|
|
</image>
|
|
</image>
|
|
@@ -47,7 +50,7 @@
|
|
@close="handleSheetClose" />
|
|
@close="handleSheetClose" />
|
|
</view>
|
|
</view>
|
|
<view class="shoot-id-card" v-if="shootCard">
|
|
<view class="shoot-id-card" v-if="shootCard">
|
|
- <camera id="card-camera" flash="off" device-position="back" @ready="cameraContext" :style="[cameraStyle]" />
|
|
|
|
|
|
+ <camera id="card-camera" flash="off" device-position="back" @ready="cameraContext" :style="[cardCameraStyle]" />
|
|
<cover-image :src="frontSelect ? '/static/identity_info.png' : '/static/national_emblem.png'"
|
|
<cover-image :src="frontSelect ? '/static/identity_info.png' : '/static/national_emblem.png'"
|
|
:style="[cardCameraStyle]"></cover-image>
|
|
:style="[cardCameraStyle]"></cover-image>
|
|
<view class="camera-btn">
|
|
<view class="camera-btn">
|
|
@@ -299,12 +302,12 @@
|
|
margin: "0 auto"
|
|
margin: "0 auto"
|
|
},
|
|
},
|
|
frontPassed: false,
|
|
frontPassed: false,
|
|
|
|
+ idCardFrontBase64: null,
|
|
|
|
+ idCardBackBase64: null,
|
|
backPassed: false,
|
|
backPassed: false,
|
|
checkPicTips: "身份核验中....",
|
|
checkPicTips: "身份核验中....",
|
|
screenWidth: 0,
|
|
screenWidth: 0,
|
|
- navBarHight: 0,
|
|
|
|
- faceAreaLineHeight: 0,
|
|
|
|
- faceAreaTipsHeight: 0,
|
|
|
|
|
|
+ faceCheckCamTopGap: 0,
|
|
showTips: true,
|
|
showTips: true,
|
|
isCheckingFace: false,
|
|
isCheckingFace: false,
|
|
faceCheckSucceed: false,
|
|
faceCheckSucceed: false,
|
|
@@ -349,13 +352,7 @@
|
|
style.width = imgWidth + 'px'
|
|
style.width = imgWidth + 'px'
|
|
style.height = imgWidth + 'px'
|
|
style.height = imgWidth + 'px'
|
|
style.left = "16px"
|
|
style.left = "16px"
|
|
- let top = 0
|
|
|
|
- if (this.faceAreaTipsHeight && this.faceAreaLineHeight && this.navBarHight) {
|
|
|
|
- top = this.faceAreaTipsHeight + this.faceAreaLineHeight + this.navBarHight + 2
|
|
|
|
- // console.log("顶部距离", top);
|
|
|
|
- }
|
|
|
|
- // console.log("computed");
|
|
|
|
- style.top = top + "px"
|
|
|
|
|
|
+ style.top = this.faceCheckCamTopGap + "px"
|
|
return style
|
|
return style
|
|
}
|
|
}
|
|
// #endif
|
|
// #endif
|
|
@@ -911,7 +908,7 @@
|
|
method: "POST",
|
|
method: "POST",
|
|
data: ocrData
|
|
data: ocrData
|
|
})
|
|
})
|
|
- console.log("ocrRes", ocrRes);
|
|
|
|
|
|
+ // console.log("ocrRes", ocrRes);
|
|
if (!ocrRes.success) {
|
|
if (!ocrRes.success) {
|
|
uni.showModal({
|
|
uni.showModal({
|
|
content: '身份证信息识别失败,请重新选择照片或拍照上传。',
|
|
content: '身份证信息识别失败,请重新选择照片或拍照上传。',
|
|
@@ -953,11 +950,13 @@
|
|
this.idCardInfoInPage.birth = data.birth
|
|
this.idCardInfoInPage.birth = data.birth
|
|
this.idCardInfoInPage.address = data.address
|
|
this.idCardInfoInPage.address = data.address
|
|
this.idCardInfoInPage.idNumber = data.cardNum
|
|
this.idCardInfoInPage.idNumber = data.cardNum
|
|
|
|
+ this.idCardFrontBase64 = imgBase64
|
|
this.frontPassed = true
|
|
this.frontPassed = true
|
|
} else if (_ocrType === ocrType.emblem) {
|
|
} else if (_ocrType === ocrType.emblem) {
|
|
this.idCardInfoInPage.issuingAuthority = data.issuingAuthority
|
|
this.idCardInfoInPage.issuingAuthority = data.issuingAuthority
|
|
this.idCardInfoInPage.issuingDate = data.issuingDate
|
|
this.idCardInfoInPage.issuingDate = data.issuingDate
|
|
this.idCardInfoInPage.expiryDate = data.expiryDate
|
|
this.idCardInfoInPage.expiryDate = data.expiryDate
|
|
|
|
+ this.idCardBackBase64 = imgBase64
|
|
this.backPassed = true
|
|
this.backPassed = true
|
|
}
|
|
}
|
|
my.hideLoading()
|
|
my.hideLoading()
|
|
@@ -990,13 +989,14 @@
|
|
this.showTips = false
|
|
this.showTips = false
|
|
this.isCheckingFace = true
|
|
this.isCheckingFace = true
|
|
|
|
|
|
|
|
+ let succeedImgBase64
|
|
while (!this.faceCheckSucceed) {
|
|
while (!this.faceCheckSucceed) {
|
|
- // console.log("开始takePhoto进行人脸检测");
|
|
|
|
|
|
+ // console.log("开始takePhoto进行人脸检测", this.faceCheckCam);
|
|
|
|
|
|
const photo = await this.faceCheckCam.takePhoto({
|
|
const photo = await this.faceCheckCam.takePhoto({
|
|
quality: 'normal',
|
|
quality: 'normal',
|
|
})
|
|
})
|
|
- // console.log("完成takePhoto", this.photo.tempImagePath);
|
|
|
|
|
|
+ // console.log("完成takePhoto", photo.tempImagePath);
|
|
const { data: photoBase64 } = await this.fileSystem.readFile({
|
|
const { data: photoBase64 } = await this.fileSystem.readFile({
|
|
filePath: photo.tempImagePath,
|
|
filePath: photo.tempImagePath,
|
|
encoding: "base64"
|
|
encoding: "base64"
|
|
@@ -1012,12 +1012,13 @@
|
|
// console.log("checkPicRes.data", checkPicRes.data.msg.split("原因:")[1]);
|
|
// console.log("checkPicRes.data", checkPicRes.data.msg.split("原因:")[1]);
|
|
this.checkPicTips = checkPicRes.data.msg.split("原因:")[1] + "请将面部完整放入拍摄区域。"
|
|
this.checkPicTips = checkPicRes.data.msg.split("原因:")[1] + "请将面部完整放入拍摄区域。"
|
|
} else {
|
|
} else {
|
|
|
|
+ succeedImgBase64 = photoBase64
|
|
this.faceCheckSucceed = checkPicRes.data.success
|
|
this.faceCheckSucceed = checkPicRes.data.success
|
|
}
|
|
}
|
|
setTimeout(() => {}, 100)
|
|
setTimeout(() => {}, 100)
|
|
}
|
|
}
|
|
// 进行云极人证比对
|
|
// 进行云极人证比对
|
|
- await this.afterSuccessCheckPicAlipay(photoBase64)
|
|
|
|
|
|
+ await this.afterSuccessCheckPicAlipay(succeedImgBase64)
|
|
},
|
|
},
|
|
async afterSuccessCheckPicAlipay(photoBase64) {
|
|
async afterSuccessCheckPicAlipay(photoBase64) {
|
|
if (this.userInfo.skipIdMatching === true) {
|
|
if (this.userInfo.skipIdMatching === true) {
|
|
@@ -1070,43 +1071,42 @@
|
|
title: '正在身份核验,请稍后',
|
|
title: '正在身份核验,请稍后',
|
|
});
|
|
});
|
|
let yunjiFaceCheckInfo = {
|
|
let yunjiFaceCheckInfo = {
|
|
- idNo: that.idNumber,
|
|
|
|
- name: that.name,
|
|
|
|
- image: mybase64,
|
|
|
|
|
|
+ idNo: this.idNumber,
|
|
|
|
+ name: this.name,
|
|
|
|
+ image: photoBase64,
|
|
};
|
|
};
|
|
let checkRes = await uni.$http.post(
|
|
let checkRes = await uni.$http.post(
|
|
'/faceVerification/yunjiVerification',
|
|
'/faceVerification/yunjiVerification',
|
|
yunjiFaceCheckInfo
|
|
yunjiFaceCheckInfo
|
|
);
|
|
);
|
|
|
|
|
|
- if (checkRes.data.success === true) {
|
|
|
|
|
|
+ if (checkRes.data.success) {
|
|
let infoFromIdCard = {}
|
|
let infoFromIdCard = {}
|
|
- that.infoList.forEach(info => {
|
|
|
|
- infoFromIdCard[info] = that.idCardInfoInPage[info]
|
|
|
|
|
|
+ this.infoList.forEach(info => {
|
|
|
|
+ infoFromIdCard[info] = this.idCardInfoInPage[info]
|
|
})
|
|
})
|
|
let currentCheckinInfo = {
|
|
let currentCheckinInfo = {
|
|
- name: that.name,
|
|
|
|
- idNumber: that.idNumber,
|
|
|
|
- faceData: mybase64,
|
|
|
|
- phone: that.phone,
|
|
|
|
|
|
+ name: this.name,
|
|
|
|
+ idNumber: this.idNumber,
|
|
|
|
+ faceData: photoBase64,
|
|
|
|
+ phone: this.phone,
|
|
...infoFromIdCard
|
|
...infoFromIdCard
|
|
}
|
|
}
|
|
//更新local storage 中的入住信息
|
|
//更新local storage 中的入住信息
|
|
- let checkinInfoToUpdate = that.checkinInfo
|
|
|
|
|
|
+ let checkinInfoToUpdate = this.checkinInfo
|
|
checkinInfoToUpdate.push(currentCheckinInfo)
|
|
checkinInfoToUpdate.push(currentCheckinInfo)
|
|
- that.updateCheckinInfo(checkinInfoToUpdate)
|
|
|
|
|
|
+ this.updateCheckinInfo(checkinInfoToUpdate)
|
|
//更新local storage 中的身份证信息
|
|
//更新local storage 中的身份证信息
|
|
- let idCardInfoToUpdate = that.idCardInfo
|
|
|
|
- idCardInfoToUpdate.push(that.idCardInfoInPage)
|
|
|
|
- that.updateIdCardInfo(idCardInfoToUpdate)
|
|
|
|
|
|
+ let idCardInfoToUpdate = this.idCardInfo
|
|
|
|
+ idCardInfoToUpdate.push(this.idCardInfoInPage)
|
|
|
|
+ this.updateIdCardInfo(idCardInfoToUpdate)
|
|
//如果上传过照片则更新服务器中的身份证信息
|
|
//如果上传过照片则更新服务器中的身份证信息
|
|
- if (that.idCardFrontDetectInfo.detected && that.idCardBackDetectInfo
|
|
|
|
- .detected) {
|
|
|
|
|
|
+ if (this.frontPassed && this.backPassed) {
|
|
uni.$http.post('/idCardInfo', {
|
|
uni.$http.post('/idCardInfo', {
|
|
- ...that.idCardInfoInPage,
|
|
|
|
- birthday: that.idCardInfoInPage.birth,
|
|
|
|
- idCardFrontBase64: that.idCardFrontPicPath.split(',')[1],
|
|
|
|
- idCardBackBase64: that.idCardBackPicPath.split(',')[1]
|
|
|
|
|
|
+ ...this.idCardInfoInPage,
|
|
|
|
+ birthday: this.idCardInfoInPage.birth,
|
|
|
|
+ idCardFrontBase64: this.idCardFrontBase64,
|
|
|
|
+ idCardBackBase64: this.idCardBackBase64
|
|
})
|
|
})
|
|
}
|
|
}
|
|
if (this.isMainCustomer) {
|
|
if (this.isMainCustomer) {
|
|
@@ -1131,16 +1131,8 @@
|
|
}), 1000)
|
|
}), 1000)
|
|
} else {
|
|
} else {
|
|
uni.hideLoading()
|
|
uni.hideLoading()
|
|
- uni.showModal({
|
|
|
|
- content: '身份核验失败,请重试',
|
|
|
|
- showCancel: false,
|
|
|
|
- success: function(res) {
|
|
|
|
- if (res.confirm) {
|
|
|
|
- console.log('用户点击确定');
|
|
|
|
- that.initData();
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
- });
|
|
|
|
|
|
+ this.isCheckingFace = false
|
|
|
|
+ this.checkPicTips = "身份核验失败,请重新进行"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
},
|
|
@@ -1554,7 +1546,10 @@
|
|
const menuButton = await uni.getMenuButtonBoundingClientRect()
|
|
const menuButton = await uni.getMenuButtonBoundingClientRect()
|
|
// 身份证拍照相机top距navBar底部10px
|
|
// 身份证拍照相机top距navBar底部10px
|
|
this.cardCamTopGap = menuButton.top + menuButton.height + 8 + 10
|
|
this.cardCamTopGap = menuButton.top + menuButton.height + 8 + 10
|
|
- this.navBarHight = menuButton.top + menuButton.height + 8
|
|
|
|
|
|
+
|
|
|
|
+ const factor = this.screenWidth / 750
|
|
|
|
+ const tipsHight = 106 * factor
|
|
|
|
+ this.faceCheckCamTopGap = menuButton.top + menuButton.height + 8 + tipsHight
|
|
|
|
|
|
this.fileSystem = my.getFileSystemManager();
|
|
this.fileSystem = my.getFileSystemManager();
|
|
// #endif
|
|
// #endif
|
|
@@ -1575,17 +1570,6 @@
|
|
}
|
|
}
|
|
},
|
|
},
|
|
// #endif
|
|
// #endif
|
|
-
|
|
|
|
- // #ifdef MP-ALIPAY
|
|
|
|
- async beforeMount() {
|
|
|
|
- let faceAreaTipsSize = await uni.$u.getRect('.face-area--tips')
|
|
|
|
- // console.log("faceAreaTipsSize", faceAreaTipsSize);
|
|
|
|
- this.faceAreaTipsHeight = faceAreaTipsSize.height
|
|
|
|
- let faceAreaLineSize = await uni.$u.getRect('.face-area--line')
|
|
|
|
- this.faceAreaLineHeight = faceAreaLineSize.height
|
|
|
|
- // console.log("faceAreaLineSize", faceAreaLineSize);
|
|
|
|
- }
|
|
|
|
- // #endif
|
|
|
|
}
|
|
}
|
|
</script>
|
|
</script>
|
|
|
|
|
|
@@ -1669,7 +1653,14 @@
|
|
}
|
|
}
|
|
|
|
|
|
.step-two {
|
|
.step-two {
|
|
|
|
+ display: flex;
|
|
|
|
+ flex-direction: column;
|
|
|
|
+ width: 100%;
|
|
|
|
+ height: 100%;
|
|
|
|
+
|
|
.face-area {
|
|
.face-area {
|
|
|
|
+ display: flex;
|
|
|
|
+ flex-direction: column;
|
|
background-color: #FFFFFF;
|
|
background-color: #FFFFFF;
|
|
border-radius: 50rpx;
|
|
border-radius: 50rpx;
|
|
overflow: hidden;
|
|
overflow: hidden;
|
|
@@ -1677,6 +1668,7 @@
|
|
.face-area--tips {
|
|
.face-area--tips {
|
|
display: flex;
|
|
display: flex;
|
|
padding: 10rpx 20rpx;
|
|
padding: 10rpx 20rpx;
|
|
|
|
+ height: 60rpx;
|
|
align-items: flex-end;
|
|
align-items: flex-end;
|
|
|
|
|
|
.face-area--tips--title {
|
|
.face-area--tips--title {
|
|
@@ -1695,6 +1687,7 @@
|
|
border-bottom: solid 6rpx #9e97c3;
|
|
border-bottom: solid 6rpx #9e97c3;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ // #ifdef MP-WEIXIN
|
|
.camera-container {
|
|
.camera-container {
|
|
width: 80%;
|
|
width: 80%;
|
|
height: 80vw;
|
|
height: 80vw;
|
|
@@ -1711,7 +1704,32 @@
|
|
// box-sizing: border-box;
|
|
// box-sizing: border-box;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ // #endif
|
|
|
|
+
|
|
|
|
+ // #ifdef MP-ALIPAY
|
|
|
|
+ .camera-container {
|
|
|
|
+ width: 100%;
|
|
|
|
+ display: flex;
|
|
|
|
+ align-items: center;
|
|
|
|
+ justify-content: center;
|
|
|
|
+ padding-bottom: 30rpx;
|
|
|
|
+
|
|
|
|
+ cover-image {
|
|
|
|
+ margin: 0;
|
|
|
|
+ padding: 0;
|
|
|
|
+ position: absolute;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
|
|
|
|
+ .check-pic-result {
|
|
|
|
+ width: 100%;
|
|
|
|
+ padding: 10rpx 20rpx;
|
|
|
|
+ display: flex;
|
|
|
|
+ justify-content: center;
|
|
|
|
+ box-sizing: border-box;
|
|
|
|
+ color: red;
|
|
|
|
+ }
|
|
|
|
+ // #endif
|
|
}
|
|
}
|
|
|
|
|
|
.precautions {
|
|
.precautions {
|
|
@@ -1766,6 +1784,12 @@
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ // #ifdef MP-ALIPAY
|
|
|
|
+ .btn {
|
|
|
|
+ margin: 20rpx;
|
|
|
|
+ }
|
|
|
|
+ // #endif
|
|
}
|
|
}
|
|
|
|
|
|
// #ifdef MP-ALIPAY
|
|
// #ifdef MP-ALIPAY
|