大改动

This commit is contained in:
宇阳
2024-12-17 12:42:40 +08:00
parent 4aadafd358
commit 290f3eba2e
17 changed files with 38 additions and 38 deletions

View File

@@ -6,10 +6,6 @@
<p align="center" style="font-size:20px; font-weight:700;">ThriveX</p>
<p align="center">
官网:<a href="https://thrivex.liuyuyang.net/" target="_blank">https://thrivex.liuyuyang.net/</a>
</p>
<p align="center" style="margin-bottom:10px">年轻、高颜值、全开源、永不收费的现代化博客管理系统</p>
![](https://bu.dusays.com/2024/11/25/67445b7df3742.png)
@@ -275,7 +271,6 @@ lyy:
## 项目后续的开发计划
![PixPin_2024-11-11_18-03-02.png](https://bu.dusays.com/2024/11/11/6731d7056b4ee.png)

View File

@@ -1,7 +1,7 @@
import Request from "@/utils/request";
// 获取项目配置
export const getConfigDataAPI = <T>(type: string) => Request<T>("GET", `/config/list/${type}`)
export const getThemeDataAPI = <T>(type: string) => Request<T>("GET", `/config/list/${type}`)
// 修改项目配置
export const editConfigDataAPI = (type: string, data: object) => Request<{ [string: string]: string }>("PATCH", `/config/${type}`, { data })
export const editThemeDataAPI = (type: string, data: object) => Request<{ [string: string]: string }>("PATCH", `/config/${type}`, { data })

View File

@@ -7,12 +7,12 @@ import { Article } from '@/types/app/article';
import { Record } from '@/types/app/record'
import { getArticlePagingAPI } from '@/api/article'
import { getConfigDataAPI } from '@/api/project'
import { getThemeDataAPI } from '@/api/project'
import { getUserDataAPI } from '@/api/user'
import { getRecordPagingAPI } from '@/api/record';
export async function GET() {
const { data: web } = await getConfigDataAPI<Web>("web") || { data: {} as Web }
const { data: web } = await getThemeDataAPI<Web>("web") || { data: {} as Web }
const { data: user } = await getUserDataAPI() || { data: {} as User }
const { data: article } = await getArticlePagingAPI({ pagination: { page: 1, size: 8 } }) || { data: {} as Paginate<Article[]> }
const { data: record } = await getRecordPagingAPI({ pagination: { page: 1, size: 8 } }) || { data: {} as Paginate<Record[]> }

View File

@@ -69,7 +69,7 @@ const ContentMD = ({ data }: Props) => {
return (
<PhotoView src={src || ''}>
<span className="flex justify-center w-full my-4">
<span className="flex justify-center sm:justify-start w-full sm:w-3/6 my-4">
<img ref={imgRef} alt={alt} src={src} />
</span>
</PhotoView>
@@ -80,7 +80,7 @@ const ContentMD = ({ data }: Props) => {
const [poster, width = '640'] = title ? title.split(',') : [];
return (
<div className="flex justify-center w-full my-4">
<div className="flex justify-center sm:justify-start w-full sm:w-3/6 my-4">
<video
controls
width={width}

View File

@@ -1,7 +1,7 @@
import Link from "next/link";
import { Metadata } from "next";
import { getConfigDataAPI } from "@/api/project";
import { getThemeDataAPI } from "@/api/project";
import { getWebListAPI, getWebTypeListAPI } from '@/api/web'
import { Web as WebLink, WebType } from "@/types/app/web";
@@ -20,7 +20,7 @@ export const metadata: Metadata = {
export default async () => {
const { data: user } = await getUserDataAPI() || { data: {} as User }
const { data: web } = await getConfigDataAPI<Web>("web") || { data: {} as Web }
const { data: web } = await getThemeDataAPI<Web>("web") || { data: {} as Web }
const { data: linkList } = await getWebListAPI() || { data: [] as WebLink[] }
const { data: typeList } = await getWebTypeListAPI() || { data: [] as WebType[] }

View File

@@ -8,7 +8,7 @@ import RouteChangeHandler from '@/components/RouteChangeHandler'
import "@/styles/index.scss";
import "@/styles/tailwind.scss";
import { getConfigDataAPI } from '@/api/project'
import { getThemeDataAPI } from '@/api/project'
import Tools from '@/components/Tools';
import NProgress from '@/components/NProgress';
@@ -16,7 +16,7 @@ import Confetti from '@/components/Confetti';
import { Web } from '@/types/app/project';
export default async function RootLayout({ children }: Readonly<{ children: React.ReactNode }>) {
const { data } = await getConfigDataAPI<Web>("web") || { data: {} as Web };
const { data } = await getThemeDataAPI<Web>("web") || { data: {} as Web };
// 尊重开源,禁止删除此版权信息!!!
console.log("🚀 欢迎使用 ThriveX 现代化博客管理系统")

View File

@@ -5,7 +5,7 @@ import Container from "@/components/Container";
import ArticleLayout from "@/components/ArticleLayout";
import Sidebar from "@/components/Sidebar";
import { getConfigDataAPI } from '@/api/project'
import { getThemeDataAPI } from '@/api/project'
import { Theme } from "@/types/app/project";
interface Props {
@@ -14,7 +14,7 @@ interface Props {
export default async ({ searchParams }: Props) => {
const page = searchParams.page || 1;
const { data } = await getConfigDataAPI<Theme>("layout") || { data: {} as Theme }
const { data } = await getThemeDataAPI<Theme>("layout") || { data: {} as Theme }
return (
<>

View File

@@ -8,6 +8,8 @@ import { dayFormat } from '@/utils'
import Pagination from "@/components/Pagination";
import Empty from "@/components/Empty";
import Show from "@/components/Show";
import { getThemeDataAPI } from "@/api/project";
import { Theme } from "@/types/app/project";
interface Props {
searchParams: { page: number };
@@ -18,15 +20,16 @@ export default async ({ searchParams }: Props) => {
const { data: user } = await getUserDataAPI() || { data: {} as User }
const { data: record } = await getRecordPagingAPI({ pagination: { page, size: 8 } }) || { data: {} as Paginate<Record[]> }
const { data: theme } = await getThemeDataAPI<Theme>("layout") || { data: {} as Theme }
return (
<>
<div className="bg-[linear-gradient(to_right,#fff1eb_0%,#d0edfb_100%)] dark:bg-[linear-gradient(to_right,#232931_0%,#232931_100%)]">
<div className="w-full lg:w-[800px] px-6 lg:px-0 mx-auto pt-24 pb-10">
<div className="flex items-center flex-col p-4 mb-10 border dark:border-black-b rounded-lg bg-white dark:bg-black-b bg-[url('https://bu.dusays.com/2024/11/27/6746e3ec88c4f.jpg')] bg-no-repeat bg-center bg-cover transition-colors">
<img src={user.avatar} alt="作者头像" width={80} height={80} className="rounded-full avatar-animation shadow-[5px_11px_30px_20px_rgba(255,255,255,0.3)]" />
<h2 className="my-2 text-white">👋 Liu </h2>
<h4 className="text-xs text-gray-300">🎯 </h4>
<h2 className="my-2 text-white">{theme.record_name}</h2>
<h4 className="text-xs text-gray-300">{theme.record_info}</h4>
</div>
<div className="space-y-12">

View File

@@ -9,7 +9,7 @@ import { GoTag } from "react-icons/go";
import Empty from '@/components/Empty';
import Show from '@/components/Show';
import { getConfigDataAPI } from '@/api/project'
import { getThemeDataAPI } from '@/api/project'
import { Theme } from '@/types/app/project';
interface ClassicsProps {
@@ -17,7 +17,7 @@ interface ClassicsProps {
}
const Classics = async ({ data }: ClassicsProps) => {
const { data: theme } = await getConfigDataAPI<Theme>("layout") || { data: {} as Theme }
const { data: theme } = await getThemeDataAPI<Theme>("layout") || { data: {} as Theme }
const covers = JSON.parse(theme.covers || '[]')

View File

@@ -2,12 +2,12 @@ import { getArticlePagingAPI } from '@/api/article'
import Pagination from "../Pagination"
import Classics from "./Classics"
import Waterfall from "./Waterfall"
import { getConfigDataAPI } from '@/api/project'
import { getThemeDataAPI } from '@/api/project'
import { Theme } from '@/types/app/project'
import { Article } from '@/types/app/article'
export default async ({ page }: { page: number }) => {
const { data: theme } = await getConfigDataAPI<Theme>("layout") || { data: {} as Theme }
const { data: theme } = await getThemeDataAPI<Theme>("layout") || { data: {} as Theme }
const sidebar: string[] = JSON.parse(theme?.right_sidebar)
// 如果是瀑布流布局就显示28条数据否则显示8条

View File

@@ -1,13 +1,13 @@
import Link from 'next/link';
import { Tooltip } from '@nextui-org/react';
import { getConfigDataAPI } from '@/api/project';
import { getThemeDataAPI } from '@/api/project';
import { getUserDataAPI } from '@/api/user';
import { User } from '@/types/app/user';
import { Web } from '@/types/app/project';
export default async () => {
const { data: { avatar } } = await getUserDataAPI() || { data: {} as User }
const { data: { footer } } = await getConfigDataAPI<Web>("web") || { data: {} as Web }
const { data: { footer } } = await getThemeDataAPI<Web>("web") || { data: {} as Web }
return (
<>

View File

@@ -14,7 +14,7 @@ import { BsFillMoonStarsFill, BsTextIndentLeft } from "react-icons/bs";
import { Cate } from '@/types/app/cate';
import { getCateListAPI } from '@/api/cate';
import { getConfigDataAPI } from '@/api/project';
import { getThemeDataAPI } from '@/api/project';
import { useConfigStore } from '@/stores';
import { Theme, Web } from '@/types/app/project';
@@ -25,10 +25,10 @@ const Header = () => {
// 获取项目配置
const getConfigData = async () => {
const { data: web } = await getConfigDataAPI<Web>("web") || { data: {} as Web };
const { data: web } = await getThemeDataAPI<Web>("web") || { data: {} as Web };
setWeb(web)
const { data: theme } = await getConfigDataAPI<Theme>("layout") || { data: {} as Theme };
const { data: theme } = await getThemeDataAPI<Theme>("layout") || { data: {} as Theme };
setTheme(theme)
}

View File

@@ -11,14 +11,14 @@ import QQ from '@/assets/svg/socializing/QQ.svg'
import Weixin from '@/assets/svg/socializing/Weixin.svg'
import { getUserDataAPI } from '@/api/user';
import { getConfigDataAPI } from '@/api/project'
import { getThemeDataAPI } from '@/api/project'
import './index.scss';
import { User } from '@/types/app/user';
const Author = async () => {
const { data: user } = await getUserDataAPI() || { data: {} as User }
const { data: { social } } = await getConfigDataAPI<Theme>("layout") || { data: {} as Theme }
const { data: { social } } = await getThemeDataAPI<Theme>("layout") || { data: {} as Theme }
const socialList = JSON.parse(social)?.map((item: string) => item)

View File

@@ -1,6 +1,6 @@
import Link from 'next/link';
import Image from 'next/image';
import { getConfigDataAPI } from '@/api/project'
import { getThemeDataAPI } from '@/api/project'
import { getArticleListAPI } from '@/api/article';
import { IoIosArrowForward } from "react-icons/io";
import fire from '@/assets/svg/other/fire.svg';
@@ -9,7 +9,7 @@ import { Theme } from '@/types/app/project';
import { Article } from '@/types/app/article';
const RandomArticle = async () => {
const { data: theme } = await getConfigDataAPI<Theme>("layout") || { data: {} as Theme }
const { data: theme } = await getThemeDataAPI<Theme>("layout") || { data: {} as Theme }
const { data: article } = await getArticleListAPI() || { data: [] as Article[] }
const ids = JSON.parse(theme.reco_article ? theme.reco_article : '[]')

View File

@@ -2,11 +2,11 @@ import Author from "./Author"
import HotArticle from "./HotArticle"
import RandomArticle from "./RandomArticle"
import Comment from "./Comment"
import { getConfigDataAPI } from '@/api/project'
import { getThemeDataAPI } from '@/api/project'
import { Theme } from "@/types/app/project"
export default async () => {
const { data: theme } = await getConfigDataAPI<Theme>("layout") || { data: {} as Theme }
const { data: theme } = await getThemeDataAPI<Theme>("layout") || { data: {} as Theme }
const sidebar: string[] = JSON.parse(theme?.right_sidebar)
return (

View File

@@ -1,7 +1,7 @@
import { ReactNode } from 'react'
import Ripple from '@/components/Ripple'
import { getRandom } from '@/utils'
import { getConfigDataAPI } from '@/api/project'
import { getThemeDataAPI } from '@/api/project'
import { Theme } from '@/types/app/project'
interface Props {
@@ -11,7 +11,7 @@ interface Props {
}
export default async ({ src, isRipple = true, children }: Props) => {
const { data } = await getConfigDataAPI<Theme>("layout") || { data: {} as Theme }
const { data } = await getThemeDataAPI<Theme>("layout") || { data: {} as Theme }
const covers = JSON.parse(data.covers || '[]')
const sty = {

View File

@@ -36,7 +36,9 @@ export interface Theme {
swiper_text: string,
reco_article: string,
social: string,
covers: string
covers: string,
record_name: string,
record_info: string
}
// 其他配置