Before 8 месяцев назад
Родитель
Сommit
d254548920

+ 1 - 1
messages/en.json

@@ -390,7 +390,7 @@
   "navBar": {
     "start": "Início",
     "deposit": "Depósito",
-    "affiliated": "Afiliado",
+    "affiliated": "affiliated",
     "exports":"Esportes",
     "profile": "Perfil"
   },

+ 5 - 0
src/app/[locale]/(TabBar)/[[...share]]/_home/HomePromotion.tsx

@@ -21,6 +21,11 @@ const HomePromotion: FC<Props> = (props) => {
         const isClosePromotion = sessionStorage.getItem("isClosePromotion");
         // 如果 type 为 1  && 有isNow为true 表示已经弹出,
         const shouldShowPromotion = () => {
+            // 如果不等于1而数据又是时间,清除
+            if (type !== 1 && dayjs().isSame(isClosePromotion, "days")) {
+                sessionStorage.removeItem("isClosePromotion");
+                return true;
+            }
             if (type === 1) {
                 return !dayjs().isSame(isClosePromotion, "days");
             } else if (type === 2) {

+ 5 - 1
src/app/[locale]/(TabBar)/profile/component/ModalCom/index.tsx

@@ -5,6 +5,7 @@ import { useSearchStore } from "@/stores/useSearchStore";
 import { useUserInfoStore } from "@/stores/useUserInfoStore";
 import { useWalletStore } from "@/stores/useWalletStore";
 import { CenterPopup } from "antd-mobile";
+import dayjs from "dayjs";
 import Cookies from "js-cookie";
 import { useTranslations } from "next-intl";
 import { FC, PropsWithChildren, useState } from "react";
@@ -28,15 +29,18 @@ const ModalCom: FC<PropsWithChildren<ItemComProps>> = () => {
     const [visible, setVisible] = useState(false);
     const logoutRequest = async () => {
         let res = await getLogoutApi();
+        const isClearPromotion = dayjs().isSame(sessionStorage.getItem("isClosePromotion"), "days");
         if (res.code == 200) {
             restGlobal();
             resetSearch();
             restWalletStore();
             localStorage.clear();
-            sessionStorage.clear();
             Cookies.remove("Token");
             router.replace("/login");
         }
+        if (!isClearPromotion) {
+            sessionStorage.clear();
+        }
     };
 
     const router = useRouter();

+ 1 - 1
src/middleware.ts

@@ -15,7 +15,7 @@ function localMiddleware() {
     return async (request: NextRequest, _next: NextFetchEvent) => {
         const handleI18nRouting = createMiddleware({
             locales: locales,
-            defaultLocale: locales.at(-1)!,
+            defaultLocale: locales.at(0)!,
         });
         return handleI18nRouting(request);
     };

+ 1 - 1
src/utils/client/axios.ts

@@ -45,7 +45,7 @@ export default class Request {
                     config = requestInterceptor(config);
                     // header请求头添加token
                     config.headers["Token"] = getToken() || "";
-                    config.headers["language"] = getCookies("language") || locales.at(-1);
+                    config.headers["language"] = getCookies("language") || locales.at(0);
                     if (config && config?.toast) {
                         Toast.show({
                             icon: "loading",

+ 1 - 1
src/utils/server/index.ts

@@ -56,7 +56,7 @@ class Server {
                 headers: {
                     Token: cookies().get("Token")?.value || "",
                     "Content-Type": "application/json",
-                    language: cookies().get("language")?.value || locales.at(-1)!,
+                    language: cookies().get("language")?.value || locales.at(0)!,
                     ...headers,
                 },
                 body: params,