From 1a20d6084131281b2a95d8b6e4738e1b8f88c135 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Liu=20=E5=AE=87=E9=98=B3?= Date: Wed, 13 Nov 2024 13:08:48 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=EF=BC=9A=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/Project.ts | 4 ++- src/pages/Setup/components/Theme/index.tsx | 40 ++++++++++++++++++++-- src/pages/Setup/components/Web/index.tsx | 4 +-- src/types/app/project.d.ts | 8 +++-- src/utils/request.ts | 4 +-- 5 files changed, 49 insertions(+), 11 deletions(-) diff --git a/src/api/Project.ts b/src/api/Project.ts index 83f1327..333b593 100644 --- a/src/api/Project.ts +++ b/src/api/Project.ts @@ -12,6 +12,8 @@ export const editWebDataAPI = (data: Web) => Request("PATCH", "/project/web // 获取主题配置信息 export const getThemeDataAPI = () => Request("GET", "/project/theme") +// export const getThemeDataAPI = () => Request("GET", "/project/layout") // 修改主题配置信息 -export const editThemeDataAPI = (data: Theme) => Request("PATCH", "/project/theme", { data }) \ No newline at end of file +export const editThemeDataAPI = (data: Theme) => Request("PATCH", "/project/theme", { data }) +// export const editThemeDataAPI = (data: Theme) => Request("PATCH", "/project/layout", { data }) \ No newline at end of file diff --git a/src/pages/Setup/components/Theme/index.tsx b/src/pages/Setup/components/Theme/index.tsx index a539c33..0c25e91 100644 --- a/src/pages/Setup/components/Theme/index.tsx +++ b/src/pages/Setup/components/Theme/index.tsx @@ -7,8 +7,10 @@ import FileUpload from '@/components/FileUpload'; const ThemePage = () => { const [loading, setLoading] = useState(false); - const [swiperText, setSwiperText] = useState(''); const [isModalOpen, setIsModalOpen] = useState(false); + const [swiperText, setSwiperText] = useState(''); + const [social, setSocial] = useState(''); + const [cover, setCover] = useState(''); const [theme, setTheme] = useState({} as Theme); const onSidebar = (value: string) => { @@ -25,6 +27,9 @@ const ThemePage = () => { const swiperText = JSON.parse(data.swiperText) setSwiperText(swiperText.join('\n')); + + setSocial(JSON.parse(data.social).join("\n")); + setCover(JSON.parse(data.covers).join("\n")); setLoading(false); }; @@ -34,7 +39,14 @@ const ThemePage = () => { const editLayoutData = async () => { setLoading(true); - const updatedLayout = { ...theme, swiperText: JSON.stringify(swiperText.split('\n')) }; + + const updatedLayout = { + ...theme, + swiperText: JSON.stringify(swiperText.split('\n')), + social: JSON.stringify(social.split('\n')), + covers: JSON.stringify(cover.split('\n')) + }; + await editThemeDataAPI(updatedLayout); notification.success({ message: '成功', @@ -84,6 +96,28 @@ const ThemePage = () => { + 社交网站 +
+ setSocial(e.target.value)} + autoSize={{ minRows: 2, maxRows: 4 }} + size='large' + /> + +
+ + 文章随机封面 +
+ setCover(e.target.value)} + autoSize={{ minRows: 2, maxRows: 4 }} + size='large' + /> + +
+ 侧边栏
@@ -128,4 +162,4 @@ const ThemePage = () => { ); }; -export default ThemePage; +export default ThemePage; \ No newline at end of file diff --git a/src/pages/Setup/components/Web/index.tsx b/src/pages/Setup/components/Web/index.tsx index 4e06420..e9e59c4 100644 --- a/src/pages/Setup/components/Web/index.tsx +++ b/src/pages/Setup/components/Web/index.tsx @@ -97,7 +97,7 @@ const WebPage = () => { - { autoSize={{ minRows: 2, maxRows: 10 }} placeholder="社交账号" /> - + */}