upload project
This commit is contained in:
commit
06961cae04
422 changed files with 110626 additions and 0 deletions
42
subpackages/realname/faceid-webview.js
Normal file
42
subpackages/realname/faceid-webview.js
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
Page({
|
||||
data:{ url: '' },
|
||||
onLoad(options){
|
||||
if(options && options.url){
|
||||
try{
|
||||
const decoded = decodeURIComponent(options.url);
|
||||
this.setData({ url: decoded });
|
||||
}catch(e){
|
||||
this.setData({ url: options.url });
|
||||
}
|
||||
}
|
||||
else{
|
||||
// 如果没有URL,直接跳转到验证成功页面
|
||||
wx.redirectTo({
|
||||
url: '/subpackages/realname/verify-success'
|
||||
});
|
||||
}
|
||||
},
|
||||
// 监听网页传来的消息
|
||||
onWebViewMessage(e){
|
||||
console.log('收到网页消息:', e.detail.data);
|
||||
const data = e.detail.data || {};
|
||||
|
||||
// 检查是否是认证成功消息
|
||||
// 根据腾讯云 FaceID 的实际回调格式调整判断条件
|
||||
if(data.type === 'verify_success' || data.success === true || data.status === 'success' || data.verifySuccess){
|
||||
// 跳转到验证成功页面
|
||||
setTimeout(() => {
|
||||
wx.redirectTo({
|
||||
url: '/subpackages/realname/verify-success'
|
||||
});
|
||||
}, 500); // 延迟500ms确保网页消息处理完成
|
||||
}
|
||||
},
|
||||
// 页面显示时检查认证状态
|
||||
onShow(){
|
||||
// 如果认证已完成,可以直接跳转
|
||||
// 注意:实际逻辑可能需要根据腾讯云 FaceID 的回调方式调整
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue