Files
RentWeAppFront/pages-biz/face/faceAuth.vue
2026-01-15 17:18:24 +08:00

134 lines
2.8 KiB
Vue
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<template>
<view class="container">
<view class="loading-content">
<view class="image-content">
<image :src="staticHost + '/public' + '/static/loading.svg'" class="image"></image>
</view>
<view class="loading-tect-content">
<text class="loading-text">加载中</text>
</view>
</view>
<view class="btn-content">
<text>如未成功跳转</text>
<text class="btn-click" bindtap="goFaceAuth">点击此处</text>
<text>手动跳转</text>
</view>
</view>
</template>
<script>
export default {
data() {
return {
bizToken: '',
redirectUrl: '',
goFaceDone: false // 是否已跳转至公证签做人脸
}
},
onLoad(e) {
console.log('---middle onLoad', e)
this.bizToken = e.bizToken || ''
this.redirectUrl = e.redirectUrl
? decodeURIComponent(e.redirectUrl)
: ''
this.goFaceAuth()
},
computed: {
staticHost() {
return this.$config.staticUrl
}
},
methods: {
goFaceAuth() {
const { bizToken } = this
// ⚠️ 只有微信小程序支持
// #ifdef MP-WEIXIN
wx.navigateToMiniProgram({
appId: 'wx1c9e1d0b916674dc', // 公证签小程序 APPID
path: `/pages-biz/face/faceAuth?bizToken=${bizToken}`,
success: () => {
this.goFaceDone = true
}
})
// #endif
}
},
onShow() {
console.log('---middle onShow')
const { goFaceDone, redirectUrl } = this
// 防止首次进入直接触发
if (!goFaceDone) return
// 重置状态
this.goFaceDone = false
// ⚠️ 微信小程序专有
// #ifdef MP-WEIXIN
if (!wx.getEnterOptionsSync) return
const options = wx.getEnterOptionsSync()
console.log('---options', options)
// scene === 1038从其他小程序返回
if (
options.scene === 1038 &&
options.referrerInfo &&
options.referrerInfo.extraData &&
options.referrerInfo.extraData.faceResult
) {
const pages = getCurrentPages()
const pre = pages[pages.length - 2]
// 调用上一个页面的 reloadPage 方法
if (pre && typeof pre.reloadPage === 'function') {
pre.reloadPage(
`${redirectUrl}&timeStamp=${Date.now()}`
)
wx.navigateBack({
delta: 1
})
}
}
// #endif
}
}
</script>
<style>
.container {
width: 100%;
height: 100%;
}
.loading-content {
text-align: center;
width: 100%;
}
.image {
width: 172rpx;
height: 186rpx;
}
.loading-tect-content {
font-size: 28rpx;
margin-top: 48rpx;
color: #333;
}
.btn-content {
font-size: 28rpx;
color: #333;
margin-top: 24rpx;
}
.btn-click {
color: #F34038;
}
</style>