Skip to content

Let's use AI to Earn!

feat: 1. 将官网的header搬到项目【临时占位】防止太空 2.添加404页面处理

gaoSira43cf342cd45
diff --git a/src/app/[lng]/page.tsx b/src/app/[lng]/page.tsx
index ab34fcd8..d3582c36 100644
--- a/src/app/[lng]/page.tsx
+++ b/src/app/[lng]/page.tsx
@@ -8,10 +8,6 @@ import { useRouter } from "next/navigation";
export default function Home() {
const router = useRouter();
- const handleLogin = () => {
- router.push("/login");
- };
-
const handleProfile = () => {
router.push("/profile");
};
@@ -22,7 +18,6 @@ export default function Home() {
return (
<div className={styles.page}>
- <Button onClick={handleLogin}>登录页面</Button>
<Button onClick={handleProfile}>个人中心</Button>
<Button onClick={handleAccounts}>账户中心</Button>
</div>
diff --git a/src/app/layout/LyaoutHeader.tsx b/src/app/layout/LyaoutHeader.tsx
index cc0b1a7d..38ca2b14 100644
--- a/src/app/layout/LyaoutHeader.tsx
+++ b/src/app/layout/LyaoutHeader.tsx
@@ -1,13 +1,107 @@
-import { ForwardedRef, forwardRef, memo } from "react";
+"use client";
+
+import { ForwardedRef, forwardRef, memo, useEffect, useRef } from "react";
import styles from "./styles/lyaoutHeader.module.scss";
+import { useUserStore } from "@/store/user";
+import Link from "next/link";
+import Image from "next/image";
+import LayoutNav from "@/app/layout/layoutNav";
+import { NoSSR } from "@kwooshung/react-no-ssr";
+import { Button, Dropdown, MenuProps } from "antd";
+import logo from "@/assets/images/logo.png";
+import defaultAvatar from "./images/defaultAvatar.jpg";
+import { CaretDownOutlined } from "@ant-design/icons";
+import { useRouter } from "next/navigation";
export interface ILyaoutHeaderRef {}
export interface ILyaoutHeaderProps {}
+function UserInfo() {
+ const userInfo = useUserStore((state) => state.userInfo)!;
+
+ const items: MenuProps["items"] = [
+ {
+ key: "1",
+ label: (
+ <div
+ onClick={() => {
+ useUserStore.getState().logout();
+ }}
+ >
+ 退出登录
+ </div>
+ ),
+ },
+ ];
+
+ return (
+ <div className={styles["layoutHeader-userinfo__wrapper"]}>
+ <Dropdown menu={{ items }} arrow placement="bottom">
+ <div className={styles["layoutHeader-userinfo"]}>
+ <Image
+ className={styles["layoutHeader-userinfo-avatar"]}
+ src={userInfo?.avatar || defaultAvatar}
+ alt="头像"
+ width={35}
+ height={35}
+ />
+ <div className={styles["layoutHeader-userinfo-name"]}>
+ {userInfo.name || "未知用户"}
+ </div>
+ <CaretDownOutlined />
+ </div>
+ </Dropdown>
+ </div>
+ );
+}
+
const LyaoutHeader = memo(
forwardRef(({}: ILyaoutHeaderProps, ref: ForwardedRef<ILyaoutHeaderRef>) => {
- return <div className={styles.lyaoutHeader}>header</div>;
+ const userStore = useUserStore();
+ const layoutHeader = useRef<HTMLDivElement>(null);
+ const router = useRouter();
+
+ useEffect(() => {
+ setTimeout(() => {
+ document.body.style.paddingTop =
+ layoutHeader.current!.offsetHeight + "px";
+ }, 2);
+ }, []);
+
+ return (
+ <div ref={layoutHeader} className={styles["layoutHeader"]}>
+ <div className={styles["layoutHeader_wrapper"]}>
+ <div className={styles["layoutHeader_wrapper-left"]}>
+ <h1 className={styles["layoutHeader_wrapper-logo"]}>
+ <Link href="/">
+ <Image src={logo} alt="logo" width={50} />
+ </Link>
+ </h1>
+ <LayoutNav />
+ </div>
+
+ <div
+ className={styles["layoutHeader_wrapper-right"]}
+ suppressHydrationWarning={true}
+ >
+ <NoSSR>
+ {userStore.token ? (
+ <UserInfo />
+ ) : (
+ <Button
+ onClick={() => {
+ router.push("/login");
+ }}
+ >
+ 登录
+ </Button>
+ )}
+ </NoSSR>
+ </div>
+ </div>
+ </div>
+ );
}),
);
diff --git a/src/app/layout/images/defaultAvatar.jpg b/src/app/layout/images/defaultAvatar.jpg
new file mode 100644
index 00000000..31fa216f
Binary files /dev/null and b/src/app/layout/images/defaultAvatar.jpg differ
diff --git a/src/app/layout/images/icon/ai.png b/src/app/layout/images/icon/ai.png
new file mode 100644
index 00000000..c30163fd
Binary files /dev/null and b/src/app/layout/images/icon/ai.png differ
diff --git a/src/app/layout/images/icon/audio.png b/src/app/layout/images/icon/audio.png
new file mode 100644
index 00000000..5bd1e8ce
Binary files /dev/null and b/src/app/layout/images/icon/audio.png differ
diff --git a/src/app/layout/images/icon/copyright.png b/src/app/layout/images/icon/copyright.png
new file mode 100644
index 00000000..c40351f0
Binary files /dev/null and b/src/app/layout/images/icon/copyright.png differ
diff --git a/src/app/layout/images/icon/dealPlatform-icon.png b/src/app/layout/images/icon/dealPlatform-icon.png
new file mode 100644
index 00000000..d994c0e3
Binary files /dev/null and b/src/app/layout/images/icon/dealPlatform-icon.png differ
diff --git a/src/app/layout/images/icon/doctor.png b/src/app/layout/images/icon/doctor.png
new file mode 100644
index 00000000..daf7a902
Binary files /dev/null and b/src/app/layout/images/icon/doctor.png differ
diff --git a/src/app/layout/images/icon/firmWX-icon.png b/src/app/layout/images/icon/firmWX-icon.png
new file mode 100644
index 00000000..57206aa4
Binary files /dev/null and b/src/app/layout/images/icon/firmWX-icon.png differ
diff --git a/src/app/layout/images/icon/jc-icon.png b/src/app/layout/images/icon/jc-icon.png
new file mode 100644
index 00000000..2a13ba2f
Binary files /dev/null and b/src/app/layout/images/icon/jc-icon.png differ
diff --git a/src/app/layout/images/icon/metaverse.png b/src/app/layout/images/icon/metaverse.png
new file mode 100644
index 00000000..2eac4422
Binary files /dev/null and b/src/app/layout/images/icon/metaverse.png differ
diff --git a/src/app/layout/images/icon/numberman.png b/src/app/layout/images/icon/numberman.png
new file mode 100644
index 00000000..00da4827
Binary files /dev/null and b/src/app/layout/images/icon/numberman.png differ
diff --git a/src/app/layout/images/icon/platform-icon.png b/src/app/layout/images/icon/platform-icon.png
new file mode 100644
index 00000000..8e36ec5e
Binary files /dev/null and b/src/app/layout/images/icon/platform-icon.png differ
diff --git a/src/app/layout/images/icon/resort.png b/src/app/layout/images/icon/resort.png
new file mode 100644
index 00000000..d9ce1ee3
Binary files /dev/null and b/src/app/layout/images/icon/resort.png differ
diff --git a/src/app/layout/images/icon/weChat-icon.png b/src/app/layout/images/icon/weChat-icon.png
new file mode 100644
index 00000000..20538f05
Binary files /dev/null and b/src/app/layout/images/icon/weChat-icon.png differ
diff --git a/src/app/layout/layoutNav.tsx b/src/app/layout/layoutNav.tsx
new file mode 100644
index 00000000..afd3bb1e
--- /dev/null
+++ b/src/app/layout/layoutNav.tsx
@@ -0,0 +1,248 @@
+"use client";
+
+import styles from "@/app/layout/styles/layoutNav.module.scss";
+import {
+ IRouterDataItem,
+ peRouterData,
+ routerData,
+} from "@/app/layout/routerData";
+import Link from "next/link";
+import { MenuFoldOutlined, RightOutlined, UpOutlined } from "@ant-design/icons";
+import Image from "next/image";
+import React, { useEffect, useRef, useState } from "react";
+import { Drawer, Menu } from "antd";
+import { useRouter, useSelectedLayoutSegments } from "next/navigation";
+
+/**
+ *
+ * @param child
+ * @param iconLoca 0=上,1=右
+ */
+function getNameTag(child: IRouterDataItem, iconLoca: number = 1) {
+ const path = child.path || "/";
+ return (
+ <>
+ {!child.children ? (
+ <Link href={path || "/"} target={path[0] === "/" ? "_self" : "_blank"}>
+ {child.name}
+ </Link>
+ ) : (
+ <span>
+ {child.name}
+ {child.children &&
+ (iconLoca === 0 ? <UpOutlined /> : <RightOutlined />)}
+ </span>
+ )}
+ </>
+ );
+}
+
+/**
+ * 递归级联
+ * @param child
+ */
+function RecursionNav({ child }: { child: IRouterDataItem }) {
+ return (
+ child.children && (
+ <ul className={styles["recursionNav"]}>
+ {child.children.map((v) => {
+ return (
+ <li key={v.name}>
+ {getNameTag(v)}
+ {v.children && <RecursionNav child={v} />}
+ </li>
+ );
+ })}
+ </ul>
+ )
+ );
+}
+
+function ParcelTag({
+ child,
+ children,
+}: {
+ child: IRouterDataItem;
+ children: React.ReactNode;
+}) {
+ if (child.children) {
+ return <>{children}</>;
+ } else {
+ return <Link href={child.path || "/"}>{children}</Link>;
+ }
+}
+
+/**
+ * 二级导航
+ * @param child
+ * @param visible
+ */
+function ChildNav({
+ child,
+ visible,
+}: {
+ child: IRouterDataItem;
+ visible: boolean;
+}) {
+ const elRef = useRef<HTMLUListElement | null>(null);
+ const [height, setHeight] = useState("auto");
+ const animaTime = 0.3;
+ const timer = useRef<NodeJS.Timeout>();
+
+ useEffect(() => {
+ if (!elRef.current) return;
+ const h = elRef.current!.offsetHeight;
+ if (h === 0) return;
+ setHeight(`${h}px`);
+ }, []);
+
+ useEffect(() => {
+ if (height !== "auto") {
+ setTimeout(() => {
+ elRef.current!.style.visibility = "visible";
+ elRef.current!.style.transition = animaTime + "s";
+ }, 1);
+ }
+ }, [height]);
+
+ useEffect(() => {
+ if (!elRef.current) return;
+ if (visible) {
+ timer.current = setTimeout(() => {
+ elRef.current!.style.overflow = "visible";
+ }, animaTime * 1000);
+ } else {
+ elRef.current!.style.overflow = "hidden";
+ clearTimeout(timer.current);
+ }
+ }, [visible]);
+
+ return (
+ child.children && (
+ <ul
+ ref={elRef}
+ className={styles["layoutNavPC-one"]}
+ style={
+ visible || height === "auto"
+ ? { height: height }
+ : { height: 0, padding: 0 }
+ }
+ >
+ {child.children.map((v1) => {
+ return (
+ <li key={v1.name}>
+ <div
+ className={styles["layoutNavPC-one-item"]}
+ style={{ backgroundImage: v1.backColor }}
+ >
+ <ParcelTag child={v1}>
+ <div className={styles["layoutNavPC-one-icon"]}>
+ {v1.icon ? (
+ <Image src={v1.icon!} alt="icon" width={20} />
+ ) : (
+ ""
+ )}
+ </div>
+ <span className={styles["layoutNavPC-one-text"]}>
+ {v1.name}
+ </span>
+ {v1.children && <RightOutlined />}
+ </ParcelTag>
+ </div>
+ <RecursionNav child={v1} />
+ </li>
+ );
+ })}
+ </ul>
+ )
+ );
+}
+
+function NavPC() {
+ const [activeNav, setActiveNav] = useState("");
+ const timer = useRef<NodeJS.Timeout>();
+ const route = useSelectedLayoutSegments();
+ let currRouter = "/";
+ if (route.length === 1) {
+ currRouter = route[0];
+ currRouter = currRouter === "/" ? currRouter : "/" + currRouter;
+ } else {
+ currRouter = "/" + route.slice(0, 2).join("/");
+ }
+
+ return (
+ <ul className={styles.layoutNavPC}>
+ {routerData.map((v1) => {
+ return (
+ <li
+ key={v1.name}
+ className={
+ activeNav === v1.name || v1.path === currRouter
+ ? styles["layoutNavPC-item-active"]
+ : ""
+ }
+ onMouseEnter={() => {
+ setActiveNav(v1.children ? v1.name : "");
+ clearTimeout(timer.current);
+ }}
+ onMouseLeave={() => {
+ timer.current = setTimeout(() => {
+ setActiveNav("");
+ }, 100);
+ }}
+ >
+ {getNameTag(v1, 0)}
+ <ChildNav
+ key={v1.name}
+ child={v1}
+ visible={activeNav === v1.name}
+ />
+ </li>
+ );
+ })}
+ </ul>
+ );
+}
+
+function NavPE() {
+ const [open, setOpen] = useState(false);
+ const router = useRouter();
+
+ return (
+ <div className={styles.layoutNavPE}>
+ <div onClick={() => setOpen(true)} className={styles["layoutNavPE-menu"]}>
+ <MenuFoldOutlined />
+ </div>
+ <Drawer
+ title="导航"
+ placement="right"
+ onClose={() => setOpen(false)}
+ width="85%"
+ open={open}
+ >
+ <Menu
+ className="layoutNavPE-menu"
+ selectable={false}
+ onClick={(e) => {
+ router.push(e.key);
+ setOpen(false);
+ }}
+ style={{ width: "100%" }}
+ mode="inline"
+ items={peRouterData!}
+ />
+ </Drawer>
+ </div>
+ );
+}
+
+function LayoutNav() {
+ return (
+ <>
+ <NavPC />
+ <NavPE />
+ </>
+ );
+}
+
+export default LayoutNav;
diff --git a/src/app/layout/routerData.ts b/src/app/layout/routerData.ts
new file mode 100644
index 00000000..97473d83
--- /dev/null
+++ b/src/app/layout/routerData.ts
@@ -0,0 +1,247 @@
+import ai from "./images/icon/ai.png";
+import audio from "./images/icon/audio.png";
+import numberman from "./images/icon/numberman.png";
+import doctor from "./images/icon/doctor.png";
+import resort from "./images/icon/resort.png";
+import copyright from "./images/icon/copyright.png";
+import weChatIcon from "./images/icon/weChat-icon.png";
+import firmWXIcon from "./images/icon/firmWX-icon.png";
+import dealPlatformIcon from "./images/icon/dealPlatform-icon.png";
+import platformIcon from "./images/icon/platform-icon.png";
+import { StaticImageData } from "next/image";
+import { MenuItemType } from "antd/es/menu/interface";
+
+export interface IRouterDataItem {
+ // 导航标题
+ name: string;
+
+ // 跳转链接
+ path?: string;
+ // icon
+ icon?: StaticImageData;
+ // 导航背景颜色
+ backColor?: string;
+ // 子导航
+ children?: IRouterDataItem[];
+}
+
+export const routerData: IRouterDataItem[] = [
+ {
+ name: "首页",
+ path: "/",
+ },
+ {
+ name: "Chat",
+ path: "/chat",
+ },
+ {
+ name: "AI+",
+ path: "/pages/aiPlus",
+ children: [
+ {
+ name: "数字人",
+ icon: numberman,
+ backColor: "linear-gradient(#FEF7EF, #FAF0E3)",
+ children: [
+ {
+ name: "2D写实",
+ children: [
+ {
+ name: "小艺数字人",
+ path: "/pages/aiPlus/xiaoice?type=2",
+ },
+ // {
+ // name: "医疗数字人",
+ // path: "/pages/aiPlus/numberman?type=1",
+ // },
+ // {
+ // name: "古装数字人",
+ // path: "/pages/aiPlus/numberman?type=0",
+ // },
+ ],
+ },
+ {
+ name: "2D卡通数字人",
+ children: [
+ {
+ name: "邮小游",
+ path: "/pages/aiPlus/live2dPersonPage?id=0",
+ },
+ {
+ name: "天安门东东",
+ path: "/pages/aiPlus/live2dPersonPage?id=1",
+ },
+ ],
+ },
+ ],
+ },
+ {
+ name: "声音",
+ backColor: "linear-gradient(#F4FCFF, #EAF6FB)",
+ icon: audio,
+ children: [
+ {
+ name: "艺秒数字人播报",
+ path: "https://bobao.yikart.cn/",
+ },
+ {
+ name: "声音定制",
+ path: "/pages/aiPlus/audioCustom",
+ },
+ {
+ name: "打电话",
+ path: "/pages/aiPlus/ringUp",
+ },
+ ],
+ },
+ {
+ name: "医疗",
+ backColor: "linear-gradient(#F5F5FF, #F5F5FF)",
+ icon: doctor,
+ children: [
+ {
+ name: "医咖APP",
+ path: "/pages/aiPlus/prodDisplay/aiHealth",
+ },
+ {
+ name: "医疗图像分析",
+ path: "/chat/#/new-chat?mask=100004",
+ },
+ ],
+ },
+ {
+ name: "文旅",
+ backColor: "linear-gradient(#FEF7EF, #FAF0E3)",
+ icon: resort,
+ children: [
+ {
+ name: "艺咖小行星",
+ path: "/pages/aiPlus/prodDisplay/asteroid",
+ },
+ {
+ name: "艺咖AI文创服务",
+ path: "/pages/aiPlus/prodDisplay/culture",
+ },
+ {
+ name: "北京旅行导游",
+ path: "/pages/aiPlus/prodDisplay/guide",
+ },
+ ],
+ },
+ {
+ name: "AIGC",
+ backColor: "linear-gradient(#F5F5FF, #F5F5FF)",
+ icon: ai,
+ children: [
+ {
+ name: "智能绘画",
+ path: "/pages/aiPlus/aiDrawing",
+ },
+ {
+ name: "视频生成",
+ path: "/pages/aiPlus/aiVideo",
+ },
+ {
+ name: "音乐生成",
+ path: "/pages/aiPlus/aiAudio",
+ },
+ {
+ name: "AI换装",
+ path: "/pages/aiPlus/reloading",
+ },
+ {
+ name: "图像编辑",
+ path: "/pages/aiPlus/doodle",
+ },
+ ],
+ },
+ ],
+ },
+ {
+ name: "其它",
+ path: "/pages/other",
+ children: [
+ {
+ name: "微信",
+ backColor: "linear-gradient(#F4FFF9, #EAFBF0)",
+ icon: weChatIcon,
+ path: "/pages/other/wx",
+ },
+ {
+ name: "企业微信",
+ backColor: "linear-gradient(#F4FCFF, #EAF6FB)",
+ icon: firmWXIcon,
+ path: "/pages/other/firmWX",
+ },
+ {
+ name: "数字资产交易流通平台",
+ backColor: "linear-gradient(#F5F5FF, #F5F5FF)",
+ icon: dealPlatformIcon,
+ path: "/pages/other/dealPlatform",
+ },
+ // {
+ // name: "元宇宙",
+ // icon: metaverse,
+ // backColor: "linear-gradient(#FEF7EF, #FAF0E3)",
+ // children: [
+ // {
+ // name: "星元数元宇宙",
+ // path: "/pages/other/metaverse",
+ // },
+ // {
+ // name: "乡村振兴元宇宙",
+ // path: "https://o2vr.net/upload/3D_editor/o2preview/#/?id=2668&secret=MjY2OA==",
+ // },
+ // ],
+ // },
+ {
+ name: "数字资产平台",
+ icon: platformIcon,
+ backColor: "linear-gradient(#F5F5FF, #F5F5FF)",
+ children: [
+ // {
+ // name: "元荷APP",
+ // path: "/pages/other/yuanhe",
+ // },
+ {
+ name: "华文数交",
+ path: "https://luanshu.hbcpre.com/",
+ },
+ ],
+ },
+ {
+ name: "艺咖APP",
+ backColor: "linear-gradient(#F4FCFF, #EAF6FB)",
+ icon: copyright,
+ path: "/pages/other/copyright",
+ },
+ ],
+ },
+ {
+ name: "关于我们",
+ path: "/pages/about",
+ },
+ {
+ name: "艺咖动态",
+ path: "/pages/dynamic",
+ },
+ {
+ name: "个人中心",
+ path: "/pages/member",
+ },
+];
+
+const recursion = (
+ child: IRouterDataItem[] | undefined,
+): MenuItemType[] | null => {
+ if (!child) return null;
+ return child.map((v) => {
+ return {
+ label: v.name,
+ key: v.path || v.name,
+ children: recursion(v.children),
+ };
+ });
+};
+
+export const peRouterData = recursion(routerData);
diff --git a/src/app/layout/styles/layoutNav.module.scss b/src/app/layout/styles/layoutNav.module.scss
new file mode 100644
index 00000000..09f0e868
--- /dev/null
+++ b/src/app/layout/styles/layoutNav.module.scss
@@ -0,0 +1,161 @@
+.layoutNavPC {
+ display: flex;
+ align-items: center;
+ a {
+ //color: var(--black);
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ height: 100%;
+ }
+
+ @media (max-width: 860px) {
+ display: none;
+ }
+ & > li {
+ position: relative;
+ height: 100%;
+ display: flex;
+ margin-right: 50px;
+ align-items: center;
+ @media (max-width: 1200px) {
+ margin-right: 30px;
+ }
+ &:hover {
+ & > span, & > a {
+ color: var(--theColor4);
+ }
+ }
+ }
+ li {
+ cursor: pointer;
+ white-space: nowrap;
+ & > span {
+ display: flex;
+ align-items: center;
+ svg {
+ transform: rotate(0deg);
+ transition: 0.3s;
+ margin-left: 8px;
+ font-size: 12px;
+ }
+ }
+ }
+
+ .layoutNavPC-item-active {
+ & > span {
+ color: var(--theColor4);
+ svg {
+ transform: rotate(180deg);
+ }
+ }
+ & > a {
+ color: var(--theColor4);
+ }
+ }
+
+ .layoutNavPC-one {
+ overflow: hidden;
+ box-sizing: border-box;
+ position: absolute;
+ bottom: 0;
+ transform: translateY(calc(100% + 10px));
+ left: 0;
+ white-space: nowrap;
+ background: var(--whiteColor);
+ padding: 10px 0;
+ border-radius: 10px;
+ z-index: 3;
+ box-shadow: 0 0 10px rgba(112, 112, 112, 0.3);
+ visibility: hidden;
+ li {
+ padding: 0 15px;
+ &:hover {
+ .layoutNavPC-one-item {
+ span {
+ color: var(--theColor4) !important;
+ }
+ }
+ & > .recursionNav {
+ display: block;
+ }
+ }
+ }
+
+ & > li {
+ position: relative;
+ }
+
+ .layoutNavPC-one-item {
+ padding: 10px;
+ min-width: 170px;
+ border-radius: 10px;
+ margin-bottom: 8px;
+ a {
+ display: flex;
+ width: 100%;
+ justify-content: left;
+ }
+ }
+ .layoutNavPC-one-item, .layoutNavPC-one-item a {
+ display: flex;
+ align-items: center;
+ position: relative;
+ .layoutNavPC-one-icon {
+ width: 44px;
+ height: 44px;
+ background: var(--whiteColor);
+ border-radius: 10px;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ margin-right: 12px;
+ }
+ svg {
+ position: absolute;
+ top: 50%;
+ transform: translateY(-50%);
+ right: 20px;
+ }
+ }
+
+ .recursionNav {
+ position: absolute;
+ right: 0;
+ top: 0;
+ transform: translateX(100%);
+ box-shadow: 0 0 10px rgba(112, 112, 112, 0.3);
+ background: var(--whiteColor);
+ border-radius: 10px;
+ padding: 10px 0;
+ display: none;
+ & > li {
+ padding: 10px 20px;
+ //width: 100px;
+ position: relative;
+ &:hover {
+ & > span, & > a {
+ color: var(--theColor4) !important;
+ }
+ }
+ & > span, a {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ }
+ }
+ }
+ }
+}
+
+.layoutNavPE {
+ display: none;
+ .layoutNavPE-menu {
+ font-size: 24px;
+ }
+ @media (max-width: 860px) {
+ display: flex;
+ align-items: center;
+ }
+}
+
diff --git a/src/app/layout/styles/lyaoutHeader.module.scss b/src/app/layout/styles/lyaoutHeader.module.scss
index c45120c5..63d32764 100644
--- a/src/app/layout/styles/lyaoutHeader.module.scss
+++ b/src/app/layout/styles/lyaoutHeader.module.scss
@@ -1,4 +1,101 @@
-.lyaoutHeader {
- :global {
+.layoutHeader {
+ width: 100%;
+ padding: 6px 0;
+ background: var(--whiteColor);
+ position: fixed;
+ top: 0;
+ z-index: 1000;
+
+ .layoutHeaderBell {
+ margin-right: 40px;
+ display: flex;
+ align-items: center;
+ svg {
+ font-size: 25px;
+ cursor: pointer;
+ color: #333;
+ transition: 0.3s;
+ }
}
+
+ .layoutHeaderBell--active {
+ svg {
+ color: var(--theColor5) !important;
+ }
+ }
+
+ .layoutHeader_wrapper {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ @include wrapper;
+
+ .layoutHeader_wrapper-left {
+ display: flex;
+ }
+
+ .layoutHeader_wrapper-logo {
+ margin-right: 12%;
+ @media (max-width: 860px) {
+ //width: 100%;
+ //margin-right: 0;
+ display: none;
+ }
+ }
+
+ .layoutHeader-userinfo__wrapper {
+ display: flex;
+ .layoutHeader-userinfo {
+ display: flex;
+ align-items: center;
+ cursor: pointer;
+ .layoutHeader-userinfo-avatar {
+ border-radius: 50%;
+ }
+ .layoutHeader-userinfo-name {
+ margin: 0 8px;
+ }
+ }
+ }
+ }
+}
+
+.userInfoBellWrapper {
+ .userInfo__unread {
+ :global {
+ .ant-list-item-meta-title {
+ position: relative;
+ padding-left: 12.5px;
+ &:after {
+ content: "";
+ display: block;
+ position: absolute;
+ width: 5px;
+ height: 5px;
+ border-radius: 50%;
+ top: 50%;
+ transform: translateY(-50%);
+ left: 0;
+ background-color: red;
+ }
+ }
+ }
+ }
+ .userInfoBell {
+ height: 60vh;
+ overflow-y: auto;
+ li {
+ h3 {
+ color: rgba(0, 0, 0, 0.88);
+ font-weight: 900;
+ }
+ p {
+ color: rgba(0, 0, 0, 0.45);
+ }
+ }
+ }
+}
+
+.ant-popover-title {
+ font-size: 16px !important;
}
\ No newline at end of file
diff --git a/src/app/not-found.tsx b/src/app/not-found.tsx
new file mode 100644
index 00000000..c95bee1f
--- /dev/null
+++ b/src/app/not-found.tsx
@@ -0,0 +1,22 @@
+"use client";
+
+import Link from "next/link";
+
+export default function Page() {
+ return (
+ <div
+ style={{
+ display: "flex",
+ justifyContent: "center",
+ alignItems: "center",
+ flexDirection: "column",
+ height: "100vh",
+ }}
+ >
+ <span style={{ fontSize: "60px" }}>404</span>
+ <Link href="/" style={{ marginTop: "20px" }}>
+ Back to Home
+ </Link>
+ </div>
+ );
+}
diff --git a/src/app/styles/page.module.scss b/src/app/styles/page.module.scss
index af8ab58b..e3a28c1c 100644
--- a/src/app/styles/page.module.scss
+++ b/src/app/styles/page.module.scss
@@ -1,2 +1,3 @@
.page {
+ min-height: 80vh;
}
\ No newline at end of file
diff --git a/src/assets/images/logo.png b/src/assets/images/logo.png
new file mode 100644
index 00000000..c1af481a
Binary files /dev/null and b/src/assets/images/logo.png differ
diff --git a/src/store/user.ts b/src/store/user.ts
index 8f135e15..6032aae2 100644
--- a/src/store/user.ts
+++ b/src/store/user.ts
@@ -11,6 +11,7 @@ export interface UserInfo {
status: number;
updateTime: string;
_id: string;
+ avatar?: string;
}
export interface IUserStore {
@@ -28,7 +29,7 @@ export const useUserStore = createPersistStore(
...state,
},
(set, _get) => {
- return {
+ const methods = {
setToken: (token: string) => {
set({ token });
},
@@ -38,7 +39,14 @@ export const useUserStore = createPersistStore(
clearLoginStatus: () => {
set({ token: undefined, userInfo: undefined });
},
+
+ // 登出
+ logout() {
+ methods.clearLoginStatus();
+ },
};
+
+ return methods;
},
{
name: "User",