From 4cdc6e0308afa638d26376be6b4f73c080f92434 Mon Sep 17 00:00:00 2001 From: Mrx <18278715334@163.com> Date: Fri, 20 Mar 2026 13:08:22 +0800 Subject: [PATCH] f --- src/pages/certification/index.vue | 34 +++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/src/pages/certification/index.vue b/src/pages/certification/index.vue index 1a3fe32..2196a6d 100644 --- a/src/pages/certification/index.vue +++ b/src/pages/certification/index.vue @@ -224,6 +224,34 @@ const devCurrentStep = ref('enterprise_info') // 合同签署加载状态 const contractSignLoading = ref(false) +// 只补 enterprise_verify 所需 auth_url,不改动原有页面展示数据结构 +// 轮询策略:最多 5 秒,每秒 1 次(最多 5 次) +const pollAuthUrlOnly = async (maxTries = 5) => { + for (let i = 0; i < maxTries; i++) { + const res = await certificationApi.getCertificationDetails() + const status = res?.data?.status + const authUrl = res?.data?.metadata?.auth_url + + // 仅同步状态,避免覆盖已有展示字段 + if (status && certificationData.value) { + certificationData.value.status = status + await setCurrentStepByStatus() + } + + if (authUrl) { + // 保留原 metadata,仅更新链接字段 + stepMeta.value = { + ...(stepMeta.value || {}), + auth_url: authUrl, + } + return authUrl + } + + await new Promise((resolve) => setTimeout(resolve, 1000)) + } + return '' +} + // 事件处理:优先用提交接口返回的认证数据更新步骤,确保进入「人工审核」页,避免依赖二次请求 const handleEnterpriseSubmit = async (payload) => { try { @@ -238,8 +266,14 @@ const handleEnterpriseSubmit = async (payload) => { certificationData.value = payload.response.data stepMeta.value = payload.response.data?.metadata || {} await setCurrentStepByStatus() + if (currentStep.value === 'enterprise_verify' && !stepMeta.value?.auth_url) { + await pollAuthUrlOnly() + } } else { await getCertificationDetails() + if (currentStep.value === 'enterprise_verify' && !stepMeta.value?.auth_url) { + await pollAuthUrlOnly() + } } } catch (error) { ElMessage.error(error?.message || '获取认证状态失败,请刷新页面')