Browse Source

feat(小程序/我的): 我的页面 登录调整

qq12rrr 3 months ago
parent
commit
3d566c32e6
2 changed files with 22 additions and 2 deletions
  1. 1 0
      src/app.tsx
  2. 21 2
      src/pages/user/mine/index.tsx

+ 1 - 0
src/app.tsx

@@ -36,6 +36,7 @@ const App = (props: PropsWithChildren<IAppProps>) => {
     return UserHelper.cacheTabMenu();
   });
   useDidShow((options: any) => {
+    console.log('11111111111111111111111', options)
     if (options.query?.source === "app" && options.query?.platform) {
       let jumpUrls = "";
 

+ 21 - 2
src/pages/user/mine/index.tsx

@@ -13,13 +13,21 @@ import useStore from "@/hooks/useRedux";
 import RouteUtil from "@/utils/routeUtil";
 import UserHelper from "@/helper/userHelper";
 import Button from "@/component/button";
-import { parseQueryParams, isOuterLink } from "@/utils/toolsUtil";
+import {
+  parseQueryParams,
+  isOuterLink,
+  replaceQueryParam,
+} from "@/utils/toolsUtil";
 import "./index.scss";
 import LoginBox from "../components/LoginBox";
+import StorageUtil, { EStorage } from "@/utils/storageUtil";
+
 interface IMineProps {}
 
 // @ts-ignore
 const Mine = (props: PropsWithChildren<IMineProps>) => {
+  const channelCode = StorageUtil.get(EStorage.channelCode) || "";
+
   const appContext = useContext(AppContext);
   // const { screenSize } = useContext(AppContext);
   const { statusBarHeight } = appContext.systemInfo!;
@@ -56,9 +64,20 @@ const Mine = (props: PropsWithChildren<IMineProps>) => {
   const loginFlowHandler = () => {
     UserHelper.UpdateOpenId();
     if (isOuterLink(indexInfoResult.data.link)) {
+      // 如果是外部链接,不用管
       postJumpUrlResult();
     } else {
-      RouteUtil.toWebViewPage({ url: indexInfoResult.data.link });
+      const jumpUrl = channelCode
+        ? replaceQueryParam(
+            indexInfoResult.data.link,
+            "channelCode",
+            channelCode
+          )
+        : indexInfoResult.data.link;
+
+      RouteUtil.toWebViewPage({
+        url: jumpUrl,
+      });
     }
   };