From 1090ca0dd0b13413281cb1769343b2c00d34fb0e Mon Sep 17 00:00:00 2001 From: quantulr <35954003+quantulr@users.noreply.github.com> Date: Sun, 29 Oct 2023 22:25:16 +0800 Subject: [PATCH] update --- .idea/caszl-next.iml | 1 + .../announcements/[articleId]/layout.tsx | 9 ++- .../announcements/[articleId]/page.tsx | 6 +- app/(introduce)/talents/academician/page.tsx | 5 ++ app/(introduce)/talents/layout.tsx | 19 +++++ app/(introduce)/talents/researcher/page.tsx | 5 ++ .../talents/vice-researcher/page.tsx | 5 ++ app/components/ArticleContent.tsx | 2 +- app/components/ArticleLayout.tsx | 10 ++- app/components/LeftNav.tsx | 77 +++++++++---------- app/layout.tsx | 2 +- package.json | 20 ++--- pnpm-lock.yaml | 48 ++++++------ 13 files changed, 118 insertions(+), 91 deletions(-) create mode 100644 app/(introduce)/talents/academician/page.tsx create mode 100644 app/(introduce)/talents/layout.tsx create mode 100644 app/(introduce)/talents/researcher/page.tsx create mode 100644 app/(introduce)/talents/vice-researcher/page.tsx diff --git a/.idea/caszl-next.iml b/.idea/caszl-next.iml index d6ebd48..25ed3f6 100644 --- a/.idea/caszl-next.iml +++ b/.idea/caszl-next.iml @@ -1,5 +1,6 @@ + diff --git a/app/(articles)/announcements/[articleId]/layout.tsx b/app/(articles)/announcements/[articleId]/layout.tsx index a08bf2d..3ccabc8 100644 --- a/app/(articles)/announcements/[articleId]/layout.tsx +++ b/app/(articles)/announcements/[articleId]/layout.tsx @@ -1,7 +1,4 @@ import { ReactNode } from "react"; -import circle from "@/app/assets/circle.png"; -import Image from "next/image"; -import LeftNav from "@/app/components/LeftNav"; import ArticleLayout from "@/app/components/ArticleLayout"; const navLinks = [ @@ -20,7 +17,11 @@ const Layout = ({ articleId: string; }; }) => { - return {children}; + return ( + + {children} + + ); }; export default Layout; diff --git a/app/(articles)/announcements/[articleId]/page.tsx b/app/(articles)/announcements/[articleId]/page.tsx index 5a905af..24a679b 100644 --- a/app/(articles)/announcements/[articleId]/page.tsx +++ b/app/(articles)/announcements/[articleId]/page.tsx @@ -9,9 +9,5 @@ export default async function Article({ }; }) { const data = await articleDetail({ id: params.articleId }); - return ( -
- -
- ); + return ; } diff --git a/app/(introduce)/talents/academician/page.tsx b/app/(introduce)/talents/academician/page.tsx new file mode 100644 index 0000000..839746f --- /dev/null +++ b/app/(introduce)/talents/academician/page.tsx @@ -0,0 +1,5 @@ +const Page = () => { + return
院士
; +}; + +export default Page; diff --git a/app/(introduce)/talents/layout.tsx b/app/(introduce)/talents/layout.tsx new file mode 100644 index 0000000..5b691ad --- /dev/null +++ b/app/(introduce)/talents/layout.tsx @@ -0,0 +1,19 @@ +import ArticleLayout from "@/app/components/ArticleLayout"; +import { ReactNode } from "react"; + +const navigations = [ + { title: "人才概览", href: "/talents/overview" }, + { title: "两院院士", href: "/talents/academician" }, + { title: "研究员", href: "/talents/researcher" }, + { title: "副研究员", href: "/talents/vice-researcher" }, +]; + +const Layout = ({ children }: { children: ReactNode }) => { + return ( + + {children} + + ); +}; + +export default Layout; diff --git a/app/(introduce)/talents/researcher/page.tsx b/app/(introduce)/talents/researcher/page.tsx new file mode 100644 index 0000000..1283ed8 --- /dev/null +++ b/app/(introduce)/talents/researcher/page.tsx @@ -0,0 +1,5 @@ +const Page = () => { + return
研究员
; +}; + +export default Page; diff --git a/app/(introduce)/talents/vice-researcher/page.tsx b/app/(introduce)/talents/vice-researcher/page.tsx new file mode 100644 index 0000000..0210072 --- /dev/null +++ b/app/(introduce)/talents/vice-researcher/page.tsx @@ -0,0 +1,5 @@ +const Page = () => { + return
副研究员
; +}; + +export default Page; diff --git a/app/components/ArticleContent.tsx b/app/components/ArticleContent.tsx index 88e1390..532fe16 100644 --- a/app/components/ArticleContent.tsx +++ b/app/components/ArticleContent.tsx @@ -3,7 +3,7 @@ import { ArticleDetail } from "@/app/types/article"; const ArticleContent = ({ article }: { article: ArticleDetail }) => { return ( -
+

{article.title}

diff --git a/app/components/ArticleLayout.tsx b/app/components/ArticleLayout.tsx index bf887be..4241b33 100644 --- a/app/components/ArticleLayout.tsx +++ b/app/components/ArticleLayout.tsx @@ -3,17 +3,19 @@ import { ReactNode } from "react"; const ArticleLayout = ({ children, - navs, + navigations, + leftNavTitle, }: { children: ReactNode; - navs: any; + navigations: any[]; + leftNavTitle: string; }) => { return (
- +
-
{children}
+
{children}
); }; diff --git a/app/components/LeftNav.tsx b/app/components/LeftNav.tsx index 2f8ecdf..20742e4 100644 --- a/app/components/LeftNav.tsx +++ b/app/components/LeftNav.tsx @@ -1,54 +1,47 @@ +"use client"; import React from "react"; import Image from "next/image"; import circle from "@/app/assets/circle.png"; import styles from "./LeftNav.module.scss"; import Link from "next/link"; +import { usePathname } from "next/navigation"; -const LeftNav = () => { +const LeftNav = ({ + navigations, + title, +}: { + navigations: any[]; + title: string; +}) => { + const pathname = usePathname(); return ( -
-
+
+
{"circle - 新闻详情 -
-
-
    -
  • - - 人才概况 - -
  • -
  • - - 人才概况 - -
  • -
  • - - 人才概况 - -
  • -
  • - - 人才概况 - -
  • -
+ {title}
+ {navigations.length > 0 && ( +
+
    + {navigations.map((navigation) => ( +
  • + + {navigation.title} + +
  • + ))} +
+
+ )}
); }; diff --git a/app/layout.tsx b/app/layout.tsx index 53381e5..5bd0233 100644 --- a/app/layout.tsx +++ b/app/layout.tsx @@ -17,7 +17,7 @@ export const metadata: Metadata = { const navLinks = [ { title: "首页", href: "/" }, { title: "机构设置", href: "#" }, - { title: "人才队伍", href: "#" }, + { title: "人才队伍", href: "/talents/overview" }, { title: "科研进展", href: "#" }, { title: "科技成果", href: "#" }, { title: "学术交流", href: "#" }, diff --git a/package.json b/package.json index 1127654..78e0565 100644 --- a/package.json +++ b/package.json @@ -12,20 +12,20 @@ "dependencies": { "axios": "^1.6.0", "next": "14.0.0", - "react": "^18", - "react-dom": "^18" + "react": "^18.2.0", + "react-dom": "^18.2.0" }, "devDependencies": { - "@types/node": "^20", - "@types/react": "^18", - "@types/react-dom": "^18", - "autoprefixer": "^10", - "eslint": "^8", + "@types/node": "^20.8.9", + "@types/react": "^18.2.33", + "@types/react-dom": "^18.2.14", + "autoprefixer": "^10.4.16", + "eslint": "^8.52.0", "eslint-config-next": "14.0.0", - "postcss": "^8", + "postcss": "^8.4.31", "prettier": "^3.0.3", "sass": "^1.69.5", - "tailwindcss": "^3", - "typescript": "^5" + "tailwindcss": "^3.3.5", + "typescript": "^5.2.2" } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index d7d4dc5..3c0d7a9 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -12,33 +12,33 @@ dependencies: specifier: 14.0.0 version: 14.0.0(react-dom@18.2.0)(react@18.2.0)(sass@1.69.5) react: - specifier: ^18 + specifier: ^18.2.0 version: 18.2.0 react-dom: - specifier: ^18 + specifier: ^18.2.0 version: 18.2.0(react@18.2.0) devDependencies: '@types/node': - specifier: ^20 + specifier: ^20.8.9 version: 20.8.9 '@types/react': - specifier: ^18 + specifier: ^18.2.33 version: 18.2.33 '@types/react-dom': - specifier: ^18 + specifier: ^18.2.14 version: 18.2.14 autoprefixer: - specifier: ^10 + specifier: ^10.4.16 version: 10.4.16(postcss@8.4.31) eslint: - specifier: ^8 + specifier: ^8.52.0 version: 8.52.0 eslint-config-next: specifier: 14.0.0 version: 14.0.0(eslint@8.52.0)(typescript@5.2.2) postcss: - specifier: ^8 + specifier: ^8.4.31 version: 8.4.31 prettier: specifier: ^3.0.3 @@ -47,10 +47,10 @@ devDependencies: specifier: ^1.69.5 version: 1.69.5 tailwindcss: - specifier: ^3 + specifier: ^3.3.5 version: 3.3.5 typescript: - specifier: ^5 + specifier: ^5.2.2 version: 5.2.2 packages: @@ -384,16 +384,16 @@ packages: resolution: {integrity: sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==} dev: true - /acorn-jsx@5.3.2(acorn@8.11.1): + /acorn-jsx@5.3.2(acorn@8.11.2): resolution: {integrity: sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==} peerDependencies: acorn: ^6.0.0 || ^7.0.0 || ^8.0.0 dependencies: - acorn: 8.11.1 + acorn: 8.11.2 dev: true - /acorn@8.11.1: - resolution: {integrity: sha512-IJTNCJMRHfRfb8un89z1QtS0x890C2QUrUxFMK8zy+RizcId6mfnqOf68Bu9YkDgpLYuvCm6aYbwDatXVZPjMQ==} + /acorn@8.11.2: + resolution: {integrity: sha512-nc0Axzp/0FILLEVsm4fNwLCwMttvhEI263QtVPQcbpfZZ3ts0hLsZGOpE6czNlid7CJ9MlyH8reXkpsf3YUY4w==} engines: {node: '>=0.4.0'} hasBin: true dev: true @@ -543,7 +543,7 @@ packages: postcss: ^8.1.0 dependencies: browserslist: 4.22.1 - caniuse-lite: 1.0.30001554 + caniuse-lite: 1.0.30001557 fraction.js: 4.3.7 normalize-range: 0.1.2 picocolors: 1.0.0 @@ -603,8 +603,8 @@ packages: engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7} hasBin: true dependencies: - caniuse-lite: 1.0.30001554 - electron-to-chromium: 1.4.568 + caniuse-lite: 1.0.30001557 + electron-to-chromium: 1.4.569 node-releases: 2.0.13 update-browserslist-db: 1.0.13(browserslist@4.22.1) dev: true @@ -634,8 +634,8 @@ packages: engines: {node: '>= 6'} dev: true - /caniuse-lite@1.0.30001554: - resolution: {integrity: sha512-A2E3U//MBwbJVzebddm1YfNp7Nud5Ip+IPn4BozBmn4KqVX7AvluoIDFWjsv5OkGnKUXQVmMSoMKLa3ScCblcQ==} + /caniuse-lite@1.0.30001557: + resolution: {integrity: sha512-91oR7hLNUP3gG6MLU+n96em322a8Xzes8wWdBKhLgUoiJsAF5irZnxSUCbc+qUZXNnPCfUwLOi9ZCZpkvjQajw==} /chalk@4.1.2: resolution: {integrity: sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==} @@ -797,8 +797,8 @@ packages: esutils: 2.0.3 dev: true - /electron-to-chromium@1.4.568: - resolution: {integrity: sha512-3TCOv8+BY6Ltpt1/CmGBMups2IdKOyfEmz4J8yIS4xLSeMm0Rf+psSaxLuswG9qMKt+XbNbmADybtXGpTFlbDg==} + /electron-to-chromium@1.4.569: + resolution: {integrity: sha512-LsrJjZ0IbVy12ApW3gpYpcmHS3iRxH4bkKOW98y1/D+3cvDUWGcbzbsFinfUS8knpcZk/PG/2p/RnkMCYN7PVg==} dev: true /emoji-regex@9.2.2: @@ -1157,8 +1157,8 @@ packages: resolution: {integrity: sha512-oruZaFkjorTpF32kDSI5/75ViwGeZginGGy2NoOSg3Q9bnwlnmDm4HLnkl0RE3n+njDXR037aY1+x58Z/zFdwQ==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dependencies: - acorn: 8.11.1 - acorn-jsx: 5.3.2(acorn@8.11.1) + acorn: 8.11.2 + acorn-jsx: 5.3.2(acorn@8.11.2) eslint-visitor-keys: 3.4.3 dev: true @@ -1858,7 +1858,7 @@ packages: '@next/env': 14.0.0 '@swc/helpers': 0.5.2 busboy: 1.6.0 - caniuse-lite: 1.0.30001554 + caniuse-lite: 1.0.30001557 postcss: 8.4.31 react: 18.2.0 react-dom: 18.2.0(react@18.2.0)