From 031cfb792828af545736363665f15e8d64c9a556 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B5=B7=E9=BE=99?= Date: Fri, 29 Aug 2025 00:11:04 +0800 Subject: [PATCH] =?UTF-8?q?=E5=86=8D=E8=B0=83=E6=95=B4=E6=A0=B7=E5=BC=8F?= =?UTF-8?q?=E5=92=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/layout/top-bar.tsx | 311 +++++++++++++++++--------------- components/pages/home-page2.tsx | 2 +- components/pages/login.tsx | 2 +- 3 files changed, 167 insertions(+), 148 deletions(-) diff --git a/components/layout/top-bar.tsx b/components/layout/top-bar.tsx index 0508606..68e6c75 100644 --- a/components/layout/top-bar.tsx +++ b/components/layout/top-bar.tsx @@ -69,8 +69,8 @@ export function TopBar({ }; useEffect(() => { - const currentUser = localStorage.getItem("currentUser"); - if (JSON.parse(currentUser || "{}")?.token) { + const token = localStorage.getItem("token"); + if (token) { setIsLogin(true); } else { setIsLogin(false); @@ -198,167 +198,186 @@ export function TopBar({ -
- {/* Pricing Link */} - - - {/* Notifications */} - {/* */} - - {/* Theme Toggle */} - {/* */} - - {/* User Menu */} -
+ { + isLogin ?(
+ {/* Pricing Link */} - {mounted && isOpen - ? ReactDOM.createPortal( - e.stopPropagation()} - > - {/* User Info */} -
-
-
- MF -
-
-

- {currentUser.name} -

-

- {currentUser.email} -

-
-
{ - logoutUser(); - }} - title="退出登录" - > - -
-
-
+ {/* Notifications */} + {/* */} - {/* AI Points */} -
-
- - - {isLoadingSubscription ? '...' : `${credits} credits`} - + {/* Theme Toggle */} + {/* */} + + {/* User Menu */} +
+ + + {mounted && isOpen + ? ReactDOM.createPortal( + e.stopPropagation()} + > + {/* User Info */} +
+
+
+ MF +
+
+

+ {currentUser.name} +

+

+ {currentUser.email} +

+
+
{ + logoutUser(); + }} + title="退出登录" + > + +
+
- - {subscriptionStatus === 'ACTIVE' && ( + + {/* AI Points */} +
+
+ + + {isLoadingSubscription ? '...' : `${credits} credits`} + +
- )} -
- - {/* Menu Items */} -
- {/* router.push('/my-library')} - data-alt="my-library-button" - > - - My Library - - - { - // 处理退出登录 - setIsOpen(false); - }} - data-alt="logout-button" - > - - Logout - */} - - {/* Footer */} -
-
Privacy Policy · Terms of Service
-
250819215404 | 2025/8/20 06:00:50
+ {subscriptionStatus === 'ACTIVE' && ( + + )}
-
-
, - document.body - ) - : null} -
-
+ + {/* Menu Items */} +
+ {/* router.push('/my-library')} + data-alt="my-library-button" + > + + My Library + + + { + // 处理退出登录 + setIsOpen(false); + }} + data-alt="logout-button" + > + + Logout + */} + + {/* Footer */} +
+
Privacy Policy · Terms of Service
+
250819215404 | 2025/8/20 06:00:50
+
+
+ , + document.body + ) + : null} +
+
):( +
+ + +
+ ) + }
); diff --git a/components/pages/home-page2.tsx b/components/pages/home-page2.tsx index bb17713..93c70d4 100644 --- a/components/pages/home-page2.tsx +++ b/components/pages/home-page2.tsx @@ -642,7 +642,7 @@ function HomeModule5() { : "text-white hover:text-gray-300" }`} > - Yearly - 10% + Yearly - 20% diff --git a/components/pages/login.tsx b/components/pages/login.tsx index 92ca8f4..7f6defd 100644 --- a/components/pages/login.tsx +++ b/components/pages/login.tsx @@ -51,7 +51,7 @@ export default function Login() { try { await loginUser(email, password); // 登录成功后跳转到首页 - router.push("/"); + router.push("/create"); } catch (error: any) { console.error("Login failed:", error);