From 691d51c09879a75285f1314cf5bec9da680d8c4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=88=90?= Date: Thu, 4 Dec 2025 14:47:10 +0800 Subject: [PATCH] 1 --- src/other_pages/ntrp-evaluate/index.tsx | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/src/other_pages/ntrp-evaluate/index.tsx b/src/other_pages/ntrp-evaluate/index.tsx index 7deef7c..acd3c06 100644 --- a/src/other_pages/ntrp-evaluate/index.tsx +++ b/src/other_pages/ntrp-evaluate/index.tsx @@ -112,18 +112,35 @@ function CommonGuideBar(props) { const { statusBarHeight, navBarHeight } = statusNavbarHeightInfo; // const userInfo = useUserInfo() + // 判断是否从分享链接进入:页面栈只有1个页面时,说明是从分享直接进入的 + const isFromShare = () => { + try { + const pages = (Taro as any).getCurrentPages(); + return pages && pages.length === 1; + } catch { + return false; + } + }; + function handleClose() { + // 如果是从分享链接进入,直接跳转首页 + if (isFromShare()) { + (Taro as any).redirectTo({ url: "/main_pages/index" }); + return; + } + + // 否则执行原来的逻辑(跳转球局或执行 onCancel) //TODO: 二次确认 if (confirm) { } try { console.log(onCancel, isOnCancelEmpty(onCancel)); if (isOnCancelEmpty(onCancel)) { - Taro.redirectTo({ url: "/main_pages/index" }); + (Taro as any).redirectTo({ url: "/main_pages/index" }); } onCancel(); } catch { - Taro.redirectTo({ url: "/main_pages/index" }); + (Taro as any).redirectTo({ url: "/main_pages/index" }); } }