From ef8c6d17056f90aa400c6b852b48049766295086 Mon Sep 17 00:00:00 2001
From: WindowBird <13870814+windows-bird@user.noreply.gitee.com>
Date: Thu, 11 Sep 2025 16:54:09 +0800
Subject: [PATCH] =?UTF-8?q?=E5=AE=9E=E5=90=8D=E9=A1=B5=E9=9D=A2-=E4=BC=98?=
=?UTF-8?q?=E5=8C=96=E5=88=B7=E6=96=B0=E5=AE=9E=E5=90=8D=E7=9A=84=E5=8A=9F?=
=?UTF-8?q?=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../realNameAuthentication.vue | 80 +++++++++++--------
1 file changed, 46 insertions(+), 34 deletions(-)
diff --git a/pages/realNameAuthentication/realNameAuthentication.vue b/pages/realNameAuthentication/realNameAuthentication.vue
index 587be4f..d2e4459 100644
--- a/pages/realNameAuthentication/realNameAuthentication.vue
+++ b/pages/realNameAuthentication/realNameAuthentication.vue
@@ -32,6 +32,7 @@
刷新实名状态
+
@@ -73,44 +74,55 @@ export default {
},
methods: {
toGetshuaxin() {
- uni.$uv.debounce(this.getshuaxin, 2000, true)
+ uni.$uv.debounce(this.getshuaxin, 500, true)
},
- // 刷新人脸识别是否成功
- getshuaxin() {
- refreshRealName().then(res => {
+
+ // 刷新人脸识别状态
+ async getshuaxin() {
+ try {
+ // 显示加载Toast(30秒超时自动隐藏)
+ this.$refs.toast.show({
+ type: 'loading',
+ message: '正在刷新实名信息...',
+ overlay: true,
+ duration: 30000,
+ })
+
+ const res = await refreshRealName()
+ this.$refs.toast.hide()
+
if (res.code === 200) {
- if (res.data.pass === true) {
- let realNameType = res.data.realNameType
- let infoId = res.data.infoId
- uni.showModal({
- title: '温馨提示',
- content: `人脸认证成功`,
- showCancel: false,
- success: function (res) {
- uni.navigateBack()
- },
- })
- } else {
- uni.showModal({
- title: '温馨提示',
- content: `人脸认证失败`,
- showCancel: false,
- success: function (res) {
- uni.navigateBack()
- },
- })
- }
+ this.handleRefreshSuccess(res.data)
} else {
- uni.showModal({
- title: '温馨提示',
- content: `人脸认证失败`,
- showCancel: false,
- success: function (res) {
- uni.navigateBack()
- },
- })
+ this.handleRefreshFail(res.msg || '人脸认证失败')
}
- })
+ } catch (error) {
+ this.$refs.toast.hide()
+ this.handleRefreshFail(error.message || '网络异常')
+ }
+ },
+
+ // 处理成功响应
+ handleRefreshSuccess(data) {
+ if (data.pass) {
+ uni.showModal({
+ title: '认证成功',
+ showCancel: false,
+ complete: () => uni.navigateBack(),
+ })
+ } else {
+ this.handleRefreshFail('人脸验证未通过')
+ }
+ },
+
+ // 统一处理失败
+ handleRefreshFail(message) {
+ // uni.showModal({
+ // title: '提示',
+ // content: message,
+ // showCancel: false,
+ // // complete: () => uni.navigateBack(),
+ // })
},
// 点击进行实名认证