feat: 自行开发设计 ui样式优化 超管端-控制台 相关的页面

This commit is contained in:
zhanjunhao
2026-11-09 21:45:37 +08:00
parent 9fc5fd212d
commit 28e924e371
242 changed files with 9242 additions and 5043 deletions
+13 -12
View File
@@ -369,19 +369,20 @@ export default function ContentGuardSetting() {
}
return (
<div style={{ padding: 20 }}>
<div>
<Banner
fullMode={false}
className='mb-4'
type='info'
description={
config.available && config.schema_ready
? t(
'UGuard 仅作用于同时命中用户和实际调用分组的请求。未命中请求不会调用防护服务。',
)
: t('运行环境或数据库迁移尚未允许启用内容防护。')
}
/>
<Space vertical align='start' spacing='medium' style={{ width: '100%' }}>
<Banner
fullMode={false}
type={config.available && config.schema_ready ? 'info' : 'warning'}
description={
config.available && config.schema_ready
? t(
'UGuard 仅作用于同时命中用户和实际调用分组的请求。未命中请求不会调用防护服务。',
)
: t('运行环境或数据库迁移尚未允许启用内容防护。')
}
/>
<Card style={{ width: '100%' }}>
<Space style={{ justifyContent: 'space-between', width: '100%' }}>
<Space>
@@ -41,7 +41,6 @@ import {
PowerOff,
RefreshCw,
Users,
Headphones,
Upload as UploadIcon,
} from 'lucide-react';
import { API, showError, showSuccess } from '../../helpers';
@@ -369,7 +368,6 @@ const CustomerServiceSetting = () => {
<div style={{ marginBottom: 16 }}>
<Banner
type='info'
icon={<Headphones size={16} />}
description={t(
'配置企业微信客服,支持多客服轮询、加权分配、最少接待等策略。客服链接可在企业微信管理后台的「微信客服」中获取。',
)}
+76 -36
View File
@@ -38,8 +38,6 @@ import {
import { API, isRoot, showError, showSuccess } from '../../helpers';
import { useTranslation } from 'react-i18next';
const PAGE_SIZE = 20;
const MODE_OPTIONS = [
{ value: 'detect_only', label: '仅检测告警' },
{ value: 'standard', label: '标准脱敏(可逆占位符)' },
@@ -128,12 +126,15 @@ export default function DataSecuritySetting() {
// 企业私有规则监督视图(企业自助维护;平台只读 + 紧急删除止血)
const [orgRules, setOrgRules] = useState([]);
const [audits, setAudits] = useState([]);
const [auditPageSize, setAuditPageSize] = useState(20);
const [auditPage, setAuditPage] = useState(1);
const [auditTotal, setAuditTotal] = useState(0);
const [hitLogs, setHitLogs] = useState([]);
const [hitLogPageSize, setHitLogPageSize] = useState(20);
const [hitLogPage, setHitLogPage] = useState(1);
const [hitLogTotal, setHitLogTotal] = useState(0);
const [changeRequests, setChangeRequests] = useState([]);
const [changeReqPageSize, setChangeReqPageSize] = useState(20);
const [changeReqPage, setChangeReqPage] = useState(1);
const [changeReqTotal, setChangeReqTotal] = useState(0);
const [metrics, setMetrics] = useState(null);
@@ -183,40 +184,64 @@ export default function DataSecuritySetting() {
showError(res.data?.message || t('加载规则失败'));
}
};
const loadAudits = async (page = 1) => {
const res = await API.get(
`/api/desensitize/config-audit?page=${page}&page_size=${PAGE_SIZE}`,
);
if (res.data?.success) {
setAudits(res.data.data?.items || []);
setAuditTotal(res.data.data?.total || 0);
setAuditPage(page);
} else {
showError(res.data?.message || t('加载配置审计失败'));
const [auditLoading, setAuditLoading] = useState(false);
const [hitLogLoading, setHitLogLoading] = useState(false);
const [changeReqLoading, setChangeReqLoading] = useState(false);
const loadAudits = async (page = 1, size = auditPageSize) => {
setAuditLoading(true);
try {
const res = await API.get(
`/api/desensitize/config-audit?page=${page}&page_size=${size}`,
);
if (res.data?.success) {
setAudits(res.data.data?.items || []);
setAuditTotal(res.data.data?.total || 0);
setAuditPage(page);
} else {
showError(res.data?.message || t('加载配置审计失败'));
}
} catch (err) {
showError(err.message || t('加载配置审计失败'));
} finally {
setAuditLoading(false);
}
};
const loadHitLogs = async (page = 1) => {
const res = await API.get(
`/api/desensitize/logs?page=${page}&page_size=${PAGE_SIZE}`,
);
if (res.data?.success) {
setHitLogs(res.data.data?.items || []);
setHitLogTotal(res.data.data?.total || 0);
setHitLogPage(page);
} else {
showError(res.data?.message || t('加载命中审计失败'));
const loadHitLogs = async (page = 1, size = hitLogPageSize) => {
setHitLogLoading(true);
try {
const res = await API.get(
`/api/desensitize/logs?page=${page}&page_size=${size}`,
);
if (res.data?.success) {
setHitLogs(res.data.data?.items || []);
setHitLogTotal(res.data.data?.total || 0);
setHitLogPage(page);
} else {
showError(res.data?.message || t('加载命中审计失败'));
}
} catch (err) {
showError(err.message || t('加载命中审计失败'));
} finally {
setHitLogLoading(false);
}
};
const loadChangeRequests = async (page = 1) => {
const res = await API.get(
`/api/desensitize/change-requests?page=${page}&page_size=${PAGE_SIZE}`,
);
if (res.data?.success) {
setChangeRequests(res.data.data?.items || []);
setChangeReqTotal(res.data.data?.total || 0);
setChangeReqPage(page);
} else {
showError(res.data?.message || t('加载变更审批列表失败'));
const loadChangeRequests = async (page = 1, size = changeReqPageSize) => {
setChangeReqLoading(true);
try {
const res = await API.get(
`/api/desensitize/change-requests?page=${page}&page_size=${size}`,
);
if (res.data?.success) {
setChangeRequests(res.data.data?.items || []);
setChangeReqTotal(res.data.data?.total || 0);
setChangeReqPage(page);
} else {
showError(res.data?.message || t('加载变更审批列表失败'));
}
} catch (err) {
showError(err.message || t('加载变更审批列表失败'));
} finally {
setChangeReqLoading(false);
}
};
// 监控指标失败必须显式呈现 '-' 而非 0:安全巡检语境下"待审批 0 / 敏感命中 0"
@@ -647,7 +672,7 @@ export default function DataSecuritySetting() {
return (
<Spin spinning={loading}>
<Banner
type='warning'
type='info'
closeIcon={null}
description={t(
'本功能基于规则匹配,无法识别所有类型的敏感信息(如图像内容、详细地址、外文姓名、未知格式的密钥等)。请勿单独依赖本功能作为合规保障。',
@@ -941,12 +966,17 @@ export default function DataSecuritySetting() {
<Table
columns={changeReqColumns}
dataSource={changeRequests}
loading={changeReqLoading}
rowKey='id'
pagination={{
currentPage: changeReqPage,
pageSize: PAGE_SIZE,
pageSize: changeReqPageSize,
total: changeReqTotal,
onPageChange: (p) => loadChangeRequests(p),
onPageSizeChange: (size) => {
setChangeReqPageSize(size);
loadChangeRequests(1, size);
},
}}
/>
</Card>
@@ -1194,12 +1224,17 @@ export default function DataSecuritySetting() {
<Table
columns={hitLogColumns}
dataSource={hitLogs}
loading={hitLogLoading}
rowKey='id'
pagination={{
currentPage: hitLogPage,
pageSize: PAGE_SIZE,
pageSize: hitLogPageSize,
total: hitLogTotal,
onPageChange: (p) => loadHitLogs(p),
onPageSizeChange: (size) => {
setHitLogPageSize(size);
loadHitLogs(1, size);
},
}}
/>
</Card>
@@ -1210,12 +1245,17 @@ export default function DataSecuritySetting() {
<Table
columns={auditColumns}
dataSource={audits}
loading={auditLoading}
rowKey='id'
pagination={{
currentPage: auditPage,
pageSize: PAGE_SIZE,
pageSize: auditPageSize,
total: auditTotal,
onPageChange: (p) => loadAudits(p),
onPageSizeChange: (size) => {
setAuditPageSize(size);
loadAudits(1, size);
},
}}
/>
</Card>
+14 -15
View File
@@ -23,6 +23,7 @@ import { API, showError, showSuccess, timestamp2string } from '../../helpers';
import { useTranslation } from 'react-i18next';
import { StatusContext } from '../../context/Status';
import { Text } from '@/components/ui';
import './other-setting.css';
const LEGAL_USER_AGREEMENT_KEY = 'legal.user_agreement';
const LEGAL_PRIVACY_POLICY_KEY = 'legal.privacy_policy';
@@ -370,22 +371,14 @@ const OtherSetting = () => {
return (
<Row>
<Col
span={24}
style={{
marginTop: '10px',
display: 'flex',
flexDirection: 'column',
gap: '10px',
}}
>
<Col span={24} className='settings-other-sections'>
{/* 版本信息 */}
<Form>
<Card>
<Form.Section text={t('系统信息')}>
<Form.Section text={t('系统信息')} className='settings-other-info'>
<Row>
<Col span={16}>
<Space>
<Col span={24}>
<Space wrap>
<Text>
{t('当前版本')}:
{statusState?.status?.version || t('未知')}
@@ -401,7 +394,7 @@ const OtherSetting = () => {
</Col>
</Row>
<Row>
<Col span={16}>
<Col span={24}>
<Text>
{t('启动时间')}:{getStartTimeString()}
</Text>
@@ -416,7 +409,10 @@ const OtherSetting = () => {
getFormApi={(formAPI) => (formAPISettingGeneral.current = formAPI)}
>
<Card>
<Form.Section text={t('通用设置')}>
<Form.Section
text={t('通用设置')}
className='settings-other-fields'
>
<Form.TextArea
label={t('公告')}
placeholder={t(
@@ -477,7 +473,10 @@ const OtherSetting = () => {
getFormApi={(formAPI) => (formAPIPersonalization.current = formAPI)}
>
<Card>
<Form.Section text={t('个性化设置')}>
<Form.Section
text={t('个性化设置')}
className='settings-other-fields'
>
<Form.Input
label={t('系统名称')}
placeholder={t('在此输入系统名称')}
+17 -17
View File
@@ -17,9 +17,11 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
For commercial licensing, please contact support@quantumnous.com
*/
import { writeClipboardText } from '../../helpers/clipboard';
import React, { useContext, useEffect, useState } from 'react';
import { useNavigate } from 'react-router-dom';
import UserCenterPageHeader from '../common/UserCenterPageHeader';
import { useConsolePage } from '../console/ConsoleContext';
import {
API,
showError,
@@ -68,6 +70,7 @@ const NAV_ITEMS = [
];
const PersonalSetting = () => {
const consolePage = useConsolePage();
const [userState, userDispatch] = useContext(UserContext);
let navigate = useNavigate();
const { t } = useTranslation();
@@ -508,22 +511,13 @@ const PersonalSetting = () => {
// 复制用户ID
const copyUserId = () => {
const userId = String(userState?.user?.id || '');
navigator.clipboard
.writeText(userId)
writeClipboardText(userId)
.then(() => {
setUserIdCopied(true);
setTimeout(() => setUserIdCopied(false), 2000);
})
.catch(() => {
// 降级方案
const textarea = document.createElement('textarea');
textarea.value = userId;
document.body.appendChild(textarea);
textarea.select();
document.execCommand('copy');
document.body.removeChild(textarea);
setUserIdCopied(true);
setTimeout(() => setUserIdCopied(false), 2000);
showError(t('复制失败,请手动复制'));
});
};
@@ -595,12 +589,18 @@ const PersonalSetting = () => {
const roleInfo = getRoleTag();
return (
<div className='ui-personal-settings min-h-screen pt-16 sm:pt-20'>
<div className='ui-personal-inner uc-page'>
<UserCenterPageHeader
title={t('个人设置')}
subtitle={t('管理你的平台形象、账户安全与通知偏好')}
/>
<div
className={`ui-personal-settings ${consolePage ? 'console-personal' : 'min-h-screen pt-16 sm:pt-20'}`}
>
<div
className={`ui-personal-inner ${consolePage ? 'console-content' : 'uc-page'}`}
>
{!consolePage && (
<UserCenterPageHeader
title={t('个人设置')}
subtitle={t('管理你的平台形象、账户安全与通知偏好')}
/>
)}
<Card className='ui-personal-profile'>
<div className='ui-profile-identity'>
<span className='ui-profile-avatar'>
+8 -9
View File
@@ -780,7 +780,6 @@ const SystemSetting = () => {
display: 'flex',
flexDirection: 'column',
gap: '10px',
marginTop: '10px',
}}
>
<Card>
@@ -812,7 +811,7 @@ const SystemSetting = () => {
description={t(
'此代理仅用于图片请求转发,Webhook通知发送等,AI API请求仍然由服务器直接发出,可在渠道设置中单独配置代理',
)}
style={{ marginBottom: 20, marginTop: 16 }}
style={{ marginBlock: '16px' }}
/>
<Text>{t('或其兼容new-api-worker格式的其他版本')}</Text>
<Row
@@ -1231,7 +1230,7 @@ const SystemSetting = () => {
description={t(
'Passkey 是基于 WebAuthn 标准的无密码身份验证方法,支持指纹、面容、硬件密钥等认证方式',
)}
style={{ marginBottom: 20, marginTop: 16 }}
style={{ marginBlock: '16px' }}
/>
<Row
gutter={{ xs: 8, sm: 16, md: 24, lg: 24, xl: 24, xxl: 24 }}
@@ -1479,7 +1478,7 @@ const SystemSetting = () => {
<Banner
type='info'
description={`${t('主页链接填')} ${inputs.ServerAddress ? inputs.ServerAddress : t('网站地址')},${t('重定向 URL 填')} ${inputs.ServerAddress ? inputs.ServerAddress : t('网站地址')}/oauth/oidc`}
style={{ marginBottom: 20, marginTop: 16 }}
style={{ marginBlock: '16px' }}
/>
<Text>
{t(
@@ -1553,7 +1552,7 @@ const SystemSetting = () => {
<Banner
type='info'
description={`${t('Homepage URL 填')} ${inputs.ServerAddress ? inputs.ServerAddress : t('网站地址')},${t('Authorization callback URL 填')} ${inputs.ServerAddress ? inputs.ServerAddress : t('网站地址')}/oauth/github`}
style={{ marginBottom: 20, marginTop: 16 }}
style={{ marginBlock: '16px' }}
/>
<Row
gutter={{ xs: 8, sm: 16, md: 24, lg: 24, xl: 24, xxl: 24 }}
@@ -1584,7 +1583,7 @@ const SystemSetting = () => {
<Banner
type='info'
description={`${t('Homepage URL 填')} ${inputs.ServerAddress ? inputs.ServerAddress : t('网站地址')},${t('Authorization callback URL 填')} ${inputs.ServerAddress ? inputs.ServerAddress : t('网站地址')}/oauth/discord`}
style={{ marginBottom: 20, marginTop: 16 }}
style={{ marginBlock: '16px' }}
/>
<Row
gutter={{ xs: 8, sm: 16, md: 24, lg: 24, xl: 24, xxl: 24 }}
@@ -1630,7 +1629,7 @@ const SystemSetting = () => {
<Banner
type='info'
description={`${t('回调 URL 填')} ${inputs.ServerAddress ? inputs.ServerAddress : t('网站地址')}/oauth/linuxdo`}
style={{ marginBottom: 20, marginTop: 16 }}
style={{ marginBlock: '16px' }}
/>
<Row
gutter={{ xs: 8, sm: 16, md: 24, lg: 24, xl: 24, xxl: 24 }}
@@ -1713,7 +1712,7 @@ const SystemSetting = () => {
window.location.origin +
'/oauth/wechat-open'
}
style={{ marginBottom: 20, marginTop: 16 }}
style={{ marginBlock: '16px' }}
/>
<Row
gutter={{ xs: 8, sm: 16, md: 24, lg: 24, xl: 24, xxl: 24 }}
@@ -1760,7 +1759,7 @@ const SystemSetting = () => {
window.location.origin +
'/oauth/wechat-mp'
}
style={{ marginBottom: 20, marginTop: 16 }}
style={{ marginBlock: '16px' }}
/>
<Row
gutter={{ xs: 8, sm: 16, md: 24, lg: 24, xl: 24, xxl: 24 }}
+46
View File
@@ -0,0 +1,46 @@
.settings-page .settings-other-sections {
display: flex;
flex-direction: column;
gap: var(--console-space-2, 16px);
}
/* Match the default Tabs navigation gap without stacking form margins. */
.settings-page .settings-other-sections > .ant-form + .ant-form {
margin-top: 0;
}
.settings-page .settings-other-info > .ant-row + .ant-row {
margin-top: 12px;
}
.settings-page .settings-other-info .ant-typography {
overflow-wrap: anywhere;
}
.settings-page .settings-other-fields {
display: flex;
flex-direction: column;
align-items: stretch;
}
.settings-page .settings-other-fields > .ant-btn {
align-self: flex-start;
}
.settings-page .settings-other-fields > .ant-form-item {
margin-bottom: 12px;
}
/* These individually saved fields need spacing, rather than a blank error row. */
.settings-page .settings-other-fields .ant-form-item-control::after {
display: none;
}
.settings-page .settings-other-fields .ant-form-item-explain {
min-height: 0;
line-height: 22px;
}
.settings-page .settings-other-fields > .ant-btn + .ant-form-item {
margin-top: var(--settings-field-gap);
}
@@ -79,7 +79,7 @@ const AccountManagement = ({
const popContent = (
<div className='text-xs p-2'>
<Typography.Paragraph copyable={{ content: accountId }}>
<Typography.Paragraph copyable={{ text: accountId }}>
{accountId}
</Typography.Paragraph>
{label ? (
@@ -16,6 +16,8 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
For commercial licensing, please contact support@quantumnous.com
*/
import { writeClipboardText } from '../../../../helpers/clipboard';
import { API, showError, showSuccess, showWarning } from '../../../../helpers';
import {
Banner,
@@ -190,8 +192,7 @@ const TwoFASetting = ({ t }) => {
// 通用复制函数
const copyTextToClipboard = (text, successMessage = t('已复制到剪贴板')) => {
navigator.clipboard
.writeText(text)
writeClipboardText(text)
.then(() => {
showSuccess(successMessage);
})
@@ -58,7 +58,7 @@ const AccountBindingSection = ({
const popContent = (
<div className='text-xs p-2'>
<Typography.Paragraph copyable={{ content: accountId }}>
<Typography.Paragraph copyable={{ text: accountId }}>
{accountId}
</Typography.Paragraph>
{label && <div className='ui-binding-popover-label'>{label}</div>}
@@ -71,10 +71,10 @@ const NotificationSection = ({
const handleCopyExample = async () => {
try {
const success = await copy(JSON.stringify(WEBHOOK_EXAMPLE, null, 2));
Toast.success(t('已复制到剪贴板'));
if (!success) {
throw new Error('Copy operation failed');
}
Toast.success(t('已复制到剪贴板'));
} catch (err) {
Toast.error(t('复制失败'));
console.error('Copy failed:', err);