feat: 自行开发设计 ui样式优化 超管端-控制台 相关的页面
This commit is contained in:
@@ -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}
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
.km-page {
|
||||
--km-page-bg: #f8fafc;
|
||||
--km-text: rgba(0, 0, 0, 0.88);
|
||||
--km-label: #6b7789;
|
||||
--km-search-border: #f0f0f0;
|
||||
--km-card-border: #e6e9ef;
|
||||
--km-card-shadow: 0 4px 24px rgba(15, 23, 42, 0.02);
|
||||
@@ -23,6 +24,7 @@
|
||||
html.dark .km-page {
|
||||
--km-page-bg: var(--surface-bg-base);
|
||||
--km-text: var(--uc-heading);
|
||||
--km-label: var(--text-secondary);
|
||||
--km-search-border: var(--border-subtle);
|
||||
--km-card-border: var(--border-subtle);
|
||||
--km-card-shadow: none;
|
||||
@@ -69,13 +71,15 @@ html.dark .km-page {
|
||||
box-shadow: var(--km-card-shadow);
|
||||
}
|
||||
|
||||
/* 查询:卡片上下内边距 22px;标签 14px/22px,下距 8px;输入 620px;输入与按钮 16px,按钮间 8px */
|
||||
/* 查询标签与消费记录筛选标签一致;输入 620px,输入与按钮 16px,按钮间 8px。 */
|
||||
.km-search-label {
|
||||
display: block;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
height: 21px;
|
||||
margin-bottom: 8px;
|
||||
color: var(--km-text);
|
||||
font-size: 14px;
|
||||
line-height: 22px;
|
||||
color: var(--km-label);
|
||||
font-size: 13px;
|
||||
line-height: 1.5714285714285714;
|
||||
}
|
||||
.km-search-row {
|
||||
display: flex;
|
||||
@@ -116,11 +120,6 @@ html.dark .km-page {
|
||||
height: 24px;
|
||||
font-size: 12px;
|
||||
}
|
||||
.km-column-settings .ant-checkbox-group {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
/* 表格:表头 46px、底色 #f8f9fc、常规字重;行分隔 #f0f0f0(middle 尺寸 12px 8px) */
|
||||
.km-table .ant-table-thead > tr > th {
|
||||
|
||||
Reference in New Issue
Block a user