From 73ae2850b614087a3f95cbc73d6ff82302807f6a Mon Sep 17 00:00:00 2001 From: quantulr <35954003+quantulr@users.noreply.github.com> Date: Wed, 8 Nov 2023 17:19:55 +0800 Subject: [PATCH] update --- .env.production.local | 4 +- .../(generally)/architecture/page.tsx | 2 +- app/(introduce)/talents/academician/page.tsx | 2 +- app/(introduce)/talents/researcher/page.tsx | 2 +- .../talents/vice-researcher/page.tsx | 2 +- app/_components/AnhuiSwiper.tsx | 2 +- app/_components/ArticleBlock.tsx | 1 - app/_components/BranchLifeSketch.tsx | 2 +- app/_components/LatestNews.tsx | 2 +- app/_lib/request.ts | 11 ++--- app/_services/articles.ts | 43 ++++++++++++------- app/page.tsx | 1 - next.config.js | 8 ++-- 13 files changed, 42 insertions(+), 40 deletions(-) diff --git a/.env.production.local b/.env.production.local index 9e19c49..15a7790 100644 --- a/.env.production.local +++ b/.env.production.local @@ -1,4 +1,2 @@ -NEXT_PUBLIC_ADMIN_BASE_URL=http://localhost:8082/api -NEXT_PUBLIC_FRONT_BASE_URL=http://localhost:8084/api +NEXT_PUBLIC_BASE_URL=http://localhost:8086/api NEXT_PUBLIC_CLIENT_BASE_URL=/api -NEXT_PUBLIC_CLIENT_ADMIN_BASE_URL=/admin-api diff --git a/app/(introduce)/organization/(generally)/architecture/page.tsx b/app/(introduce)/organization/(generally)/architecture/page.tsx index fe4fe3d..1e7211a 100644 --- a/app/(introduce)/organization/(generally)/architecture/page.tsx +++ b/app/(introduce)/organization/(generally)/architecture/page.tsx @@ -6,7 +6,7 @@ const Page = () => { ); diff --git a/app/(introduce)/talents/academician/page.tsx b/app/(introduce)/talents/academician/page.tsx index b0f63dc..6fd0300 100644 --- a/app/(introduce)/talents/academician/page.tsx +++ b/app/(introduce)/talents/academician/page.tsx @@ -8,7 +8,7 @@ const Page = () => {

中科院院士

{"张景中"}

