feat: 自行开发设计 ui样式优化 超管端-控制台 相关的页面
This commit is contained in:
@@ -22,6 +22,9 @@ import { Card, Divider, Button } from '@/components/ui';
|
||||
import PropTypes from 'prop-types';
|
||||
import { useIsMobile } from '../../../hooks/common/useIsMobile';
|
||||
import { IconEyeOpened, IconEyeClosed } from '@/components/ui/icons';
|
||||
import { useConsolePage } from '../../console/ConsoleContext';
|
||||
import ConsoleCollection from '../../console/ConsoleCollection';
|
||||
import TableToolbar from '../table/TableToolbar';
|
||||
|
||||
/**
|
||||
* CardPro 高级卡片组件
|
||||
@@ -49,6 +52,9 @@ const CardPro = ({
|
||||
tabsArea,
|
||||
actionsArea,
|
||||
searchArea,
|
||||
tableActions,
|
||||
tableTitle,
|
||||
tableActionsOffset = false,
|
||||
paginationArea, // 新增分页区域
|
||||
// 卡片属性
|
||||
shadows,
|
||||
@@ -59,6 +65,7 @@ const CardPro = ({
|
||||
t = (key) => key,
|
||||
...props
|
||||
}) => {
|
||||
const consolePage = useConsolePage();
|
||||
const isMobile = useIsMobile();
|
||||
const [showMobileActions, setShowMobileActions] = useState(false);
|
||||
|
||||
@@ -156,6 +163,24 @@ const CardPro = ({
|
||||
|
||||
const footerContent = renderFooter();
|
||||
|
||||
if (consolePage) {
|
||||
return (
|
||||
<ConsoleCollection
|
||||
statsArea={statsArea}
|
||||
descriptionArea={descriptionArea}
|
||||
tabsArea={tabsArea}
|
||||
actionsArea={actionsArea}
|
||||
searchArea={searchArea}
|
||||
tableActions={tableActions}
|
||||
tableTitle={tableTitle}
|
||||
tableActionsOffset={tableActionsOffset}
|
||||
paginationArea={paginationArea}
|
||||
>
|
||||
{children}
|
||||
</ConsoleCollection>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<Card
|
||||
className={`table-scroll-card !rounded-2xl ${className}`}
|
||||
@@ -166,6 +191,11 @@ const CardPro = ({
|
||||
style={style}
|
||||
{...props}
|
||||
>
|
||||
{tableTitle ? (
|
||||
<TableToolbar title={tableTitle}>{tableActions}</TableToolbar>
|
||||
) : tableActions ? (
|
||||
<div className='table-column-toolbar'>{tableActions}</div>
|
||||
) : null}
|
||||
{children}
|
||||
</Card>
|
||||
);
|
||||
@@ -188,6 +218,9 @@ CardPro.propTypes = {
|
||||
PropTypes.arrayOf(PropTypes.node),
|
||||
]),
|
||||
searchArea: PropTypes.node,
|
||||
tableActions: PropTypes.node,
|
||||
tableTitle: PropTypes.node,
|
||||
tableActionsOffset: PropTypes.bool,
|
||||
paginationArea: PropTypes.node,
|
||||
// 表格内容
|
||||
children: PropTypes.node,
|
||||
|
||||
@@ -33,6 +33,7 @@ import { IconChevronDown, IconChevronUp } from '@/components/ui/icons';
|
||||
import PropTypes from 'prop-types';
|
||||
import { useIsMobile } from '../../../hooks/common/useIsMobile';
|
||||
import { useMinimumLoadingTime } from '../../../hooks/common/useMinimumLoadingTime';
|
||||
import { useConsolePage } from '../../console/ConsoleContext';
|
||||
|
||||
/**
|
||||
* CardTable 响应式表格组件
|
||||
@@ -48,6 +49,7 @@ const CardTable = ({
|
||||
hidePagination = false,
|
||||
...tableProps
|
||||
}) => {
|
||||
const consolePage = useConsolePage();
|
||||
const isMobile = useIsMobile();
|
||||
const { t } = useTranslation();
|
||||
|
||||
@@ -103,7 +105,7 @@ const CardTable = ({
|
||||
selectableKeys.length > 0 &&
|
||||
selectableKeys.every((key) => selectedKeys.includes(key));
|
||||
|
||||
if (!isMobile) {
|
||||
if (!isMobile || consolePage) {
|
||||
const finalTableProps = hidePagination
|
||||
? { ...tableProps, pagination: false }
|
||||
: tableProps;
|
||||
|
||||
@@ -20,7 +20,7 @@ For commercial licensing, please contact support@quantumnous.com
|
||||
import React from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { Card, Button, Typography, Tag } from '@/components/ui';
|
||||
import { copy, showSuccess } from '../../../helpers';
|
||||
import { copy, showError, showSuccess } from '../../../helpers';
|
||||
|
||||
/**
|
||||
* 解析密钥数据,支持多种格式
|
||||
@@ -95,14 +95,14 @@ const ChannelKeyDisplay = ({
|
||||
const parsedKeys = parseChannelKeys(keyData, t);
|
||||
const isMultipleKeys = parsedKeys.length > 1;
|
||||
|
||||
const handleCopyAll = () => {
|
||||
copy(keyData);
|
||||
showSuccess(t('所有密钥已复制到剪贴板'));
|
||||
const handleCopyAll = async () => {
|
||||
if (await copy(keyData)) showSuccess(t('所有密钥已复制到剪贴板'));
|
||||
else showError(t('复制失败,请手动复制'));
|
||||
};
|
||||
|
||||
const handleCopyKey = (content) => {
|
||||
copy(content);
|
||||
showSuccess(t('密钥已复制到剪贴板'));
|
||||
const handleCopyKey = async (content) => {
|
||||
if (await copy(content)) showSuccess(t('密钥已复制到剪贴板'));
|
||||
else showError(t('复制失败,请手动复制'));
|
||||
};
|
||||
|
||||
return (
|
||||
|
||||
@@ -21,6 +21,7 @@ import React from 'react';
|
||||
import { Button } from '@/components/ui';
|
||||
import PropTypes from 'prop-types';
|
||||
import { useIsMobile } from '../../../hooks/common/useIsMobile';
|
||||
import { useConsolePage } from '../../console/ConsoleContext';
|
||||
|
||||
/**
|
||||
* 紧凑模式切换按钮组件
|
||||
@@ -37,9 +38,10 @@ const CompactModeToggle = ({
|
||||
...props
|
||||
}) => {
|
||||
const isMobile = useIsMobile();
|
||||
const consolePage = useConsolePage();
|
||||
|
||||
// 在移动端隐藏紧凑列表切换按钮
|
||||
if (isMobile) {
|
||||
// Console lists keep their stored density, but no longer expose a toggle.
|
||||
if (isMobile || consolePage) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -58,6 +58,7 @@ const JSONEditor = ({
|
||||
template,
|
||||
templateLabel,
|
||||
editorType = 'keyValue',
|
||||
objectValueAutoSize,
|
||||
rules = [],
|
||||
formApi = null,
|
||||
...props
|
||||
@@ -368,6 +369,7 @@ const JSONEditor = ({
|
||||
return (
|
||||
<TextArea
|
||||
rows={2}
|
||||
autosize={objectValueAutoSize}
|
||||
value={JSON.stringify(value, null, 2)}
|
||||
onChange={(txt) => {
|
||||
try {
|
||||
@@ -407,7 +409,7 @@ const JSONEditor = ({
|
||||
// 渲染键值对编辑器
|
||||
const renderKeyValueEditor = () => {
|
||||
return (
|
||||
<div className='space-y-1'>
|
||||
<div className='json-editor-pairs space-y-1'>
|
||||
{/* 重复键警告 */}
|
||||
{duplicateKeys.size > 0 && (
|
||||
<Banner
|
||||
@@ -442,7 +444,12 @@ const JSONEditor = ({
|
||||
keyValuePairs.slice(index + 1).every((p) => p.key !== pair.key);
|
||||
|
||||
return (
|
||||
<Row key={pair.id} gutter={8} align='middle'>
|
||||
<Row
|
||||
key={pair.id}
|
||||
gutter={8}
|
||||
align='middle'
|
||||
className='json-editor-pair'
|
||||
>
|
||||
<Col span={10}>
|
||||
<div className='relative'>
|
||||
<Input
|
||||
@@ -486,7 +493,7 @@ const JSONEditor = ({
|
||||
);
|
||||
})}
|
||||
|
||||
<div className='mt-2 flex justify-center'>
|
||||
<div className='json-editor-add mt-2 flex justify-center'>
|
||||
<Button
|
||||
icon={<IconPlus />}
|
||||
type='primary'
|
||||
@@ -568,7 +575,10 @@ const JSONEditor = ({
|
||||
<Tooltip content={t('重复的键名')}>
|
||||
<IconAlertTriangle
|
||||
className='absolute right-2 top-1/2 transform -translate-y-1/2'
|
||||
style={{ color: 'var(--ui-color-warning)', fontSize: '14px' }}
|
||||
style={{
|
||||
color: 'var(--ui-color-warning)',
|
||||
fontSize: '14px',
|
||||
}}
|
||||
/>
|
||||
</Tooltip>
|
||||
)}
|
||||
@@ -628,8 +638,9 @@ const JSONEditor = ({
|
||||
<Form.Slot label={label}>
|
||||
<Card
|
||||
header={
|
||||
<div className='flex justify-between items-center'>
|
||||
<div className='json-editor-header flex justify-between items-center'>
|
||||
<Tabs
|
||||
className='json-editor-tabs'
|
||||
type='slash'
|
||||
activeKey={editMode}
|
||||
onChange={(key) => {
|
||||
@@ -651,7 +662,9 @@ const JSONEditor = ({
|
||||
)}
|
||||
</div>
|
||||
}
|
||||
headerStyle={{ padding: '12px 16px' }}
|
||||
headerStyle={{
|
||||
padding: 'var(--json-editor-header-padding, 12px 16px)',
|
||||
}}
|
||||
bodyStyle={{ padding: '16px' }}
|
||||
className='!rounded-2xl'
|
||||
>
|
||||
@@ -670,6 +683,7 @@ const JSONEditor = ({
|
||||
{renderVisualEditor()}
|
||||
{/* 隐藏的Form字段用于验证和数据绑定 */}
|
||||
<Form.Input
|
||||
className='json-editor-bound-field'
|
||||
field={field}
|
||||
value={value}
|
||||
rules={rules}
|
||||
@@ -689,6 +703,7 @@ const JSONEditor = ({
|
||||
/>
|
||||
{/* 隐藏的Form字段用于验证和数据绑定 */}
|
||||
<Form.Input
|
||||
className='json-editor-bound-field'
|
||||
field={field}
|
||||
value={value}
|
||||
rules={rules}
|
||||
@@ -701,7 +716,7 @@ const JSONEditor = ({
|
||||
|
||||
{/* 额外文本显示在卡片底部 */}
|
||||
{extraText && (
|
||||
<Divider margin='12px' align='center'>
|
||||
<Divider margin='var(--json-editor-note-margin, 12px)' align='center'>
|
||||
<Text type='tertiary' size='small'>
|
||||
{extraText}
|
||||
</Text>
|
||||
|
||||
Reference in New Issue
Block a user