This commit is contained in:
quantulr
2023-11-08 17:19:55 +08:00
parent cecc64f366
commit 73ae2850b6
13 changed files with 42 additions and 40 deletions

View File

@ -1,4 +1,2 @@
NEXT_PUBLIC_ADMIN_BASE_URL=http://localhost:8082/api NEXT_PUBLIC_BASE_URL=http://localhost:8086/api
NEXT_PUBLIC_FRONT_BASE_URL=http://localhost:8084/api
NEXT_PUBLIC_CLIENT_BASE_URL=/api NEXT_PUBLIC_CLIENT_BASE_URL=/api
NEXT_PUBLIC_CLIENT_ADMIN_BASE_URL=/admin-api

View File

@ -6,7 +6,7 @@ const Page = () => {
<ArticleHeading text={"组织架构"} /> <ArticleHeading text={"组织架构"} />
<img <img
className={"w-full"} className={"w-full"}
src={`${process.env.NEXT_PUBLIC_CLIENT_ADMIN_BASE_URL}/uploads/image/20231030/5c0b98dc-cf76-49c3-a510-f2f197f7dd09.jpeg`} src={`${process.env.NEXT_PUBLIC_CLIENT_BASE_URL}/uploads/image/20231030/5c0b98dc-cf76-49c3-a510-f2f197f7dd09.jpeg`}
/> />
</> </>
); );

View File

