|
@@ -4,9 +4,14 @@ import Button from "@/component/button";
|
|
|
import APPConfig from "@/config";
|
|
|
import UserHelper from "@/helper/userHelper";
|
|
|
import RouteUtil from "@/utils/routeUtil";
|
|
|
+import StorageUtil, { EStorage } from "@/utils/storageUtil";
|
|
|
import { Image, View, Text, Input } from "@tarojs/components";
|
|
|
import { useRequest } from "ahooks";
|
|
|
-import { parseQueryParams, isOuterLink } from "../../../utils/toolsUtil";
|
|
|
+import {
|
|
|
+ parseQueryParams,
|
|
|
+ isOuterLink,
|
|
|
+ replaceQueryParam,
|
|
|
+} from "../../../utils/toolsUtil";
|
|
|
import { useState, useEffect, useImperativeHandle, forwardRef } from "react";
|
|
|
import { AtFloatLayout } from "taro-ui";
|
|
|
import { showToast } from "@tarojs/taro";
|
|
@@ -14,6 +19,8 @@ import ctyptoUtil from "@/utils/crypto";
|
|
|
|
|
|
// @ts-ignore
|
|
|
const LoginBox = forwardRef((props, ref) => {
|
|
|
+ const channelCode = StorageUtil.get(EStorage.channelCode) || "";
|
|
|
+
|
|
|
useImperativeHandle(ref, () => ({
|
|
|
handleOpen() {
|
|
|
handleOpen();
|
|
@@ -44,9 +51,20 @@ const LoginBox = forwardRef((props, ref) => {
|
|
|
const loginFlowHandler = async () => {
|
|
|
await UserHelper.UpdateOpenId();
|
|
|
if (isOuterLink(indexInfoResult?.data.link)) {
|
|
|
+ // 如果是外部链接,不用管
|
|
|
await postJumpUrlResult();
|
|
|
} else {
|
|
|
- await RouteUtil.toWebViewPage({ url: indexInfoResult?.data.link });
|
|
|
+ const jumpUrl = channelCode
|
|
|
+ ? replaceQueryParam(
|
|
|
+ indexInfoResult.data.link,
|
|
|
+ "channelCode",
|
|
|
+ channelCode
|
|
|
+ )
|
|
|
+ : indexInfoResult.data.link;
|
|
|
+
|
|
|
+ RouteUtil.toWebViewPage({
|
|
|
+ url: jumpUrl,
|
|
|
+ });
|
|
|
}
|
|
|
};
|
|
|
|