Skip to content

Commit 136f012

Browse files
committed
feat: add system systemSubTitle setting config
1 parent 848a5da commit 136f012

File tree

6 files changed

+46
-23
lines changed

6 files changed

+46
-23
lines changed

client/pages/page/[id].tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ const Page: NextPage<IProps> = ({ page }) => {
3232
<ImageViewer containerSelector="#js-page-wrapper">
3333
<div id="js-page-wrapper" className={style.container}>
3434
<Helmet>
35-
<title>{page.name + ' | ' + setting.systemTitle}</title>
35+
<title>{page.name + ' - ' + setting.systemTitle}</title>
3636
</Helmet>
3737
<div
3838
style={{

client/src/components/Seo/index.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,14 @@ export const Seo = () => {
88

99
return (
1010
<Helmet>
11-
<title>{setting.systemTitle}</title>
11+
<title>
12+
{setting.systemTitle}{setting.systemSubTitle ? `- ${setting.systemSubTitle}` : ''}
13+
</title>
1214
<meta name="viewport" content="width=device-width,initial-scale=1.0,viewport-fit=cover,maximum-scale=1" />
1315
<meta name="keyword" content={setting.seoKeyword} />
1416
<meta name="description" content={setting.seoDesc} />
1517
<link rel="shortcut icon" href={setting.systemFavicon} />
1618
<link href="//fonts.googleapis.com/css?family=Nunito:400,400i,700,700i&amp;display=swap" rel="stylesheet"></link>
1719
</Helmet>
1820
);
19-
};
21+
};

client/src/components/Setting/SystemSetting/index.tsx

Lines changed: 35 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Form } from 'antd';
1+
import { Form, Image } from 'antd';
22
import { FileImageOutlined } from '@ant-design/icons';
33
import { Button, Input, message } from 'antd';
44
import React, { useEffect, useState } from 'react';
@@ -11,6 +11,7 @@ export const SystemSetting = ({ setting }) => {
1111
const [mode, setMode] = useState('logo');
1212
const [systemUrl, setSystemUrl] = useState(null);
1313
const [systemTitle, setSystemTitle] = useState(null);
14+
const [systemSubTitle, setSystemSubTitle] = useState(null);
1415
const [systemBg, setSystemBg] = useState(null);
1516
const [systemLogo, setSystemLogo] = useState(null);
1617
const [systemFavicon, setSystemFavicon] = useState(null);
@@ -20,6 +21,7 @@ export const SystemSetting = ({ setting }) => {
2021

2122
useEffect(() => {
2223
setSystemUrl((setting && setting.systemUrl) || null);
24+
setSystemSubTitle((setting && setting.systemSubTitle) || null);
2325
setSystemTitle((setting && setting.systemTitle) || null);
2426
setSystemBg((setting && setting.systemBg) || null);
2527
setSystemLogo((setting && setting.systemLogo) || null);
@@ -33,6 +35,7 @@ export const SystemSetting = ({ setting }) => {
3335
const data = {
3436
systemUrl,
3537
systemTitle,
38+
systemSubTitle,
3639
systemBg,
3740
systemLogo,
3841
systemFavicon,
@@ -47,6 +50,24 @@ export const SystemSetting = ({ setting }) => {
4750

4851
return (
4952
<Form layout="vertical">
53+
<Form.Item label="系统标题">
54+
<Input
55+
placeholder="请输入系统标题,将作为 head.title 显示"
56+
value={systemTitle}
57+
onChange={(e) => {
58+
setSystemTitle(e.target.value);
59+
}}
60+
/>
61+
</Form.Item>
62+
<Form.Item label="系统标题">
63+
<Input
64+
placeholder="请输入系统副标题,首页将在系统标题后展示"
65+
value={systemSubTitle}
66+
onChange={(e) => {
67+
setSystemSubTitle(e.target.value);
68+
}}
69+
/>
70+
</Form.Item>
5071
<Form.Item label="系统地址">
5172
<Input
5273
placeholder="请输入系统地址"
@@ -65,31 +86,23 @@ export const SystemSetting = ({ setting }) => {
6586
}}
6687
/>
6788
</Form.Item>
68-
<Form.Item label="系统标题">
69-
<Input
70-
placeholder="请输入系统标题,将作为 head.title 显示"
71-
value={systemTitle}
72-
onChange={(e) => {
73-
setSystemTitle(e.target.value);
74-
}}
75-
/>
76-
</Form.Item>
77-
<Form.Item label="全局背景">
89+
<Form.Item label="站点图标(Favicon)">
7890
<Input
79-
placeholder="请输入全局背景链接或选择文件"
91+
placeholder="请输入 favicon 链接或选择文件"
8092
addonAfter={
8193
<FileImageOutlined
8294
onClick={() => {
83-
setMode('bg');
95+
setMode('favicon');
8496
setVisible(true);
8597
}}
8698
/>
8799
}
88-
value={systemBg}
100+
value={systemFavicon}
89101
onChange={(e) => {
90-
setSystemBg(e.target.value);
102+
setSystemFavicon(e.target.value);
91103
}}
92104
/>
105+
<Image width={30} src={systemFavicon} />
93106
</Form.Item>
94107
<Form.Item label="Logo">
95108
<Input
@@ -107,23 +120,25 @@ export const SystemSetting = ({ setting }) => {
107120
setSystemLogo(e.target.value);
108121
}}
109122
/>
123+
<Image width={100} src={systemLogo} />
110124
</Form.Item>
111-
<Form.Item label="Favicon">
125+
<Form.Item label="全局背景">
112126
<Input
113-
placeholder="请输入 favicon 链接或选择文件"
127+
placeholder="请输入全局背景链接或选择文件"
114128
addonAfter={
115129
<FileImageOutlined
116130
onClick={() => {
117-
setMode('favicon');
131+
setMode('bg');
118132
setVisible(true);
119133
}}
120134
/>
121135
}
122-
value={systemFavicon}
136+
value={systemBg}
123137
onChange={(e) => {
124-
setSystemFavicon(e.target.value);
138+
setSystemBg(e.target.value);
125139
}}
126140
/>
141+
<Image width={200} src={systemBg} />
127142
</Form.Item>
128143
<Form.Item label="系统通知">
129144
<Input.TextArea

client/types/index.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ interface ISetting {
143143
i18n?: string; // 国际化
144144
systemUrl?: string; // 系统地址
145145
systemTitle?: string; // 系统标题
146+
systemSubTitle?: string; // 系统副标题
146147
systemBg?: string; // 全局背景
147148
systemLogo?: string; // 系统 Logo
148149
systemFavicon?: string; // 系统 favicon

server/src/modules/setting/setting.constant.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ export const UNPROTECTED_KEYS = [
77
'systemUrl',
88
'adminSystemUrl',
99
'systemTitle',
10+
'systemSubTitle',
1011
'systemBg',
1112
'systemLogo',
1213
'systemFavicon',

server/src/modules/setting/setting.entity.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ export class Setting {
1919
@Column({ type: 'text', default: null })
2020
systemTitle: string; // 系统标题
2121

22+
@ApiProperty()
23+
@Column({ type: 'text', default: null })
24+
systemSubTitle: string; // 系统副标题
25+
2226
@ApiProperty()
2327
@Column({ type: 'text', default: null })
2428
systemLogo: string; // 系统Logo

0 commit comments

Comments
 (0)