@ -8,7 +8,7 @@ const Page = () => {
<p className={"text-center text-base"}></p> <p className={"text-center text-base"}></p>
<p className={"mt-2 flex justify-center"}> <p className={"mt-2 flex justify-center"}>
<img <img
src={`${process.env.NEXT_PUBLIC_CLIENT_ADMIN_BASE_URL}/uploads/image/20231030/8d05e613-e2c6-47d1-81a9-08bd70b8ba73.jpeg`} src={`${process.env.NEXT_PUBLIC_CLIENT_BASE_URL}/uploads/image/20231030/8d05e613-e2c6-47d1-81a9-08bd70b8ba73.jpeg`}
alt={"张景中"} alt={"张景中"}
/> />
</p> </p>

View File

@ -59,7 +59,7 @@ const Page = () => {
> >
<img <img
className={"h-[138px]"} className={"h-[138px]"}
src={`${process.env.NEXT_PUBLIC_CLIENT_ADMIN_BASE_URL}${academician.picture}`} src={`${process.env.NEXT_PUBLIC_CLIENT_BASE_URL}${academician.picture}`}
/> />
<Link href={academician.link}>{academician.name}</Link> <Link href={academician.link}>{academician.name}</Link>
</div> </div>

View File

@ -28,7 +28,7 @@ const Page = () => {
> >
<img <img
className={"h-[138px]"} className={"h-[138px]"}
src={`${process.env.NEXT_PUBLIC_CLIENT_ADMIN_BASE_URL}${academician.picture}`} src={`${process.env.NEXT_PUBLIC_CLIENT_BASE_URL}${academician.picture}`}
/> />
<Link href={academician.link}>{academician.name}</Link> <Link href={academician.link}>{academician.name}</Link>
</div> </div>

View File

@ -153,7 +153,7 @@ const AnhuiSwiper = () => {
<img <img
className={"h-full w-full object-contain"} className={"h-full w-full object-contain"}
src={`${ src={`${
process.env.NEXT_PUBLIC_CLIENT_ADMIN_BASE_URL process.env.NEXT_PUBLIC_CLIENT_BASE_URL
}${el.path.match(/\/uploads\/.*/)?.[0]}`} }${el.path.match(/\/uploads\/.*/)?.[0]}`}
alt={""} alt={""}
/> />

View File

@ -2,7 +2,6 @@ import Image from "next/image";
import trumpetIcon from "@/app/_assets/trumpet-icon.png"; import trumpetIcon from "@/app/_assets/trumpet-icon.png";
import styles from "@/app/_assets/page.module.css"; import styles from "@/app/_assets/page.module.css";
import Link from "next/link"; import Link from "next/link";
import request from "@/app/_lib/request";
import { listArticles } from "@/app/_services/articles"; import { listArticles } from "@/app/_services/articles";
import dayjs from "dayjs"; import dayjs from "dayjs";

View File

@ -84,7 +84,7 @@ const ArticleItem = ({ article }: { article: Article }) => {
className={"h-full w-full"} className={"h-full w-full"}
src={ src={
cover_path cover_path
? `${process.env.NEXT_PUBLIC_CLIENT_ADMIN_BASE_URL}${cover_path}` ? `${process.env.NEXT_PUBLIC_CLIENT_BASE_URL}${cover_path}`
: undefined : undefined
} }
/> />

View File

@ -30,7 +30,7 @@ const LatestNews = async () => {
> >
<img <img
className={"h-full w-full object-cover"} className={"h-full w-full object-cover"}
src={`${process.env.NEXT_PUBLIC_CLIENT_ADMIN_BASE_URL}/uploads/${article.image}`} src={`${process.env.NEXT_PUBLIC_CLIENT_BASE_URL}/uploads/${article.image}`}
alt={""} alt={""}
/> />
</Link> </Link>

View File

@ -1,14 +1,12 @@
import axios from "axios"; import axios from "axios";
const axiosInstance = axios.create({ const axiosInstance = axios.create({
baseURL: process.env.NEXT_PUBLIC_FRONT_BASE_URL, baseURL: process.env.NEXT_PUBLIC_BASE_URL,
}); });
const axiosClientInstance = axios.create({ const axiosClientInstance = axios.create({
baseURL: process.env.NEXT_PUBLIC_CLIENT_BASE_URL, 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) => { axiosInstance.interceptors.response.use((response) => {
return response.data; return response.data;
@ -17,9 +15,6 @@ axiosInstance.interceptors.response.use((response) => {
axiosClientInstance.interceptors.response.use((response) => { axiosClientInstance.interceptors.response.use((response) => {
return response.data; return response.data;
}); });
axiosClientAdminInstance.interceptors.response.use((response) => {
return response.data;
});
export { axiosClientInstance, axiosClientAdminInstance }; export { axiosClientInstance };
export default axiosInstance; export default axiosInstance;

View File

@ -1,5 +1,4 @@
import request from "@/app/_lib/request"; import { PageData } from "@/app/_types/base";
import { BaseResponse, PageData } from "@/app/_types/base";
import { import {
Article, Article,
ArticleDetail, ArticleDetail,
@ -7,18 +6,30 @@ import {
ArticleListParams, ArticleListParams,
} from "@/app/_types/article"; } from "@/app/_types/article";
export const listArticles = (params: ArticleListParams) => export const listArticles = (
request params: ArticleListParams,
.get<never, BaseResponse<PageData<Article>>>("/article/list", { ): Promise<PageData<Article>> =>
params, fetch(
}) `${process.env.NEXT_PUBLIC_BASE_URL}/article/list?${new URLSearchParams(
.then((res) => { params as Record<string, any>,
return res.data; )}`,
}); {
cache: "no-store",
},
)
.then((res) => res.json())
.then((json) => json.data);
export const articleDetail = (params: ArticleDetailParams) => export const articleDetail = (
request params: ArticleDetailParams,
.get<never, BaseResponse<ArticleDetail>>("/pc/articleDetail", { ): Promise<ArticleDetail> =>
params, fetch(
}) `${process.env.NEXT_PUBLIC_BASE_URL}/pc/articleDetail?${new URLSearchParams(
.then((res) => res.data); params as Record<string, any>,
)}`,
{
cache: "no-store",
},
)
.then((res) => res.json())
.then((json) => json.data);

View File

@ -8,7 +8,6 @@ import FriendLinks from "@/app/_components/FriendLinks";
import BranchLifeSketch from "@/app/_components/BranchLifeSketch"; import BranchLifeSketch from "@/app/_components/BranchLifeSketch";
import { ReactNode } from "react"; import { ReactNode } from "react";
export const dynamic = "force-dynamic";
export default async function Home() { export default async function Home() {
return ( return (
<main className={"mt-1 flex justify-between bg-[#f5fafe]"}> <main className={"mt-1 flex justify-between bg-[#f5fafe]"}>

View File

@ -4,12 +4,12 @@ const nextConfig = {
return process.env.NODE_ENV === "development" return process.env.NODE_ENV === "development"
? [ ? [
{ {
source: "/api/:path*", source: "/api/uploads/:path*",
destination: "http://101.34.131.16:8086/api/:path*", destination: "http://101.34.131.16:8086/api/uploads/:path*",
}, },
{ {
source: "/admin-api/:path*", source: "/api/:path*",
destination: "http://101.34.131.16:8086/admin-api/:path*", destination: "http://101.34.131.16:8086/api/:path*",
}, },
] ]
: []; : [];