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

This commit is contained in:
zhanjunhao
2026-11-09 21:45:37 +08:00
parent 54b3e0cc21
commit 5c0849e82b
242 changed files with 9242 additions and 5043 deletions
+21 -48
View File
@@ -17,16 +17,16 @@ 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 TableEmpty from '../../components/common/table/TableEmpty';
import React, { useState, useRef, useEffect, useContext } from 'react';
import {
Alert,
Button,
Card,
Checkbox,
Drawer,
Empty,
Input,
Popover,
Spin,
Switch,
Table,
@@ -42,7 +42,6 @@ import {
HelpCircle,
Plus,
Search,
Settings,
ShieldCheck,
} from 'lucide-react';
import Joyride, { STATUS, ACTIONS, EVENTS } from 'react-joyride';
@@ -58,6 +57,7 @@ import {
import { useNavigate } from 'react-router-dom';
import PageBackground from '../../components/common/PageBackground';
import UserCenterPageHeader from '../../components/common/UserCenterPageHeader';
import TableColumnSettings from '../../components/common/table/ColumnSettings';
import { CUSTOMER_SERVICE_OPEN_EVENT } from '../../components/customer-service';
import { StatusContext } from '../../context/Status';
import { UserContext } from '../../context/User';
@@ -182,6 +182,7 @@ const KeyTable = ({
return (
<div className='km-status-cell'>
<Switch
size='small'
checked={token.status === 1}
checkedChildren={t('启用')}
unCheckedChildren={t('禁用')}
@@ -391,9 +392,13 @@ const ModelsDrawer = ({ visible, onClose, token, t }) => {
groupedModels[category].push(model);
});
const copyModel = (model) => {
navigator.clipboard.writeText(model);
showSuccess(t('已复制') + ': ' + model);
const copyModel = async (model) => {
try {
await writeClipboardText(model);
showSuccess(t('已复制') + ': ' + model);
} catch {
showError(t('复制失败,请手动复制'));
}
};
return (
@@ -714,25 +719,6 @@ const KeyManagement = ({ embedded = false }) => {
token.group?.toLowerCase().includes(searchValue.toLowerCase()),
);
const columnSettings = (
<Checkbox.Group
value={visibleColumns}
options={COLUMN_OPTIONS.map((option) => ({
value: option.value,
label: t(option.label),
disabled:
visibleColumns.length === 1 && visibleColumns[0] === option.value,
}))}
onChange={(values) =>
setVisibleColumns(
COLUMN_OPTIONS.map((option) => option.value).filter((value) =>
values.includes(value),
),
)
}
/>
);
return (
<>
{/* 新手引导 */}
@@ -921,19 +907,15 @@ const KeyManagement = ({ embedded = false }) => {
>
{t('创建密钥')}
</Button>
<Popover
trigger='click'
placement='bottomRight'
title={t('列设置')}
content={columnSettings}
rootClassName='km-column-settings'
>
<Button
type='text'
aria-label={t('列设置')}
icon={<Settings size={16} />}
/>
</Popover>
<TableColumnSettings
columns={COLUMN_OPTIONS.map((option) => ({
key: option.value,
title: t(option.label),
}))}
value={visibleColumns}
defaultValue={COLUMN_OPTIONS.map((option) => option.value)}
onChange={setVisibleColumns}
/>
</div>
</div>
@@ -941,16 +923,7 @@ const KeyManagement = ({ embedded = false }) => {
tokens={filteredTokens}
loading={loading}
visibleColumns={visibleColumns}
emptyText={
<Empty
image={Empty.PRESENTED_IMAGE_SIMPLE}
description={
searchValue
? t('未找到匹配的密钥')
: t('暂无密钥,点击上方按钮创建')
}
/>
}
emptyText={<TableEmpty />}
onCopy={copyText}
onEdit={handleEdit}
onToggle={handleToggle}