完整API模块结构:
client/admin/api/ ├── auth.ts (认证API) ├── users.ts (用户API) ├── files.ts (文件API) ├── theme.ts (主题API) ├── charts.ts (图表API) ├── messages.ts (消息API) ├── sys.ts (系统API) ├── know_info.ts (知识库API) ├── maps.ts (地图API) └── index.ts (统一入口)
This commit is contained in:
@@ -1,20 +1,14 @@
|
||||
import React, { useState, useEffect } from 'react';
|
||||
import React, { useEffect } from 'react';
|
||||
import {
|
||||
Layout, Menu, Button, Table, Space,
|
||||
Button,Space,
|
||||
Form, Input, Select, message, Modal,
|
||||
Card, Spin, Row, Col, Breadcrumb, Avatar,
|
||||
Dropdown, ConfigProvider, theme, Typography,
|
||||
Switch, Badge, Image, Upload, Divider, Descriptions,
|
||||
Popconfirm, Tag, Statistic, DatePicker, Radio, Progress, Tabs, List, Alert, Collapse, Empty, Drawer, InputNumber,ColorPicker,
|
||||
Popover
|
||||
Card, Spin, Typography,
|
||||
Switch, Tabs, Alert, InputNumber
|
||||
} from 'antd';
|
||||
import {
|
||||
UploadOutlined,
|
||||
ReloadOutlined,
|
||||
SaveOutlined,
|
||||
BgColorsOutlined
|
||||
} from '@ant-design/icons';
|
||||
import { debounce } from 'lodash';
|
||||
import {
|
||||
useQuery,
|
||||
useMutation,
|
||||
@@ -25,25 +19,20 @@ import weekday from 'dayjs/plugin/weekday';
|
||||
import localeData from 'dayjs/plugin/localeData';
|
||||
import 'dayjs/locale/zh-cn';
|
||||
import type {
|
||||
FileLibrary, FileCategory, KnowInfo, SystemSetting, SystemSettingValue,
|
||||
ColorScheme
|
||||
SystemSetting, SystemSettingValue
|
||||
} from '../share/types.ts';
|
||||
import { ThemeMode } from '../share/types.ts';
|
||||
|
||||
import {
|
||||
SystemSettingGroup,
|
||||
SystemSettingKey,
|
||||
FontSize,
|
||||
CompactMode,
|
||||
AllowedFileType
|
||||
} from '../share/types.ts';
|
||||
|
||||
|
||||
import { getEnumOptions } from './utils.ts';
|
||||
|
||||
import {
|
||||
SystemAPI,
|
||||
} from './api.ts';
|
||||
SystemAPI
|
||||
} from './api/index.ts';
|
||||
|
||||
import { useTheme } from './hooks_sys.tsx';
|
||||
|
||||
@@ -241,44 +230,44 @@ export const SettingsPage = () => {
|
||||
items={Object.values(SystemSettingGroup).map(group => ({
|
||||
key: group,
|
||||
label: String(GROUP_TITLES[group]),
|
||||
children: (
|
||||
<div>
|
||||
<Alert
|
||||
children: (
|
||||
<div>
|
||||
<Alert
|
||||
message={GROUP_DESCRIPTIONS[group]}
|
||||
type="info"
|
||||
showIcon
|
||||
style={{ marginBottom: 24 }}
|
||||
/>
|
||||
<Form
|
||||
form={form}
|
||||
layout="vertical"
|
||||
onFinish={handleSubmit}
|
||||
>
|
||||
type="info"
|
||||
showIcon
|
||||
style={{ marginBottom: 24 }}
|
||||
/>
|
||||
<Form
|
||||
form={form}
|
||||
layout="vertical"
|
||||
onFinish={handleSubmit}
|
||||
>
|
||||
{settingsData
|
||||
?.find(g => g.name === group)
|
||||
?.settings.map(setting => (
|
||||
<Form.Item
|
||||
<Form.Item
|
||||
key={setting.key}
|
||||
label={setting.description || setting.key}
|
||||
name={setting.key}
|
||||
rules={[{ required: true, message: `请输入${setting.description || setting.key}` }]}
|
||||
>
|
||||
{renderSettingInput(setting)}
|
||||
</Form.Item>
|
||||
</Form.Item>
|
||||
))}
|
||||
<Form.Item>
|
||||
<Button
|
||||
type="primary"
|
||||
htmlType="submit"
|
||||
icon={<SaveOutlined />}
|
||||
loading={updateSettingsMutation.isPending}
|
||||
>
|
||||
保存设置
|
||||
</Button>
|
||||
</Form.Item>
|
||||
</Form>
|
||||
</div>
|
||||
)
|
||||
<Form.Item>
|
||||
<Button
|
||||
type="primary"
|
||||
htmlType="submit"
|
||||
icon={<SaveOutlined />}
|
||||
loading={updateSettingsMutation.isPending}
|
||||
>
|
||||
保存设置
|
||||
</Button>
|
||||
</Form.Item>
|
||||
</Form>
|
||||
</div>
|
||||
)
|
||||
}))}
|
||||
/>
|
||||
</Spin>
|
||||
|
||||
Reference in New Issue
Block a user