diff --git a/src/components/Header/Auth.tsx b/src/components/Header/Auth.tsx
new file mode 100644
index 0000000..e97d478
--- /dev/null
+++ b/src/components/Header/Auth.tsx
@@ -0,0 +1,38 @@
+'use client';
+
+import { parseCookies } from 'nookies';
+import { useShallow } from 'zustand/react/shallow';
+
+import HeaderAvatar from './HeaderAvatar';
+
+import { LoginModal } from '@/components';
+import useUserStore from '@/store/user';
+
+export default function Auth() {
+ const { token } = parseCookies();
+ const { showLogin, setShowLogin } = useUserStore(
+ useShallow((state) => ({
+ showLogin: state.showLogin,
+ setShowLogin: state.setShowLogin,
+ })),
+ );
+
+ return (
+
+ {!!token ? (
+
+ ) : (
+
+
+
+ )}
+ {/* 登录框 */}
+ {showLogin &&
}
+
+ );
+}
diff --git a/src/components/Header/Header.tsx b/src/components/Header/Header.tsx
new file mode 100644
index 0000000..fb32b82
--- /dev/null
+++ b/src/components/Header/Header.tsx
@@ -0,0 +1,20 @@
+'use client';
+
+import Auth from './Auth';
+import Nav from './Nav';
+
+import { Logo } from '@/components';
+
+export default function Header({ className }: { className?: string }) {
+ return (
+
+ );
+}
diff --git a/src/components/Header/Nav.tsx b/src/components/Header/Nav.tsx
new file mode 100644
index 0000000..9a3675c
--- /dev/null
+++ b/src/components/Header/Nav.tsx
@@ -0,0 +1,37 @@
+'use client';
+
+import Link from 'next/link';
+import { usePathname } from 'next/navigation';
+
+export default function Nav() {
+ const pathName = usePathname();
+ const menuList = [
+ {
+ name: '首页',
+ path: '/',
+ },
+ {
+ name: 'APP下载',
+ path: '/download',
+ },
+ {
+ name: '关于我们',
+ path: '/about',
+ },
+ ];
+
+ return (
+
+ );
+}
diff --git a/src/components/Header/index.tsx b/src/components/Header/index.tsx
deleted file mode 100644
index 83a82af..0000000
--- a/src/components/Header/index.tsx
+++ /dev/null
@@ -1,83 +0,0 @@
-'use client';
-
-import { useEffect, useState } from 'react';
-
-import Link from 'next/link';
-import { usePathname } from 'next/navigation';
-import { useShallow } from 'zustand/react/shallow';
-
-import HeaderAvatar from './HeaderAvatar';
-
-import { Logo, LoginModal } from '@/components';
-import useUserStore from '@/store/user';
-
-export default function Header({ className }: { className?: string }) {
- const { userInfo, showLogin, setShowLogin } = useUserStore(
- useShallow((state) => ({
- userInfo: state.userInfo,
- showLogin: state.showLogin,
- setShowLogin: state.setShowLogin,
- })),
- );
- const pathName = usePathname();
- const [redirect, setRedirect] = useState('');
- const menuList = [
- {
- name: '首页',
- path: '/',
- },
- {
- name: 'APP下载',
- path: '/download',
- },
- {
- name: '关于我们',
- path: '/about',
- },
- ];
-
- // 登录重定向
- useEffect(() => {
- const searchParams = new URLSearchParams(window.location.search);
- const redirectParam = searchParams.get('redirect');
- setRedirect(redirectParam || '');
- if (!userInfo.id && redirectParam) {
- setShowLogin(true);
- }
- }, [pathName]);
-
- return (
-
- );
-}