Initial commit
This commit is contained in:
87
pages/face/index.vue
Normal file
87
pages/face/index.vue
Normal file
@@ -0,0 +1,87 @@
|
||||
<template>
|
||||
<view class="container">
|
||||
<!-- 唤起上链公证签刷脸小程序提示文本 -->
|
||||
<view class="btn-content">
|
||||
<text>中间页唤起上链公证签刷脸小程序</text>
|
||||
<!-- 点击按钮跳转刷脸小程序 -->
|
||||
<button type="default" @click="goFaceAuth()">若未自动唤起,手动点击跳转刷脸小程序</button>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
bizToken: "", // 公证签业务 token
|
||||
redirectUrl: "", // 重定向地址
|
||||
goFaceDone: "" // 是否已自动跳转至公证签做人脸
|
||||
};
|
||||
},
|
||||
onLoad: function(option) {
|
||||
// 设置 bizToken 和 redirectUrl
|
||||
this.bizToken = option.bizToken;
|
||||
this.redirectUrl = option.redirectUrl;
|
||||
this.goFaceDone=false
|
||||
console.log('onLoad----this.goFaceDone',this.goFaceDone)
|
||||
},
|
||||
onShow: function(option) {
|
||||
console.log('this.goFaceDone',this.goFaceDone)
|
||||
|
||||
// 自动请求跳转刷脸小程序
|
||||
if (!this.goFaceDone) {
|
||||
this.goFaceAuth()
|
||||
return
|
||||
}
|
||||
|
||||
// 从公证签小程序返回判断刷脸结果
|
||||
const options = uni.getEnterOptionsSync();
|
||||
console.log('---options', options);
|
||||
if (
|
||||
options.scene === 1038 &&
|
||||
options.referrerInfo.extraData &&
|
||||
options.referrerInfo.extraData.faceResult
|
||||
) {
|
||||
// 刷脸成功跳转签署页面,并携带重定向地址
|
||||
uni.redirectTo({
|
||||
url: `/pages/webview/index?url=${this.redirectUrl}&type=face`,
|
||||
success: () => {},
|
||||
fail: (err) => {
|
||||
console.log('Failed to navigate back:', err);
|
||||
},
|
||||
});
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// 跳转刷脸小程序方法
|
||||
goFaceAuth() {
|
||||
this.goFaceDone = true;
|
||||
uni.navigateToMiniProgram({
|
||||
appId: 'wx1cf2708c2de46337',
|
||||
path: 'pages/face/index?bizToken=' + this.bizToken,
|
||||
success: (res) => {
|
||||
// 打开成功
|
||||
console.log('跳转成功,this.goFaceDone', this.goFaceDone);
|
||||
},
|
||||
fail(res) {
|
||||
// 打开失败
|
||||
console.log(res);
|
||||
},
|
||||
});
|
||||
},
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.container {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
height: 100vh; /* 可以根据实际需求设置容器高度 */
|
||||
}
|
||||
|
||||
.btn-content {
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user