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" }); } }