调整:项目配置
This commit is contained in:
@@ -12,6 +12,8 @@ export const editWebDataAPI = (data: Web) => Request<Web>("PATCH", "/project/web
|
||||
|
||||
// 获取主题配置信息
|
||||
export const getThemeDataAPI = () => Request<Theme>("GET", "/project/theme")
|
||||
// export const getThemeDataAPI = () => Request<Theme>("GET", "/project/layout")
|
||||
|
||||
// 修改主题配置信息
|
||||
export const editThemeDataAPI = (data: Theme) => Request<Theme>("PATCH", "/project/theme", { data })
|
||||
export const editThemeDataAPI = (data: Theme) => Request<Theme>("PATCH", "/project/theme", { data })
|
||||
// export const editThemeDataAPI = (data: Theme) => Request<Theme>("PATCH", "/project/layout", { data })
|
||||
@@ -7,8 +7,10 @@ import FileUpload from '@/components/FileUpload';
|
||||
|
||||
const ThemePage = () => {
|
||||
const [loading, setLoading] = useState<boolean>(false);
|
||||
const [swiperText, setSwiperText] = useState<string>('');
|
||||
const [isModalOpen, setIsModalOpen] = useState<boolean>(false);
|
||||
const [swiperText, setSwiperText] = useState<string>('');
|
||||
const [social, setSocial] = useState<string>('');
|
||||
const [cover, setCover] = useState<string>('');
|
||||
const [theme, setTheme] = useState<Theme>({} 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 = () => {
|
||||
<Alert message="以换行分隔,每行表示一段文本" type="info" className="mt-2" />
|
||||
</div>
|
||||
|
||||
<Divider orientation="left">社交网站</Divider>
|
||||
<div className="mb-8">
|
||||
<Input.TextArea
|
||||
value={social}
|
||||
onChange={(e) => setSocial(e.target.value)}
|
||||
autoSize={{ minRows: 2, maxRows: 4 }}
|
||||
size='large'
|
||||
/>
|
||||
<Alert message="以换行分隔,每行表示一段文本" type="info" className="mt-2" />
|
||||
</div>
|
||||
|
||||
<Divider orientation="left">文章随机封面</Divider>
|
||||
<div className="mb-8">
|
||||
<Input.TextArea
|
||||
value={cover}
|
||||
onChange={(e) => setCover(e.target.value)}
|
||||
autoSize={{ minRows: 2, maxRows: 4 }}
|
||||
size='large'
|
||||
/>
|
||||
<Alert message="以换行分隔,每行表示一段文本" type="info" className="mt-2" />
|
||||
</div>
|
||||
|
||||
<Divider orientation="left">侧边栏</Divider>
|
||||
<div className='overflow-auto w-full'>
|
||||
<div className="sidebar w-[750px] flex mb-4">
|
||||
@@ -128,4 +162,4 @@ const ThemePage = () => {
|
||||
);
|
||||
};
|
||||
|
||||
export default ThemePage;
|
||||
export default ThemePage;
|
||||
@@ -97,7 +97,7 @@ const WebPage = () => {
|
||||
<Input placeholder="Java,前端,Python" />
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item
|
||||
{/* <Form.Item
|
||||
label="随机文章封面"
|
||||
name="covers"
|
||||
rules={[{ required: true, message: '网站随机封面不能为空' }]}
|
||||
@@ -117,7 +117,7 @@ const WebPage = () => {
|
||||
autoSize={{ minRows: 2, maxRows: 10 }}
|
||||
placeholder="社交账号"
|
||||
/>
|
||||
</Form.Item>
|
||||
</Form.Item> */}
|
||||
|
||||
<Form.Item
|
||||
label="底部信息"
|
||||
|
||||
8
src/types/app/project.d.ts
vendored
8
src/types/app/project.d.ts
vendored
@@ -19,8 +19,8 @@ export interface Web {
|
||||
keyword: string,
|
||||
footer: string,
|
||||
// font: string,
|
||||
social: string,
|
||||
covers: string
|
||||
// social: string,
|
||||
// covers: string
|
||||
}
|
||||
|
||||
export type ArticleLayout = "classics" | "card" | "waterfall" | ""
|
||||
@@ -31,5 +31,7 @@ export interface Theme {
|
||||
isArticleLayout: string,
|
||||
rightSidebar: string,
|
||||
swiperImage: string,
|
||||
swiperText: string
|
||||
swiperText: string,
|
||||
social: string,
|
||||
covers: string
|
||||
}
|
||||
@@ -3,8 +3,8 @@ import { Modal, notification } from "antd";
|
||||
import { useUserStore } from "@/stores";
|
||||
|
||||
// 配置项目API域名
|
||||
// export const baseURL = "http://localhost:9003/api";
|
||||
export const baseURL = "https://api.liuyuyang.net/api";
|
||||
export const baseURL = "http://localhost:9003/api";
|
||||
// export const baseURL = "https://api.liuyuyang.net/api";
|
||||
|
||||
// 创建 axios 实例
|
||||
export const instance = axios.create({
|
||||
|
||||
Reference in New Issue
Block a user