year 3 هفته پیش
والد
کامیت
10fc98ae41
1فایلهای تغییر یافته به همراه9 افزوده شده و 1 حذف شده
  1. 9 1
      src/app/[locale]/(enter)/login/page.tsx

+ 9 - 1
src/app/[locale]/(enter)/login/page.tsx

@@ -3,6 +3,7 @@ import { CashbackTypes } from "@/api/cashback";
 import FooterTip from "@/components/FooterTip";
 import { useRouter } from "@/i18n/routing";
 import { server } from "@/utils/client";
+import { getToken } from "@/utils/Cookies";
 import { useRequest } from "ahooks";
 import clsx from "clsx";
 import dynamic from "next/dynamic";
@@ -78,7 +79,14 @@ const Login = () => {
             <div className={clsx(styles.page, "flex-1")}>
                 <div className="relative h-[2.2rem]">
                     <div
-                        onClick={() => router.back()}
+                        onClick={() => {
+                            const redirect = searchParams.get("redirect")
+                                ? getToken()
+                                    ? `/${searchParams.get("redirect")}`
+                                    : "/"
+                                : "/";
+                            router.replace(redirect);
+                        }}
                         className="fixed right-[10px] top-[10px] flex h-[.32rem] w-[.32rem] items-center justify-center rounded-[50%] bg-[rgba(0,0,0,.5)]"
                     >
                         <i className="iconfont icon-guanbi text-[.13rem]"></i>