feat: 参考原型图 ui优化提交 企业端-企业中心 相关的页面
This commit is contained in:
@@ -81,7 +81,7 @@ const COLUMN_WIDTHS = {
|
||||
// 列设置:只控制本页表格列的显示,不持久化、不改请求。
|
||||
const COLUMN_OPTIONS = [
|
||||
{ value: 'name', label: '名称' },
|
||||
{ value: 'key', label: '令牌' },
|
||||
{ value: 'key', label: '密钥' },
|
||||
{ value: 'group', label: '分组' },
|
||||
{ value: 'status', label: '状态' },
|
||||
{ value: 'expired_time', label: '过期时间' },
|
||||
@@ -117,11 +117,11 @@ const KeyTable = ({
|
||||
key: 'name',
|
||||
dataIndex: 'name',
|
||||
render: (name) => (
|
||||
<span className='km-name'>{name || t('未命名令牌')}</span>
|
||||
<span className='km-name'>{name || t('未命名密钥')}</span>
|
||||
),
|
||||
},
|
||||
{
|
||||
title: t('令牌'),
|
||||
title: t('密钥'),
|
||||
key: 'key',
|
||||
render: (_, token) => {
|
||||
const shown = !!showKeys[token.id];
|
||||
@@ -130,22 +130,22 @@ const KeyTable = ({
|
||||
<code className='km-key-code'>
|
||||
sk-{shown ? token.key : KEY_MASK}
|
||||
</code>
|
||||
<Tooltip title={shown ? t('隐藏令牌') : t('显示令牌')}>
|
||||
<Tooltip title={shown ? t('隐藏密钥') : t('显示密钥')}>
|
||||
<Button
|
||||
type='text'
|
||||
size='small'
|
||||
aria-label={shown ? t('隐藏令牌') : t('显示令牌')}
|
||||
aria-label={shown ? t('隐藏密钥') : t('显示密钥')}
|
||||
aria-pressed={shown}
|
||||
icon={shown ? <EyeOff size={16} /> : <Eye size={16} />}
|
||||
onClick={() => onToggleShowKey(token.id)}
|
||||
/>
|
||||
</Tooltip>
|
||||
<Tooltip title={t('复制令牌')}>
|
||||
<Tooltip title={t('复制密钥')}>
|
||||
<Button
|
||||
type='text'
|
||||
size='small'
|
||||
className='km-copy-btn tour-copy-btn'
|
||||
aria-label={t('复制令牌')}
|
||||
aria-label={t('复制密钥')}
|
||||
icon={<Copy size={16} />}
|
||||
onClick={() => onCopy('sk-' + token.key)}
|
||||
/>
|
||||
@@ -346,12 +346,12 @@ const ModelsDrawer = ({ visible, onClose, token, t }) => {
|
||||
const loadModels = async () => {
|
||||
setLoading(true);
|
||||
try {
|
||||
// 如果秘钥有模型限制,使用限制的模型列表
|
||||
// 如果密钥有模型限制,使用限制的模型列表
|
||||
if (token.model_limits_enabled && token.model_limits) {
|
||||
const limitedModels = token.model_limits.split(',').filter(Boolean);
|
||||
setModels(limitedModels);
|
||||
} else {
|
||||
// 否则获取该秘钥所属分组下的可用模型
|
||||
// 否则获取该密钥所属分组下的可用模型
|
||||
const groupValue = token.group || token.groups;
|
||||
// 如果分组为 auto 或空,获取用户所有分组的模型
|
||||
const apiUrl =
|
||||
@@ -401,16 +401,17 @@ const ModelsDrawer = ({ visible, onClose, token, t }) => {
|
||||
title={t('可用模型列表')}
|
||||
open={visible}
|
||||
onClose={onClose}
|
||||
maskClosable
|
||||
placement='right'
|
||||
width={440}
|
||||
rootClassName='km-models-drawer'
|
||||
>
|
||||
<dl className='km-models-info'>
|
||||
<dt>{t('令牌名称')}</dt>
|
||||
<dd>{token?.name || t('未命名令牌')}</dd>
|
||||
<dt>{t('密钥名称')}</dt>
|
||||
<dd>{token?.name || t('未命名密钥')}</dd>
|
||||
{token?.group ? (
|
||||
<>
|
||||
<dt>{t('令牌分组')}</dt>
|
||||
<dt>{t('密钥分组')}</dt>
|
||||
<dd>{token.group === 'auto' ? t('智能熔断') : token.group}</dd>
|
||||
</>
|
||||
) : null}
|
||||
@@ -501,11 +502,11 @@ const KeyManagement = ({ embedded = false }) => {
|
||||
t: originalT,
|
||||
} = tokensData;
|
||||
|
||||
// 设计图统一称“密钥”:沿用原 令牌 文案键,仅替换显示词。
|
||||
// 设计图统一称“密钥”:沿用原 密钥 文案键,仅替换显示词。
|
||||
const t = (key, options) => {
|
||||
const result = originalT(key, options);
|
||||
return typeof result === 'string'
|
||||
? result.replace(/令牌|秘钥/g, '密钥')
|
||||
? result.replace(/密钥|密钥/g, '密钥')
|
||||
: result;
|
||||
};
|
||||
|
||||
@@ -525,23 +526,23 @@ const KeyManagement = ({ embedded = false }) => {
|
||||
userState?.user?.group,
|
||||
);
|
||||
|
||||
// 判断是否有秘钥
|
||||
// 判断是否有密钥
|
||||
const hasKeys = tokens.length > 0;
|
||||
|
||||
// 新手引导步骤 - 根据是否有秘钥动态调整
|
||||
// 新手引导步骤 - 根据是否有密钥动态调整
|
||||
const tourSteps = hasKeys
|
||||
? [
|
||||
// 有秘钥时:完整引导
|
||||
// 有密钥时:完整引导
|
||||
{
|
||||
target: '.tour-create-btn',
|
||||
content: (
|
||||
<div>
|
||||
<div className='flex items-center gap-2 mb-2'>
|
||||
<span className='text-lg'>✨</span>
|
||||
<span className='font-semibold'>{t('创建秘钥')}</span>
|
||||
<span className='font-semibold'>{t('创建密钥')}</span>
|
||||
</div>
|
||||
<div className='text-sm text-gray-600 dark:text-gray-300'>
|
||||
{t('点击这里创建新秘钥,设置名称和使用额度')}
|
||||
{t('点击这里创建新密钥,设置名称和使用额度')}
|
||||
</div>
|
||||
</div>
|
||||
),
|
||||
@@ -555,13 +556,13 @@ const KeyManagement = ({ embedded = false }) => {
|
||||
<div>
|
||||
<div className='flex items-center gap-2 mb-2'>
|
||||
<span className='text-lg'>📋</span>
|
||||
<span className='font-semibold'>{t('秘钥卡片')}</span>
|
||||
<span className='font-semibold'>{t('密钥卡片')}</span>
|
||||
</div>
|
||||
<div className='text-sm text-gray-600 dark:text-gray-300'>
|
||||
{t('每张卡片展示秘钥的状态、名称和剩余额度')}
|
||||
{t('每张卡片展示密钥的状态、名称和剩余额度')}
|
||||
</div>
|
||||
<div className='mt-2 text-xs text-gray-400'>
|
||||
💡 {t('绿色状态点表示秘钥已启用')}
|
||||
💡 {t('绿色状态点表示密钥已启用')}
|
||||
</div>
|
||||
</div>
|
||||
),
|
||||
@@ -573,10 +574,10 @@ const KeyManagement = ({ embedded = false }) => {
|
||||
<div>
|
||||
<div className='flex items-center gap-2 mb-2'>
|
||||
<span className='text-lg'>📋</span>
|
||||
<span className='font-semibold'>{t('复制秘钥')}</span>
|
||||
<span className='font-semibold'>{t('复制密钥')}</span>
|
||||
</div>
|
||||
<div className='text-sm text-gray-600 dark:text-gray-300'>
|
||||
{t('点击复制完整秘钥(sk-xxx 格式)')}
|
||||
{t('点击复制完整密钥(sk-xxx 格式)')}
|
||||
</div>
|
||||
<div className='mt-2 p-2 bg-gray-100 dark:bg-neutral-800 rounded text-xs font-mono'>
|
||||
sk-xxxxxxxxxxxxxxxx
|
||||
@@ -592,10 +593,10 @@ const KeyManagement = ({ embedded = false }) => {
|
||||
<div>
|
||||
<div className='flex items-center gap-2 mb-2'>
|
||||
<span className='text-lg'>⚙️</span>
|
||||
<span className='font-semibold'>{t('管理秘钥')}</span>
|
||||
<span className='font-semibold'>{t('管理密钥')}</span>
|
||||
</div>
|
||||
<div className='text-sm text-gray-600 dark:text-gray-300'>
|
||||
{t('编辑秘钥名称、额度、过期时间等设置')}
|
||||
{t('编辑密钥名称、额度、过期时间等设置')}
|
||||
</div>
|
||||
<div className='mt-3 text-xs text-gray-400'>
|
||||
💡 {t('点击右上角问号可随时重新查看引导')}
|
||||
@@ -607,7 +608,7 @@ const KeyManagement = ({ embedded = false }) => {
|
||||
},
|
||||
]
|
||||
: [
|
||||
// 没有秘钥时:简化引导,只显示创建按钮
|
||||
// 没有密钥时:简化引导,只显示创建按钮
|
||||
{
|
||||
target: '.tour-create-btn',
|
||||
content: (
|
||||
@@ -615,14 +616,14 @@ const KeyManagement = ({ embedded = false }) => {
|
||||
<div className='flex items-center gap-2 mb-2'>
|
||||
<span className='text-lg'>🚀</span>
|
||||
<span className='font-semibold'>
|
||||
{t('开始创建您的第一个秘钥')}
|
||||
{t('开始创建您的第一个密钥')}
|
||||
</span>
|
||||
</div>
|
||||
<div className='text-sm text-gray-600 dark:text-gray-300'>
|
||||
{t('点击这里创建秘钥,创建后可用于调用 API 服务')}
|
||||
{t('点击这里创建密钥,创建后可用于调用 API 服务')}
|
||||
</div>
|
||||
<div className='mt-3 p-2 bg-brand/5 dark:bg-brand-deep/20 rounded-lg text-xs text-brand-deep dark:text-brand-from'>
|
||||
💡 {t('创建秘钥后,可再次点击右上角问号查看完整操作指引')}
|
||||
💡 {t('创建密钥后,可再次点击右上角问号查看完整操作指引')}
|
||||
</div>
|
||||
</div>
|
||||
),
|
||||
@@ -668,7 +669,7 @@ const KeyManagement = ({ embedded = false }) => {
|
||||
const action = token.status === 1 ? 'disable' : 'enable';
|
||||
Modal.confirm({
|
||||
title: t(
|
||||
action === 'disable' ? '确定要禁用此秘钥吗?' : '确定要启用此秘钥吗?',
|
||||
action === 'disable' ? '确定要禁用此密钥吗?' : '确定要启用此密钥吗?',
|
||||
),
|
||||
onOk: () => manageToken(token.id, action, token),
|
||||
});
|
||||
@@ -676,7 +677,7 @@ const KeyManagement = ({ embedded = false }) => {
|
||||
|
||||
const handleDelete = (token) => {
|
||||
Modal.confirm({
|
||||
title: t('确定要删除此秘钥吗?'),
|
||||
title: t('确定要删除此密钥吗?'),
|
||||
content: t('删除后将无法恢复'),
|
||||
okType: 'danger',
|
||||
onOk: async () => {
|
||||
@@ -744,6 +745,7 @@ const KeyManagement = ({ embedded = false }) => {
|
||||
showCloseButton
|
||||
hideBackButton={false}
|
||||
disableCloseOnEsc={false}
|
||||
disableScrollParentFix
|
||||
disableOverlayClose={false}
|
||||
scrollToFirstStep
|
||||
scrollOffset={100}
|
||||
@@ -848,7 +850,7 @@ const KeyManagement = ({ embedded = false }) => {
|
||||
<div className='km-content uc-page relative'>
|
||||
<UserCenterPageHeader
|
||||
title={t('密钥管理')}
|
||||
subtitle={t('管理模型调用的访问令牌')}
|
||||
subtitle={t('管理模型调用的访问密钥')}
|
||||
extra={
|
||||
<>
|
||||
{tutorialButtonVisible ? (
|
||||
@@ -877,13 +879,13 @@ const KeyManagement = ({ embedded = false }) => {
|
||||
<div className='km-panels'>
|
||||
<Card className='km-card km-search-card tour-search-input'>
|
||||
<label className='km-search-label' htmlFor='km-search-input'>
|
||||
{t('令牌查询')}
|
||||
{t('密钥查询')}
|
||||
</label>
|
||||
<div className='km-search-row'>
|
||||
<Input
|
||||
id='km-search-input'
|
||||
className='km-search-input'
|
||||
placeholder={t('搜索令牌名称、Key 或分组')}
|
||||
placeholder={t('搜索密钥名称、Key 或分组')}
|
||||
value={searchValue}
|
||||
onChange={(event) => setSearchValue(event.target.value)}
|
||||
onPressEnter={() => setSearchValue(searchValue)}
|
||||
@@ -902,14 +904,14 @@ const KeyManagement = ({ embedded = false }) => {
|
||||
|
||||
<Card className='km-card km-list-card'>
|
||||
<div className='km-list-head'>
|
||||
<h2>{t('令牌列表')}</h2>
|
||||
<h2>{t('密钥列表')}</h2>
|
||||
<div className='km-list-actions'>
|
||||
<Button
|
||||
type='link'
|
||||
className='km-contact-link'
|
||||
onClick={openCustomerService}
|
||||
>
|
||||
{t('创建令牌后不知道怎么用?联系客服')}
|
||||
{t('创建密钥后不知道怎么用?联系客服')}
|
||||
</Button>
|
||||
<Button
|
||||
type='primary'
|
||||
@@ -917,7 +919,7 @@ const KeyManagement = ({ embedded = false }) => {
|
||||
className='tour-create-btn'
|
||||
onClick={handleCreate}
|
||||
>
|
||||
{t('创建令牌')}
|
||||
{t('创建密钥')}
|
||||
</Button>
|
||||
<Popover
|
||||
trigger='click'
|
||||
@@ -944,8 +946,8 @@ const KeyManagement = ({ embedded = false }) => {
|
||||
image={Empty.PRESENTED_IMAGE_SIMPLE}
|
||||
description={
|
||||
searchValue
|
||||
? t('未找到匹配的令牌')
|
||||
: t('暂无令牌,点击上方按钮创建')
|
||||
? t('未找到匹配的密钥')
|
||||
: t('暂无密钥,点击上方按钮创建')
|
||||
}
|
||||
/>
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ html.dark .km-page {
|
||||
.km-panels {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 20px;
|
||||
gap: var(--uc-layout-gap);
|
||||
}
|
||||
|
||||
/* 卡片:查询卡为 Ant Design 默认描边;列表卡描边 #e6e9ef + 极浅投影(设计图可见),圆角 10px,内边距 24px */
|
||||
|
||||
Reference in New Issue
Block a user