Commit 6a9ab059 authored by liwei's avatar liwei

修改了实名认证页面,修改了处理逻辑

parent cf6a4c7e
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
<title>实名认证</title> <title>实名认证</title>
<!-- 引入该JS,全局注入getMetaInfo方法 --> <!-- 引入该JS,全局注入getMetaInfo方法 -->
<script type="text/javascript" src="https://o.alicdn.com/yd-cloudauth/cloudauth-cdn/jsvm_all.js"></script> <script type="text/javascript" src="https://o.alicdn.com/yd-cloudauth/cloudauth-cdn/jsvm_all.js"></script>
<script type="text/javascript" src="https://res.wx.qq.com/open/js/jweixin-1.3.2.js"></script>
<style> <style>
body { body {
-webkit-box-sizing: border-box; -webkit-box-sizing: border-box;
...@@ -74,7 +75,7 @@ ...@@ -74,7 +75,7 @@
} }
console.log('JSON.stringify(MetaInfo):',JSON.stringify(MetaInfo)) console.log('JSON.stringify(MetaInfo):',JSON.stringify(MetaInfo))
// 请求认证业务接口获取CertifyUrl // 请求认证业务接口获取CertifyUrl
fetch('http://106.3.97.198:20162/faceVerify/initFaceVerify', { fetch('http://192.168.1.7:8092/faceVerify/initFaceVerify', {
method: 'POST', method: 'POST',
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',
...@@ -85,15 +86,18 @@ ...@@ -85,15 +86,18 @@
.then(response => response.json()) .then(response => response.json())
.then(data => { .then(data => {
// 获取CertifyUrl后跳转至认证页面 // 获取CertifyUrl后跳转至认证页面
window.location.href = data.data.certifyUrl; console.log('data:',data)
}).catch(error => { if (data.code == 200){
console.error('Error:', error); window.location.href = data.data.certifyUrl;
// 遇到错误时隐藏加载指示器 } else if (data.code == null || data.code == 'null'){
document.getElementById('loading-spinner').style.display = 'none'; //向小程序发送信息
// 可选:显示错误信息给用户 wx.miniProgram.postMessage({ data: data.message })
document.getElementById('loading-message').innerText = '发生错误,请刷新页面重试。'; //回退页面 不能使用别的 否则会有问题
document.getElementById('loading-message').style.color = 'red'; wx.miniProgram.navigateBack({
}); delta: 1
})
}
})
</script> </script>
</body> </body>
</html> </html>
...@@ -74,7 +74,7 @@ ...@@ -74,7 +74,7 @@
certifyId: certifyId certifyId: certifyId
} }
// 携带CertifyId // 携带CertifyId
fetch('http://106.3.97.198:20162/faceVerify/describeFaceVerify', { fetch('http://192.168.1.7:8092/faceVerify/describeFaceVerify', {
method: 'POST', method: 'POST',
headers: { headers: {
'Content-Type': 'application/json' 'Content-Type': 'application/json'
...@@ -82,22 +82,33 @@ ...@@ -82,22 +82,33 @@
body: JSON.stringify(data) body: JSON.stringify(data)
}) })
.then(response => { .then(response => {
console.log('res', response)
return response.json() return response.json()
}) })
.then(data => { .then(data => {
console.log('data', data) console.log('data', data)
wx.miniProgram.switchTab({ if (data.code == 200){
url: '/pages/tab/my' //进行认证了
}) if (data.data.passed === 'T'){
}).catch(error => { //认证通过
console.error('Error:', error); wx.miniProgram.postMessage({ data: 'T' })
// 遇到错误时隐藏加载指示器 wx.miniProgram.navigateBack({
document.getElementById('loading-spinner').style.display = 'none'; delta: 3
// 可选:显示错误信息给用户 })
document.getElementById('loading-message').innerText = '发生错误,请刷新页面重试。'; } else if (data.data.passed === 'F'){
document.getElementById('loading-message').style.color = 'red'; //认证未通过
}); wx.miniProgram.postMessage({ data: '人脸识别错误,请重新认证' })
//回退页面 不能使用别的 否则会有问题
wx.miniProgram.navigateBack({
delta: 1
})
}
} else {
//未进行认证
wx.miniProgram.navigateBack({
delta: 1
})
}
})
</script> </script>
</body> </body>
......
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