Skip to content

Let's use AI to Earn!

feat: 添加header、footer及添加一些css混入

gaoSir20ccda839646
diff --git a/.idea/watcherTasks.xml b/.idea/watcherTasks.xml
new file mode 100644
index 00000000..fb0d65a4
--- /dev/null
+++ b/.idea/watcherTasks.xml
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="ProjectTasksOptions" suppressed-tasks="SCSS" />
+</project>
\ No newline at end of file
diff --git a/@types/i18next.d.ts b/@types/i18next.d.ts
index b0ccdd04..a873dec9 100644
--- a/@types/i18next.d.ts
+++ b/@types/i18next.d.ts
@@ -6,4 +6,10 @@ declare module "i18next" {
// defaultNS: 'translation'
resources: Resources;
}
+
+ namespace JSX {
+ interface IntrinsicElements {
+ "chatlio-widget": any;
+ }
+ }
}
diff --git a/next.config.mjs b/next.config.mjs
index 4678774e..076d6ea9 100644
--- a/next.config.mjs
+++ b/next.config.mjs
@@ -1,4 +1,9 @@
/** @type {import('next').NextConfig} */
-const nextConfig = {};
+const nextConfig = {
+ sassOptions: {
+ includePaths: ['./app', '*.scss'],
+ prependData: `@import "@/app/styles/mixin.scss";`,
+ }
+};
export default nextConfig;
diff --git a/src/app/[lng]/layout.tsx b/src/app/[lng]/layout.tsx
index af6e0753..86f50ae6 100644
--- a/src/app/[lng]/layout.tsx
+++ b/src/app/[lng]/layout.tsx
@@ -1,6 +1,6 @@
import "@/var.css";
import "../globals.css";
-import { Providers } from "./providers";
+import { Providers } from "../layout/Providers";
import { dir } from "i18next";
import { languages, fallbackLng } from "@/app/i18n/settings";
diff --git a/src/app/[lng]/page.tsx b/src/app/[lng]/page.tsx
index af09422c..ab34fcd8 100644
--- a/src/app/[lng]/page.tsx
+++ b/src/app/[lng]/page.tsx
@@ -1,6 +1,6 @@
"use client";
-import styles from "./page.module.scss";
+import styles from "@/app/styles/page.module.scss";
import { Button } from "antd";
import React from "react";
import { useRouter } from "next/navigation";
@@ -16,7 +16,6 @@ export default function Home() {
router.push("/profile");
};
-
const handleAccounts = () => {
router.push("/accounts");
};
@@ -26,7 +25,6 @@ export default function Home() {
<Button onClick={handleLogin}>登录页面</Button>
<Button onClick={handleProfile}>个人中心</Button>
<Button onClick={handleAccounts}>账户中心</Button>
-
</div>
);
}
diff --git a/src/app/globals.css b/src/app/globals.css
index 2772a043..99508bf5 100644
--- a/src/app/globals.css
+++ b/src/app/globals.css
@@ -5,6 +5,10 @@
box-sizing: border-box;
}
+li {
+ list-style: none;
+}
+
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial,
'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol',
@@ -17,6 +21,7 @@ html,
body {
max-width: 100vw;
overflow-x: hidden;
+ font-size: var(--fs-sm);
}
body {
diff --git a/src/app/layout/LyaoutFooter.tsx b/src/app/layout/LyaoutFooter.tsx
new file mode 100644
index 00000000..7a00dc51
--- /dev/null
+++ b/src/app/layout/LyaoutFooter.tsx
@@ -0,0 +1,75 @@
+import { ForwardedRef, forwardRef, memo } from "react";
+import styles from "./styles/lyaoutFooter.module.scss";
+import Image from "next/image";
+import Link from "next/link";
+import QRCode1 from "./images/QRCode1.jpg";
+import QRCode2 from "./images/QRCode2.png";
+
+export interface ILyaoutFooterRef {}
+
+export interface ILyaoutFooterProps {}
+
+function getLinkList() {
+ return [
+ {
+ name: "新华网",
+ link: "http://www.news.cn",
+ },
+ {
+ name: "财经网",
+ link: "https://www.caijing.com.cn",
+ },
+ {
+ name: "腾讯网",
+ link: "https://www.qq.com",
+ },
+ ];
+}
+
+const LyaoutFooter = memo(
+ forwardRef(({}: ILyaoutFooterProps, ref: ForwardedRef<ILyaoutFooterRef>) => {
+ const linkList = getLinkList();
+
+ return (
+ <div className={styles.layoutFooter}>
+ <div className={styles.layoutFooter_wrapper}>
+ <div className={styles["layoutFooter_wrapper-left"]}>
+ <h2>艺咖(北京)科技有限公司</h2>
+ <p>
+ <a
+ href="https://beian.miit.gov.cn/#/Integrated/recordQuery"
+ target="_blank"
+ >
+ Copyright@2020艺咖(北京)科技有限公司 京ICP备19059131号-1
+ </a>
+ </p>
+ </div>
+ <div className={styles["layoutFooter_wrapper-center"]}>
+ <h3>友情链接</h3>
+ <ul>
+ {linkList.map((item, i) => (
+ <li key={i}>
+ <Link href={item.link} target="_blank">
+ {item.name}
+ </Link>
+ </li>
+ ))}
+ </ul>
+ </div>
+ <ul className={styles["layoutFooter_wrapper-right"]}>
+ <li>
+ <Image src={QRCode1} alt="商务合作" width={88} />
+ <p>商务合作</p>
+ </li>
+ <li>
+ <Image src={QRCode2} alt="公众号" width={88} />
+ <p>公众号</p>
+ </li>
+ </ul>
+ </div>
+ </div>
+ );
+ }),
+);
+
+export default LyaoutFooter;
diff --git a/src/app/layout/LyaoutHeader.tsx b/src/app/layout/LyaoutHeader.tsx
new file mode 100644
index 00000000..cc0b1a7d
--- /dev/null
+++ b/src/app/layout/LyaoutHeader.tsx
@@ -0,0 +1,14 @@
+import { ForwardedRef, forwardRef, memo } from "react";
+import styles from "./styles/lyaoutHeader.module.scss";
+
+export interface ILyaoutHeaderRef {}
+
+export interface ILyaoutHeaderProps {}
+
+const LyaoutHeader = memo(
+ forwardRef(({}: ILyaoutHeaderProps, ref: ForwardedRef<ILyaoutHeaderRef>) => {
+ return <div className={styles.lyaoutHeader}>header</div>;
+ }),
+);
+
+export default LyaoutHeader;
diff --git a/src/app/[lng]/providers.tsx b/src/app/layout/Providers.tsx
similarity index 74%
rename from src/app/[lng]/providers.tsx
rename to src/app/layout/Providers.tsx
index 8416d5e3..d1e15a9f 100644
--- a/src/app/[lng]/providers.tsx
+++ b/src/app/layout/Providers.tsx
@@ -5,6 +5,8 @@ import { ConfigProvider, App } from "antd";
import zh_CN from "antd/es/locale/zh_CN";
import { AntdRegistry } from "@ant-design/nextjs-registry";
import { Suspense } from "react";
+import LyaoutHeader from "@/app/layout/LyaoutHeader";
+import LyaoutFooter from "@/app/layout/LyaoutFooter";
export function Providers({ children }: { children: React.ReactNode }) {
return (
@@ -19,10 +21,14 @@ export function Providers({ children }: { children: React.ReactNode }) {
>
<App component={false}>
<Suspense>
- <AntdRegistry>{children}</AntdRegistry>
+ <AntdRegistry>
+ <LyaoutHeader />
+ {children}
+ <LyaoutFooter />
+ </AntdRegistry>
</Suspense>
</App>
</ConfigProvider>
</GoogleOAuthProvider>
);
-}
\ No newline at end of file
+}
diff --git a/src/app/layout/images/QRCode1.jpg b/src/app/layout/images/QRCode1.jpg
new file mode 100644
index 00000000..19beca22
Binary files /dev/null and b/src/app/layout/images/QRCode1.jpg differ
diff --git a/src/app/layout/images/QRCode2.png b/src/app/layout/images/QRCode2.png
new file mode 100644
index 00000000..0506d119
Binary files /dev/null and b/src/app/layout/images/QRCode2.png differ
diff --git a/src/app/layout/styles/lyaoutFooter.module.scss b/src/app/layout/styles/lyaoutFooter.module.scss
new file mode 100644
index 00000000..98e6d268
--- /dev/null
+++ b/src/app/layout/styles/lyaoutFooter.module.scss
@@ -0,0 +1,73 @@
+.layoutFooter {
+ background: #111111;
+ width: 100%;
+ color: var(--whiteColor);
+
+ .layoutFooter_wrapper {
+ @include contentWrapper;
+ padding: 60px 0;
+ display: flex;
+ justify-content: space-between;
+ .layoutFooter_wrapper-left {
+ h2 {
+ margin-bottom: 16px;
+ }
+ p {
+ opacity: 0.6;
+ margin-bottom: 15px;
+ a {
+ color: var(--whiteColor);
+ display: flex;
+ align-items: center;
+ img {
+ margin-right: 4px;
+ }
+ }
+ }
+ }
+
+ .layoutFooter_wrapper-center {
+ ul {
+ display: flex;
+ margin-top: 16px;
+ li {
+ margin-right: 20px;
+ opacity: 0.6;
+ a {
+ color: var(--whiteColor);
+ }
+ }
+ }
+
+ @media (max-width: 1024px) {
+ display: none;
+ }
+ }
+
+ .layoutFooter_wrapper-right {
+ display: flex;
+ li {
+ text-align: center;
+ p {
+ opacity: 0.7;
+ margin-top: 16px;
+ }
+ &:nth-child(1) {
+ margin-right: 30px;
+ }
+ }
+ }
+
+ @media (max-width: 682px) {
+ flex-direction: column;
+ padding: 20px 0;
+ .layoutFooter_wrapper-left {
+ text-align: center;
+ }
+ .layoutFooter_wrapper-right {
+ justify-content: center;
+ margin-top: 20px;
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/app/layout/styles/lyaoutHeader.module.scss b/src/app/layout/styles/lyaoutHeader.module.scss
new file mode 100644
index 00000000..c45120c5
--- /dev/null
+++ b/src/app/layout/styles/lyaoutHeader.module.scss
@@ -0,0 +1,4 @@
+.lyaoutHeader {
+ :global {
+ }
+}
\ No newline at end of file
diff --git a/src/app/styles/mixin.scss b/src/app/styles/mixin.scss
new file mode 100644
index 00000000..689299ed
--- /dev/null
+++ b/src/app/styles/mixin.scss
@@ -0,0 +1,36 @@
+// 内容包装器
+@mixin contentWrapper {
+ margin: 0 auto;
+ width: 1200px !important;
+ min-height: 0 !important;
+ box-sizing: border-box;
+
+ @media (max-width: 1200px) {
+ width: 95% !important;
+ margin: 0 auto;
+ }
+}
+
+// 外部容器包装器
+@mixin wrapper {
+ margin: 0 auto;
+ width: 1438px;
+ box-sizing: border-box;
+
+ @media (max-width: 1500px) {
+ width: 1200px;
+ }
+
+ @media (max-width: 1200px) {
+ width: 100%;
+ padding: 0 15px;
+ }
+}
+
+// 溢出隐藏 @param $line 行数
+@mixin omitText($line) {
+ display: -webkit-box;
+ -webkit-box-orient: vertical;
+ -webkit-line-clamp: $line;
+ overflow: hidden;
+}
\ No newline at end of file
diff --git a/src/app/[lng]/page.module.scss b/src/app/styles/page.module.scss
similarity index 100%
rename from src/app/[lng]/page.module.scss
rename to src/app/styles/page.module.scss
diff --git a/src/store/user.ts b/src/store/user.ts
index 79576925..8f135e15 100644
--- a/src/store/user.ts
+++ b/src/store/user.ts
@@ -15,12 +15,12 @@ export interface UserInfo {
export interface IUserStore {
token?: string;
- userInfo?: UserInfo;
+ userInfo?: Partial<UserInfo>;
}
const state: IUserStore = {
token: undefined,
- userInfo: undefined,
+ userInfo: {},
};
export const useUserStore = createPersistStore(
diff --git a/src/utils/request.ts b/src/utils/request.ts
index a1ef78bc..37bbaeaf 100644
--- a/src/utils/request.ts
+++ b/src/utils/request.ts
@@ -2,6 +2,7 @@ import FetchService from "@/utils/FetchService/FetchService";
import { RequestParams } from "@/utils/FetchService/types";
import { API_BASE_URL } from "@/constant";
import { useUserStore } from "@/store/user";
+import { message } from "antd";
type ResponseType<T> = {
code: string | number;
@@ -14,10 +15,10 @@ export const fetchService = new FetchService({
baseURL: API_BASE_URL,
requestInterceptor(requestParams) {
const token = useUserStore.getState().token;
-
+
requestParams.headers = {
...(requestParams["headers"] || {}),
- Authorization: token ? `Bearer ${token}` : '',
+ Authorization: token ? `Bearer ${token}` : "",
};
return requestParams;
@@ -38,9 +39,12 @@ export async function request<T>(params: RequestParams) {
}
if (data.code !== 0) {
- // if (typeof window !== "undefined")
- // message.warning(data.msg || "网络繁忙,请稍后重试!");
- // return null;
+ if (typeof window !== "undefined")
+ message.warning({
+ content: data.msg || "网络繁忙,请稍后重试!",
+ key: "apiErrorMessage",
+ });
+ return null;
}
return data;
diff --git a/src/var.css b/src/var.css
index c53ed374..e53f6f47 100644
--- a/src/var.css
+++ b/src/var.css
@@ -1,7 +1,7 @@
/* 全局css变量 */
:root {
/* 中性面板色组---------------------------------------------------- */
- --whiteColor1: #fff;
+ --whiteColor: #fff;
--grayColor0: rgb(247,250,250);
--grayColor1: #F3F3F3;
--grayColor2: #EEEEEE;
@@ -29,6 +29,14 @@
/* 超小号字 */
--fs-xs: 12px;
+ @media (min-width: 1600px) {
+ --fs-xl: 22px;
+ --fs-lg: 20px;
+ --fs-md: 18px;
+ --fs-sm: 16px;
+ --fs-xs: 14px;
+ }
+
/* 主题色由浅到深 */
--theColor1: #fbf0ff;
--theColor2: #fbf0ff;