From ad7833a3125b8cab016e0215ceea4aa2f33e2b57 Mon Sep 17 00:00:00 2001 From: xingyy <64720302+Concur-max@users.noreply.github.com> Date: Fri, 14 Mar 2025 09:44:36 +0800 Subject: [PATCH] =?UTF-8?q?refactor(collect-code):=20=E9=87=8D=E6=9E=84?= =?UTF-8?q?=E6=94=B6=E9=9B=86=E4=BA=8C=E7=BB=B4=E7=A0=81=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=E7=9A=84=E4=B8=AA=E4=BA=BA=E8=B5=84=E6=96=99=E5=92=8C=E5=8D=8F?= =?UTF-8?q?=E8=AE=AE=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 优化了个人资料页面的代码结构,增加了注释和函数封装 - 重构了协议页面的代码,提高了可读性和可维护性 - 添加了获取用户法大大认证信息的功能 - 完善了签署确认逻辑,支持特殊用户和普通用户的不同签署流程 - 优化了折叠面板和 PDF 查看的处理 --- .../signature/personal-Info/index.vue | 55 +++++-- .../collectCode/signature/protocol/index.vue | 139 ++++++++++++------ 2 files changed, 138 insertions(+), 56 deletions(-) diff --git a/app/pages/collectCode/signature/personal-Info/index.vue b/app/pages/collectCode/signature/personal-Info/index.vue index ccaa6dc..c9eaa05 100644 --- a/app/pages/collectCode/signature/personal-Info/index.vue +++ b/app/pages/collectCode/signature/personal-Info/index.vue @@ -26,6 +26,11 @@ const columns1 = ref([ {text: t('realAuth.passport'), value: 2}, {text: t('realAuth.other'), value: 3}, ]) + +/** + * 根据当前语言获取默认国家/地区信息 + * @returns {{zone: string, name: string}} 返回国家区号和名称 + */ const getDefaultCountry = () => { let defaultCode = 'CN' // 默认中国大陆 switch (locale.value) { @@ -53,11 +58,20 @@ const getDefaultCountry = () => { } } -const goCountryRegion=()=>{ +/** + * 跳转到国家/地区选择页面 + */ +const goCountryRegion = () => { router.push({ - path:'/countryRegion' + path: '/countryRegion' }) } + +/** + * 检查表单是否完整填写 + * @param {Object} obj - 要检查的表单对象 + * @returns {boolean} 是否完整 + */ function isFormComplete(obj) { for (const key in obj) { if (typeof obj[key] === 'object' && obj[key] !== null) { @@ -71,15 +85,25 @@ function isFormComplete(obj) { return true; } -const getData=async ()=>{ -const res=await offlineQrcode({ - qrUid:qrUid.value -}) - if (res.status===0){ - qrData.value=res.data +/** + * 获取线下二维码支付状态 + */ +const getData = async () => { + const res = await offlineQrcode({ + qrUid: qrUid.value + }) + if (res.status === 0) { + qrData.value = res.data } } -const initData= async ()=>{ + +/** + * 初始化页面数据 + * 1. 处理URL参数 + * 2. 检查支付状态(扫付款码场景) + * 3. 设置默认国家/地区信息 + */ +const initData = async () => { if (route.query.number){ number.value=Number(route.query.number) } @@ -101,7 +125,18 @@ const initData= async ()=>{ formData.value.countryCode=route.query.zone } } -const nextClick=async ()=>{ + +/** + * 处理下一步按钮点击 + * 场景1(number=1): 扫号牌进入 + * - 验证表单完整性 + * - 检查用户号牌是否存在 + * - 根据国家区号判断签署方式(国内用法大大,国外直接签字) + * + * 场景2(number=2): 扫付款码进入 + * - 验证必填信息(手机、区号、用户名) + */ +const nextClick = async () => { //扫号牌 if (number.value==1){ if (!isFormComplete(formData.value)){ diff --git a/app/pages/collectCode/signature/protocol/index.vue b/app/pages/collectCode/signature/protocol/index.vue index 4af944b..857d6e2 100644 --- a/app/pages/collectCode/signature/protocol/index.vue +++ b/app/pages/collectCode/signature/protocol/index.vue @@ -1,86 +1,132 @@ + {{ t('signature.tips.prePayment') }} + { {{ item.title }} +