From 593a8a0bc3e504fe0371779b18822333fa3b0a91 Mon Sep 17 00:00:00 2001 From: quantulr <35954003+quantulr@users.noreply.github.com> Date: Thu, 2 Nov 2023 10:56:18 +0800 Subject: [PATCH] update --- .../branch-life-sketch/[articleId]/layout.tsx | 19 +++++ .../branch-life-sketch/[articleId]/page.tsx | 24 ++++++ .../pages/[pageIndex]/layout.tsx | 21 +++++ .../pages/[pageIndex]/page.tsx | 23 +++++ app/components/BranchLifeSketch.tsx | 83 +++++++++++++++++++ app/components/FriendLinks.tsx | 1 + app/components/MainNav.tsx | 6 ++ app/page.tsx | 4 + 8 files changed, 181 insertions(+) create mode 100644 app/(articles)/branch-life-sketch/[articleId]/layout.tsx create mode 100644 app/(articles)/branch-life-sketch/[articleId]/page.tsx create mode 100644 app/(articles)/branch-life-sketch/pages/[pageIndex]/layout.tsx create mode 100644 app/(articles)/branch-life-sketch/pages/[pageIndex]/page.tsx create mode 100644 app/components/BranchLifeSketch.tsx diff --git a/app/(articles)/branch-life-sketch/[articleId]/layout.tsx b/app/(articles)/branch-life-sketch/[articleId]/layout.tsx new file mode 100644 index 0000000..b63a93b --- /dev/null +++ b/app/(articles)/branch-life-sketch/[articleId]/layout.tsx @@ -0,0 +1,19 @@ +import { ReactNode } from "react"; +import ArticleLayout from "@/app/components/ArticleLayout"; + +const Layout = ({ + children, +}: { + children: ReactNode; + params: { + articleId: string; + }; +}) => { + return ( + + {children} + + ); +}; + +export default Layout; diff --git a/app/(articles)/branch-life-sketch/[articleId]/page.tsx b/app/(articles)/branch-life-sketch/[articleId]/page.tsx new file mode 100644 index 0000000..4ad4e29 --- /dev/null +++ b/app/(articles)/branch-life-sketch/[articleId]/page.tsx @@ -0,0 +1,24 @@ +import { articleDetail } from "@/app/api/articles"; +import ArticleRender from "@/app/components/ArticleRender"; +import ArticleWithBreadcrumb from "@/app/components/ArticleWithBreadcrumb"; + +export default async function Article({ + params, +}: { + params: { + articleId: string; + }; +}) { + const data = await articleDetail({ id: params.articleId }); + return ( + + + + ); +} diff --git a/app/(articles)/branch-life-sketch/pages/[pageIndex]/layout.tsx b/app/(articles)/branch-life-sketch/pages/[pageIndex]/layout.tsx new file mode 100644 index 0000000..30da134 --- /dev/null +++ b/app/(articles)/branch-life-sketch/pages/[pageIndex]/layout.tsx @@ -0,0 +1,21 @@ +import { ReactNode } from "react"; +import ArticleLayout from "@/app/components/ArticleLayout"; +import { BreadcrumbItem } from "@/app/components/Breadcrumb"; +import ArticleWithBreadcrumb from "@/app/components/ArticleWithBreadcrumb"; + +const breadcrumb: BreadcrumbItem[] = [ + { title: "首页", href: "/" }, + { title: "分院生活剪影", href: "/branch-life-sketch/pages/1" }, +]; + +const Layout = ({ children }: { children: ReactNode }) => { + return ( + + + {children} + + + ); +}; + +export default Layout; diff --git a/app/(articles)/branch-life-sketch/pages/[pageIndex]/page.tsx b/app/(articles)/branch-life-sketch/pages/[pageIndex]/page.tsx new file mode 100644 index 0000000..38aea84 --- /dev/null +++ b/app/(articles)/branch-life-sketch/pages/[pageIndex]/page.tsx @@ -0,0 +1,23 @@ +import React from "react"; +import ArticleList from "@/app/components/ArticleList"; + +const Page = ({ + params, +}: { + params: { + pageIndex: string; + }; +}) => { + const { pageIndex } = params; + return ( + <> + + + ); +}; + +export default Page; diff --git a/app/components/BranchLifeSketch.tsx b/app/components/BranchLifeSketch.tsx new file mode 100644 index 0000000..de0fed0 --- /dev/null +++ b/app/components/BranchLifeSketch.tsx @@ -0,0 +1,83 @@ +"use client"; +import styles from "@/app/assets/page.module.css"; +import Image from "next/image"; +import trumpetIcon from "@/app/assets/trumpet-icon.png"; +import { articleDetail, listArticles } from "@/app/api/articles"; +import { htmlToText } from "html-to-text"; +import Link from "next/link"; + +const BranchLifeSketch = async () => { + const { lists } = await listArticles({ cid: "13" }); + return ( +
+
+ {"trumpet + 分院生活剪影 +
+
+ {/*@ts-ignore*/} + + {lists?.map(async (article) => { + const articleInfo = await articleDetail({ + id: `${article.id}`, + }); + const articleText = htmlToText(articleInfo.content, { + selectors: [ + { + selector: "img", + format: "skip", + }, + ], + }); + return ( + // @ts-ignore + +
+ + {article.title} + +
+ + {article.title} + +
+ {articleText} +
+
+
+ {/*@ts-ignore*/} +
+ ); + })} + {/*@ts-ignore*/} +
+
+
+ ); +}; + +export default BranchLifeSketch; diff --git a/app/components/FriendLinks.tsx b/app/components/FriendLinks.tsx index 4ae0c48..a490daf 100644 --- a/app/components/FriendLinks.tsx +++ b/app/components/FriendLinks.tsx @@ -62,6 +62,7 @@ const FriendLinks = () => { {links.map((link) => (
  • diff --git a/app/components/MainNav.tsx b/app/components/MainNav.tsx index 35b1664..161f620 100644 --- a/app/components/MainNav.tsx +++ b/app/components/MainNav.tsx @@ -65,6 +65,9 @@ const MainNav = () => { key={navigation.title + index} > { + setActivePopup(() => -1); + }} href={navigation.href} target={navigation.target} className={`${ @@ -88,6 +91,9 @@ const MainNav = () => { {navigation.children.map((child) => (
  • { + setActivePopup(() => -1); + }} className={ "h-10 flex justify-center items-center text-[13px] px-2 hover:text-[#fe5722]" } diff --git a/app/page.tsx b/app/page.tsx index 9550a85..b4240c7 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -5,6 +5,7 @@ import { register } from "swiper/element/bundle"; import AnhuiSwiper from "@/app/components/AnhuiSwiper"; import LatestNews from "@/app/components/LatestNews"; import FriendLinks from "@/app/components/FriendLinks"; +import BranchLifeSketch from "@/app/components/BranchLifeSketch"; export default async function Home() { return ( @@ -80,6 +81,9 @@ export default async function Home() { target="_blank" /> +
    + +