diff --git a/app/(introduce)/talents/researcher/page.tsx b/app/(introduce)/talents/researcher/page.tsx index ec582e5..c4bb0b0 100644 --- a/app/(introduce)/talents/researcher/page.tsx +++ b/app/(introduce)/talents/researcher/page.tsx @@ -59,7 +59,7 @@ const Page = () => { > {academician.name} diff --git a/app/(introduce)/talents/vice-researcher/page.tsx b/app/(introduce)/talents/vice-researcher/page.tsx index a2584e7..4488f10 100644 --- a/app/(introduce)/talents/vice-researcher/page.tsx +++ b/app/(introduce)/talents/vice-researcher/page.tsx @@ -28,7 +28,7 @@ const Page = () => { > {academician.name} diff --git a/app/_components/AnhuiSwiper.tsx b/app/_components/AnhuiSwiper.tsx index b24dbc0..a05379e 100644 --- a/app/_components/AnhuiSwiper.tsx +++ b/app/_components/AnhuiSwiper.tsx @@ -153,7 +153,7 @@ const AnhuiSwiper = () => { {""} diff --git a/app/_components/ArticleBlock.tsx b/app/_components/ArticleBlock.tsx index 63a3e64..0471099 100644 --- a/app/_components/ArticleBlock.tsx +++ b/app/_components/ArticleBlock.tsx @@ -2,7 +2,6 @@ import Image from "next/image"; import trumpetIcon from "@/app/_assets/trumpet-icon.png"; import styles from "@/app/_assets/page.module.css"; import Link from "next/link"; -import request from "@/app/_lib/request"; import { listArticles } from "@/app/_services/articles"; import dayjs from "dayjs"; diff --git a/app/_components/BranchLifeSketch.tsx b/app/_components/BranchLifeSketch.tsx index 8b1304f..77c3305 100644 --- a/app/_components/BranchLifeSketch.tsx +++ b/app/_components/BranchLifeSketch.tsx @@ -84,7 +84,7 @@ const ArticleItem = ({ article }: { article: Article }) => { className={"h-full w-full"} src={ cover_path - ? `${process.env.NEXT_PUBLIC_CLIENT_ADMIN_BASE_URL}${cover_path}` + ? `${process.env.NEXT_PUBLIC_CLIENT_BASE_URL}${cover_path}` : undefined } /> diff --git a/app/_components/LatestNews.tsx b/app/_components/LatestNews.tsx index 60137f5..45e8358 100644 --- a/app/_components/LatestNews.tsx +++ b/app/_components/LatestNews.tsx @@ -30,7 +30,7 @@ const LatestNews = async () => { > {""} diff --git a/app/_lib/request.ts b/app/_lib/request.ts index c6e80d7..bfb0893 100644 --- a/app/_lib/request.ts +++ b/app/_lib/request.ts @@ -1,14 +1,12 @@ import axios from "axios"; const axiosInstance = axios.create({ - baseURL: process.env.NEXT_PUBLIC_FRONT_BASE_URL, + baseURL: process.env.NEXT_PUBLIC_BASE_URL, }); + const axiosClientInstance = axios.create({ baseURL: process.env.NEXT_PUBLIC_CLIENT_BASE_URL, }); -const axiosClientAdminInstance = axios.create({ - baseURL: process.env.NEXT_PUBLIC_CLIENT_ADMIN_BASE_URL, -}); axiosInstance.interceptors.response.use((response) => { return response.data; @@ -17,9 +15,6 @@ axiosInstance.interceptors.response.use((response) => { axiosClientInstance.interceptors.response.use((response) => { return response.data; }); -axiosClientAdminInstance.interceptors.response.use((response) => { - return response.data; -}); -export { axiosClientInstance, axiosClientAdminInstance }; +export { axiosClientInstance }; export default axiosInstance; diff --git a/app/_services/articles.ts b/app/_services/articles.ts index 0fa4aeb..c147520 100644 --- a/app/_services/articles.ts +++ b/app/_services/articles.ts @@ -1,5 +1,4 @@ -import request from "@/app/_lib/request"; -import { BaseResponse, PageData } from "@/app/_types/base"; +import { PageData } from "@/app/_types/base"; import { Article, ArticleDetail, @@ -7,18 +6,30 @@ import { ArticleListParams, } from "@/app/_types/article"; -export const listArticles = (params: ArticleListParams) => - request - .get>>("/article/list", { - params, - }) - .then((res) => { - return res.data; - }); +export const listArticles = ( + params: ArticleListParams, +): Promise> => + fetch( + `${process.env.NEXT_PUBLIC_BASE_URL}/article/list?${new URLSearchParams( + params as Record, + )}`, + { + cache: "no-store", + }, + ) + .then((res) => res.json()) + .then((json) => json.data); -export const articleDetail = (params: ArticleDetailParams) => - request - .get>("/pc/articleDetail", { - params, - }) - .then((res) => res.data); +export const articleDetail = ( + params: ArticleDetailParams, +): Promise => + fetch( + `${process.env.NEXT_PUBLIC_BASE_URL}/pc/articleDetail?${new URLSearchParams( + params as Record, + )}`, + { + cache: "no-store", + }, + ) + .then((res) => res.json()) + .then((json) => json.data); diff --git a/app/page.tsx b/app/page.tsx index b1ebf63..22ad9df 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -8,7 +8,6 @@ import FriendLinks from "@/app/_components/FriendLinks"; import BranchLifeSketch from "@/app/_components/BranchLifeSketch"; import { ReactNode } from "react"; -export const dynamic = "force-dynamic"; export default async function Home() { return (
diff --git a/next.config.js b/next.config.js index 107af23..b3b4201 100644 --- a/next.config.js +++ b/next.config.js @@ -4,12 +4,12 @@ const nextConfig = { return process.env.NODE_ENV === "development" ? [ { - source: "/api/:path*", - destination: "http://101.34.131.16:8086/api/:path*", + source: "/api/uploads/:path*", + destination: "http://101.34.131.16:8086/api/uploads/:path*", }, { - source: "/admin-api/:path*", - destination: "http://101.34.131.16:8086/admin-api/:path*", + source: "/api/:path*", + destination: "http://101.34.131.16:8086/api/:path*", }, ] : [];