feat: 参考原型图 ui优化提交 企业端-企业中心 相关的页面

This commit is contained in:
zhanjunhao
2026-11-06 20:19:43 +08:00
parent 43048626a6
commit a075732cb4
147 changed files with 9816 additions and 8768 deletions
@@ -218,7 +218,7 @@ export const KpiGrid = ({ report, lists, cny, onJump, t }) => {
title: t('企业活跃成员'),
value: `${(k.active_members || 0).toLocaleString()} ${t('人')}`,
sub: `${t('渗透率')} ${Math.min(100, pct(k.active_members, k.total_members)).toFixed(1)}% · ${t('成员')} ${(k.total_members || 0).toLocaleString()}`,
tip: t('本期通过企业令牌产生调用的去重成员数(按自然日统计)'),
tip: t('本期通过企业密钥产生调用的去重成员数(按自然日统计)'),
onClick: () => onJump('growth'),
},
{
+1 -1
View File
@@ -155,7 +155,7 @@ export const REASONS = {
never_used: {
label: '开通未使用',
color: 'violet',
action: '引导创建令牌、完成首次调用',
action: '引导创建密钥、完成首次调用',
},
};
+1 -1
View File
@@ -60,7 +60,7 @@ const CardTable = ({
// ===== 移动端多选支持 =====
// 移动端卡片分支此前完全没有消费 rowSelection,导致调用方的 selectedKeys 永远是空数组,
// 令牌/兑换码/渠道/模型/管理员令牌五个页面的批量操作在手机上全是死按钮
// 密钥/兑换码/渠道/模型/管理员密钥五个页面的批量操作在手机上全是死按钮
// (点了只提示「请至少选择一个」,渠道页甚至会对空集合弹出删除确认)。
// 这里补上:兼容 Semi 的受控(传 selectedRowKeys)与非受控(只传 onChange)两种用法。
const rowSelection =
@@ -0,0 +1,91 @@
/*
Copyright (C) 2025 QuantumNous
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
For commercial licensing, please contact support@quantumnous.com
*/
import React from 'react';
import { DatePicker, Form, Input, Modal, Select } from 'antd';
import dayjs from 'dayjs';
import './user-dashboard-filter.css';
const DATE_FORMAT = 'YYYY-MM-DD HH:mm:ss';
const UserDashboardFilterModal = ({
searchModalVisible,
handleSearchConfirm,
handleCloseModal,
isAdminUser,
inputs,
dataExportDefaultTime,
timeOptions,
handleInputChange,
t,
}) => (
<Modal
open={searchModalVisible}
title={t('筛选数据')}
width={520}
className='uc-dashboard-filter-modal'
onCancel={handleCloseModal}
onOk={handleSearchConfirm}
okText={t('查询')}
cancelText={t('取消')}
maskClosable
>
<Form layout='vertical' requiredMark={false}>
<Form.Item label={t('时间范围')} htmlFor='dashboard-filter-range'>
<DatePicker.RangePicker
id='dashboard-filter-range'
aria-label={t('时间范围')}
showTime
format={DATE_FORMAT}
allowClear={false}
value={[dayjs(inputs.start_timestamp), dayjs(inputs.end_timestamp)]}
onChange={(_, dateStrings) => {
// Keep the existing query hook's local date-string contract.
handleInputChange(dateStrings[0], 'start_timestamp');
handleInputChange(dateStrings[1], 'end_timestamp');
}}
/>
</Form.Item>
<Form.Item label={t('时间粒度')} htmlFor='dashboard-filter-granularity'>
<Select
id='dashboard-filter-granularity'
value={dataExportDefaultTime}
options={timeOptions}
onChange={(value) =>
handleInputChange(value, 'data_export_default_time')
}
/>
</Form.Item>
{isAdminUser && (
<Form.Item label={t('用户名称')} htmlFor='dashboard-filter-username'>
<Input
id='dashboard-filter-username'
value={inputs.username}
placeholder={t('可选值')}
onChange={(event) =>
handleInputChange(event.target.value, 'username')
}
/>
</Form.Item>
)}
</Form>
</Modal>
);
export default UserDashboardFilterModal;
@@ -0,0 +1,15 @@
.uc-dashboard-filter-modal .ant-modal-body {
padding-top: 24px;
}
.uc-dashboard-filter-modal .ant-picker-range {
width: 100%;
}
.uc-dashboard-filter-modal .ant-form-item {
margin-bottom: 24px;
}
.uc-dashboard-filter-modal .ant-modal-footer {
margin-top: 0;
}
+59 -57
View File
@@ -21,7 +21,7 @@ import React, { useContext, useEffect, useMemo, useState } from 'react';
import { Link, useLocation } from 'react-router-dom';
import { useTranslation } from 'react-i18next';
import { getLucideIcon } from '../../helpers/render';
import { ChevronLeft } from 'lucide-react';
import { ChevronDown, ChevronLeft } from 'lucide-react';
import { useSidebarCollapsed } from '../../hooks/common/useSidebarCollapsed';
import { useSidebar } from '../../hooks/common/useSidebar';
import { useMinimumLoadingTime } from '../../hooks/common/useMinimumLoadingTime';
@@ -35,7 +35,7 @@ import {
import SkeletonWrapper from './components/SkeletonWrapper';
import { CLOUD_BRAIN_UI_ENABLED } from '../../config/cloudBrainUi';
import { Nav, Divider, Button } from '@/components/ui';
import { Nav, Button } from '@/components/ui';
const routerMap = {
home: '/',
@@ -58,7 +58,6 @@ const routerMap = {
personal: '/console/personal',
monitor: '/console/monitor',
analytics: '/console/analytics',
commission: '/console/commission',
'my-commission': '/console/my-commission',
partner: '/console/partner',
organizations: '/console/organizations',
@@ -97,6 +96,7 @@ const SiderBar = ({ onNavigate = () => {}, forceExpanded = false }) => {
const [selectedKeys, setSelectedKeys] = useState(['home']);
const [chatItems, setChatItems] = useState([]);
const [openedKeys, setOpenedKeys] = useState([]);
const [foldedGroups, setFoldedGroups] = useState([]);
const location = useLocation();
const [routerMapState, setRouterMapState] = useState(routerMap);
@@ -112,7 +112,7 @@ const SiderBar = ({ onNavigate = () => {}, forceExpanded = false }) => {
: 'tableHiddle',
},
{
text: t('令牌管理'),
text: t('密钥管理'),
itemKey: 'token',
to: '/token',
},
@@ -210,12 +210,6 @@ const SiderBar = ({ onNavigate = () => {}, forceExpanded = false }) => {
to: '/console/analytics',
className: isAdmin() ? '' : 'tableHiddle',
},
{
text: t('分佣管理'),
itemKey: 'commission',
to: '/console/commission',
className: isRoot() ? '' : 'tableHiddle',
},
{
text: t('渠道管理'),
itemKey: 'channel',
@@ -247,7 +241,7 @@ const SiderBar = ({ onNavigate = () => {}, forceExpanded = false }) => {
className: isAdmin() ? '' : 'tableHiddle',
},
{
text: t('秘钥管理'),
text: t('密钥管理'),
itemKey: 'admin-token',
to: '/console/token',
className: isAdmin() ? '' : 'tableHiddle',
@@ -320,10 +314,6 @@ const SiderBar = ({ onNavigate = () => {}, forceExpanded = false }) => {
) {
return false;
}
// 分佣管理:新增模块不在 sidebar 配置注册表内,绕过 isModuleVisible(Root 硬门控)
if (item.itemKey === 'commission') {
return isRoot();
}
// 系统设置入口:被下放了至少一个 tab 的普通管理员强制可见
// (需绕过 isModuleVisible,因为 GetSelf 默认对普通管理员置 admin.setting=false)。
// root 及其它情况仍走原有 isModuleVisible 逻辑,保留 root 自行隐藏该入口的能力。
@@ -459,6 +449,35 @@ const SiderBar = ({ onNavigate = () => {}, forceExpanded = false }) => {
// 选中高亮颜色(统一)
const SELECTED_COLOR = 'var(--ui-color-primary)';
const renderGroup = (key, label, items) => {
const folded = foldedGroups.includes(key);
return (
<Nav.Group
itemKey={key}
folded={folded}
text={
<button
type='button'
className='sidebar-group-toggle'
aria-expanded={!folded}
onClick={() =>
setFoldedGroups((previous) =>
previous.includes(key)
? previous.filter((group) => group !== key)
: [...previous, key],
)
}
>
<span className='truncate'>{label}</span>
<ChevronDown size={13} className={folded ? '-rotate-90' : ''} />
</button>
}
>
{items}
</Nav.Group>
);
};
// 渲染自定义菜单项
const renderNavItem = (item) => {
// 跳过隐藏的项目
@@ -546,7 +565,7 @@ const SiderBar = ({ onNavigate = () => {}, forceExpanded = false }) => {
width: forceExpanded
? 'var(--sidebar-width)'
: 'var(--sidebar-current-width)',
background: 'var(--ui-color-bg-0)',
background: 'var(--surface-sidebar)',
}}
>
<SkeletonWrapper
@@ -596,53 +615,36 @@ const SiderBar = ({ onNavigate = () => {}, forceExpanded = false }) => {
}}
>
{/* 聊天区域 */}
{hasSectionVisibleModules('chat') && (
<div className='sidebar-section'>
{!collapsed && (
<div className='sidebar-group-label'>{t('聊天')}</div>
)}
{chatMenuItems.map((item) => renderSubItem(item))}
</div>
)}
{hasSectionVisibleModules('chat') &&
renderGroup(
'chat-group',
t('聊天'),
chatMenuItems.map(renderSubItem),
)}
{/* 控制台区域 */}
{hasSectionVisibleModules('console') && (
<>
<Divider className='sidebar-divider' />
<div>
{!collapsed && (
<div className='sidebar-group-label'>{t('控制台')}</div>
)}
{workspaceItems.map((item) => renderNavItem(item))}
</div>
</>
)}
{hasSectionVisibleModules('console') &&
renderGroup(
'console-group',
t('控制台'),
workspaceItems.map(renderNavItem),
)}
{/* 个人中心区域 */}
{hasSectionVisibleModules('personal') && (
<>
<Divider className='sidebar-divider' />
<div>
{!collapsed && (
<div className='sidebar-group-label'>{t('个人中心')}</div>
)}
{financeItems.map((item) => renderNavItem(item))}
</div>
</>
)}
{hasSectionVisibleModules('personal') &&
renderGroup(
'personal-group',
t('个人中心'),
financeItems.map(renderNavItem),
)}
{/* 管理员区域:按角色、权限下放及菜单配置过滤。 */}
{isAdmin() && (
<>
<Divider className='sidebar-divider' />
<div>
{!collapsed && (
<div className='sidebar-group-label'>{t('管理员')}</div>
)}
{adminItems.map((item) => renderNavItem(item))}
</div>
</>
)}
{isAdmin() &&
renderGroup(
'admin-group',
t('管理员'),
adminItems.map(renderNavItem),
)}
</Nav>
</SkeletonWrapper>
+1 -1
View File
@@ -90,7 +90,7 @@ const UserArea = ({
isActionVisible('userSettings') &&
isTopNavModuleVisible('userCenter') &&
isSidebarModuleVisible('userCenter', 'settings');
// 「秘钥管理快捷入口」由 rightActions.keyManagement 单独控制(运营设置→顶栏管理)。
// 「密钥管理快捷入口」由 rightActions.keyManagement 单独控制(运营设置→顶栏管理)。
// 个人用户的 /user-center/key-management 路由不依赖顶栏模块是否显示,故顶栏导航隐藏该模块时
// 头像菜单仍保留入口;企业员工只有在其顶栏模块放开时路由才被放行,继续联动判断。
const showKeyManagement =
+1 -1
View File
@@ -195,7 +195,7 @@ const SSEViewer = ({ sseData }) => {
)}
{item.parsed.usage && (
<Badge
count={`${t('令牌')}: ${item.parsed.usage.prompt_tokens || 0}/${item.parsed.usage.completion_tokens || 0}`}
count={`${t('密钥')}: ${item.parsed.usage.prompt_tokens || 0}/${item.parsed.usage.completion_tokens || 0}`}
type='tertiary'
/>
)}
+1 -1
View File
@@ -175,7 +175,7 @@ const QualityBreakdown = ({ quality, t }) => {
if (dim === 'error')
return row.key !== 'service_error' && (row.key || row.key2);
if (row.key === '' || row.key === '__unknown__') return false;
// 渠道 / 企业 / 用户 / 令牌的 0 表示"无",筛选参数里 0 等于不过滤
// 渠道 / 企业 / 用户 / 密钥的 0 表示"无",筛选参数里 0 等于不过滤
if (['channel', 'org', 'user', 'token'].includes(dim) && row.key === '0')
return false;
return true;
+1 -1
View File
@@ -343,7 +343,7 @@ const QualityDetail = ({ quality, t }) => {
)}
{row.token_name && (
<span>
{t('令牌')}: {row.token_name}
{t('密钥')}: {row.token_name}
</span>
)}
{!isOrg && row.group && (
+5 -5
View File
@@ -45,7 +45,7 @@ import {
const splitList = (v) => (v ? String(v).split(',').filter(Boolean) : []);
/**
* 远程搜索下拉(企业 / 用户 / 令牌)。选中项的名称缓存在本地,
* 远程搜索下拉(企业 / 用户 / 密钥)。选中项的名称缓存在本地,
* 即使结果列表被新的搜索替换,已选值仍能显示名称而非裸 ID。
*/
const RemoteSelect = ({
@@ -88,7 +88,7 @@ const RemoteSelect = ({
[quality.get, type, extraKey],
);
// 联动条件(如令牌随用户)变化后清空候选,下次展开时按新条件重新搜索
// 联动条件(如密钥随用户)变化后清空候选,下次展开时按新条件重新搜索
useEffect(() => {
seq.current += 1;
setList([]);
@@ -193,7 +193,7 @@ const QualityFilterBar = ({ quality, t, onOpenDetail }) => {
if (filters.token_id)
push(
'token_id',
`${t('令牌')}: ${nameOf(options.tokens, filters.token_id) || '#' + filters.token_id}`,
`${t('密钥')}: ${nameOf(options.tokens, filters.token_id) || '#' + filters.token_id}`,
);
if (filters.path) push('path', `${t('接口')}: ${filters.path}`);
if (filters.error_code)
@@ -415,7 +415,7 @@ const QualityFilterBar = ({ quality, t, onOpenDetail }) => {
extra={
filters.user_id ? { user_id: filters.user_id } : undefined
}
placeholder={t('全部令牌(输入名称搜索)')}
placeholder={t('全部密钥(输入名称搜索)')}
onChange={(v) => setFilters({ token_id: v })}
/>
)}
@@ -425,7 +425,7 @@ const QualityFilterBar = ({ quality, t, onOpenDetail }) => {
quality={quality}
type='token'
value={filters.token_id}
placeholder={t('全部令牌(输入名称搜索)')}
placeholder={t('全部密钥(输入名称搜索)')}
onChange={(v) => setFilters({ token_id: v })}
/>
)}
+1 -1
View File
@@ -102,7 +102,7 @@ export const QualityMetaNotice = ({ meta, scope, t }) => {
if (meta.detail_available === false) {
notes.push({
tone: 'warn',
text: t('日志表尚未完成质量字段升级,明细与按用户 / 令牌分析暂不可用'),
text: t('日志表尚未完成质量字段升级,明细与按用户 / 密钥分析暂不可用'),
});
}
if (notes.length === 0) return null;
+6 -6
View File
@@ -61,7 +61,7 @@ export const PLATFORM_DIMS = [
{ value: 'error', label: '错误码', filterKey: 'error_code' },
{ value: 'path', label: '接口', filterKey: 'path' },
{ value: 'user', label: '用户', filterKey: 'user_id' },
{ value: 'token', label: '令牌', filterKey: 'token_id' },
{ value: 'token', label: '密钥', filterKey: 'token_id' },
];
export const ORG_DIMS = [
@@ -69,7 +69,7 @@ export const ORG_DIMS = [
{ value: 'dept', label: '部门', filterKey: 'dept_id' },
{ value: 'project', label: '项目', filterKey: 'project_id' },
{ value: 'user', label: '成员', filterKey: 'user_id' },
{ value: 'token', label: '令牌', filterKey: 'token_id' },
{ value: 'token', label: '密钥', filterKey: 'token_id' },
{ value: 'error', label: '错误码', filterKey: 'error_code' },
];
@@ -100,7 +100,7 @@ export const ALERT_DIM_TYPES = [
export const QUALITY_ERROR_TEXT = {
window_invalid: '时间范围无效,请重新选择',
window_too_wide:
'按用户 / 令牌或交叉条件筛选时,时间范围最长 7 天,请缩小范围',
'按用户 / 密钥或交叉条件筛选时,时间范围最长 7 天,请缩小范围',
detail_window_too_wide: '明细查询时间范围最长 31 天,请缩小范围',
invalid_dimension: '不支持的分析维度',
unsupported_dimension: '当前筛选条件下不支持该维度',
@@ -113,7 +113,7 @@ export const QUALITY_ERROR_TEXT = {
invalid_path: '接口参数过长',
invalid_error_code: '错误码参数过长',
org_required: '缺少企业上下文,请重新进入企业中心',
token_not_in_org: '该令牌不属于本企业',
token_not_in_org: '该密钥不属于本企业',
invalid_keyword: '搜索关键词过长',
invalid_type: '搜索类型无效',
request_trace_params_required: '缺少请求 ID,无法查看链路',
@@ -135,8 +135,8 @@ export const QUALITY_ERROR_TEXT = {
};
export const DEGRADE_TEXT = {
user_or_token_filter: '按用户 / 令牌筛选,已改为直接统计调用日志',
user_or_token_dimension: '按用户 / 令牌维度分析,已改为直接统计调用日志',
user_or_token_filter: '按用户 / 密钥筛选,已改为直接统计调用日志',
user_or_token_dimension: '按用户 / 密钥维度分析,已改为直接统计调用日志',
cross_dimension: '当前筛选组合超出预聚合范围,已改为直接统计调用日志',
path_ignored: '直查日志时不支持按接口筛选,接口条件未生效',
heatmap_requires_single_dimension:
+1 -1
View File
@@ -71,7 +71,7 @@ const ChatsSetting = () => {
<>
<Spin spinning={loading} size='large'>
{/* 聊天设置 */}
<Card style={{ marginTop: '10px' }}>
<Card className='settings-section'>
<SettingsChats options={inputs} refresh={onRefresh} />
</Card>
</Spin>
@@ -423,6 +423,7 @@ const CustomerServiceSetting = () => {
{/* 新建/编辑弹窗 */}
<Modal
rootClassName='settings-form-dialog'
title={editingAgent ? t('编辑客服') : t('添加客服')}
visible={modalVisible}
onOk={handleSubmit}
+5 -5
View File
@@ -146,27 +146,27 @@ const DashboardSetting = () => {
</Modal>
{/* 数据看板设置 */}
<Card style={{ marginTop: '10px' }}>
<Card className='settings-section'>
<SettingsDataDashboard options={inputs} refresh={onRefresh} />
</Card>
{/* 系统公告管理 */}
<Card style={{ marginTop: '10px' }}>
<Card className='settings-section'>
<SettingsAnnouncements options={inputs} refresh={onRefresh} />
</Card>
{/* API信息管理 */}
<Card style={{ marginTop: '10px' }}>
<Card className='settings-section'>
<SettingsAPIInfo options={inputs} refresh={onRefresh} />
</Card>
{/* 常见问答管理 */}
<Card style={{ marginTop: '10px' }}>
<Card className='settings-section'>
<SettingsFAQ options={inputs} refresh={onRefresh} />
</Card>
{/* Uptime Kuma 监控设置 */}
<Card style={{ marginTop: '10px' }}>
<Card className='settings-section'>
<SettingsUptimeKuma options={inputs} refresh={onRefresh} />
</Card>
</Spin>
+1 -1
View File
@@ -73,7 +73,7 @@ const DrawingSetting = () => {
<>
<Spin spinning={loading} size='large'>
{/* 绘图设置 */}
<Card style={{ marginTop: '10px' }}>
<Card className='settings-section'>
<SettingsDrawing options={inputs} refresh={onRefresh} />
</Card>
</Spin>
@@ -113,7 +113,7 @@ const GroupModelDiscountEditor = ({
maxTagCount={3}
showClear
size='small'
style={{ minWidth: 320 }}
style={{ width: 320, maxWidth: '100%' }}
placeholder={t('搜索并选择模型(可多选)')}
optionList={selectableModels.map((m) => ({ label: m, value: m }))}
value={pendingModels}
@@ -954,7 +954,7 @@ const LevelPolicySetting = () => {
content={
<div style={{ maxWidth: 360 }}>
{t(
'该等级用户在市场页与令牌创建中看不到这些分组,也无法显式选用',
'该等级用户在市场页与密钥创建中看不到这些分组,也无法显式选用',
)}
{rest > 0 && (
<div style={{ marginTop: 4 }}>
@@ -1374,7 +1374,7 @@ const LevelPolicySetting = () => {
searchPosition='dropdown'
maxTagCount={3}
showClear
style={{ minWidth: 340, flex: 1 }}
style={{ minWidth: 0, flex: '1 1 340px' }}
placeholder={t('搜索并选择模型(可多选)')}
value={overrideModels}
onChange={setOverrideModels}
@@ -1491,7 +1491,7 @@ const LevelPolicySetting = () => {
'折扣系数 <=1 表示打折,在分组倍率基础上相乘,对该个人等级用户计费生效;留空表示该分组不打折。',
)}{' '}
{t(
'「隐藏」开启后:该等级用户在市场页、令牌创建下拉中看不到该分组,显式选用的令牌在调用时会被拒绝(403);auto 路由也会绕开。例外:分组等于用户自身分组(企业为作用域默认分组)的令牌不受影响,避免误配切断存量流量(用户分组事后迁移则豁免随之失效)。',
'「隐藏」开启后:该等级用户在市场页、密钥创建下拉中看不到该分组,显式选用的密钥在调用时会被拒绝(403);auto 路由也会绕开。例外:分组等于用户自身分组(企业为作用域默认分组)的密钥不受影响,避免误配切断存量流量(用户分组事后迁移则豁免随之失效)。',
)}{' '}
{t(
'点击「模型折扣」列可展开分组行,为指定模型单独设置折扣系数——命中的模型直接按覆盖系数计费(替换分组折扣,不叠乘)。',
+6 -6
View File
@@ -106,27 +106,27 @@ const ModelSetting = () => {
<>
<Spin spinning={loading} size='large'>
{/* 模型分类管理 */}
<Card style={{ marginTop: '10px' }}>
<Card className='settings-section'>
<SettingModelCategory />
</Card>
{/* OpenAI */}
<Card style={{ marginTop: '10px' }}>
<Card className='settings-section'>
<SettingGlobalModel options={inputs} refresh={onRefresh} />
</Card>
{/* Gemini */}
<Card style={{ marginTop: '10px' }}>
<Card className='settings-section'>
<SettingGeminiModel options={inputs} refresh={onRefresh} />
</Card>
{/* Claude */}
<Card style={{ marginTop: '10px' }}>
<Card className='settings-section'>
<SettingClaudeModel options={inputs} refresh={onRefresh} />
</Card>
{/* Image pricing */}
<Card style={{ marginTop: '10px' }}>
<Card className='settings-section'>
<SettingImagePricing options={inputs} refresh={onRefresh} />
</Card>
{/* Video */}
<Card style={{ marginTop: '10px' }}>
<Card className='settings-section'>
<SettingVideoModel options={inputs} refresh={onRefresh} />
</Card>
</Spin>
+82 -81
View File
@@ -61,14 +61,13 @@ const NotifyChannelForm = ({
const patch = (fields) => onChange?.({ ...v, ...fields });
const Label = ({ children }) => (
<label className='block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1.5'>
{children}
</label>
<label className='oc-notify-label'>{children}</label>
);
// 原型:渠道下拉(≤360px)+ 浅底详情框承载各渠道字段(竖排标签)
return (
<div className='space-y-4'>
<div className='max-w-xs'>
<div className='oc-notify-form'>
<div className='oc-notify-field oc-notify-channel'>
<Label>{t('通知渠道')}</Label>
<Select
value={type}
@@ -84,85 +83,87 @@ const NotifyChannelForm = ({
/>
</div>
{type === 'email' && (
<div className='max-w-md'>
<Label>{t('通知邮箱')}</Label>
<Input
value={v.notification_email || ''}
onChange={(val) => patch({ notification_email: val })}
placeholder={emailPlaceholder || t('留空则使用企业联系邮箱')}
disabled={disabled}
/>
</div>
)}
<div className='oc-notify-details'>
{type === 'email' && (
<div className='oc-notify-field'>
<Label>{t('通知邮箱')}</Label>
<Input
value={v.notification_email || ''}
onChange={(val) => patch({ notification_email: val })}
placeholder={emailPlaceholder || t('留空则使用企业联系邮箱')}
disabled={disabled}
/>
</div>
)}
{type === 'webhook' && (
<div className='max-w-md space-y-3'>
<div>
<Label>{t('Webhook 地址')}</Label>
<Input
value={v.webhook_url || ''}
onChange={(val) => patch({ webhook_url: val })}
placeholder='https://example.com/webhook'
disabled={disabled}
/>
</div>
<div>
<Label>{t('接口凭证')}</Label>
<Input
value={v.webhook_secret || ''}
onChange={(val) => patch({ webhook_secret: val })}
placeholder={t('可选,将以 Bearer 方式加入请求头')}
disabled={disabled}
/>
</div>
</div>
)}
{type === 'webhook' && (
<>
<div className='oc-notify-field'>
<Label>{t('Webhook 地址')}</Label>
<Input
value={v.webhook_url || ''}
onChange={(val) => patch({ webhook_url: val })}
placeholder='https://example.com/webhook'
disabled={disabled}
/>
</div>
<div className='oc-notify-field'>
<Label>{t('接口凭证')}</Label>
<Input
value={v.webhook_secret || ''}
onChange={(val) => patch({ webhook_secret: val })}
placeholder={t('可选,将以 Bearer 方式加入请求头')}
disabled={disabled}
/>
</div>
</>
)}
{type === 'bark' && (
<div className='max-w-md'>
<Label>{t('Bark 推送地址')}</Label>
<Input
value={v.bark_url || ''}
onChange={(val) => patch({ bark_url: val })}
placeholder='https://api.day.app/xxx'
disabled={disabled}
/>
</div>
)}
{type === 'bark' && (
<div className='oc-notify-field'>
<Label>{t('Bark 推送地址')}</Label>
<Input
value={v.bark_url || ''}
onChange={(val) => patch({ bark_url: val })}
placeholder='https://api.day.app/xxx'
disabled={disabled}
/>
</div>
)}
{type === 'gotify' && (
<div className='max-w-md space-y-3'>
<div>
<Label>{t('Gotify 服务器地址')}</Label>
<Input
value={v.gotify_url || ''}
onChange={(val) => patch({ gotify_url: val })}
placeholder='https://gotify.example.com'
disabled={disabled}
/>
</div>
<div>
<Label>{t('Gotify 应用令牌')}</Label>
<Input
value={v.gotify_token || ''}
onChange={(val) => patch({ gotify_token: val })}
disabled={disabled}
/>
</div>
<div>
<Label>{t('消息优先级')}</Label>
<InputNumber
value={v.gotify_priority ?? 0}
onChange={(val) => patch({ gotify_priority: val })}
min={0}
max={10}
disabled={disabled}
style={{ width: '100%' }}
/>
</div>
</div>
)}
{type === 'gotify' && (
<>
<div className='oc-notify-field'>
<Label>{t('Gotify 服务器地址')}</Label>
<Input
value={v.gotify_url || ''}
onChange={(val) => patch({ gotify_url: val })}
placeholder='https://gotify.example.com'
disabled={disabled}
/>
</div>
<div className='oc-notify-field'>
<Label>{t('Gotify 应用密钥')}</Label>
<Input
value={v.gotify_token || ''}
onChange={(val) => patch({ gotify_token: val })}
disabled={disabled}
/>
</div>
<div className='oc-notify-field'>
<Label>{t('消息优先级')}</Label>
<InputNumber
value={v.gotify_priority ?? 0}
onChange={(val) => patch({ gotify_priority: val })}
min={0}
max={10}
disabled={disabled}
style={{ width: '100%' }}
/>
</div>
</>
)}
</div>
</div>
);
};
+14 -14
View File
@@ -230,59 +230,59 @@ const OperationSetting = () => {
{errorBanner}
<ProgressiveSettingsSections loading={loading}>
{/* 通用设置 */}
<Card style={{ marginTop: '10px' }}>
<Card className='settings-section'>
<SettingsGeneral options={inputs} refresh={onRefresh} />
</Card>
{/* 语言与地区 */}
<Card style={{ marginTop: '10px' }}>
<Card className='settings-section'>
<SettingsLanguage options={inputs} refresh={onRefresh} />
</Card>
{/* 主题色配置 */}
<div style={{ marginTop: '10px' }}>
<div className='settings-section'>
<SettingsTheme options={inputs} refresh={onRefresh} />
</div>
{/* 顶栏模块管理 */}
<div style={{ marginTop: '10px' }}>
<div className='settings-section'>
<SettingsHeaderNavModules options={inputs} refresh={onRefresh} />
</div>
{/* 企业员工顶栏管理 */}
<div style={{ marginTop: '10px' }}>
<div className='settings-section'>
<SettingsOrgUserNavModules options={inputs} refresh={onRefresh} />
</div>
{/* 左侧边栏模块管理(管理员) */}
<div style={{ marginTop: '10px' }}>
<div className='settings-section'>
<SettingsSidebarModulesAdmin options={inputs} refresh={onRefresh} />
</div>
{/* 屏蔽词过滤设置 */}
<Card style={{ marginTop: '10px' }}>
<Card className='settings-section'>
<SettingsSensitiveWords options={inputs} refresh={onRefresh} />
</Card>
{/* 日志设置 */}
<Card style={{ marginTop: '10px' }}>
<Card className='settings-section'>
<SettingsLog options={inputs} refresh={onRefresh} />
</Card>
{/* 监控设置 */}
<Card style={{ marginTop: '10px' }}>
<Card className='settings-section'>
<SettingsMonitoring options={inputs} refresh={onRefresh} />
</Card>
{/* 兜底渠道设置 */}
<Card style={{ marginTop: '10px' }}>
<Card className='settings-section'>
<SettingsFallback options={inputs} refresh={onRefresh} />
</Card>
{/* 技能注入(网关直连)设置 */}
<Card style={{ marginTop: '10px' }}>
<Card className='settings-section'>
<SettingsSkillInject options={inputs} refresh={onRefresh} />
</Card>
{/* 服务大盘监控设置 */}
<div style={{ marginTop: '10px' }}>
<div className='settings-section'>
<SettingsDashboardMonitor />
</div>
{/* 额度设置 */}
<Card style={{ marginTop: '10px' }}>
<Card className='settings-section'>
<SettingsCreditLimit options={inputs} refresh={onRefresh} />
</Card>
{/* 跑马灯设置 */}
<Card style={{ marginTop: '10px' }}>
<Card className='settings-section'>
<SettingsMarquee options={inputs} refresh={onRefresh} />
</Card>
{/* 体验中心设置 */}
+8 -8
View File
@@ -270,28 +270,28 @@ const PaymentSetting = () => {
return (
<>
<Spin spinning={loading} size='large'>
<Card style={{ marginTop: '10px' }}>
<Card className='settings-section'>
<SettingsGeneralPayment options={inputs} refresh={onRefresh} />
</Card>
<Card style={{ marginTop: '10px' }}>
<Card className='settings-section'>
<SettingsPaymentGateway options={inputs} refresh={onRefresh} />
</Card>
<Card style={{ marginTop: '10px' }}>
<Card className='settings-section'>
<SettingsPaymentGatewayStripe options={inputs} refresh={onRefresh} />
</Card>
<Card style={{ marginTop: '10px' }}>
<Card className='settings-section'>
<SettingsPaymentGatewayPayPal options={inputs} refresh={onRefresh} />
</Card>
<Card style={{ marginTop: '10px' }}>
<Card className='settings-section'>
<SettingsPaymentGatewayCreem options={inputs} refresh={onRefresh} />
</Card>
<Card style={{ marginTop: '10px' }}>
<Card className='settings-section'>
<SettingsPaymentWechat options={inputs} refresh={onRefresh} />
</Card>
<Card style={{ marginTop: '10px' }}>
<Card className='settings-section'>
<SettingsPaymentAlipay options={inputs} refresh={onRefresh} />
</Card>
<Card style={{ marginTop: '10px' }}>
<Card className='settings-section'>
<SettingsNuonuoInvoice options={inputs} refresh={onRefresh} />
</Card>
</Spin>
+1 -1
View File
@@ -78,7 +78,7 @@ const RateLimitSetting = () => {
<>
<Spin spinning={loading} size='large'>
{/* AI请求速率限制 */}
<Card style={{ marginTop: '10px' }}>
<Card className='settings-section'>
<RequestRateLimit options={inputs} refresh={onRefresh} />
</Card>
</Spin>
+1 -1
View File
@@ -98,7 +98,7 @@ const RatioSetting = () => {
return (
<Spin spinning={loading} size='large'>
{/* 模型倍率设置以及可视化编辑器 */}
<Card style={{ marginTop: '10px' }}>
<Card className='settings-section'>
<Tabs type='card'>
<Tabs.TabPane tab={t('模型倍率设置')} itemKey='model'>
<ModelRatioSettings options={inputs} refresh={onRefresh} />
+1 -1
View File
@@ -1875,7 +1875,7 @@ const SystemSetting = () => {
)}
{/* WeyAi 账号接入配置:仅超级管理员可见(后端同样按 root-only 校验) */}
{isLoaded && isRoot() && (
<div style={{ marginTop: '10px' }}>
<div className='settings-section'>
<SettingsWeyAi />
</div>
)}
@@ -473,7 +473,7 @@ const AccountManagement = ({
<div className='py-4'>
<div className='space-y-6'>
<Space vertical className='w-full'>
{/* 系统访问令牌 */}
{/* 系统访问密钥 */}
<Card className='!rounded-xl w-full'>
<div className='flex flex-col sm:flex-row items-start sm:justify-between gap-4'>
<div className='flex items-start w-full sm:w-auto'>
@@ -482,10 +482,10 @@ const AccountManagement = ({
</div>
<div className='flex-1'>
<Typography.Title heading={6} className='mb-1'>
{t('系统访问令牌')}
{t('系统访问密钥')}
</Typography.Title>
<Typography.Text type='tertiary' className='text-sm'>
{t('用于API调用的身份验证令牌,请妥善保管')}
{t('用于API调用的身份验证密钥,请妥善保管')}
</Typography.Text>
{systemToken && (
<div className='mt-3'>
@@ -508,7 +508,7 @@ const AccountManagement = ({
className='!bg-slate-600 hover:!bg-slate-700 w-full sm:w-auto'
icon={<IconKey />}
>
{systemToken ? t('重新生成') : t('生成令牌')}
{systemToken ? t('重新生成') : t('生成密钥')}
</Button>
</div>
</Card>
@@ -240,7 +240,7 @@ const NotificationSettings = ({
description: t('数据管理和日志查看'),
modules: [
{ key: 'detail', title: t('数据看板'), description: t('系统数据统计') },
{ key: 'token', title: t('令牌管理'), description: t('API令牌管理') },
{ key: 'token', title: t('密钥管理'), description: t('API密钥管理') },
{ key: 'log', title: t('使用日志'), description: t('API使用记录') },
{
key: 'midjourney',
@@ -628,19 +628,19 @@ const NotificationSettings = ({
<Form.Input
field='gotifyToken'
label={t('Gotify应用令牌')}
placeholder={t('请输入Gotify应用令牌')}
label={t('Gotify应用密钥')}
placeholder={t('请输入Gotify应用密钥')}
onChange={(val) => handleFormChange('gotifyToken', val)}
prefix={<IconKey />}
extraText={t(
'在Gotify服务器创建应用后获得的令牌,用于发送通知',
'在Gotify服务器创建应用后获得的密钥,用于发送通知',
)}
showClear
rules={[
{
required:
notificationSettings.warningType === 'gotify',
message: t('请输入Gotify应用令牌'),
message: t('请输入Gotify应用密钥'),
},
]}
/>
@@ -675,7 +675,7 @@ const NotificationSettings = ({
<div>
2.{' '}
{t(
'复制应用的令牌(Token)并填写到上方的应用令牌字段',
'复制应用的密钥(Token)并填写到上方的应用密钥字段',
)}
</div>
<div>3. {t('填写Gotify服务器的完整URL地址')}</div>
@@ -18,7 +18,7 @@ For commercial licensing, please contact support@quantumnous.com
*/
import React from 'react';
import { Input as AntInput, Segmented } from 'antd';
import { Segmented } from 'antd';
import { Button, Input } from '@/components/ui';
import { Check } from 'lucide-react';
import {
@@ -58,9 +58,6 @@ const AvatarSection = ({
avatarSettings.avatarType === USER_AVATAR_TYPES.CUSTOM &&
!avatarSettings.customAvatarUrl?.trim();
// 与 getInitialAvatarDataUrl 相同的首字取法,仅用于展示,不进入保存载荷
const initialText = username ? username[0].toUpperCase() : '';
return (
<section className='ui-avatar-section'>
<SectionHeader
@@ -135,13 +132,6 @@ const AvatarSection = ({
)}
{avatarSettings.avatarType === USER_AVATAR_TYPES.INITIAL && (
<div className='ui-avatar-field'>
<div className='ui-avatar-field-label'>{t('显示文字')}</div>
<AntInput
readOnly
value={initialText}
className='ui-avatar-text-input'
aria-label={t('显示文字')}
/>
<p className='ui-avatar-help'>
{t('根据用户名自动生成简洁文字头像')}
</p>
@@ -178,7 +178,7 @@ const SidebarSection = ({ t }) => {
gradient: 'from-emerald-500 to-teal-500',
modules: [
{ key: 'detail', title: t('数据看板'), description: t('系统数据统计') },
{ key: 'token', title: t('令牌管理'), description: t('API令牌管理') },
{ key: 'token', title: t('密钥管理'), description: t('API密钥管理') },
{ key: 'log', title: t('使用日志'), description: t('API使用记录') },
{
key: 'midjourney',
@@ -207,7 +207,7 @@ export const getAdminTokensColumns = ({
render: (text, record) => renderUserCell(text, record, t),
},
{
title: t('秘钥名称'),
title: t('密钥名称'),
dataIndex: 'name',
render: (text) => (
<span className='truncate inline-block max-w-[160px]' title={text}>
@@ -216,7 +216,7 @@ export const getAdminTokensColumns = ({
),
},
{
title: t('秘钥'),
title: t('密钥'),
dataIndex: 'key',
render: renderKey,
},
@@ -29,7 +29,7 @@ const AdminTokensDescription = ({ compactMode, setCompactMode, t }) => {
<div className='flex flex-col md:flex-row justify-between items-start md:items-center gap-2 w-full'>
<div className='flex items-center gap-2 text-brand'>
<IconKey />
<Text>{t('秘钥管理')}</Text>
<Text>{t('密钥管理')}</Text>
<Tag color='orange' shape='circle' size='small'>
{t('管理员')}
</Tag>
@@ -61,7 +61,7 @@ const AdminTokensFilters = ({
<Form.Input
field='keyword'
prefix={<IconSearch />}
placeholder={t('秘钥名称 / Key 片段')}
placeholder={t('密钥名称 / Key 片段')}
showClear
pure
size='small'
@@ -21,16 +21,16 @@ import React from 'react';
import { Modal, Banner } from '@/components/ui';
const actionMeta = {
enable: { title: '批量启用', danger: false, hint: '将选中秘钥批量启用' },
enable: { title: '批量启用', danger: false, hint: '将选中密钥批量启用' },
disable: {
title: '批量禁用',
danger: true,
hint: '将选中秘钥批量禁用,用户将无法使用',
hint: '将选中密钥批量禁用,用户将无法使用',
},
delete: {
title: '批量删除',
danger: true,
hint: '将选中秘钥批量删除,操作不可恢复',
hint: '将选中密钥批量删除,操作不可恢复',
},
};
@@ -59,7 +59,7 @@ const AdminBatchActionModal = ({
okText={t('确认执行')}
>
<div className='space-y-2'>
<div>{t('共选中 {{count}} 个秘钥', { count })}</div>
<div>{t('共选中 {{count}} 个密钥', { count })}</div>
<Banner
type={meta.danger ? 'danger' : 'info'}
description={t(meta.hint)}
@@ -28,7 +28,7 @@ const AdminDeleteTokenModal = ({ visible, onCancel, onConfirm, token, t }) => {
return (
<Modal
title={t('确定要删除此秘钥吗?')}
title={t('确定要删除此密钥吗?')}
visible={visible}
onCancel={onCancel}
onOk={onConfirm}
@@ -41,14 +41,14 @@ const AdminDeleteTokenModal = ({ visible, onCancel, onConfirm, token, t }) => {
<Banner
type='warning'
description={t(
'该秘钥属于企业 Token,删除将影响企业内多用户的使用',
'该密钥属于企业 Token,删除将影响企业内多用户的使用',
)}
closeIcon={null}
/>
)}
<div>{t('删除后将无法恢复,且会立即终止使用此秘钥的所有调用')}</div>
<div>{t('删除后将无法恢复,且会立即终止使用此密钥的所有调用')}</div>
<Text type='tertiary' size='small'>
{t('秘钥名称')}:{token.name || '—'}
{t('密钥名称')}:{token.name || '—'}
</Text>
<br />
<Text type='tertiary' size='small'>
@@ -35,7 +35,7 @@ const statusMeta = {
};
/**
* 管理员编辑秘钥弹窗
* 管理员编辑密钥弹窗
* 允许修改:name / group / unlimited_quota / remain_quota / expired_time
* 不修改:
* - status —— 启用/禁用走专用按钮,避免在编辑路径上绕过状态校验
@@ -136,7 +136,7 @@ const AdminEditTokenModal = ({
return (
<Modal
title={t('编辑秘钥')}
title={t('编辑密钥')}
visible={visible}
onCancel={onCancel}
onOk={handleSubmit}
@@ -155,7 +155,7 @@ const AdminEditTokenModal = ({
<Text strong>
{token.display_name || token.username || '—'}
</Text>{' '}
(ID: {token.user_id}) {t('的秘钥')}
(ID: {token.user_id}) {t('的密钥')}
<Tag
color={curStatusMeta.color}
shape='circle'
@@ -172,7 +172,7 @@ const AdminEditTokenModal = ({
<Banner
type='warning'
description={t(
'该秘钥属于企业 Token,修改额度或过期时间将影响企业内多用户的使用',
'该密钥属于企业 Token,修改额度或过期时间将影响企业内多用户的使用',
)}
closeIcon={null}
className='!mt-2'
@@ -190,10 +190,10 @@ const AdminEditTokenModal = ({
>
<Form.Input
field='name'
label={t('秘钥名称')}
placeholder={t('给秘钥起个名字')}
label={t('密钥名称')}
placeholder={t('给密钥起个名字')}
maxLength={30}
rules={[{ required: true, message: t('请输入秘钥名称') }]}
rules={[{ required: true, message: t('请输入密钥名称') }]}
/>
<Form.Select
@@ -35,7 +35,7 @@ const AdminEnableDisableTokenModal = ({
return (
<Modal
title={isDisable ? t('确定要禁用此秘钥吗?') : t('确定要启用此秘钥吗?')}
title={isDisable ? t('确定要禁用此密钥吗?') : t('确定要启用此密钥吗?')}
visible={visible}
onCancel={onCancel}
onOk={onConfirm}
@@ -44,11 +44,11 @@ const AdminEnableDisableTokenModal = ({
<div className='space-y-1'>
<div>
{isDisable
? t('禁用后用户将无法使用此秘钥调用 API')
: t('启用后用户即可重新使用此秘钥')}
? t('禁用后用户将无法使用此密钥调用 API')
: t('启用后用户即可重新使用此密钥')}
</div>
<Text type='tertiary' size='small'>
{t('秘钥名称')}:{token.name || '—'}
{t('密钥名称')}:{token.name || '—'}
</Text>
<br />
<Text type='tertiary' size='small'>
@@ -79,7 +79,7 @@ const PricingGroups = ({
return (
<MarketFilterGroup
title={title === undefined ? t('可用令牌分组') : title}
title={title === undefined ? t('可用密钥分组') : title}
items={items}
activeValue={filterGroup}
onChange={setFilterGroup}
@@ -56,6 +56,7 @@ const ModelDetailSideSheet = ({
title={t('模型详情')}
open={visible}
onClose={onClose}
maskClosable
width={isMobile ? '100%' : 820}
rootClassName='mm-detail-drawer mm-theme'
rootStyle={themeStyle}
@@ -39,7 +39,7 @@ const TokensActions = ({
// Handle copy selected tokens with options
const handleCopySelectedTokens = () => {
if (selectedKeys.length === 0) {
showError(t('请至少选择一个令牌!'));
showError(t('请至少选择一个密钥!'));
return;
}
setShowCopyModal(true);
@@ -48,7 +48,7 @@ const TokensActions = ({
// Handle delete selected tokens with confirmation
const handleDeleteSelectedTokens = () => {
if (selectedKeys.length === 0) {
showError(t('请至少选择一个令牌!'));
showError(t('请至少选择一个密钥!'));
return;
}
setShowDeleteModal(true);
@@ -74,7 +74,7 @@ const TokensActions = ({
}}
size='small'
>
{t('添加令牌')}
{t('添加密钥')}
</Button>
<Button
@@ -83,7 +83,7 @@ const TokensActions = ({
onClick={handleCopySelectedTokens}
size='small'
>
{t('复制所选令牌')}
{t('复制所选密钥')}
</Button>
<Button
@@ -92,7 +92,7 @@ const TokensActions = ({
onClick={handleDeleteSelectedTokens}
size='small'
>
{t('删除所选令牌')}
{t('删除所选密钥')}
</Button>
</div>
@@ -407,7 +407,7 @@ const renderOperations = (
size='small'
onClick={() => {
Modal.confirm({
title: t('确定是否要删除此令牌?'),
title: t('确定是否要删除此密钥?'),
content: t('此修改将不可逆'),
onOk: () => {
(async () => {
@@ -29,7 +29,7 @@ const TokensDescription = ({ compactMode, setCompactMode, t }) => {
<div className='flex flex-col md:flex-row justify-between items-start md:items-center gap-2 w-full'>
<div className='flex items-center text-blue-500'>
<Key size={16} className='mr-2' />
<Text>{t('令牌管理')}</Text>
<Text>{t('密钥管理')}</Text>
</div>
<CompactModeToggle
+3 -3
View File
@@ -55,7 +55,7 @@ function TokensPage({ labelReplace } = {}) {
? (key, options) => {
const result = originalT(key, options);
return typeof result === 'string'
? result.replace(/令牌/g, labelReplace)
? result.replace(/密钥/g, labelReplace)
: result;
}
: originalT;
@@ -145,7 +145,7 @@ function TokensPage({ labelReplace } = {}) {
<div style={{ marginBottom: 8 }}>
{key
? t('请选择模型。')
: t('选择模型后可一键填充当前选中令牌(或本页第一个令牌)。')}
: t('选择模型后可一键填充当前选中密钥(或本页第一个密钥)。')}
</div>
<div style={{ marginBottom: 8 }}>
<Select
@@ -235,7 +235,7 @@ function TokensPage({ labelReplace } = {}) {
? tokens[0]
: null;
if (!token) {
Toast.warning(t('没有可用令牌用于填充'));
Toast.warning(t('没有可用密钥用于填充'));
return;
}
apiKeyToUse = 'sk-' + token.key;
@@ -43,7 +43,7 @@ const CopyTokensModal = ({ visible, onCancel, selectedKeys, copyText, t }) => {
return (
<Modal
title={t('复制令牌')}
title={t('复制密钥')}
icon={null}
visible={visible}
onCancel={onCancel}
@@ -29,14 +29,14 @@ const DeleteTokensModal = ({
}) => {
return (
<Modal
title={t('批量删除令牌')}
title={t('批量删除密钥')}
visible={visible}
onCancel={onCancel}
onOk={onConfirm}
type='warning'
>
<div>
{t('确定要删除所选的 {{count}} 个令牌吗?', {
{t('确定要删除所选的 {{count}} 个密钥吗?', {
count: selectedKeys.length,
})}
</div>
@@ -95,9 +95,9 @@ const EditTokenDrawer = ({
<Drawer
open={open}
onClose={onCancel}
title={isEdit ? t('编辑令牌') : t('创建令牌')}
title={isEdit ? t('编辑密钥') : t('创建密钥')}
width={isMobile ? '100%' : 560}
maskClosable={false}
maskClosable
forceRender
rootClassName='km-edit-drawer'
footer={
@@ -108,7 +108,7 @@ const EditTokenDrawer = ({
loading={loading}
onClick={() => formApiRef.current?.submitForm()}
>
{isEdit ? t('保存') : t('创建令牌')}
{isEdit ? t('保存') : t('创建密钥')}
</Button>
</div>
}
@@ -126,13 +126,13 @@ const EditTokenDrawer = ({
<Form.Input
field='name'
label={t('名称')}
placeholder={t('请输入令牌名称')}
placeholder={t('请输入密钥名称')}
rules={[{ required: true, message: t('请输入名称') }]}
/>
{groups.length > 0 ? (
<Form.Select
field='group'
label={t('令牌分组')}
label={t('密钥分组')}
placeholder={t('选择分组,默认为用户分组')}
optionList={groups}
renderOptionItem={renderGroupOption}
@@ -142,7 +142,7 @@ const EditTokenDrawer = ({
) : (
<Form.Select
field='group'
label={t('令牌分组')}
label={t('密钥分组')}
placeholder={t('管理员未设置用户可选分组')}
disabled
style={{ width: '100%' }}
@@ -60,7 +60,7 @@ const EditTokenModal = (props) => {
? (key, options) => {
const result = originalT(key, options);
return typeof result === 'string'
? result.replace(/令牌/g, props.labelReplace)
? result.replace(/密钥/g, props.labelReplace)
: result;
}
: originalT;
@@ -365,7 +365,7 @@ const EditTokenModal = (props) => {
});
const { success, message } = res.data;
if (success) {
showSuccess(t('令牌更新成功!'));
showSuccess(t('密钥更新成功!'));
props.refresh();
props.handleClose();
} else {
@@ -393,7 +393,7 @@ const EditTokenModal = (props) => {
}
}
if (successCount > 0) {
showSuccess(t('令牌创建成功,请在列表页面点击复制获取令牌!'));
showSuccess(t('密钥创建成功,请在列表页面点击复制获取密钥!'));
props.refresh();
props.handleClose();
}
@@ -464,10 +464,10 @@ const EditTokenModal = (props) => {
</div>
<div>
<h2 className='text-base font-semibold text-gray-800 dark:text-gray-100'>
{isEdit ? t('编辑令牌') : t('创建令牌')}
{isEdit ? t('编辑密钥') : t('创建密钥')}
</h2>
<p className='text-xs text-gray-500 dark:text-gray-400'>
{isEdit ? t('修改令牌配置') : t('快速创建访问令牌')}
{isEdit ? t('修改密钥配置') : t('快速创建访问密钥')}
</p>
</div>
</div>
@@ -506,16 +506,16 @@ const EditTokenModal = (props) => {
<Form.Input
field='name'
noLabel
placeholder={t('请输入令牌名称')}
placeholder={t('请输入密钥名称')}
rules={[{ required: true, message: t('请输入名称') }]}
showClear
/>
</div>
{/* 秘钥分组 */}
{/* 密钥分组 */}
<div>
<FieldLabel icon={Layers} iconColor='text-brand'>
{t('令牌分组')}
{t('密钥分组')}
</FieldLabel>
{groups.length > 0 ? (
<Form.Select
@@ -664,7 +664,7 @@ const EditTokenModal = (props) => {
<Form.Switch
field='unlimited_quota'
label={t('无限额度')}
extraText={t('开启后令牌不限制使用额度')}
extraText={t('开启后密钥不限制使用额度')}
/>
{!values.unlimited_quota && (
@@ -755,7 +755,7 @@ const EditTokenModal = (props) => {
icon={<Check size={16} />}
loading={loading}
>
{isEdit ? t('保存修改') : t('创建令牌')}
{isEdit ? t('保存修改') : t('创建密钥')}
</Button>
<Button
theme='light'
@@ -504,7 +504,7 @@ export const getLogsColumns = ({
},
{
key: COLUMN_KEYS.TOKEN,
title: t('令牌'),
title: t('密钥'),
dataIndex: 'token_name',
render: (text, record, index) => {
return record.type === 0 || record.type === 2 || record.type === 5 ? (
@@ -259,7 +259,7 @@ const LogsFilters = ({
field='token_name'
className={controlClass}
prefix={<InputPrefix icon={Key} />}
placeholder={t('令牌名称')}
placeholder={t('密钥名称')}
showClear
pure
size='small'
@@ -96,7 +96,7 @@ const FIELD_DEFS = [
},
{
id: 'tokenName',
label: '令牌名称',
label: '密钥名称',
width: 16,
value: (r) => r.token_name || '',
},
@@ -17,6 +17,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
For commercial licensing, please contact support@quantumnous.com
*/
import './payment-confirm.css';
import React, { useEffect, useState } from 'react';
import { Tag as AntTag } from 'antd';
import { Modal, Typography, Skeleton } from '@/components/ui';
@@ -0,0 +1,59 @@
/* 充值确认弹窗(原型未定义):Ant Design 默认弹窗 + 统一规范的语义行列表 */
.payment-confirm-rows {
display: grid;
gap: 12px;
margin: 16px 0;
padding: 16px 0;
border-block: 1px solid var(--border-subtle);
}
.payment-confirm-rows > div {
display: flex;
align-items: center;
justify-content: space-between;
gap: 16px;
}
.payment-confirm-rows dt {
color: var(--text-secondary);
font-size: 13px;
}
.payment-confirm-rows dd {
display: inline-flex;
align-items: center;
gap: 8px;
margin: 0;
color: var(--text-primary);
font-weight: 600;
}
.payment-confirm-amount {
color: var(--ui-color-primary);
font-size: 20px;
}
.payment-confirm-discount {
color: var(--ui-color-success);
}
.payment-confirm-method .ant-typography {
font-weight: 400;
}
.payment-confirm-modal .ant-modal-content {
border-radius: 12px;
padding: 20px 24px;
}
.payment-confirm-modal .ant-modal-footer {
margin-top: 12px;
}
.payment-confirm-rows {
gap: 12px;
margin: 18px 0;
padding: 18px 0;
}
.payment-confirm-rows dt {
line-height: 20px;
}
.payment-confirm-rows dd {
font-size: 13px;
}
.payment-confirm-method {
flex-wrap: wrap;
justify-content: flex-end;
}
+11 -1
View File
@@ -109,7 +109,17 @@ export const Form = forwardRef(function Form(
? 'inline'
: 'vertical'
}
labelCol={labelWidth ? { flex: labelWidth } : undefined}
labelCol={
props.labelCol ??
(labelWidth
? {
flex: `0 0 ${typeof labelWidth === 'number' ? `${labelWidth}px` : labelWidth}`,
}
: undefined)
}
wrapperCol={
props.wrapperCol ?? (labelWidth ? { flex: '1 1 0' } : undefined)
}
labelAlign={labelAlign}
onFinish={onSubmit}
onFinishFailed={onSubmitFail}
+24 -4
View File
@@ -20,7 +20,8 @@ For commercial licensing, please contact support@quantumnous.com
import React, { forwardRef } from 'react';
import * as Ant from 'antd';
import { controlSize, placement } from './controls';
import { paginationEvents } from './pagination';
import { paginationEvents, paginationShowTotal } from './pagination';
import { overlayMaskClosable } from './overlayPolicy';
export * from './controls';
export { Form, withField } from './form';
@@ -124,7 +125,7 @@ export const Space = ({ spacing, vertical, size, ...props }) => (
<Ant.Space
{...props}
direction={vertical ? 'vertical' : 'horizontal'}
size={spacing ?? size}
size={spacing === 'medium' ? 'middle' : (spacing ?? size)}
/>
);
export const Divider = ({ margin, align, layout, style, ...props }) => (
@@ -271,6 +272,7 @@ export function Table({
current: pagination.currentPage ?? pagination.current,
pageSizeOptions:
pagination.pageSizeOpts ?? pagination.pageSizeOptions,
showTotal: paginationShowTotal(pagination.showTotal),
...paginationEvents(pagination),
}
: false
@@ -301,7 +303,7 @@ export function Pagination({
})}
pageSizeOptions={pageSizeOpts ?? props.pageSizeOptions}
size={size === 'small' ? 'small' : 'default'}
showTotal={showTotal === true ? (total) => `${total}` : showTotal}
showTotal={paginationShowTotal(showTotal)}
/>
);
}
@@ -516,6 +518,7 @@ function modalProps({
}) {
return {
...props,
maskClosable: overlayMaskClosable(props.maskClosable),
open: visible,
title: header === null ? null : (props.title ?? header),
keyboard: closeOnEsc,
@@ -556,6 +559,7 @@ export const SideSheet = ({
}) => (
<Ant.Drawer
{...props}
maskClosable={overlayMaskClosable(props.maskClosable)}
open={visible}
onClose={onCancel}
keyboard={closeOnEsc}
@@ -681,6 +685,7 @@ export const Dropdown = Object.assign(
const NavItem = ({ children }) => children;
const NavSub = ({ children }) => children;
const NavGroup = ({ children }) => children;
export const Nav = Object.assign(
function Nav({
children,
@@ -701,6 +706,21 @@ export const Nav = Object.assign(
return React.Children.toArray(nodes).flatMap((child, index) => {
if (!React.isValidElement(child)) return [];
const p = child.props;
if (child.type === NavGroup) {
const children = items(p.children, `${prefix}${p.itemKey}-`);
if (children.length === 0) return [];
// Collapsed menus keep their icon tooltips without group headings.
if (isCollapsed) return children;
return [
{
type: 'group',
key: p.itemKey,
label: p.text,
className: p.className,
children: p.folded ? [] : children,
},
];
}
if (child.type === NavItem || child.type === NavSub) {
const label = renderWrapper
? renderWrapper({ itemElement: <span>{p.text}</span>, props: p })
@@ -736,5 +756,5 @@ export const Nav = Object.assign(
/>
);
},
{ Item: NavItem, Sub: NavSub },
{ Item: NavItem, Sub: NavSub, Group: NavGroup },
);
+34
View File
@@ -0,0 +1,34 @@
/*
Copyright (C) 2025 QuantumNous
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
For commercial licensing, please contact support@quantumnous.com
*/
// Shared overlays also serve admin pages; apply the personal-page policy only
// when rendering an overlay or opening an imperative confirmation on these routes.
export function overlayMaskClosable(
configured,
pathname = globalThis.window?.location?.pathname ?? '',
) {
const scoped =
pathname === '/market' ||
pathname === '/market/' ||
pathname === '/skill-market' ||
pathname === '/skill-market/' ||
pathname === '/user-center' ||
pathname.startsWith('/user-center/');
return scoped ? true : configured;
}
+4
View File
@@ -17,6 +17,10 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
For commercial licensing, please contact support@quantumnous.com
*/
// Legacy pagination accepts a boolean; Ant Design calls a renderer when enabled.
export const paginationShowTotal = (showTotal) =>
showTotal === true ? (total) => `${total}` : showTotal;
// Preserve the existing callback sequence while Ant Design owns presentation.
export function paginationEvents({
currentPage,