From 42d517f0a11e0a220dc55377312c700872fde3e4 Mon Sep 17 00:00:00 2001
From: quantulr <35954003+quantulr@users.noreply.github.com>
Date: Wed, 1 Nov 2023 22:25:06 +0800
Subject: [PATCH] bugfix
---
.env.production.local | 4 ++--
.../media-scan/[articleId]/layout.tsx | 19 +++++++++++++++
.../media-scan/[articleId]/page.tsx | 24 +++++++++++++++++++
.../media-scan/pages/[pageIndex]/layout.tsx | 20 ++++++++++++++++
.../media-scan/pages/[pageIndex]/page.tsx | 18 ++++++++++++++
app/components/ArticleBlock.tsx | 2 +-
app/components/LatestNews.tsx | 15 ++++++------
next.config.js | 5 ++++
8 files changed, 96 insertions(+), 11 deletions(-)
create mode 100644 app/(articles)/media-scan/[articleId]/layout.tsx
create mode 100644 app/(articles)/media-scan/[articleId]/page.tsx
create mode 100644 app/(articles)/media-scan/pages/[pageIndex]/layout.tsx
create mode 100644 app/(articles)/media-scan/pages/[pageIndex]/page.tsx
diff --git a/.env.production.local b/.env.production.local
index d9f669d..71cea7c 100644
--- a/.env.production.local
+++ b/.env.production.local
@@ -1,2 +1,2 @@
-NEXT_PUBLIC_ADMIN_BASE_URL=/admin-api
-NEXT_PUBLIC_FRONT_BASE_URL=/front-api
+NEXT_PUBLIC_ADMIN_BASE_URL=http://101.34.131.16:8082/api
+NEXT_PUBLIC_FRONT_BASE_URL=http://101.34.131.16:8084/api
diff --git a/app/(articles)/media-scan/[articleId]/layout.tsx b/app/(articles)/media-scan/[articleId]/layout.tsx
new file mode 100644
index 0000000..cb6b744
--- /dev/null
+++ b/app/(articles)/media-scan/[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)/media-scan/[articleId]/page.tsx b/app/(articles)/media-scan/[articleId]/page.tsx
new file mode 100644
index 0000000..9329b6e
--- /dev/null
+++ b/app/(articles)/media-scan/[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)/media-scan/pages/[pageIndex]/layout.tsx b/app/(articles)/media-scan/pages/[pageIndex]/layout.tsx
new file mode 100644
index 0000000..cd8b1fe
--- /dev/null
+++ b/app/(articles)/media-scan/pages/[pageIndex]/layout.tsx
@@ -0,0 +1,20 @@
+import { ReactNode } from "react";
+import ArticleLayout from "@/app/components/ArticleLayout";
+import Breadcrumb, { BreadcrumbItem } from "@/app/components/Breadcrumb";
+import ArticleWithBreadcrumb from "@/app/components/ArticleWithBreadcrumb";
+
+const breadcrumb: BreadcrumbItem[] = [
+ { title: "首页", href: "/" },
+ { title: "媒体扫描", href: "/media-scan/pages/1" },
+];
+const Layout = ({ children }: { children: ReactNode }) => {
+ return (
+
+
+ {children}
+
+
+ );
+};
+
+export default Layout;
diff --git a/app/(articles)/media-scan/pages/[pageIndex]/page.tsx b/app/(articles)/media-scan/pages/[pageIndex]/page.tsx
new file mode 100644
index 0000000..fc75584
--- /dev/null
+++ b/app/(articles)/media-scan/pages/[pageIndex]/page.tsx
@@ -0,0 +1,18 @@
+import ArticleList from "@/app/components/ArticleList";
+
+const Page = ({
+ params,
+}: {
+ params: {
+ pageIndex: string;
+ };
+}) => {
+ const { pageIndex } = params;
+ return (
+ <>
+
+ >
+ );
+};
+
+export default Page;
diff --git a/app/components/ArticleBlock.tsx b/app/components/ArticleBlock.tsx
index 211c8a9..7f9d989 100644
--- a/app/components/ArticleBlock.tsx
+++ b/app/components/ArticleBlock.tsx
@@ -50,7 +50,7 @@ const ArticleBlock = async ({
- {data.lists.map((article) => (
+ {data.lists?.map((article) => (
-
{
pageSize: 1,
sort: "new",
});
- if (!lists.length) {
+ if (!lists?.length) {
return <>>;
}
const { id } = lists[0];
@@ -18,22 +18,21 @@ const LatestNews = async () => {
id: `${id}`,
});
- // const text = window.document.createElement("div");
- // text.innerHTML = article.content;
const content = htmlToText(article.content, {
- // baseElements:{
- // selectors:['p']
- // }
selectors: [{ selector: "img", format: "skip" }],
});
- // const content = text.innerText;
+
return (
-
+