From 371b478e332265bcd86924425047a441072e6772 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E5=BF=A0=E6=9E=97?= <170083662@qq.com> Date: Sat, 11 Apr 2026 23:21:39 +0800 Subject: [PATCH] =?UTF-8?q?fix(passport):=20=E4=BC=98=E5=8C=96=E9=82=80?= =?UTF-8?q?=E8=AF=B7=E7=A0=81=E6=8E=A5=E5=8F=97=E5=A4=B1=E8=B4=A5=E7=9A=84?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E6=8F=90=E7=A4=BA=E5=92=8C=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 针对“用户不存在”、“用户创建失败”及“请先登录”提示,改为弹窗提示需登录 - 在弹窗中增加“去登录”按钮,点击后跳转到登录页面,并携带重定向token参数 - 其他错误仍使用原Toast提示方式展示错误信息 - 保留错误日志打印,便于排查异常情况 --- .workbuddy/expert-history.json | 2 +- src/passport/invite/index.tsx | 22 +++++++++++++++++++++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/.workbuddy/expert-history.json b/.workbuddy/expert-history.json index 64baa52..decac99 100644 --- a/.workbuddy/expert-history.json +++ b/.workbuddy/expert-history.json @@ -24,5 +24,5 @@ } ] }, - "lastUpdated": 1775909724804 + "lastUpdated": 1775910071224 } \ No newline at end of file diff --git a/src/passport/invite/index.tsx b/src/passport/invite/index.tsx index d4eaaba..6acb211 100644 --- a/src/passport/invite/index.tsx +++ b/src/passport/invite/index.tsx @@ -171,7 +171,27 @@ const InvitePage: React.FC = () => { }, 1500); } else { console.error('接受邀请失败:', res.data.message, 'code:', res.data.code); - Taro.showToast({ title: res.data.message || '加入失败', icon: 'none' }); + const errorMsg = res.data.message || ''; + + // 用户不存在,引导去登录注册 + if (errorMsg.includes('用户不存在') || errorMsg.includes('用户创建失败') || errorMsg.includes('请先登录')) { + Taro.showModal({ + title: '需要登录', + content: '您尚未注册,请先完成登录或注册后再加入应用', + confirmText: '去登录', + cancelText: '取消', + success: (modalRes) => { + if (modalRes.confirm) { + // 跳转到登录页面,携带token参数以便登录后返回 + Taro.navigateTo({ + url: `/passport/login/index?redirect=${encodeURIComponent('/passport/invite/index?token=' + token)}` + }); + } + } + }); + } else { + Taro.showToast({ title: errorMsg || '加入失败', icon: 'none' }); + } } } catch (err: any) { console.error('接受邀请异常:', err);