Commit b1e37d5b authored by liwei's avatar liwei

小程序端跳转的h5页面

parent 44e52da2
<!DOCTYPE HTML>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Title</title>
<!-- 引入该JS,全局注入getMetaInfo方法 -->
<script type="text/javascript" src="https://o.alicdn.com/yd-cloudauth/cloudauth-cdn/jsvm_all.js"></script>
</head>
<body>
<div>1111111</div>
<script>
// 获取当前页面的URL
const url = window.location.href;
// 创建一个新的URL对象
const urlObj = new URL(url);
// 使用URLSearchParams来获取参数
const params = new URLSearchParams(urlObj.search);
// 获取uniapp用户的token
var token = params.get('token'); // 替换'token'为实际参数名
console.log('Token:', token);
// 在调用实人认证服务端发起认证请求时需要传入该MetaInfo值
var MetaInfoChildren = window.getMetaInfo();
console.log('MetaInfo:',MetaInfo)
var MetaInfo = {
metaInfo: JSON.stringify(MetaInfoChildren),
}
console.log('JSON.stringify(MetaInfo):',JSON.stringify(MetaInfo))
// 请求认证业务接口获取CertifyUrl
fetch('http://localhost:8092/faceVerify/initFaceVerify', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer ' + token
},
body: JSON.stringify(MetaInfo)
})
.then(response => response.json())
.then(data => {
console.log('data:', data)
// 获取CertifyUrl后跳转至认证页面
window.location.href = data.resultObject.certifyUrl;
});
</script>
</body>
</html>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment