feat: 自行开发设计 ui样式优化 超管端-控制台 相关的页面
This commit is contained in:
@@ -16,6 +16,12 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import {
|
||||
ConsoleCard,
|
||||
ConsoleSearchBar,
|
||||
ConsoleSearchActions,
|
||||
} from '../../components/console/ConsolePrimitives';
|
||||
import React, { useEffect, useState, useCallback } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import {
|
||||
@@ -29,7 +35,7 @@ import {
|
||||
Spin,
|
||||
Typography,
|
||||
} from '@/components/ui';
|
||||
import { Receipt, Search, Eye, Check, X, RotateCw, Ban } from 'lucide-react';
|
||||
import { Search, Eye, Check, X, RotateCw, Ban } from 'lucide-react';
|
||||
import { API, showError, showSuccess } from '../../helpers';
|
||||
import {
|
||||
INVOICE_STATUS,
|
||||
@@ -53,6 +59,7 @@ const AdminInvoice = () => {
|
||||
const [total, setTotal] = useState(0);
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [page, setPage] = useState(1);
|
||||
const [pageSize, setPageSize] = useState(20);
|
||||
const [keyword, setKeyword] = useState('');
|
||||
const [searchKeyword, setSearchKeyword] = useState('');
|
||||
const [statusFilter, setStatusFilter] = useState('');
|
||||
@@ -77,20 +84,22 @@ const AdminInvoice = () => {
|
||||
const fetchInvoices = useCallback(async () => {
|
||||
setLoading(true);
|
||||
try {
|
||||
const params = { p: page, page_size: 20 };
|
||||
const params = { p: page, page_size: pageSize };
|
||||
if (searchKeyword) params.keyword = searchKeyword;
|
||||
if (statusFilter) params.status = statusFilter;
|
||||
const res = await API.get('/api/invoice/list', { params });
|
||||
if (res.data.success) {
|
||||
setInvoices(res.data.data?.items || []);
|
||||
setTotal(res.data.data?.total || 0);
|
||||
} else {
|
||||
showError(res.data.message || t('查询失败'));
|
||||
}
|
||||
} catch (err) {
|
||||
showError(err.message);
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
}, [page, searchKeyword, statusFilter]);
|
||||
}, [page, pageSize, searchKeyword, statusFilter]);
|
||||
|
||||
useEffect(() => {
|
||||
fetchInvoices();
|
||||
@@ -359,61 +368,61 @@ const AdminInvoice = () => {
|
||||
];
|
||||
|
||||
return (
|
||||
<div className='mt-[60px] p-4 sm:p-6'>
|
||||
<div className='console-content'>
|
||||
{/* 筛选区:标题与筛选项同行 */}
|
||||
<div className='flex flex-wrap items-center gap-2 mb-4'>
|
||||
<div className='flex items-center gap-1.5 mr-2 flex-shrink-0'>
|
||||
<Receipt size={18} className='text-amber-500' />
|
||||
<span className='text-base font-bold text-gray-900 dark:text-white'>
|
||||
{t('发票管理')}
|
||||
</span>
|
||||
<ConsoleSearchBar formProps={{ layout: 'inline' }}>
|
||||
<div className='console-search-fields'>
|
||||
<Input
|
||||
prefix={<Search size={14} />}
|
||||
placeholder={t('搜索抬头/税号/订单号/用户')}
|
||||
value={keyword}
|
||||
onChange={setKeyword}
|
||||
onEnterPress={handleSearch}
|
||||
style={{ width: 240 }}
|
||||
/>
|
||||
<Select
|
||||
placeholder={t('状态')}
|
||||
value={statusFilter || undefined}
|
||||
onChange={handleStatusFilterChange}
|
||||
style={{ width: 120 }}
|
||||
allowClear
|
||||
optionList={[
|
||||
{ label: t('待审核'), value: '1' },
|
||||
{ label: t('审核通过'), value: '2' },
|
||||
{ label: t('已拒绝'), value: '3' },
|
||||
{ label: t('开票中'), value: '4' },
|
||||
{ label: t('已开票'), value: '5' },
|
||||
{ label: t('已取消'), value: '6' },
|
||||
{ label: t('开票失败'), value: '7' },
|
||||
]}
|
||||
/>
|
||||
<ConsoleSearchActions onSearch={handleSearch} loading={loading} />
|
||||
</div>
|
||||
<Input
|
||||
prefix={<Search size={14} />}
|
||||
placeholder={t('搜索抬头/税号/订单号/用户')}
|
||||
value={keyword}
|
||||
onChange={setKeyword}
|
||||
onEnterPress={handleSearch}
|
||||
style={{ width: 240 }}
|
||||
/>
|
||||
<Select
|
||||
placeholder={t('状态')}
|
||||
value={statusFilter || undefined}
|
||||
onChange={handleStatusFilterChange}
|
||||
style={{ width: 120 }}
|
||||
allowClear
|
||||
optionList={[
|
||||
{ label: t('待审核'), value: '1' },
|
||||
{ label: t('审核通过'), value: '2' },
|
||||
{ label: t('已拒绝'), value: '3' },
|
||||
{ label: t('开票中'), value: '4' },
|
||||
{ label: t('已开票'), value: '5' },
|
||||
{ label: t('已取消'), value: '6' },
|
||||
{ label: t('开票失败'), value: '7' },
|
||||
]}
|
||||
/>
|
||||
<Button theme='solid' type='primary' onClick={handleSearch}>
|
||||
{t('搜索')}
|
||||
</Button>
|
||||
</div>
|
||||
</ConsoleSearchBar>
|
||||
|
||||
{/* 表格 */}
|
||||
<Table
|
||||
columns={columns}
|
||||
dataSource={invoices}
|
||||
loading={loading}
|
||||
rowKey='id'
|
||||
pagination={{
|
||||
currentPage: page,
|
||||
total,
|
||||
pageSize: 20,
|
||||
onPageChange: setPage,
|
||||
showTotal: true,
|
||||
}}
|
||||
scroll={{ x: 1100 }}
|
||||
size='small'
|
||||
empty={t('暂无发票数据')}
|
||||
/>
|
||||
<ConsoleCard>
|
||||
<Table
|
||||
columns={columns}
|
||||
dataSource={invoices}
|
||||
loading={loading}
|
||||
rowKey='id'
|
||||
pagination={{
|
||||
currentPage: page,
|
||||
total,
|
||||
pageSize,
|
||||
onPageChange: setPage,
|
||||
onPageSizeChange: (size) => {
|
||||
setPage(1);
|
||||
setPageSize(size);
|
||||
},
|
||||
showTotal: true,
|
||||
}}
|
||||
scroll={{ x: 1100 }}
|
||||
size='middle'
|
||||
empty={t('暂无发票数据')}
|
||||
/>
|
||||
</ConsoleCard>
|
||||
|
||||
{/* 审核通过弹窗 */}
|
||||
<Modal
|
||||
|
||||
+197
-116
@@ -16,12 +16,19 @@ 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 TableToolbar from '../../components/common/table/TableToolbar';
|
||||
import {
|
||||
ConsoleCard,
|
||||
ConsoleSearchBar,
|
||||
} from '../../components/console/ConsolePrimitives';
|
||||
import React, { useEffect, useState, useCallback } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { ShoppingCart, Search, Copy, Check } from 'lucide-react';
|
||||
import { Search, Copy, Check } from 'lucide-react';
|
||||
import {
|
||||
Table,
|
||||
Button,
|
||||
Input,
|
||||
Tag,
|
||||
Select,
|
||||
@@ -65,12 +72,23 @@ const formatUSDMinor = (value) => {
|
||||
return `$${(Number(value) / 100).toFixed(2)}`;
|
||||
};
|
||||
|
||||
import { Descriptions } from 'antd';
|
||||
import { ConsoleDrawer } from '../../components/console/ConsolePrimitives';
|
||||
import { Button } from '@/components/ui';
|
||||
import {
|
||||
ConsoleFilterField,
|
||||
ConsoleFilterActions,
|
||||
} from '../../components/console/ConsoleModuleFilters';
|
||||
|
||||
const AdminOrder = () => {
|
||||
const { t } = useTranslation();
|
||||
const [detailOrder, setDetailOrder] = useState(null);
|
||||
const [queryVersion, setQueryVersion] = useState(0);
|
||||
const [orders, setOrders] = useState([]);
|
||||
const [total, setTotal] = useState(0);
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [page, setPage] = useState(1);
|
||||
const [pageSize, setPageSize] = useState(20);
|
||||
const [keyword, setKeyword] = useState('');
|
||||
const [searchKeyword, setSearchKeyword] = useState('');
|
||||
const [orderId, setOrderId] = useState(undefined);
|
||||
@@ -89,7 +107,7 @@ const AdminOrder = () => {
|
||||
const fetchOrders = useCallback(async () => {
|
||||
setLoading(true);
|
||||
try {
|
||||
const params = { p: page, page_size: 20 };
|
||||
const params = { p: page, page_size: pageSize };
|
||||
if (searchKeyword) params.keyword = searchKeyword;
|
||||
if (appliedOrderId) params.order_id = appliedOrderId;
|
||||
if (appliedUserId) params.user_id = appliedUserId;
|
||||
@@ -107,6 +125,8 @@ const AdminOrder = () => {
|
||||
if (res.data.success) {
|
||||
setOrders(res.data.data?.items || []);
|
||||
setTotal(res.data.data?.total || 0);
|
||||
} else {
|
||||
showError(res.data.message || t('查询失败'));
|
||||
}
|
||||
} catch (err) {
|
||||
showError(err.message);
|
||||
@@ -115,6 +135,7 @@ const AdminOrder = () => {
|
||||
}
|
||||
}, [
|
||||
page,
|
||||
pageSize,
|
||||
searchKeyword,
|
||||
appliedOrderId,
|
||||
appliedUserId,
|
||||
@@ -123,6 +144,7 @@ const AdminOrder = () => {
|
||||
dateRange,
|
||||
appliedMinMoney,
|
||||
appliedMaxMoney,
|
||||
queryVersion,
|
||||
]);
|
||||
|
||||
useEffect(() => {
|
||||
@@ -149,6 +171,7 @@ const AdminOrder = () => {
|
||||
setAppliedUserId(normalizedUserId);
|
||||
setAppliedMinMoney(minMoney);
|
||||
setAppliedMaxMoney(maxMoney);
|
||||
setQueryVersion((version) => version + 1);
|
||||
};
|
||||
|
||||
const handleStatusFilterChange = (value) => {
|
||||
@@ -175,6 +198,7 @@ const AdminOrder = () => {
|
||||
};
|
||||
|
||||
const handleReset = () => {
|
||||
setQueryVersion((version) => version + 1);
|
||||
setPage(1);
|
||||
setKeyword('');
|
||||
setSearchKeyword('');
|
||||
@@ -192,8 +216,7 @@ const AdminOrder = () => {
|
||||
};
|
||||
|
||||
const copyText = (text, id) => {
|
||||
navigator.clipboard
|
||||
.writeText(text)
|
||||
writeClipboardText(text)
|
||||
.then(() => {
|
||||
setCopiedId(id);
|
||||
Toast.success(t('已复制'));
|
||||
@@ -332,124 +355,182 @@ const AdminOrder = () => {
|
||||
width: 150,
|
||||
render: (v) => formatTime(v),
|
||||
},
|
||||
{
|
||||
title: t('操作'),
|
||||
key: 'operate',
|
||||
fixed: 'right',
|
||||
width: 80,
|
||||
render: (_, record) => (
|
||||
<Button type='link' size='small' onClick={() => setDetailOrder(record)}>
|
||||
{t('详情')}
|
||||
</Button>
|
||||
),
|
||||
},
|
||||
];
|
||||
|
||||
return (
|
||||
<div className='mt-[60px] p-4 sm:p-6'>
|
||||
{/* 筛选区:标题与筛选项同行,紧凑布局 */}
|
||||
<div className='flex flex-wrap items-center gap-2 mb-4'>
|
||||
<div className='flex items-center gap-1.5 mr-2 flex-shrink-0'>
|
||||
<ShoppingCart size={18} className='text-blue-500' />
|
||||
<span className='text-base font-bold text-gray-900 dark:text-white'>
|
||||
{t('订单管理')}
|
||||
</span>
|
||||
<div className='console-content'>
|
||||
<ConsoleDrawer
|
||||
title={t('记录详情')}
|
||||
classNames={{ header: 'console-detail-header' }}
|
||||
open={Boolean(detailOrder)}
|
||||
onClose={() => setDetailOrder(null)}
|
||||
placement='right'
|
||||
maskClosable
|
||||
width={560}
|
||||
footer={
|
||||
<div className='console-model-footer'>
|
||||
<Button onClick={() => setDetailOrder(null)}>{t('关闭')}</Button>
|
||||
</div>
|
||||
}
|
||||
>
|
||||
<Descriptions
|
||||
bordered
|
||||
column={1}
|
||||
size='small'
|
||||
items={
|
||||
detailOrder
|
||||
? columns
|
||||
.filter((column) => column.key !== 'operate')
|
||||
.map((column, key) => ({
|
||||
key,
|
||||
label: column.title,
|
||||
children:
|
||||
column.dataIndex === 'trade_no'
|
||||
? detailOrder.trade_no
|
||||
: column.render
|
||||
? column.render(
|
||||
detailOrder[column.dataIndex],
|
||||
detailOrder,
|
||||
)
|
||||
: (detailOrder[column.dataIndex] ?? '-'),
|
||||
}))
|
||||
: []
|
||||
}
|
||||
/>
|
||||
</ConsoleDrawer>
|
||||
<ConsoleSearchBar
|
||||
formProps={{
|
||||
layout: 'vertical',
|
||||
onFinish: handleSearch,
|
||||
className: 'console-module-filter-form',
|
||||
}}
|
||||
>
|
||||
<div className='console-module-filter-grid'>
|
||||
<ConsoleFilterField label={t('搜索昵称/订单号')}>
|
||||
<Input
|
||||
prefix={<Search size={14} />}
|
||||
placeholder={t('搜索昵称/订单号')}
|
||||
value={keyword}
|
||||
onChange={setKeyword}
|
||||
onEnterPress={handleSearch}
|
||||
/>
|
||||
</ConsoleFilterField>
|
||||
<ConsoleFilterField label={t('订单ID')}>
|
||||
<InputNumber
|
||||
placeholder={t('订单ID')}
|
||||
value={orderId}
|
||||
onChange={setOrderId}
|
||||
min={1}
|
||||
hideButtons
|
||||
/>
|
||||
</ConsoleFilterField>
|
||||
<ConsoleFilterField label={t('用户ID')}>
|
||||
<InputNumber
|
||||
placeholder={t('用户ID')}
|
||||
value={userId}
|
||||
onChange={setUserId}
|
||||
min={1}
|
||||
hideButtons
|
||||
/>
|
||||
</ConsoleFilterField>
|
||||
<ConsoleFilterField label={t('状态')}>
|
||||
<Select
|
||||
placeholder={t('状态')}
|
||||
value={statusFilter || undefined}
|
||||
onChange={handleStatusFilterChange}
|
||||
allowClear
|
||||
optionList={[
|
||||
{ label: t('待支付'), value: 'pending' },
|
||||
{ label: t('已完成'), value: 'success' },
|
||||
{ label: t('已过期'), value: 'expired' },
|
||||
]}
|
||||
/>
|
||||
</ConsoleFilterField>
|
||||
<ConsoleFilterField label={t('支付方式')}>
|
||||
<Select
|
||||
placeholder={t('支付方式')}
|
||||
value={paymentMethodFilter || undefined}
|
||||
onChange={handlePaymentMethodChange}
|
||||
allowClear
|
||||
optionList={Object.entries(paymentMethodMap).map(
|
||||
([value, label]) => ({ label, value }),
|
||||
)}
|
||||
/>
|
||||
</ConsoleFilterField>
|
||||
<ConsoleFilterField label={t('创建时间')}>
|
||||
<DatePicker
|
||||
type='dateTimeRange'
|
||||
value={dateRange}
|
||||
onChange={handleDateRangeChange}
|
||||
placeholder={[t('开始时间'), t('结束时间')]}
|
||||
density='compact'
|
||||
/>
|
||||
</ConsoleFilterField>
|
||||
<ConsoleFilterField label={t('支付金额')}>
|
||||
<div className='flex items-center gap-1'>
|
||||
<InputNumber
|
||||
placeholder={t('最小金额')}
|
||||
value={minMoney}
|
||||
onChange={handleMinMoneyChange}
|
||||
min={0}
|
||||
precision={2}
|
||||
prefix='¥'
|
||||
/>
|
||||
<span className='text-gray-400'>-</span>
|
||||
<InputNumber
|
||||
placeholder={t('最大金额')}
|
||||
value={maxMoney}
|
||||
onChange={handleMaxMoneyChange}
|
||||
min={0}
|
||||
precision={2}
|
||||
prefix='¥'
|
||||
/>
|
||||
</div>
|
||||
</ConsoleFilterField>
|
||||
</div>
|
||||
<Input
|
||||
prefix={<Search size={14} />}
|
||||
placeholder={t('搜索昵称/订单号')}
|
||||
value={keyword}
|
||||
onChange={setKeyword}
|
||||
onEnterPress={handleSearch}
|
||||
style={{ width: 220 }}
|
||||
<ConsoleFilterActions
|
||||
onReset={handleReset}
|
||||
onSearch={handleSearch}
|
||||
loading={loading}
|
||||
/>
|
||||
<InputNumber
|
||||
placeholder={t('订单ID')}
|
||||
value={orderId}
|
||||
onChange={setOrderId}
|
||||
min={1}
|
||||
style={{ width: 110 }}
|
||||
hideButtons
|
||||
/>
|
||||
<InputNumber
|
||||
placeholder={t('用户ID')}
|
||||
value={userId}
|
||||
onChange={setUserId}
|
||||
min={1}
|
||||
style={{ width: 110 }}
|
||||
hideButtons
|
||||
/>
|
||||
<Select
|
||||
placeholder={t('状态')}
|
||||
value={statusFilter || undefined}
|
||||
onChange={handleStatusFilterChange}
|
||||
style={{ width: 110 }}
|
||||
allowClear
|
||||
optionList={[
|
||||
{ label: t('待支付'), value: 'pending' },
|
||||
{ label: t('已完成'), value: 'success' },
|
||||
{ label: t('已过期'), value: 'expired' },
|
||||
]}
|
||||
/>
|
||||
<Select
|
||||
placeholder={t('支付方式')}
|
||||
value={paymentMethodFilter || undefined}
|
||||
onChange={handlePaymentMethodChange}
|
||||
style={{ width: 120 }}
|
||||
allowClear
|
||||
optionList={Object.entries(paymentMethodMap).map(
|
||||
([value, label]) => ({ label, value }),
|
||||
)}
|
||||
/>
|
||||
<DatePicker
|
||||
type='dateTimeRange'
|
||||
value={dateRange}
|
||||
onChange={handleDateRangeChange}
|
||||
placeholder={[t('开始时间'), t('结束时间')]}
|
||||
style={{ width: 340 }}
|
||||
density='compact'
|
||||
/>
|
||||
<div className='flex items-center gap-1'>
|
||||
<InputNumber
|
||||
placeholder={t('最小金额')}
|
||||
value={minMoney}
|
||||
onChange={handleMinMoneyChange}
|
||||
min={0}
|
||||
precision={2}
|
||||
style={{ width: 100 }}
|
||||
prefix='¥'
|
||||
/>
|
||||
<span className='text-gray-400'>-</span>
|
||||
<InputNumber
|
||||
placeholder={t('最大金额')}
|
||||
value={maxMoney}
|
||||
onChange={handleMaxMoneyChange}
|
||||
min={0}
|
||||
precision={2}
|
||||
style={{ width: 100 }}
|
||||
prefix='¥'
|
||||
/>
|
||||
</div>
|
||||
<Button
|
||||
theme='solid'
|
||||
type='primary'
|
||||
size='default'
|
||||
onClick={handleSearch}
|
||||
>
|
||||
{t('搜索')}
|
||||
</Button>
|
||||
<Button type='tertiary' size='default' onClick={handleReset}>
|
||||
{t('重置')}
|
||||
</Button>
|
||||
</div>
|
||||
</ConsoleSearchBar>
|
||||
|
||||
{/* 表格 */}
|
||||
<Table
|
||||
columns={columns}
|
||||
dataSource={orders}
|
||||
loading={loading}
|
||||
rowKey='id'
|
||||
pagination={{
|
||||
currentPage: page,
|
||||
total,
|
||||
pageSize: 20,
|
||||
onPageChange: setPage,
|
||||
showTotal: true,
|
||||
showSizeChanger: false,
|
||||
}}
|
||||
scroll={{ x: 1100 }}
|
||||
size='small'
|
||||
empty={t('暂无订单数据')}
|
||||
/>
|
||||
<ConsoleCard>
|
||||
<TableToolbar title={t('订单列表')} />
|
||||
<Table
|
||||
columns={columns}
|
||||
dataSource={orders}
|
||||
loading={loading}
|
||||
rowKey='id'
|
||||
pagination={{
|
||||
currentPage: page,
|
||||
total,
|
||||
pageSize,
|
||||
onPageChange: setPage,
|
||||
onPageSizeChange: (size) => {
|
||||
setPage(1);
|
||||
setPageSize(size);
|
||||
},
|
||||
showTotal: true,
|
||||
showSizeChanger: false,
|
||||
}}
|
||||
scroll={{ x: 1100 }}
|
||||
size='middle'
|
||||
empty={<TableEmpty />}
|
||||
/>
|
||||
</ConsoleCard>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -16,19 +16,18 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import TableEmpty from '../../components/common/table/TableEmpty';
|
||||
import TableToolbar from '../../components/common/table/TableToolbar';
|
||||
import {
|
||||
ConsoleCard,
|
||||
ConsoleSearchBar,
|
||||
} from '../../components/console/ConsolePrimitives';
|
||||
import { ConsolePageActions } from '../../components/console/ConsolePageContainer';
|
||||
import React, { useEffect, useState, useCallback, useRef } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import {
|
||||
Building2,
|
||||
Plus,
|
||||
Search,
|
||||
Pencil,
|
||||
ExternalLink,
|
||||
BarChart3,
|
||||
Bell,
|
||||
BellOff,
|
||||
} from 'lucide-react';
|
||||
import { Plus, Search, ExternalLink, BarChart3, Bell } from 'lucide-react';
|
||||
import {
|
||||
Table,
|
||||
Button,
|
||||
@@ -85,6 +84,11 @@ const VISIBLE_ORG_FEATURE_KEYS = CLOUD_BRAIN_UI_ENABLED
|
||||
({ key }) => !CLOUD_BRAIN_ORG_FEATURE_KEYS.has(key),
|
||||
);
|
||||
|
||||
import {
|
||||
ConsoleFilterField,
|
||||
ConsoleFilterActions,
|
||||
} from '../../components/console/ConsoleModuleFilters';
|
||||
|
||||
const AdminOrganizations = () => {
|
||||
const { t } = useTranslation();
|
||||
const navigate = useNavigate();
|
||||
@@ -92,8 +96,10 @@ const AdminOrganizations = () => {
|
||||
const [total, setTotal] = useState(0);
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [page, setPage] = useState(1);
|
||||
const [pageSize, setPageSize] = useState(20);
|
||||
const [keyword, setKeyword] = useState('');
|
||||
const [searchKeyword, setSearchKeyword] = useState('');
|
||||
const [queryVersion, setQueryVersion] = useState(0);
|
||||
const [quotaModalVisible, setQuotaModalVisible] = useState(false);
|
||||
const [quotaOrgId, setQuotaOrgId] = useState(null);
|
||||
const [quotaAmount, setQuotaAmount] = useState(0);
|
||||
@@ -303,7 +309,7 @@ const AdminOrganizations = () => {
|
||||
const seq = ++fetchSeqRef.current;
|
||||
setLoading(true);
|
||||
try {
|
||||
const params = { p: page, page_size: 20 };
|
||||
const params = { p: page, page_size: pageSize };
|
||||
if (searchKeyword) params.keyword = searchKeyword;
|
||||
if (statusFilter != null) params.status = statusFilter;
|
||||
if (levelFilter) params.level = levelFilter;
|
||||
@@ -318,6 +324,8 @@ const AdminOrganizations = () => {
|
||||
if (res.data.success) {
|
||||
setOrgs(res.data.data?.items || []);
|
||||
setTotal(res.data.data?.total || 0);
|
||||
} else {
|
||||
showError(res.data.message || t('查询失败'));
|
||||
}
|
||||
} catch (err) {
|
||||
if (seq === fetchSeqRef.current) showError(err.message);
|
||||
@@ -326,6 +334,7 @@ const AdminOrganizations = () => {
|
||||
}
|
||||
}, [
|
||||
page,
|
||||
pageSize,
|
||||
searchKeyword,
|
||||
statusFilter,
|
||||
levelFilter,
|
||||
@@ -333,11 +342,12 @@ const AdminOrganizations = () => {
|
||||
userIdFilter,
|
||||
sortBy,
|
||||
sortOrder,
|
||||
t,
|
||||
]);
|
||||
|
||||
useEffect(() => {
|
||||
fetchOrgs();
|
||||
}, [fetchOrgs]);
|
||||
}, [fetchOrgs, queryVersion]);
|
||||
|
||||
useEffect(() => {
|
||||
fetchGroups();
|
||||
@@ -352,15 +362,15 @@ const AdminOrganizations = () => {
|
||||
setPage(1);
|
||||
};
|
||||
|
||||
const hasActiveFilters =
|
||||
!!searchKeyword ||
|
||||
statusFilter != null ||
|
||||
!!levelFilter ||
|
||||
!!salesRepFilter ||
|
||||
!!userIdFilter ||
|
||||
!!sortBy;
|
||||
const handleSearch = () => {
|
||||
setPage(1);
|
||||
setSearchKeyword(keyword.trim());
|
||||
setUserIdFilter(userIdInput);
|
||||
setQueryVersion((version) => version + 1);
|
||||
};
|
||||
|
||||
const resetFilters = () => {
|
||||
setQueryVersion((version) => version + 1);
|
||||
setKeyword('');
|
||||
setSearchKeyword('');
|
||||
setStatusFilter(undefined);
|
||||
@@ -375,10 +385,11 @@ const AdminOrganizations = () => {
|
||||
|
||||
// 服务端排序:列头点击 → 下推 sort_by/sort_order 重新拉取
|
||||
const sortOrderFor = (key) =>
|
||||
sortBy === key ? (sortOrder === 'asc' ? 'ascend' : 'descend') : false;
|
||||
sortBy === key ? (sortOrder === 'asc' ? 'ascend' : 'descend') : null;
|
||||
|
||||
const handleTableChange = ({ sorter }) => {
|
||||
if (!sorter || !sorter.dataIndex) return;
|
||||
// Ant Design clears both the field and order when sorting is cancelled.
|
||||
if (!sorter || (sorter.sortOrder && !sorter.dataIndex)) return;
|
||||
const nextBy = sorter.sortOrder ? sorter.dataIndex : '';
|
||||
const nextOrder = sorter.sortOrder
|
||||
? sorter.sortOrder === 'ascend'
|
||||
@@ -805,22 +816,21 @@ const AdminOrganizations = () => {
|
||||
},
|
||||
{
|
||||
title: t('操作'),
|
||||
width: 320,
|
||||
width: 380,
|
||||
render: (_, record) => (
|
||||
<div className='flex items-center gap-1.5 flex-nowrap'>
|
||||
<div className='console-module-row-actions'>
|
||||
{isAdmin() && (
|
||||
<>
|
||||
<Button
|
||||
type='link'
|
||||
size='small'
|
||||
theme='light'
|
||||
icon={<Pencil size={14} />}
|
||||
onClick={() => openEditModal(record)}
|
||||
>
|
||||
{t('编辑')}
|
||||
</Button>
|
||||
<Button
|
||||
type='link'
|
||||
size='small'
|
||||
theme='light'
|
||||
onClick={() => {
|
||||
setQuotaOrgId(record.id);
|
||||
setQuotaAmount(0);
|
||||
@@ -830,8 +840,8 @@ const AdminOrganizations = () => {
|
||||
{t('调额')}
|
||||
</Button>
|
||||
<Button
|
||||
type='link'
|
||||
size='small'
|
||||
theme='light'
|
||||
onClick={() => openFeatureModal(record)}
|
||||
>
|
||||
{t('功能开关')}
|
||||
@@ -839,8 +849,7 @@ const AdminOrganizations = () => {
|
||||
{record.status === 4 ? (
|
||||
<Button
|
||||
size='small'
|
||||
theme='solid'
|
||||
type='primary'
|
||||
type='link'
|
||||
onClick={() => handleActivate(record.id)}
|
||||
>
|
||||
{t('激活')}
|
||||
@@ -848,8 +857,7 @@ const AdminOrganizations = () => {
|
||||
) : record.status === 1 ? (
|
||||
<Button
|
||||
size='small'
|
||||
theme='light'
|
||||
type='warning'
|
||||
type='link'
|
||||
onClick={() => handleStatusChange(record.id, 2)}
|
||||
>
|
||||
{t('冻结')}
|
||||
@@ -857,17 +865,16 @@ const AdminOrganizations = () => {
|
||||
) : (
|
||||
<Button
|
||||
size='small'
|
||||
theme='light'
|
||||
type='primary'
|
||||
type='link'
|
||||
onClick={() => handleStatusChange(record.id, 1)}
|
||||
>
|
||||
{t('解冻')}
|
||||
</Button>
|
||||
)}
|
||||
<Button
|
||||
type='link'
|
||||
size='small'
|
||||
theme='light'
|
||||
type='danger'
|
||||
danger
|
||||
onClick={() => handleDelete(record.id)}
|
||||
>
|
||||
{t('删除')}
|
||||
@@ -875,16 +882,8 @@ const AdminOrganizations = () => {
|
||||
{isRoot() && (
|
||||
<Button
|
||||
size='small'
|
||||
theme='borderless'
|
||||
type='tertiary'
|
||||
type='link'
|
||||
loading={alertToggleLoading === record.id}
|
||||
icon={
|
||||
alertExcludedIds.has(record.id) ? (
|
||||
<BellOff size={14} />
|
||||
) : (
|
||||
<Bell size={14} />
|
||||
)
|
||||
}
|
||||
title={
|
||||
alertExcludedIds.has(record.id)
|
||||
? t('已屏蔽预警,点击恢复')
|
||||
@@ -896,7 +895,11 @@ const AdminOrganizations = () => {
|
||||
: t('屏蔽该企业的预警')
|
||||
}
|
||||
onClick={() => toggleAlertExclude(record)}
|
||||
/>
|
||||
>
|
||||
{alertExcludedIds.has(record.id)
|
||||
? t('恢复通知')
|
||||
: t('屏蔽通知')}
|
||||
</Button>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
@@ -906,114 +909,109 @@ const AdminOrganizations = () => {
|
||||
];
|
||||
|
||||
return (
|
||||
<div className='mt-[60px] p-4 sm:p-6'>
|
||||
<div className='flex items-center justify-between mb-6'>
|
||||
<div className='flex items-center gap-3'>
|
||||
<div className='p-2 rounded-xl bg-gradient-to-br from-blue-500 to-brand-to'>
|
||||
<Building2 size={24} className='text-white' />
|
||||
</div>
|
||||
<div>
|
||||
<h1 className='text-2xl font-bold text-gray-900 dark:text-white'>
|
||||
{t('企业管理')}
|
||||
</h1>
|
||||
<p className='text-sm text-gray-500 dark:text-gray-400'>
|
||||
{t('管理所有企业账户')}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className='mb-4 flex items-start justify-between flex-wrap gap-3'>
|
||||
<div className='flex items-center flex-wrap gap-2'>
|
||||
<Input
|
||||
prefix={<Search size={16} />}
|
||||
value={keyword}
|
||||
onChange={(v) => {
|
||||
setKeyword(v);
|
||||
// 退格删空/点清除都会走到这里:输入框空了就同步解除过滤,
|
||||
// 避免"框已空但表格仍按旧关键字过滤"的幽灵状态
|
||||
if (v === '' && searchKeyword) {
|
||||
setSearchKeyword('');
|
||||
<div className='console-content'>
|
||||
<ConsoleSearchBar
|
||||
formProps={{
|
||||
layout: 'vertical',
|
||||
onFinish: handleSearch,
|
||||
className: 'console-module-filter-form',
|
||||
}}
|
||||
>
|
||||
<div className='console-module-filter-grid'>
|
||||
<ConsoleFilterField label={t('企业名称')}>
|
||||
<Input
|
||||
prefix={<Search size={16} />}
|
||||
value={keyword}
|
||||
onChange={(v) => {
|
||||
setKeyword(v);
|
||||
// 退格删空/点清除都会走到这里:输入框空了就同步解除过滤,
|
||||
// 避免"框已空但表格仍按旧关键字过滤"的幽灵状态
|
||||
if (v === '' && searchKeyword) {
|
||||
setSearchKeyword('');
|
||||
setPage(1);
|
||||
}
|
||||
}}
|
||||
placeholder={t('搜索企业名称、代码、联系人、商务...')}
|
||||
showClear
|
||||
onEnterPress={() => {
|
||||
setPage(1);
|
||||
}
|
||||
}}
|
||||
placeholder={t('搜索企业名称、代码、联系人、商务...')}
|
||||
showClear
|
||||
style={{ width: 260 }}
|
||||
onEnterPress={() => {
|
||||
setPage(1);
|
||||
setSearchKeyword(keyword);
|
||||
}}
|
||||
/>
|
||||
<Input
|
||||
value={userIdInput}
|
||||
onChange={(v) => {
|
||||
// 只留数字并剥前导零:杜绝 "0"/"007" 这类后端会静默忽略的值,
|
||||
// 否则 UI 显示筛选生效、实际返回全量列表(幽灵筛选态)
|
||||
const digits = (v || '').replace(/\D/g, '').replace(/^0+/, '');
|
||||
setUserIdInput(digits);
|
||||
// 与关键字框同款:删空/点清除即解除过滤
|
||||
if (digits === '' && userIdFilter) {
|
||||
setUserIdFilter('');
|
||||
setSearchKeyword(keyword);
|
||||
}}
|
||||
/>
|
||||
</ConsoleFilterField>
|
||||
<ConsoleFilterField label={t('用户ID')}>
|
||||
<Input
|
||||
value={userIdInput}
|
||||
onChange={(v) => {
|
||||
// 只留数字并剥前导零:杜绝 "0"/"007" 这类后端会静默忽略的值,
|
||||
// 否则 UI 显示筛选生效、实际返回全量列表(幽灵筛选态)
|
||||
const digits = (v || '').replace(/\D/g, '').replace(/^0+/, '');
|
||||
setUserIdInput(digits);
|
||||
// 与关键字框同款:删空/点清除即解除过滤
|
||||
if (digits === '' && userIdFilter) {
|
||||
setUserIdFilter('');
|
||||
setPage(1);
|
||||
}
|
||||
}}
|
||||
placeholder={t('用户ID(owner或成员)')}
|
||||
showClear
|
||||
// 10 位封顶:真实用户ID 不会更长,且远离后端 Atoi 溢出边界(19 位)
|
||||
maxLength={10}
|
||||
aria-label={t('按用户ID筛选')}
|
||||
onEnterPress={() => {
|
||||
setPage(1);
|
||||
}
|
||||
}}
|
||||
placeholder={t('用户ID(owner或成员)')}
|
||||
showClear
|
||||
// 10 位封顶:真实用户ID 不会更长,且远离后端 Atoi 溢出边界(19 位)
|
||||
maxLength={10}
|
||||
style={{ width: 170 }}
|
||||
aria-label={t('按用户ID筛选')}
|
||||
onEnterPress={() => {
|
||||
setPage(1);
|
||||
setUserIdFilter(userIdInput);
|
||||
}}
|
||||
/>
|
||||
<Select
|
||||
value={statusFilter}
|
||||
onChange={applyFilter(setStatusFilter)}
|
||||
optionList={[
|
||||
{ value: 1, label: t('正常') },
|
||||
{ value: 2, label: t('冻结') },
|
||||
{ value: 3, label: t('欠费') },
|
||||
{ value: 4, label: t('待激活') },
|
||||
]}
|
||||
placeholder={t('全部状态')}
|
||||
showClear
|
||||
style={{ width: 120 }}
|
||||
aria-label={t('按状态筛选')}
|
||||
/>
|
||||
<Select
|
||||
value={levelFilter}
|
||||
onChange={applyFilter(setLevelFilter)}
|
||||
optionList={levelOptions}
|
||||
placeholder={t('全部等级')}
|
||||
showClear
|
||||
filter
|
||||
style={{ width: 130 }}
|
||||
aria-label={t('按企业等级筛选')}
|
||||
/>
|
||||
<Select
|
||||
value={salesRepFilter}
|
||||
onChange={applyFilter(setSalesRepFilter)}
|
||||
optionList={[
|
||||
{ value: '__none__', label: t('未分配') },
|
||||
...salesRepOptions,
|
||||
]}
|
||||
placeholder={t('全部商务')}
|
||||
showClear
|
||||
filter
|
||||
style={{ width: 130 }}
|
||||
aria-label={t('按商务人员筛选')}
|
||||
/>
|
||||
{hasActiveFilters && (
|
||||
<Button theme='borderless' type='tertiary' onClick={resetFilters}>
|
||||
{t('重置')}
|
||||
</Button>
|
||||
)}
|
||||
setUserIdFilter(userIdInput);
|
||||
}}
|
||||
/>
|
||||
</ConsoleFilterField>
|
||||
<ConsoleFilterField label={t('状态')}>
|
||||
<Select
|
||||
value={statusFilter}
|
||||
onChange={applyFilter(setStatusFilter)}
|
||||
optionList={[
|
||||
{ value: 1, label: t('正常') },
|
||||
{ value: 2, label: t('冻结') },
|
||||
{ value: 3, label: t('欠费') },
|
||||
{ value: 4, label: t('待激活') },
|
||||
]}
|
||||
placeholder={t('全部状态')}
|
||||
showClear
|
||||
aria-label={t('按状态筛选')}
|
||||
/>
|
||||
</ConsoleFilterField>
|
||||
<ConsoleFilterField label={t('企业等级')}>
|
||||
<Select
|
||||
value={levelFilter}
|
||||
onChange={applyFilter(setLevelFilter)}
|
||||
optionList={levelOptions}
|
||||
placeholder={t('全部等级')}
|
||||
showClear
|
||||
filter
|
||||
aria-label={t('按企业等级筛选')}
|
||||
/>
|
||||
</ConsoleFilterField>
|
||||
<ConsoleFilterField label={t('商务人员')}>
|
||||
<Select
|
||||
value={salesRepFilter}
|
||||
onChange={applyFilter(setSalesRepFilter)}
|
||||
optionList={[
|
||||
{ value: '__none__', label: t('未分配') },
|
||||
...salesRepOptions,
|
||||
]}
|
||||
placeholder={t('全部商务')}
|
||||
showClear
|
||||
filter
|
||||
aria-label={t('按商务人员筛选')}
|
||||
/>
|
||||
</ConsoleFilterField>
|
||||
</div>
|
||||
<ConsoleFilterActions
|
||||
onReset={resetFilters}
|
||||
onSearch={handleSearch}
|
||||
loading={loading}
|
||||
/>
|
||||
{isAdmin() && (
|
||||
<div className='flex gap-2'>
|
||||
<ConsolePageActions>
|
||||
{CLOUD_BRAIN_UI_ENABLED && (
|
||||
<Button icon={<BarChart3 size={16} />} onClick={openEffectUsage}>
|
||||
{t('企业使用统计')}
|
||||
@@ -1028,6 +1026,7 @@ const AdminOrganizations = () => {
|
||||
</Button>
|
||||
)}
|
||||
<Button
|
||||
className='console-create-action'
|
||||
type='primary'
|
||||
icon={<Plus size={16} />}
|
||||
onClick={() => {
|
||||
@@ -1037,28 +1036,36 @@ const AdminOrganizations = () => {
|
||||
>
|
||||
{t('创建企业')}
|
||||
</Button>
|
||||
</div>
|
||||
</ConsolePageActions>
|
||||
)}
|
||||
</div>
|
||||
</ConsoleSearchBar>
|
||||
|
||||
<Table
|
||||
columns={columns}
|
||||
dataSource={orgs}
|
||||
loading={loading}
|
||||
rowKey='id'
|
||||
// 11 列且「操作」是最后一列(编辑/调额/功能开关/冻结/删除)。
|
||||
// 不给 scroll 时表格会压缩到 min-content(~790px) 硬塞进 390px 视口,
|
||||
// 操作列落在视口右侧 ~500px 处,iOS 上滚动条不可见、毫无可拖动提示。
|
||||
scroll={{ x: 'max-content' }}
|
||||
style={{ width: '100%' }}
|
||||
onChange={handleTableChange}
|
||||
pagination={{
|
||||
currentPage: page,
|
||||
pageSize: 20,
|
||||
total,
|
||||
onPageChange: setPage,
|
||||
}}
|
||||
/>
|
||||
<ConsoleCard>
|
||||
<TableToolbar title={t('企业列表')} />
|
||||
<Table
|
||||
empty={<TableEmpty />}
|
||||
columns={columns}
|
||||
dataSource={orgs}
|
||||
loading={loading}
|
||||
rowKey='id'
|
||||
// 11 列且「操作」是最后一列(编辑/调额/功能开关/冻结/删除)。
|
||||
// 不给 scroll 时表格会压缩到 min-content(~790px) 硬塞进 390px 视口,
|
||||
// 操作列落在视口右侧 ~500px 处,iOS 上滚动条不可见、毫无可拖动提示。
|
||||
scroll={{ x: 'max-content' }}
|
||||
style={{ width: '100%' }}
|
||||
onChange={handleTableChange}
|
||||
pagination={{
|
||||
currentPage: page,
|
||||
pageSize,
|
||||
total,
|
||||
onPageChange: setPage,
|
||||
onPageSizeChange: (size) => {
|
||||
setPage(1);
|
||||
setPageSize(size);
|
||||
},
|
||||
}}
|
||||
/>
|
||||
</ConsoleCard>
|
||||
|
||||
{CLOUD_BRAIN_UI_ENABLED && (
|
||||
<Modal
|
||||
|
||||
+68
-102
@@ -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 { ConsolePageActions } from '../../components/console/ConsolePageContainer';
|
||||
import React, {
|
||||
useState,
|
||||
useEffect,
|
||||
@@ -47,7 +48,6 @@ import {
|
||||
FileText,
|
||||
UserCheck,
|
||||
Wallet,
|
||||
ChevronDown,
|
||||
ShieldAlert,
|
||||
History,
|
||||
Upload,
|
||||
@@ -63,6 +63,7 @@ import ChannelConsumption from '../../components/analytics/ChannelConsumption';
|
||||
import UserRanking from '../../components/analytics/UserRanking';
|
||||
import TopupChannelChart from '../../components/analytics/TopupChannelChart';
|
||||
import DailyStatsTable from '../../components/analytics/DailyStatsTable';
|
||||
import CollapsibleHeader from '../../components/analytics/CollapsibleHeader';
|
||||
import UserSurveyStats from '../../components/analytics/UserSurveyStats';
|
||||
import UserTopupRanking from '../../components/analytics/UserTopupRanking';
|
||||
import HighFreqLowCostUsers from '../../components/analytics/HighFreqLowCostUsers';
|
||||
@@ -89,25 +90,6 @@ const TabChunkFallback = () => (
|
||||
</div>
|
||||
);
|
||||
|
||||
// 可折叠区块头部
|
||||
const CollapsibleHeader = ({ icon, title, isOpen, onToggle, t, extra }) => (
|
||||
<div
|
||||
className='flex items-center justify-between cursor-pointer select-none px-5 py-4 bg-white dark:bg-gray-800 rounded-xl shadow-sm hover:shadow-md transition-all border border-gray-100 dark:border-gray-700'
|
||||
onClick={onToggle}
|
||||
>
|
||||
<div className='flex items-center gap-2'>
|
||||
<span className='text-brand'>{icon}</span>
|
||||
<span className='font-semibold text-gray-800 dark:text-gray-100'>
|
||||
{title}
|
||||
</span>
|
||||
{extra}
|
||||
</div>
|
||||
<ChevronDown
|
||||
className={`w-5 h-5 text-gray-400 transition-transform duration-300 ${isOpen ? 'rotate-180' : ''}`}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
|
||||
// 从 URL ?tab= 派生 activeTab,未知值落回 operations
|
||||
const readTabFromURL = () => {
|
||||
try {
|
||||
@@ -236,81 +218,62 @@ const Analytics = () => {
|
||||
];
|
||||
|
||||
return (
|
||||
<div className='min-h-screen mt-[60px]'>
|
||||
<div className='console-content'>
|
||||
<Spin spinning={curLoading && showPeriodControls}>
|
||||
<div className='px-4 py-6 max-w-[1600px] mx-auto'>
|
||||
<div className='console-content'>
|
||||
{/* Header */}
|
||||
<div className='mb-6 flex flex-col sm:flex-row items-start sm:items-center justify-between gap-4'>
|
||||
<div className='flex items-center gap-3'>
|
||||
<div className='p-2.5 bg-gradient-to-br from-brand-from to-brand-to rounded-xl shadow-lg'>
|
||||
<BarChart2 className='w-6 h-6 text-white' />
|
||||
</div>
|
||||
<div>
|
||||
<h1 className='text-2xl font-bold text-gray-800 dark:text-gray-100'>
|
||||
{t('运营数据看板')}
|
||||
</h1>
|
||||
<p className='text-sm text-gray-500 dark:text-gray-400 mt-0.5'>
|
||||
{t('实时监控平台运营状况')}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div className='flex flex-wrap items-center gap-3'>
|
||||
{showPeriodControls && (
|
||||
<>
|
||||
<Radio.Group
|
||||
type='button'
|
||||
value={curPeriod}
|
||||
onChange={(e) => curSetPeriod(e.target.value)}
|
||||
buttonSize='middle'
|
||||
>
|
||||
{periodOptions.map((opt) => (
|
||||
<Radio key={opt.value} value={opt.value}>
|
||||
{opt.label}
|
||||
</Radio>
|
||||
))}
|
||||
</Radio.Group>
|
||||
{curPeriod === 'custom' && (
|
||||
<DatePicker
|
||||
type='dateRange'
|
||||
value={curDateRange}
|
||||
onChange={curSetDateRange}
|
||||
placeholder={[t('开始日期'), t('结束日期')]}
|
||||
format='yyyy-MM-dd'
|
||||
style={{ width: 260 }}
|
||||
presets={[
|
||||
{
|
||||
text: t('最近7天'),
|
||||
start: new Date(Date.now() - 7 * 24 * 60 * 60 * 1000),
|
||||
end: new Date(),
|
||||
},
|
||||
{
|
||||
text: t('最近30天'),
|
||||
start: new Date(
|
||||
Date.now() - 30 * 24 * 60 * 60 * 1000,
|
||||
),
|
||||
end: new Date(),
|
||||
},
|
||||
{
|
||||
text: t('最近90天'),
|
||||
start: new Date(
|
||||
Date.now() - 90 * 24 * 60 * 60 * 1000,
|
||||
),
|
||||
end: new Date(),
|
||||
},
|
||||
]}
|
||||
/>
|
||||
)}
|
||||
<Button
|
||||
icon={<IconRefresh />}
|
||||
onClick={() => curRefresh(curPeriod, curDateRange, true)}
|
||||
loading={curLoading}
|
||||
>
|
||||
{t('刷新')}
|
||||
</Button>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
<ConsolePageActions>
|
||||
{showPeriodControls && (
|
||||
<>
|
||||
<Radio.Group
|
||||
type='button'
|
||||
value={curPeriod}
|
||||
onChange={(e) => curSetPeriod(e.target.value)}
|
||||
buttonSize='middle'
|
||||
>
|
||||
{periodOptions.map((opt) => (
|
||||
<Radio key={opt.value} value={opt.value}>
|
||||
{opt.label}
|
||||
</Radio>
|
||||
))}
|
||||
</Radio.Group>
|
||||
{curPeriod === 'custom' && (
|
||||
<DatePicker
|
||||
type='dateRange'
|
||||
value={curDateRange}
|
||||
onChange={curSetDateRange}
|
||||
placeholder={[t('开始日期'), t('结束日期')]}
|
||||
format='yyyy-MM-dd'
|
||||
style={{ width: 260 }}
|
||||
presets={[
|
||||
{
|
||||
text: t('最近7天'),
|
||||
start: new Date(Date.now() - 7 * 24 * 60 * 60 * 1000),
|
||||
end: new Date(),
|
||||
},
|
||||
{
|
||||
text: t('最近30天'),
|
||||
start: new Date(Date.now() - 30 * 24 * 60 * 60 * 1000),
|
||||
end: new Date(),
|
||||
},
|
||||
{
|
||||
text: t('最近90天'),
|
||||
start: new Date(Date.now() - 90 * 24 * 60 * 60 * 1000),
|
||||
end: new Date(),
|
||||
},
|
||||
]}
|
||||
/>
|
||||
)}
|
||||
<Button
|
||||
icon={<IconRefresh />}
|
||||
onClick={() => curRefresh(curPeriod, curDateRange, true)}
|
||||
loading={curLoading}
|
||||
>
|
||||
{t('刷新')}
|
||||
</Button>
|
||||
</>
|
||||
)}
|
||||
</ConsolePageActions>
|
||||
|
||||
{!firstVisibleTab && (
|
||||
<div className='rounded-2xl border border-dashed border-gray-200 dark:border-gray-700 bg-white/70 dark:bg-gray-800/60 p-10 text-center shadow-sm'>
|
||||
@@ -398,7 +361,7 @@ const Analytics = () => {
|
||||
<OverviewCards overview={overview} t={t} />
|
||||
|
||||
{/* Trend Charts */}
|
||||
<div className='grid grid-cols-1 lg:grid-cols-2 gap-6 mb-6'>
|
||||
<div className='grid grid-cols-1 lg:grid-cols-2 gap-4'>
|
||||
<TrendCharts
|
||||
title={t('用户趋势')}
|
||||
icon={<Users className='w-5 h-5' />}
|
||||
@@ -416,7 +379,7 @@ const Analytics = () => {
|
||||
</div>
|
||||
|
||||
{/* Distribution Charts */}
|
||||
<div className='grid grid-cols-1 lg:grid-cols-2 gap-6 mb-6'>
|
||||
<div className='grid grid-cols-1 lg:grid-cols-2 gap-4'>
|
||||
<TopupChannelChart
|
||||
data={topupChannel}
|
||||
title={t('充值渠道分布')}
|
||||
@@ -432,7 +395,7 @@ const Analytics = () => {
|
||||
</div>
|
||||
|
||||
{/* Channel Consumption Ranking */}
|
||||
<div className='mb-6'>
|
||||
<div className='analytics-fold-panel'>
|
||||
<CollapsibleHeader
|
||||
icon={<Server className='w-5 h-5' />}
|
||||
title={t('渠道消耗排行')}
|
||||
@@ -441,8 +404,9 @@ const Analytics = () => {
|
||||
t={t}
|
||||
/>
|
||||
<Collapsible isOpen={channelOpen} keepDOM>
|
||||
<div className='mt-2'>
|
||||
<div>
|
||||
<ChannelConsumption
|
||||
embedded
|
||||
data={channelConsumption}
|
||||
title={t('渠道消耗排行')}
|
||||
icon={<Server className='w-5 h-5' />}
|
||||
@@ -453,7 +417,7 @@ const Analytics = () => {
|
||||
</div>
|
||||
|
||||
{/* User Survey Stats */}
|
||||
<div className='mb-6'>
|
||||
<div>
|
||||
<UserSurveyStats
|
||||
title={t('用户身份问卷统计')}
|
||||
icon={<UserCheck className='w-5 h-5' />}
|
||||
@@ -462,7 +426,7 @@ const Analytics = () => {
|
||||
</div>
|
||||
|
||||
{/* User Topup Ranking */}
|
||||
<div className='mb-6'>
|
||||
<div className='analytics-fold-panel'>
|
||||
<CollapsibleHeader
|
||||
icon={<Wallet className='w-5 h-5' />}
|
||||
title={t('用户充值排行')}
|
||||
@@ -471,8 +435,9 @@ const Analytics = () => {
|
||||
t={t}
|
||||
/>
|
||||
<Collapsible isOpen={topupRankOpen} keepDOM>
|
||||
<div className='mt-2'>
|
||||
<div>
|
||||
<UserTopupRanking
|
||||
embedded
|
||||
data={userTopupRanking}
|
||||
title={t('用户充值排行')}
|
||||
icon={<Wallet className='w-5 h-5' />}
|
||||
@@ -483,7 +448,7 @@ const Analytics = () => {
|
||||
</div>
|
||||
|
||||
{/* Daily Stats Table */}
|
||||
<div className='mb-6'>
|
||||
<div className='analytics-fold-panel'>
|
||||
<CollapsibleHeader
|
||||
icon={<FileText className='w-5 h-5' />}
|
||||
title={t('每日统计明细')}
|
||||
@@ -492,8 +457,9 @@ const Analytics = () => {
|
||||
t={t}
|
||||
/>
|
||||
<Collapsible isOpen={dailyStatsOpen} keepDOM>
|
||||
<div className='mt-2'>
|
||||
<div>
|
||||
<DailyStatsTable
|
||||
embedded
|
||||
data={dailyStats}
|
||||
title={t('每日统计明细')}
|
||||
icon={<FileText className='w-5 h-5' />}
|
||||
|
||||
@@ -22,7 +22,7 @@ import ChannelsTable from '../../components/table/channels';
|
||||
|
||||
const File = () => {
|
||||
return (
|
||||
<div className='mt-[60px] px-2'>
|
||||
<div className='console-content'>
|
||||
<ChannelsTable />
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -56,17 +56,12 @@ const ChatPage = () => {
|
||||
return !isLoading && iframeSrc ? (
|
||||
<iframe
|
||||
src={iframeSrc}
|
||||
style={{
|
||||
width: '100%',
|
||||
height: 'calc(100vh - 64px)',
|
||||
border: 'none',
|
||||
marginTop: '64px',
|
||||
}}
|
||||
className='console-chat-frame'
|
||||
title='Token Frame'
|
||||
allow='camera;microphone'
|
||||
/>
|
||||
) : (
|
||||
<div className='fixed inset-0 w-screen h-screen flex items-center justify-center bg-white/80 z-[1000] mt-[60px]'>
|
||||
<div className='console-chat-loading'>
|
||||
<div className='flex flex-col items-center'>
|
||||
<Spin size='large' spinning={true} tip={null} />
|
||||
<span
|
||||
|
||||
@@ -16,6 +16,8 @@ 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 React, {
|
||||
useCallback,
|
||||
useEffect,
|
||||
@@ -1414,7 +1416,7 @@ const CloudBrain = ({ organization = false, orgId = 0, canManage = false }) => {
|
||||
if (!content) return;
|
||||
const identity = contextIdentity;
|
||||
try {
|
||||
await navigator.clipboard.writeText(content);
|
||||
await writeClipboardText(content);
|
||||
if (identity === contextIdentityRef.current)
|
||||
showSuccess(t('已复制产物内容'));
|
||||
} catch {
|
||||
@@ -1446,7 +1448,7 @@ const CloudBrain = ({ organization = false, orgId = 0, canManage = false }) => {
|
||||
raw ? `${t('原始报错')}: ${raw}` : '',
|
||||
].filter(Boolean);
|
||||
try {
|
||||
await navigator.clipboard.writeText(lines.join('\n'));
|
||||
await writeClipboardText(lines.join('\n'));
|
||||
if (identity === contextIdentityRef.current)
|
||||
showSuccess(t('已复制报错信息'));
|
||||
} catch {
|
||||
@@ -1553,7 +1555,6 @@ const CloudBrain = ({ organization = false, orgId = 0, canManage = false }) => {
|
||||
for (
|
||||
const visited = new Set();
|
||||
departmentId && !visited.has(departmentId);
|
||||
|
||||
) {
|
||||
visited.add(departmentId);
|
||||
departmentIds.add(departmentId);
|
||||
|
||||
@@ -17,24 +17,16 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import TableEmpty from '../../components/common/table/TableEmpty';
|
||||
import React, { useEffect, useMemo, useRef, useState } from 'react';
|
||||
import {
|
||||
Banner,
|
||||
Button,
|
||||
Empty,
|
||||
Form,
|
||||
Select,
|
||||
Spin,
|
||||
Typography,
|
||||
} from '@/components/ui';
|
||||
import { Banner, Button, Form, Spin } from '@/components/ui';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import CardPro from '../../components/common/ui/CardPro';
|
||||
import CardTable from '../../components/common/ui/CardTable';
|
||||
import CompactModeToggle from '../../components/common/ui/CompactModeToggle';
|
||||
import {
|
||||
IllustrationNoResult,
|
||||
IllustrationNoResultDark,
|
||||
} from '../../components/common/illustrations';
|
||||
import FilterSearchButton from '../../components/common/table/FilterSearchButton';
|
||||
import '../../components/common/table/log-filters.css';
|
||||
|
||||
import { createCardProPagination } from '../../helpers/utils';
|
||||
import { useIsMobile } from '../../hooks/common/useIsMobile';
|
||||
import { useTableCompactMode } from '../../hooks/common/useTableCompactMode';
|
||||
@@ -142,7 +134,7 @@ export default function DemoReservations() {
|
||||
});
|
||||
|
||||
return (
|
||||
<div className='mt-[60px] px-2' aria-busy={loading}>
|
||||
<div className='console-content' aria-busy={loading}>
|
||||
<Spin
|
||||
spinning={loading}
|
||||
size='large'
|
||||
@@ -150,26 +142,17 @@ export default function DemoReservations() {
|
||||
data-testid='demo-reservations-loading'
|
||||
>
|
||||
<CardPro
|
||||
tableTitle={t('预约列表')}
|
||||
type='type1'
|
||||
t={t}
|
||||
descriptionArea={
|
||||
<div className='flex w-full flex-col items-start justify-between gap-2 md:flex-row md:items-center'>
|
||||
<div>
|
||||
<Typography.Title heading={4} style={{ marginBottom: 8 }}>
|
||||
{t('预约演示')}
|
||||
</Typography.Title>
|
||||
<Typography.Text type='tertiary' size='small'>
|
||||
{t('查看官网访客提交的预约信息,支持模糊查询与分页。')}
|
||||
</Typography.Text>
|
||||
</div>
|
||||
<CompactModeToggle
|
||||
compactMode={compactMode}
|
||||
setCompactMode={setCompactMode}
|
||||
t={t}
|
||||
/>
|
||||
</div>
|
||||
tableActions={
|
||||
<CompactModeToggle
|
||||
compactMode={compactMode}
|
||||
setCompactMode={setCompactMode}
|
||||
t={t}
|
||||
/>
|
||||
}
|
||||
actionsArea={
|
||||
searchArea={
|
||||
<div className='flex w-full justify-start'>
|
||||
<Form
|
||||
initValues={EMPTY_FILTERS}
|
||||
@@ -185,74 +168,35 @@ export default function DemoReservations() {
|
||||
}
|
||||
allowEmpty
|
||||
autoComplete='off'
|
||||
layout='horizontal'
|
||||
className='w-full md:w-auto'
|
||||
layout='vertical'
|
||||
className='log-filter-form w-full'
|
||||
>
|
||||
<div className='flex w-full flex-col items-center gap-2 md:w-auto md:flex-row'>
|
||||
{[
|
||||
['name', '请输入姓名'],
|
||||
['contact', '请输入联系方式'],
|
||||
['companyName', '请输入公司名称'],
|
||||
].map(([field, placeholder]) => (
|
||||
<div key={field} className='w-full md:w-44'>
|
||||
<div className='log-filter-content'>
|
||||
<div className='log-filter-grid'>
|
||||
{[
|
||||
['name', '姓名', '请输入姓名'],
|
||||
['contact', '联系方式', '请输入联系方式'],
|
||||
['companyName', '公司名称', '请输入公司名称'],
|
||||
].map(([field, label, placeholder]) => (
|
||||
<Form.Input
|
||||
key={field}
|
||||
field={field}
|
||||
aria-label={t(placeholder)}
|
||||
label={t(label)}
|
||||
placeholder={t(placeholder)}
|
||||
showClear
|
||||
pure
|
||||
size='small'
|
||||
maxLength={254}
|
||||
/>
|
||||
</div>
|
||||
))}
|
||||
<div className='flex w-full gap-2 md:w-auto'>
|
||||
<Button
|
||||
type='tertiary'
|
||||
htmlType='submit'
|
||||
loading={loading}
|
||||
size='small'
|
||||
className='flex-1 md:flex-initial'
|
||||
>
|
||||
{t('查询')}
|
||||
</Button>
|
||||
<Button
|
||||
type='tertiary'
|
||||
onClick={reset}
|
||||
size='small'
|
||||
className='flex-1 md:flex-initial'
|
||||
>
|
||||
{t('重置')}
|
||||
</Button>
|
||||
))}
|
||||
</div>
|
||||
<div className='log-filter-actions'>
|
||||
<Button onClick={reset}>{t('重置')}</Button>
|
||||
<FilterSearchButton loading={loading} />
|
||||
</div>
|
||||
</div>
|
||||
</Form>
|
||||
</div>
|
||||
}
|
||||
paginationArea={
|
||||
isMobile && result.total > 0 ? (
|
||||
<div className='flex w-full flex-col items-center gap-3'>
|
||||
<div className='flex items-center gap-3'>
|
||||
<Typography.Text type='tertiary'>
|
||||
{t('共')} {result.total} {t('条')}
|
||||
</Typography.Text>
|
||||
<Select
|
||||
aria-label={t('每页条数')}
|
||||
size='small'
|
||||
value={result.page_size ?? query.pageSize}
|
||||
onChange={changePageSize}
|
||||
optionList={[10, 20, 50, 100].map((value) => ({
|
||||
value,
|
||||
label: `${value} ${t('条/页')}`,
|
||||
}))}
|
||||
/>
|
||||
</div>
|
||||
{pagination}
|
||||
</div>
|
||||
) : (
|
||||
pagination
|
||||
)
|
||||
}
|
||||
paginationArea={pagination}
|
||||
>
|
||||
{error && (
|
||||
<Banner
|
||||
@@ -270,22 +214,7 @@ export default function DemoReservations() {
|
||||
hidePagination
|
||||
className='overflow-hidden'
|
||||
size='middle'
|
||||
empty={
|
||||
<Empty
|
||||
image={
|
||||
<IllustrationNoResult style={{ width: 150, height: 150 }} />
|
||||
}
|
||||
darkModeImage={
|
||||
<IllustrationNoResultDark
|
||||
style={{ width: 150, height: 150 }}
|
||||
/>
|
||||
}
|
||||
description={t(
|
||||
error ? '预约信息加载失败' : '暂无符合条件的预约信息',
|
||||
)}
|
||||
style={{ padding: 30 }}
|
||||
/>
|
||||
}
|
||||
empty={<TableEmpty />}
|
||||
/>
|
||||
</CardPro>
|
||||
</Spin>
|
||||
|
||||
@@ -17,8 +17,10 @@ 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 React, { useEffect, useRef, useState } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { showError, showSuccess } from '../../helpers';
|
||||
import './styles.css';
|
||||
|
||||
const Docs = () => {
|
||||
@@ -41,9 +43,9 @@ const Docs = () => {
|
||||
|
||||
// 复制代码功能
|
||||
const copyCode = (code) => {
|
||||
navigator.clipboard.writeText(code).then(() => {
|
||||
// 显示复制成功提示
|
||||
});
|
||||
writeClipboardText(code)
|
||||
.then(() => showSuccess(t('复制成功')))
|
||||
.catch(() => showError(t('复制失败,请手动复制')));
|
||||
};
|
||||
|
||||
// 滚动到顶部
|
||||
|
||||
@@ -17,15 +17,9 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import { copyText } from '../../../../helpers/clipboard';
|
||||
import React, { useState, useEffect } from 'react';
|
||||
import {
|
||||
Modal,
|
||||
Image,
|
||||
Button,
|
||||
Space,
|
||||
Typography,
|
||||
Tag,
|
||||
} from '@/components/ui';
|
||||
import { Modal, Image, Button, Space, Typography, Tag } from '@/components/ui';
|
||||
import { Download, Copy, ImagePlus, Sparkles } from 'lucide-react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { showSuccess, showError } from '../../../../helpers';
|
||||
@@ -83,30 +77,7 @@ const ImageDetailModal = ({
|
||||
};
|
||||
|
||||
// 复制(带 execCommand 兜底,兼容 http / 老浏览器)
|
||||
const copyToClipboard = async (text) => {
|
||||
if (navigator.clipboard && window.isSecureContext) {
|
||||
try {
|
||||
await navigator.clipboard.writeText(text);
|
||||
return true;
|
||||
} catch (err) {
|
||||
console.warn('Clipboard API failed:', err);
|
||||
}
|
||||
}
|
||||
try {
|
||||
const textArea = document.createElement('textarea');
|
||||
textArea.value = text;
|
||||
textArea.style.position = 'fixed';
|
||||
textArea.style.left = '-9999px';
|
||||
document.body.appendChild(textArea);
|
||||
textArea.select();
|
||||
const ok = document.execCommand('copy');
|
||||
document.body.removeChild(textArea);
|
||||
return ok;
|
||||
} catch (err) {
|
||||
console.error('execCommand copy failed:', err);
|
||||
return false;
|
||||
}
|
||||
};
|
||||
const copyToClipboard = copyText;
|
||||
|
||||
const handleCopyPrompt = async () => {
|
||||
if (!task.prompt) return;
|
||||
|
||||
@@ -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 { copyText } from '../../../../helpers/clipboard';
|
||||
import React, { useState, useMemo, useEffect, useRef } from 'react';
|
||||
import {
|
||||
Empty,
|
||||
@@ -443,30 +444,7 @@ const ImageTaskList = ({
|
||||
}
|
||||
};
|
||||
|
||||
const copyToClipboard = async (text) => {
|
||||
if (navigator.clipboard && window.isSecureContext) {
|
||||
try {
|
||||
await navigator.clipboard.writeText(text);
|
||||
return true;
|
||||
} catch (err) {
|
||||
console.warn('Clipboard API failed:', err);
|
||||
}
|
||||
}
|
||||
try {
|
||||
const textArea = document.createElement('textarea');
|
||||
textArea.value = text;
|
||||
textArea.style.position = 'fixed';
|
||||
textArea.style.left = '-9999px';
|
||||
document.body.appendChild(textArea);
|
||||
textArea.select();
|
||||
const ok = document.execCommand('copy');
|
||||
document.body.removeChild(textArea);
|
||||
return ok;
|
||||
} catch (err) {
|
||||
console.error('execCommand copy failed:', err);
|
||||
return false;
|
||||
}
|
||||
};
|
||||
const copyToClipboard = copyText;
|
||||
|
||||
const handleCopyPrompt = async (prompt) => {
|
||||
if (!prompt) return;
|
||||
|
||||
@@ -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 { writeClipboardText } from '../../../../../helpers/clipboard';
|
||||
import React, { useState, useEffect } from 'react';
|
||||
import {
|
||||
Card,
|
||||
@@ -40,6 +41,7 @@ import {
|
||||
Loader2,
|
||||
} from 'lucide-react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { showError, showSuccess } from '../../../../../helpers';
|
||||
import {
|
||||
canCancelVideoTask,
|
||||
canRegenerateVideoTask,
|
||||
@@ -164,20 +166,9 @@ const VideoPreviewPanel = ({
|
||||
|
||||
// 复制到剪贴板
|
||||
const copyToClipboard = (text) => {
|
||||
if (navigator.clipboard) {
|
||||
navigator.clipboard.writeText(text).then(() => {
|
||||
// 可以添加提示
|
||||
console.log('链接已复制到剪贴板');
|
||||
});
|
||||
} else {
|
||||
// 兼容旧浏览器
|
||||
const textArea = document.createElement('textarea');
|
||||
textArea.value = text;
|
||||
document.body.appendChild(textArea);
|
||||
textArea.select();
|
||||
document.execCommand('copy');
|
||||
document.body.removeChild(textArea);
|
||||
}
|
||||
writeClipboardText(text)
|
||||
.then(() => showSuccess(t('链接已复制')))
|
||||
.catch(() => showError(t('复制失败,请手动复制')));
|
||||
};
|
||||
|
||||
// 处理生成视频(同时关闭当前播放的视频)
|
||||
|
||||
@@ -436,23 +436,25 @@ export const ExperienceCenterAuditPanel = () => {
|
||||
)}
|
||||
|
||||
{/* 趋势图 */}
|
||||
<Card
|
||||
className='!rounded-2xl !shadow-sm border border-gray-100 dark:border-gray-700 mt-4'
|
||||
title={
|
||||
<span className='flex items-center gap-2'>
|
||||
<AlertTriangle size={16} className='text-brand' />
|
||||
{t('事件趋势')}
|
||||
</span>
|
||||
}
|
||||
>
|
||||
{chartSpec ? (
|
||||
<div style={{ height: 320 }}>
|
||||
<VChart spec={chartSpec} />
|
||||
</div>
|
||||
) : (
|
||||
<Empty description={t('此区间内暂无事件')} />
|
||||
)}
|
||||
</Card>
|
||||
<div className='mt-4'>
|
||||
<Card
|
||||
className='!rounded-2xl !shadow-sm border border-gray-100 dark:border-gray-700'
|
||||
title={
|
||||
<span className='flex items-center gap-2'>
|
||||
<AlertTriangle size={16} className='text-brand' />
|
||||
{t('事件趋势')}
|
||||
</span>
|
||||
}
|
||||
>
|
||||
{chartSpec ? (
|
||||
<div style={{ height: 320 }}>
|
||||
<VChart spec={chartSpec} />
|
||||
</div>
|
||||
) : (
|
||||
<Empty description={t('此区间内暂无事件')} />
|
||||
)}
|
||||
</Card>
|
||||
</div>
|
||||
|
||||
{/* 失败用户 + 最近事件 双列布局(移动端堆叠) */}
|
||||
<div className='grid grid-cols-1 xl:grid-cols-5 gap-4 mt-4'>
|
||||
|
||||
@@ -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 { ConsolePageActions } from '../../components/console/ConsolePageContainer';
|
||||
import React, {
|
||||
useCallback,
|
||||
useEffect,
|
||||
@@ -50,11 +51,9 @@ import {
|
||||
RefreshCw,
|
||||
Scale,
|
||||
ShieldCheck,
|
||||
Sparkles,
|
||||
} from 'lucide-react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { API, isRoot, showError } from '../../helpers';
|
||||
import PageBackground from '../../components/common/PageBackground';
|
||||
import './expert-platform.css';
|
||||
|
||||
const { Text } = Typography;
|
||||
@@ -1257,63 +1256,28 @@ const ExpertPlatform = () => {
|
||||
);
|
||||
|
||||
return (
|
||||
<main className='expert-platform-page'>
|
||||
<PageBackground variant='subtle' />
|
||||
<section className='expert-platform-page'>
|
||||
<div className='expert-platform-shell'>
|
||||
<header className='expert-hero'>
|
||||
<div className='expert-hero-copy'>
|
||||
<div className='expert-eyebrow'>
|
||||
<Sparkles size={15} />
|
||||
<span>{t('云端大脑 · 平台能力供给')}</span>
|
||||
</div>
|
||||
<h1>{t('平台专家与模型能力')}</h1>
|
||||
<p>
|
||||
{t(
|
||||
'专家版本不可变:任何改动都以新版本发布,发布后全平台企业立即可用。',
|
||||
)}
|
||||
</p>
|
||||
<div className='expert-flow' aria-label={t('三步闭环')}>
|
||||
<span className='expert-flow-step'>
|
||||
<b>1</b>
|
||||
{t('登记模型能力')}
|
||||
</span>
|
||||
<span className='expert-flow-arrow' aria-hidden='true'>
|
||||
→
|
||||
</span>
|
||||
<span className='expert-flow-step'>
|
||||
<b>2</b>
|
||||
{t('配置专家')}
|
||||
</span>
|
||||
<span className='expert-flow-arrow' aria-hidden='true'>
|
||||
→
|
||||
</span>
|
||||
<span className='expert-flow-step'>
|
||||
<b>3</b>
|
||||
{t('发布给全平台使用')}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div className='expert-hero-actions'>
|
||||
<Button
|
||||
icon={<RefreshCw size={16} />}
|
||||
loading={loading}
|
||||
onClick={() => void load()}
|
||||
>
|
||||
{t('刷新')}
|
||||
</Button>
|
||||
<Button icon={<Cpu size={16} />} onClick={() => openCapability()}>
|
||||
{t('登记模型能力')}
|
||||
</Button>
|
||||
<Button
|
||||
theme='solid'
|
||||
type='primary'
|
||||
icon={<Plus size={16} />}
|
||||
onClick={openCreate}
|
||||
>
|
||||
{t('创建专家')}
|
||||
</Button>
|
||||
</div>
|
||||
</header>
|
||||
<ConsolePageActions>
|
||||
<Button
|
||||
icon={<RefreshCw size={16} />}
|
||||
loading={loading}
|
||||
onClick={() => void load()}
|
||||
>
|
||||
{t('刷新')}
|
||||
</Button>
|
||||
<Button icon={<Cpu size={16} />} onClick={() => openCapability()}>
|
||||
{t('登记模型能力')}
|
||||
</Button>
|
||||
<Button
|
||||
theme='solid'
|
||||
type='primary'
|
||||
icon={<Plus size={16} />}
|
||||
onClick={openCreate}
|
||||
>
|
||||
{t('创建专家')}
|
||||
</Button>
|
||||
</ConsolePageActions>
|
||||
|
||||
{loadError !== '' && (
|
||||
<Banner
|
||||
@@ -1657,7 +1621,7 @@ const ExpertPlatform = () => {
|
||||
<Text
|
||||
className='expert-card-key'
|
||||
size='small'
|
||||
copyable={{ content: item.workload_id }}
|
||||
copyable={{ text: item.workload_id }}
|
||||
>
|
||||
{item.workload_id}
|
||||
</Text>
|
||||
@@ -1764,7 +1728,7 @@ const ExpertPlatform = () => {
|
||||
{(topic.dead_letters || []).map((item) => (
|
||||
<div className='expert-dead-row' key={item.id}>
|
||||
<div className='expert-dead-copy'>
|
||||
<Text size='small' copyable={{ content: item.key }}>
|
||||
<Text size='small' copyable={{ text: item.key }}>
|
||||
{item.key}
|
||||
</Text>
|
||||
<p>{item.error_message || t('未知投递错误')}</p>
|
||||
@@ -2657,7 +2621,7 @@ const ExpertPlatform = () => {
|
||||
/>
|
||||
</div>
|
||||
</Modal>
|
||||
</main>
|
||||
</section>
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
@@ -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 { writeClipboardText } from '../../helpers/clipboard';
|
||||
import React, { useState, useCallback, useEffect } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import {
|
||||
@@ -319,8 +320,7 @@ const ImageGeneration = () => {
|
||||
// 复制图片链接
|
||||
const copyImageLink = useCallback(
|
||||
(imageUrl) => {
|
||||
navigator.clipboard
|
||||
.writeText(imageUrl)
|
||||
writeClipboardText(imageUrl)
|
||||
.then(() => {
|
||||
showSuccess(t('链接已复制'));
|
||||
})
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -21,7 +21,7 @@ import React from 'react';
|
||||
import UsageLogsTable from '../../components/table/usage-logs';
|
||||
|
||||
const Token = () => (
|
||||
<div className='mt-[60px] px-2'>
|
||||
<div className='console-content'>
|
||||
<UsageLogsTable />
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -21,7 +21,7 @@ import React from 'react';
|
||||
import MjLogsTable from '../../components/table/mj-logs';
|
||||
|
||||
const Midjourney = () => (
|
||||
<div className='mt-[60px] px-2'>
|
||||
<div className='console-content'>
|
||||
<MjLogsTable />
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -21,7 +21,7 @@ import ModelsTable from '../../components/table/models';
|
||||
|
||||
const ModelPage = () => {
|
||||
return (
|
||||
<div className='mt-[60px] px-2'>
|
||||
<div className='console-content'>
|
||||
<ModelsTable />
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -22,6 +22,7 @@ import { Tabs, Card } from '@/components/ui';
|
||||
import { Activity, Shield } from 'lucide-react';
|
||||
import ChannelMonitor from './ChannelMonitor';
|
||||
import AdminMonitor from './AdminMonitor';
|
||||
import './monitor-center.css';
|
||||
|
||||
const MonitorCenter = () => {
|
||||
const [activeTab, setActiveTab] = useState('channel');
|
||||
@@ -42,23 +43,12 @@ const MonitorCenter = () => {
|
||||
const isAdmin = userRole >= 10;
|
||||
|
||||
return (
|
||||
<div className='mt-[60px] px-2 md:px-6 pb-8'>
|
||||
<div className='max-w-[1600px] mx-auto'>
|
||||
<div className='console-content'>
|
||||
<div className='console-content'>
|
||||
{/* 页面标题 */}
|
||||
<div className='mb-6'>
|
||||
<h1 className='text-3xl font-bold flex items-center gap-3'>
|
||||
<div className='w-10 h-10 rounded-lg bg-gradient-to-br from-blue-500 to-brand-to flex items-center justify-center'>
|
||||
<Activity className='w-6 h-6 text-white' />
|
||||
</div>
|
||||
监控中心
|
||||
</h1>
|
||||
<p className='text-gray-500 mt-2 ml-[52px]'>
|
||||
实时监控渠道状态与系统性能指标
|
||||
</p>
|
||||
</div>
|
||||
|
||||
{/* 标签页 */}
|
||||
<Card className='shadow-lg'>
|
||||
<Card className='console-monitor-card'>
|
||||
<Tabs
|
||||
activeKey={activeTab}
|
||||
onChange={setActiveTab}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
/* Keep the card inset and reduce the large tabs' top padding by 5px. */
|
||||
.console-page .console-monitor-card > .ant-card-body {
|
||||
padding-top: var(--console-space-1);
|
||||
}
|
||||
.console-page
|
||||
.console-monitor-card
|
||||
.ant-tabs-large
|
||||
> .ant-tabs-nav
|
||||
.ant-tabs-tab {
|
||||
padding-top: 11px;
|
||||
}
|
||||
@media (max-width: 768px) {
|
||||
.console-page .console-monitor-card > .ant-card-body {
|
||||
padding-top: 0;
|
||||
}
|
||||
}
|
||||
@@ -16,22 +16,24 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
import TableEmpty from '../../components/common/table/TableEmpty';
|
||||
import TableToolbar from '../../components/common/table/TableToolbar';
|
||||
import React, { useCallback, useEffect, useState } from 'react';
|
||||
import {
|
||||
Banner,
|
||||
Button,
|
||||
Card,
|
||||
Descriptions,
|
||||
Empty,
|
||||
Modal,
|
||||
Table,
|
||||
Tag,
|
||||
Typography,
|
||||
} from '@/components/ui';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { RefreshCw } from 'lucide-react';
|
||||
import { API, showError, showSuccess } from '../../helpers';
|
||||
|
||||
const { Title, Text } = Typography;
|
||||
const { Text } = Typography;
|
||||
const uToYuan = (u) =>
|
||||
u === undefined || u === null ? '-' : (u / 1e6).toFixed(2);
|
||||
|
||||
@@ -40,10 +42,19 @@ export default function MyCommission() {
|
||||
const { t } = useTranslation();
|
||||
const [bills, setBills] = useState([]);
|
||||
const [detail, setDetail] = useState(null);
|
||||
const [loading, setLoading] = useState(false);
|
||||
|
||||
const load = useCallback(async () => {
|
||||
const res = await API.get('/api/sales/commission/bills');
|
||||
if (res.data.success) setBills(res.data.data || []);
|
||||
setLoading(true);
|
||||
try {
|
||||
const res = await API.get('/api/sales/commission/bills');
|
||||
if (res.data.success) setBills(res.data.data || []);
|
||||
else showError(res.data.message);
|
||||
} catch (error) {
|
||||
showError(error.message);
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
@@ -67,9 +78,8 @@ export default function MyCommission() {
|
||||
|
||||
return (
|
||||
// mt-[60px]:顶栏 fixed 定位需自行让位(跑马灯由 PageLayout 占位补偿)
|
||||
<div className='mt-[60px] px-2 pb-4'>
|
||||
<div className='console-content'>
|
||||
<Card>
|
||||
<Title heading={4}>{t('我的提成')}</Title>
|
||||
<Banner
|
||||
type='info'
|
||||
closeIcon={null}
|
||||
@@ -78,7 +88,17 @@ export default function MyCommission() {
|
||||
'对账单于次月发出;如有异议请在 3 个工作日内联系管理员,逾期视为确认。当期发放 70%,余 30% 随回款到账释放',
|
||||
)}
|
||||
/>
|
||||
<TableToolbar title={t('提成列表')}>
|
||||
<Button
|
||||
icon={<RefreshCw size={16} />}
|
||||
onClick={load}
|
||||
loading={loading}
|
||||
>
|
||||
{t('刷新')}
|
||||
</Button>
|
||||
</TableToolbar>
|
||||
<Table
|
||||
loading={loading}
|
||||
columns={[
|
||||
{ title: t('月份'), dataIndex: 'month' },
|
||||
{ title: t('毛利(元)'), dataIndex: 'gp_uyuan', render: uToYuan },
|
||||
@@ -139,9 +159,7 @@ export default function MyCommission() {
|
||||
rowKey='id'
|
||||
pagination={false}
|
||||
scroll={{ x: 'max-content' }}
|
||||
empty={
|
||||
<Empty description={t('暂无提成账单(非销售人员或尚未出账)')} />
|
||||
}
|
||||
empty={<TableEmpty />}
|
||||
/>
|
||||
<Modal
|
||||
title={detail ? `${detail.bill.month} ${t('月提成明细')}` : ''}
|
||||
|
||||
@@ -16,18 +16,18 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
import TableEmpty from '../../components/common/table/TableEmpty';
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import { getQuotaPerUnit } from '../../helpers';
|
||||
import { timestamp2string } from '../../helpers/utils';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { RefreshCw, ScrollText, Search } from 'lucide-react';
|
||||
import { RefreshCw, Search } from 'lucide-react';
|
||||
import { Form as AntForm, Tabs as AntTabs } from 'antd';
|
||||
import { Table, Select, Button, Tag, Tooltip } from '@/components/ui';
|
||||
import { API } from '../../helpers/api';
|
||||
import { useOrgAuditLogs } from '../../hooks/org/useOrgData';
|
||||
import OrgPageHeader from './components/OrgPageHeader';
|
||||
import { OrgFilterCard, OrgListCard } from './components/OrgListCard';
|
||||
import OrgStateBlock from './components/OrgStateBlock';
|
||||
import OrgPromptRecords from './OrgPromptRecords';
|
||||
import {
|
||||
formatQuotaAsCNY,
|
||||
@@ -212,6 +212,7 @@ const OrgAudit = ({ orgId }) => {
|
||||
const quotaPerUnit = getQuotaPerUnit();
|
||||
const { logs, total, loading, fetch } = useOrgAuditLogs(orgId);
|
||||
const [page, setPage] = useState(1);
|
||||
const [pageSize, setPageSize] = useState(20);
|
||||
const [actionFilter, setActionFilter] = useState('');
|
||||
const [activeTab, setActiveTab] = useState('operations');
|
||||
// 提示词记录 tab 由企业 feature flag(prompt_archive)控制显隐
|
||||
@@ -220,8 +221,8 @@ const OrgAudit = ({ orgId }) => {
|
||||
const [canViewPromptRecords, setCanViewPromptRecords] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
fetch(page, 20, actionFilter);
|
||||
}, [fetch, page, actionFilter]);
|
||||
fetch(page, pageSize, actionFilter);
|
||||
}, [fetch, page, pageSize, actionFilter]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!orgId) return;
|
||||
@@ -386,7 +387,7 @@ const OrgAudit = ({ orgId }) => {
|
||||
},
|
||||
];
|
||||
|
||||
const refresh = () => fetch(page, 20, actionFilter);
|
||||
const refresh = () => fetch(page, pageSize, actionFilter);
|
||||
// 选择即筛选(原交互):与原页头 Select 的 onChange 相同
|
||||
const applyAction = (v) => {
|
||||
setActionFilter(v ?? '');
|
||||
@@ -445,13 +446,17 @@ const OrgAudit = ({ orgId }) => {
|
||||
scroll={{ x: 1140 }}
|
||||
pagination={{
|
||||
currentPage: page,
|
||||
pageSize: 20,
|
||||
pageSize,
|
||||
showSizeChanger: false,
|
||||
total,
|
||||
onPageChange: setPage,
|
||||
onPageSizeChange: (size) => {
|
||||
setPage(1);
|
||||
setPageSize(size);
|
||||
},
|
||||
showTotal: (n) => t('共 {{total}} 条', { total: n }),
|
||||
}}
|
||||
empty={<OrgStateBlock icon={ScrollText} title={t('暂无审计日志')} />}
|
||||
empty={<TableEmpty />}
|
||||
/>
|
||||
</OrgListCard>
|
||||
</>
|
||||
|
||||
@@ -16,6 +16,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
import TableEmpty from '../../components/common/table/TableEmpty';
|
||||
import React, {
|
||||
useCallback,
|
||||
useEffect,
|
||||
@@ -461,6 +462,7 @@ const OrgBudgets = ({ orgId }) => {
|
||||
}
|
||||
>
|
||||
<Table
|
||||
empty={<TableEmpty />}
|
||||
columns={columns}
|
||||
dataSource={list}
|
||||
loading={loading}
|
||||
|
||||
@@ -124,15 +124,16 @@ const MemberUsageSheet = ({ visible, onClose, member, orgId, t }) => {
|
||||
modelName: '',
|
||||
});
|
||||
const requestSeq = useRef(0);
|
||||
const pageSize = 20;
|
||||
const [pageSize, setPageSize] = useState(20);
|
||||
const pageSizeRef = useRef(20);
|
||||
|
||||
const fetchLogs = useCallback(
|
||||
async (p = 1, filters = appliedFilters) => {
|
||||
async (p = 1, filters = appliedFilters, size = pageSize) => {
|
||||
if (!member || !orgId) return;
|
||||
const seq = ++requestSeq.current;
|
||||
setLoading(true);
|
||||
try {
|
||||
let url = `/api/org/logs?user_id=${member.user_id}&p=${p}&page_size=${pageSize}`;
|
||||
let url = `/api/org/logs?user_id=${member.user_id}&p=${p}&page_size=${size}`;
|
||||
if (filters.dateRange && filters.dateRange.length === 2) {
|
||||
if (filters.dateRange[0])
|
||||
url += `&start_timestamp=${Math.floor(filters.dateRange[0].getTime() / 1000)}`;
|
||||
@@ -161,7 +162,7 @@ const MemberUsageSheet = ({ visible, onClose, member, orgId, t }) => {
|
||||
if (seq === requestSeq.current) setLoading(false);
|
||||
}
|
||||
},
|
||||
[member, orgId, appliedFilters],
|
||||
[member, orgId, appliedFilters, pageSize],
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
@@ -171,6 +172,8 @@ const MemberUsageSheet = ({ visible, onClose, member, orgId, t }) => {
|
||||
setModelName('');
|
||||
setAppliedFilters({ dateRange: [], modelName: '' });
|
||||
setPage(1);
|
||||
setPageSize(20);
|
||||
pageSizeRef.current = 20;
|
||||
setLogs([]);
|
||||
setTotal(0);
|
||||
// 直接发起无过滤的请求(不依赖 state 更新)
|
||||
@@ -178,7 +181,7 @@ const MemberUsageSheet = ({ visible, onClose, member, orgId, t }) => {
|
||||
const seq = ++requestSeq.current;
|
||||
setLoading(true);
|
||||
try {
|
||||
const url = `/api/org/logs?user_id=${member.user_id}&p=1&page_size=${pageSize}`;
|
||||
const url = `/api/org/logs?user_id=${member.user_id}&p=1&page_size=${pageSizeRef.current}`;
|
||||
const res = await API.get(url, { headers: getOrgHeaders(orgId) });
|
||||
if (seq !== requestSeq.current) return;
|
||||
if (res.data.success) {
|
||||
@@ -330,12 +333,17 @@ const MemberUsageSheet = ({ visible, onClose, member, orgId, t }) => {
|
||||
size='small'
|
||||
loading={loading}
|
||||
pagination={
|
||||
total > pageSize
|
||||
total > pageSize || pageSize !== 20
|
||||
? {
|
||||
currentPage: page,
|
||||
pageSize,
|
||||
total,
|
||||
onPageChange: (p) => fetchLogs(p),
|
||||
onPageSizeChange: (size) => {
|
||||
pageSizeRef.current = size;
|
||||
setPageSize(size);
|
||||
fetchLogs(1, appliedFilters, size);
|
||||
},
|
||||
}
|
||||
: false
|
||||
}
|
||||
@@ -373,6 +381,10 @@ const renderBudgetAmount = (quota) => {
|
||||
};
|
||||
|
||||
const OrgDashboard = ({ orgId, orgRole, orgName, featureFlags }) => {
|
||||
const quotaPaginationSizeRef = useRef(null);
|
||||
useEffect(() => {
|
||||
quotaPaginationSizeRef.current = null;
|
||||
}, [orgId]);
|
||||
const { t } = useTranslation();
|
||||
const navigate = useNavigate();
|
||||
const [statusState] = useContext(StatusContext);
|
||||
@@ -601,13 +613,18 @@ const OrgDashboard = ({ orgId, orgRole, orgName, featureFlags }) => {
|
||||
rowKey='member_id'
|
||||
scroll={{ x: 860 }}
|
||||
pagination={
|
||||
memberQuotaTotal > memberQuotaPageSize
|
||||
memberQuotaTotal > memberQuotaPageSize ||
|
||||
quotaPaginationSizeRef.current !== null
|
||||
? {
|
||||
currentPage: memberQuotaPage,
|
||||
pageSize: memberQuotaPageSize,
|
||||
total: memberQuotaTotal,
|
||||
showSizeChanger: false,
|
||||
onPageChange: (page) => fetchQuota(page, memberQuotaPageSize),
|
||||
onPageSizeChange: (size) => {
|
||||
quotaPaginationSizeRef.current = size;
|
||||
fetchQuota(1, size);
|
||||
},
|
||||
showTotal: (n) => t('共 {{total}} 条', { total: n }),
|
||||
}
|
||||
: false
|
||||
|
||||
@@ -16,16 +16,15 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
import TableEmpty from '../../components/common/table/TableEmpty';
|
||||
import React, { useEffect, useState, useMemo, useCallback } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import {
|
||||
RefreshCw,
|
||||
Receipt,
|
||||
Wallet,
|
||||
Zap,
|
||||
BarChart3,
|
||||
Download,
|
||||
Trophy,
|
||||
Search,
|
||||
} from 'lucide-react';
|
||||
import { Card as AntCard, Form as AntForm, Tabs as AntTabs } from 'antd';
|
||||
@@ -47,7 +46,8 @@ import {
|
||||
import OrgPageHeader from './components/OrgPageHeader';
|
||||
import { OrgFilterCard, OrgListCard } from './components/OrgListCard';
|
||||
import OrgModal from './components/OrgModal';
|
||||
import TaskLogsTable from '../../components/table/task-logs';
|
||||
import OrgTaskRecords from './components/OrgTaskRecords';
|
||||
import { useOrgLogsThemeStyle } from './components/useOrgLogsThemeStyle';
|
||||
import {
|
||||
API,
|
||||
showError,
|
||||
@@ -220,6 +220,7 @@ function rangeToFilters(range) {
|
||||
// ========== 主组件 ==========
|
||||
const OrgLogs = ({ orgId, orgRole, isDeptManager = false }) => {
|
||||
const { t } = useTranslation();
|
||||
const themeStyle = useOrgLogsThemeStyle();
|
||||
const { logs, total, loading, fetch } = useOrgMemberLogs(orgId);
|
||||
const {
|
||||
stat,
|
||||
@@ -232,9 +233,8 @@ const OrgLogs = ({ orgId, orgRole, isDeptManager = false }) => {
|
||||
fetch: fetchRanking,
|
||||
} = useOrgMemberRanking(orgId);
|
||||
const [page, setPage] = useState(1);
|
||||
const pageSize = 20;
|
||||
const [pageSize, setPageSize] = useState(20);
|
||||
const [activeTab, setActiveTab] = useState('logs');
|
||||
const [taskFilterRevision, setTaskFilterRevision] = useState(0);
|
||||
const isAdmin =
|
||||
orgRole === 'owner' || orgRole === 'admin' || orgRole === 'super_admin';
|
||||
const canViewTeamUsage = isAdmin || isDeptManager;
|
||||
@@ -312,8 +312,9 @@ const OrgLogs = ({ orgId, orgRole, isDeptManager = false }) => {
|
||||
setDateRange(range);
|
||||
setIsDefaultRange(true);
|
||||
setPage(1);
|
||||
setPageSize(20);
|
||||
setAppliedFilters(filters);
|
||||
fetch(1, pageSize, filters);
|
||||
fetch(1, 20, filters);
|
||||
fetchStat(filters);
|
||||
if (canViewTeamUsage) {
|
||||
fetchRanking({
|
||||
@@ -321,7 +322,7 @@ const OrgLogs = ({ orgId, orgRole, isDeptManager = false }) => {
|
||||
endTimestamp: filters.endTimestamp,
|
||||
});
|
||||
}
|
||||
}, [fetch, fetchStat, fetchRanking, canViewTeamUsage, pageSize]);
|
||||
}, [fetch, fetchStat, fetchRanking, canViewTeamUsage]);
|
||||
|
||||
// forceRefresh=true(点击「刷新」)时绕过后端聚合缓存,拿到最新数据;
|
||||
// 普通「查询」走缓存,相同条件重复查询不再压数据库。
|
||||
@@ -346,7 +347,6 @@ const OrgLogs = ({ orgId, orgRole, isDeptManager = false }) => {
|
||||
);
|
||||
}
|
||||
setPage(1);
|
||||
setTaskFilterRevision((revision) => revision + 1);
|
||||
};
|
||||
|
||||
// 重置:回到默认状态(滚动最近 7 天、不限成员/模型)
|
||||
@@ -367,7 +367,6 @@ const OrgLogs = ({ orgId, orgRole, isDeptManager = false }) => {
|
||||
});
|
||||
}
|
||||
setPage(1);
|
||||
setTaskFilterRevision((revision) => revision + 1);
|
||||
};
|
||||
|
||||
// 导出弹窗状态(导出方式 + 字段勾选从 localStorage 恢复)
|
||||
@@ -679,6 +678,17 @@ const OrgLogs = ({ orgId, orgRole, isDeptManager = false }) => {
|
||||
);
|
||||
|
||||
// ========== 排行榜表格列(原型 90/200/190/150/160)==========
|
||||
// 后端排行可能对同一成员返回多行(如成员改名前后分组),user_id 不唯一会导致 React 重复 key;
|
||||
// 仅为行键附加名次序号,数据、排序与展示不变
|
||||
const rankingRows = useMemo(
|
||||
() =>
|
||||
(ranking || []).map((row, index) => ({
|
||||
...row,
|
||||
rank_row_key: `${row.user_id ?? 'unknown'}-${index}`,
|
||||
})),
|
||||
[ranking],
|
||||
);
|
||||
|
||||
const rankingColumns = useMemo(
|
||||
() => [
|
||||
{
|
||||
@@ -747,7 +757,7 @@ const OrgLogs = ({ orgId, orgRole, isDeptManager = false }) => {
|
||||
];
|
||||
|
||||
return (
|
||||
<div className='uc-page oc-page'>
|
||||
<div className='uc-page oc-page oc-expenses' style={themeStyle}>
|
||||
{/* 标题栏 */}
|
||||
<OrgPageHeader
|
||||
title={canViewTeamUsage ? t('消耗明细') : t('我的消耗明细')}
|
||||
@@ -782,21 +792,16 @@ const OrgLogs = ({ orgId, orgRole, isDeptManager = false }) => {
|
||||
onChange={setActiveTab}
|
||||
items={[
|
||||
{ key: 'logs', label: t('明细日志') },
|
||||
{ key: 'tasks', label: t('绘图与视频') },
|
||||
...(canViewTeamUsage
|
||||
? [{ key: 'ranking', label: t('成员排行') }]
|
||||
: []),
|
||||
{ key: 'tasks', label: t('绘图与视频') },
|
||||
]}
|
||||
/>
|
||||
|
||||
{activeTab === 'tasks' ? (
|
||||
<TaskLogsTable
|
||||
usageRecordMode
|
||||
organizationMode
|
||||
sharedStartTimestamp={appliedFilters.startTimestamp}
|
||||
sharedEndTimestamp={appliedFilters.endTimestamp}
|
||||
sharedFilterRevision={taskFilterRevision}
|
||||
/>
|
||||
// 绘图与视频使用自身筛选卡(与原型一致,时间范围独立可编辑)
|
||||
<OrgTaskRecords />
|
||||
) : (
|
||||
<>
|
||||
{/* 筛选栏(原型 .ee-filter-card / .eex-filter-grid) */}
|
||||
@@ -881,24 +886,12 @@ const OrgLogs = ({ orgId, orgRole, isDeptManager = false }) => {
|
||||
{activeTab === 'ranking' && canViewTeamUsage ? (
|
||||
<Table
|
||||
columns={rankingColumns}
|
||||
dataSource={ranking}
|
||||
dataSource={rankingRows}
|
||||
loading={rankingLoading}
|
||||
rowKey='user_id'
|
||||
rowKey='rank_row_key'
|
||||
pagination={false}
|
||||
scroll={{ x: 790 }}
|
||||
empty={
|
||||
<div className='py-10 text-center'>
|
||||
<div className='inline-flex p-3 rounded-full bg-gray-100 dark:bg-neutral-800 mb-3'>
|
||||
<Trophy
|
||||
size={24}
|
||||
className='text-gray-400 dark:text-gray-500'
|
||||
/>
|
||||
</div>
|
||||
<p className='text-gray-400 dark:text-gray-500 text-sm'>
|
||||
{t('暂无排行数据')}
|
||||
</p>
|
||||
</div>
|
||||
}
|
||||
empty={<TableEmpty />}
|
||||
/>
|
||||
) : (
|
||||
<Table
|
||||
@@ -913,35 +906,29 @@ const OrgLogs = ({ orgId, orgRole, isDeptManager = false }) => {
|
||||
total,
|
||||
showSizeChanger: false,
|
||||
onPageChange: (p) => doPageFetch(p),
|
||||
onPageSizeChange: (size) => {
|
||||
setPage(1);
|
||||
setPageSize(size);
|
||||
fetch(1, size, appliedFilters);
|
||||
},
|
||||
showTotal: (n) => t('共 {{total}} 条', { total: n }),
|
||||
}}
|
||||
empty={
|
||||
<div className='py-10 text-center'>
|
||||
<div className='inline-flex p-3 rounded-full bg-gray-100 dark:bg-neutral-800 mb-3'>
|
||||
<Receipt
|
||||
size={24}
|
||||
className='text-gray-400 dark:text-gray-500'
|
||||
/>
|
||||
</div>
|
||||
<p className='text-gray-400 dark:text-gray-500 text-sm'>
|
||||
{t('暂无消耗记录')}
|
||||
</p>
|
||||
</div>
|
||||
}
|
||||
empty={<TableEmpty />}
|
||||
/>
|
||||
)}
|
||||
</OrgListCard>
|
||||
</>
|
||||
)}
|
||||
|
||||
{/* 导出弹窗:汇总 / 按用户 + 字段选择 */}
|
||||
{/* 导出弹窗:汇总 / 按用户 + 字段选择(原型无此弹窗:Ant 默认 + token 语义色) */}
|
||||
<OrgModal
|
||||
className='oc-dialog oc-export-dialog'
|
||||
title={t('导出消耗明细')}
|
||||
visible={exportModalVisible}
|
||||
onCancel={() => setExportModalVisible(false)}
|
||||
maskClosable={!exporting}
|
||||
footer={
|
||||
<div className='flex justify-end gap-2'>
|
||||
<div className='oc-export-footer'>
|
||||
<Button
|
||||
onClick={() => setExportModalVisible(false)}
|
||||
disabled={exporting}
|
||||
@@ -960,29 +947,22 @@ const OrgLogs = ({ orgId, orgRole, isDeptManager = false }) => {
|
||||
}
|
||||
>
|
||||
{/* 导出范围概览(与表格当前展示一致) */}
|
||||
<div className='mb-4 rounded-lg p-3 bg-gray-50 dark:bg-neutral-800/50'>
|
||||
<div className='text-xs text-gray-500 dark:text-gray-400 mb-1.5'>
|
||||
<div className='oc-export-scope'>
|
||||
<div className='oc-export-scope-title'>
|
||||
{t('导出范围(与当前查询结果一致)')}
|
||||
</div>
|
||||
{exportScope.map((s) => (
|
||||
<div
|
||||
key={s.label}
|
||||
className='text-xs text-gray-600 dark:text-gray-300'
|
||||
>
|
||||
<span className='text-gray-400 dark:text-gray-500'>
|
||||
{s.label}:
|
||||
</span>
|
||||
<div key={s.label} className='oc-export-scope-row'>
|
||||
<span>{s.label}:</span>
|
||||
{s.value}
|
||||
</div>
|
||||
))}
|
||||
<div className='text-xs text-gray-600 dark:text-gray-300 mt-1.5'>
|
||||
<span className='text-gray-400 dark:text-gray-500'>
|
||||
{t('记录数')}:
|
||||
</span>
|
||||
<span className='font-medium'>{total}</span>
|
||||
<div className='oc-export-scope-row oc-export-scope-count'>
|
||||
<span>{t('记录数')}:</span>
|
||||
<strong>{total}</strong>
|
||||
</div>
|
||||
{total > EXPORT_LIMIT && (
|
||||
<div className='text-xs text-amber-600 dark:text-amber-400 mt-1.5'>
|
||||
<div className='oc-export-scope-warning'>
|
||||
{t(
|
||||
'超过单次导出上限,仅导出最新 {{limit}} 条,建议缩小时间范围。',
|
||||
{
|
||||
@@ -993,10 +973,8 @@ const OrgLogs = ({ orgId, orgRole, isDeptManager = false }) => {
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div className='mb-4'>
|
||||
<div className='text-sm font-medium text-gray-700 dark:text-gray-300 mb-2'>
|
||||
{t('导出方式')}
|
||||
</div>
|
||||
<div className='oc-export-section'>
|
||||
<div className='oc-export-label'>{t('导出方式')}</div>
|
||||
<RadioGroup
|
||||
type='card'
|
||||
value={exportMode}
|
||||
@@ -1015,11 +993,9 @@ const OrgLogs = ({ orgId, orgRole, isDeptManager = false }) => {
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<div className='flex items-center justify-between mb-2'>
|
||||
<span className='text-sm font-medium text-gray-700 dark:text-gray-300'>
|
||||
{t('导出字段')}
|
||||
</span>
|
||||
<div className='flex gap-2'>
|
||||
<div className='oc-export-fields-head'>
|
||||
<span className='oc-export-label'>{t('导出字段')}</span>
|
||||
<div className='oc-export-fields-actions'>
|
||||
<Button
|
||||
size='small'
|
||||
theme='borderless'
|
||||
@@ -1036,22 +1012,18 @@ const OrgLogs = ({ orgId, orgRole, isDeptManager = false }) => {
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
className='flex flex-wrap rounded-lg p-3'
|
||||
style={{ border: '1px solid var(--ui-color-border)' }}
|
||||
>
|
||||
<div className='oc-export-fields'>
|
||||
{EXPORT_FIELDS.map((f) => (
|
||||
<div key={f.id} className='w-1/2 mb-2'>
|
||||
<Checkbox
|
||||
checked={!!exportFields[f.id]}
|
||||
onChange={(e) => toggleExportField(f.id, e.target.checked)}
|
||||
>
|
||||
{t(f.label)}
|
||||
</Checkbox>
|
||||
</div>
|
||||
<Checkbox
|
||||
key={f.id}
|
||||
checked={!!exportFields[f.id]}
|
||||
onChange={(e) => toggleExportField(f.id, e.target.checked)}
|
||||
>
|
||||
{t(f.label)}
|
||||
</Checkbox>
|
||||
))}
|
||||
</div>
|
||||
<p className='text-xs text-gray-400 dark:text-gray-500 mt-2'>
|
||||
<p className='oc-export-note'>
|
||||
{t('消耗额度以人民币(¥)金额导出。')}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
@@ -16,6 +16,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
import TableEmpty from '../../components/common/table/TableEmpty';
|
||||
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import {
|
||||
@@ -490,6 +491,7 @@ const OrgMemberAccounts = ({
|
||||
{embedded ? (
|
||||
<OrgListCard title={t('员工账号')} tools={actions}>
|
||||
<Table
|
||||
empty={<TableEmpty />}
|
||||
columns={columns}
|
||||
dataSource={members}
|
||||
loading={loading}
|
||||
@@ -702,7 +704,7 @@ const OrgMemberAccounts = ({
|
||||
</Tag>{' '}
|
||||
<Text
|
||||
size='small'
|
||||
copyable={{ content: r.initial_password }}
|
||||
copyable={{ text: r.initial_password }}
|
||||
>
|
||||
{t('初始密码')}
|
||||
</Text>
|
||||
|
||||
@@ -16,6 +16,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
import TableEmpty from '../../components/common/table/TableEmpty';
|
||||
import React, { useEffect, useState, useCallback, useRef } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { Users, RefreshCw, Layers, Pencil, ShieldCheck } from 'lucide-react';
|
||||
@@ -65,6 +66,7 @@ const OrgMembers = ({
|
||||
updateMemberInList,
|
||||
} = useOrgMembers(orgId);
|
||||
const [page, setPage] = useState(1);
|
||||
const [pageSize, setPageSize] = useState(20);
|
||||
const [quotaModalVisible, setQuotaModalVisible] = useState(false);
|
||||
const [quotaMemberId, setQuotaMemberId] = useState(null);
|
||||
const [quotaMemberName, setQuotaMemberName] = useState('');
|
||||
@@ -107,9 +109,9 @@ const OrgMembers = ({
|
||||
|
||||
useEffect(() => {
|
||||
if (showMemberList) {
|
||||
fetch(page);
|
||||
fetch(page, pageSize);
|
||||
}
|
||||
}, [fetch, page, showMemberList]);
|
||||
}, [fetch, page, pageSize, showMemberList]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!showMemberList && activeTab === 'members') setActiveTab('accounts');
|
||||
@@ -121,10 +123,10 @@ const OrgMembers = ({
|
||||
const ok = await removeMember(memberId);
|
||||
if (ok) {
|
||||
Toast.success(t('成员已移除'));
|
||||
fetch(page);
|
||||
fetch(page, pageSize);
|
||||
}
|
||||
},
|
||||
[removeMember, fetch, page, t],
|
||||
[removeMember, fetch, page, pageSize, t],
|
||||
);
|
||||
|
||||
const handleRoleChange = useCallback(
|
||||
@@ -132,10 +134,10 @@ const OrgMembers = ({
|
||||
const ok = await updateMemberRole(memberId, role);
|
||||
if (ok) {
|
||||
Toast.success(t('角色已更新'));
|
||||
fetch(page);
|
||||
fetch(page, pageSize);
|
||||
}
|
||||
},
|
||||
[updateMemberRole, fetch, page, t],
|
||||
[updateMemberRole, fetch, page, pageSize, t],
|
||||
);
|
||||
|
||||
const handleStatusChange = useCallback(
|
||||
@@ -143,10 +145,10 @@ const OrgMembers = ({
|
||||
const ok = await updateMemberStatus(memberId, status);
|
||||
if (ok) {
|
||||
Toast.success(t('状态已更新'));
|
||||
fetch(page);
|
||||
fetch(page, pageSize);
|
||||
}
|
||||
},
|
||||
[updateMemberStatus, fetch, page, t],
|
||||
[updateMemberStatus, fetch, page, pageSize, t],
|
||||
);
|
||||
|
||||
const handleQuotaLimitSave = useCallback(async () => {
|
||||
@@ -155,7 +157,7 @@ const OrgMembers = ({
|
||||
if (ok) {
|
||||
Toast.success(t('配额已更新'));
|
||||
setQuotaModalVisible(false);
|
||||
fetch(page);
|
||||
fetch(page, pageSize);
|
||||
}
|
||||
}, [
|
||||
quotaMemberId,
|
||||
@@ -165,6 +167,7 @@ const OrgMembers = ({
|
||||
fetch,
|
||||
page,
|
||||
t,
|
||||
pageSize,
|
||||
]);
|
||||
|
||||
const handleModelLimitsSave = useCallback(async () => {
|
||||
@@ -182,7 +185,7 @@ const OrgMembers = ({
|
||||
if (ok) {
|
||||
Toast.success(t('模型限制已更新'));
|
||||
setModelLimitsModalVisible(false);
|
||||
fetch(page);
|
||||
fetch(page, pageSize);
|
||||
}
|
||||
}, [
|
||||
modelLimitsMemberId,
|
||||
@@ -192,6 +195,7 @@ const OrgMembers = ({
|
||||
fetch,
|
||||
page,
|
||||
t,
|
||||
pageSize,
|
||||
]);
|
||||
|
||||
// 解析成员管理员权限:兼容 JSON 字符串/对象;为空表示未授予任何权限
|
||||
@@ -221,7 +225,7 @@ const OrgMembers = ({
|
||||
if (ok) {
|
||||
Toast.success(t('权限已更新'));
|
||||
setPermModalVisible(false);
|
||||
fetch(page);
|
||||
fetch(page, pageSize);
|
||||
}
|
||||
}, [
|
||||
permMemberId,
|
||||
@@ -234,6 +238,7 @@ const OrgMembers = ({
|
||||
fetch,
|
||||
page,
|
||||
t,
|
||||
pageSize,
|
||||
]);
|
||||
|
||||
// 解析成员分组:兼容 JSON 字符串/数组;为空表示"继承企业全部分组"
|
||||
@@ -284,7 +289,7 @@ const OrgMembers = ({
|
||||
if (ok) {
|
||||
Toast.success(t('成员分组已更新'));
|
||||
setGroupsModalVisible(false);
|
||||
fetch(page);
|
||||
fetch(page, pageSize);
|
||||
}
|
||||
}, [
|
||||
groupsMemberId,
|
||||
@@ -293,6 +298,7 @@ const OrgMembers = ({
|
||||
fetch,
|
||||
page,
|
||||
t,
|
||||
pageSize,
|
||||
]);
|
||||
|
||||
const handleRemarkSave = useCallback(
|
||||
@@ -713,7 +719,7 @@ const OrgMembers = ({
|
||||
tools={
|
||||
<Button
|
||||
icon={<RefreshCw size={16} />}
|
||||
onClick={() => fetch(page)}
|
||||
onClick={() => fetch(page, pageSize)}
|
||||
loading={loading}
|
||||
>
|
||||
{t('刷新')}
|
||||
@@ -726,21 +732,16 @@ const OrgMembers = ({
|
||||
loading={loading}
|
||||
rowKey='id'
|
||||
scroll={{ x: 1500 }}
|
||||
empty={
|
||||
<div className='py-10 text-center'>
|
||||
<div className='inline-flex p-3 rounded-full bg-gray-100 dark:bg-neutral-800 mb-3'>
|
||||
<Users size={24} className='text-gray-400 dark:text-gray-500' />
|
||||
</div>
|
||||
<p className='text-gray-400 dark:text-gray-500 text-sm'>
|
||||
{t('暂无成员数据')}
|
||||
</p>
|
||||
</div>
|
||||
}
|
||||
empty={<TableEmpty />}
|
||||
pagination={{
|
||||
currentPage: page,
|
||||
pageSize: 20,
|
||||
pageSize,
|
||||
total,
|
||||
onPageChange: setPage,
|
||||
onPageSizeChange: (size) => {
|
||||
setPage(1);
|
||||
setPageSize(size);
|
||||
},
|
||||
showTotal: (n) => t('共 {{total}} 条', { total: n }),
|
||||
}}
|
||||
/>
|
||||
|
||||
@@ -16,6 +16,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
import TableEmpty from '../../components/common/table/TableEmpty';
|
||||
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { Switch } from 'antd';
|
||||
@@ -397,6 +398,7 @@ const OrgProjects = ({ orgId }) => {
|
||||
}
|
||||
>
|
||||
<Table
|
||||
empty={<TableEmpty />}
|
||||
columns={columns}
|
||||
dataSource={list}
|
||||
loading={loading}
|
||||
|
||||
@@ -170,6 +170,7 @@ const OrgPromptRecords = ({ orgId }) => {
|
||||
const quotaPerUnit = getQuotaPerUnit();
|
||||
const { records, total, loading, error, fetch } = useOrgPromptRecords(orgId);
|
||||
const [page, setPage] = useState(1);
|
||||
const [pageSize, setPageSize] = useState(20);
|
||||
const [members, setMembers] = useState([]);
|
||||
const [membersLoading, setMembersLoading] = useState(true);
|
||||
const [selectedMemberId, setSelectedMemberId] = useState('');
|
||||
@@ -228,8 +229,8 @@ const OrgPromptRecords = ({ orgId }) => {
|
||||
|
||||
useEffect(() => {
|
||||
if (membersLoading) return;
|
||||
fetch(page, 20, appliedFilters);
|
||||
}, [appliedFilters, fetch, membersLoading, page]);
|
||||
fetch(page, pageSize, appliedFilters);
|
||||
}, [appliedFilters, fetch, membersLoading, page, pageSize]);
|
||||
|
||||
const applyFilter = () => {
|
||||
setAppliedFilters(buildFilters());
|
||||
@@ -602,7 +603,7 @@ const OrgPromptRecords = ({ orgId }) => {
|
||||
actions={
|
||||
<Button
|
||||
icon={<RefreshCw size={14} />}
|
||||
onClick={() => fetch(page, 20, appliedFilters)}
|
||||
onClick={() => fetch(page, pageSize, appliedFilters)}
|
||||
loading={loading || membersLoading}
|
||||
>
|
||||
{t('刷新')}
|
||||
@@ -624,9 +625,13 @@ const OrgPromptRecords = ({ orgId }) => {
|
||||
scroll={{ x: 'max(100%, 1400px)' }}
|
||||
pagination={{
|
||||
currentPage: page,
|
||||
pageSize: 20,
|
||||
pageSize,
|
||||
total,
|
||||
onPageChange: setPage,
|
||||
onPageSizeChange: (size) => {
|
||||
setPage(1);
|
||||
setPageSize(size);
|
||||
},
|
||||
}}
|
||||
empty={
|
||||
<OrgStateBlock
|
||||
|
||||
@@ -123,6 +123,7 @@ const OrgRecharge = ({ orgId }) => {
|
||||
const [history, setHistory] = useState([]);
|
||||
const [historyTotal, setHistoryTotal] = useState(0);
|
||||
const [historyPage, setHistoryPage] = useState(1);
|
||||
const [historyPageSize, setHistoryPageSize] = useState(10);
|
||||
const [historyLoading, setHistoryLoading] = useState(false);
|
||||
const [refreshHistory, setRefreshHistory] = useState(0);
|
||||
|
||||
@@ -186,21 +187,26 @@ const OrgRecharge = ({ orgId }) => {
|
||||
async (page = 1) => {
|
||||
setHistoryLoading(true);
|
||||
try {
|
||||
const res = await API.get(`/api/org/topup?p=${page}&page_size=10`, {
|
||||
headers: orgHeaders,
|
||||
});
|
||||
const res = await API.get(
|
||||
`/api/org/topup?p=${page}&page_size=${historyPageSize}`,
|
||||
{
|
||||
headers: orgHeaders,
|
||||
},
|
||||
);
|
||||
if (res.data.success) {
|
||||
const data = res.data.data;
|
||||
setHistory(data.items || []);
|
||||
setHistoryTotal(data.total || 0);
|
||||
} else {
|
||||
showError(res.data.message);
|
||||
}
|
||||
} catch (e) {
|
||||
// ignore
|
||||
showError(e.message);
|
||||
} finally {
|
||||
setHistoryLoading(false);
|
||||
}
|
||||
},
|
||||
[orgId],
|
||||
[orgId, historyPageSize],
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
@@ -772,8 +778,12 @@ const OrgRecharge = ({ orgId }) => {
|
||||
pagination={{
|
||||
currentPage: historyPage,
|
||||
total: historyTotal,
|
||||
pageSize: 10,
|
||||
pageSize: historyPageSize,
|
||||
onPageChange: setHistoryPage,
|
||||
onPageSizeChange: (size) => {
|
||||
setHistoryPage(1);
|
||||
setHistoryPageSize(size);
|
||||
},
|
||||
showTotal: (n) => t('共 {{total}} 条', { total: n }),
|
||||
}}
|
||||
empty={<Text type='tertiary'>{t('暂无充值记录')}</Text>}
|
||||
|
||||
@@ -16,6 +16,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
import TableEmpty from '../../components/common/table/TableEmpty';
|
||||
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { Form as AntForm, Tabs as AntTabs } from 'antd';
|
||||
@@ -268,7 +269,7 @@ const OrgRequests = ({ orgId, orgRole, featureFlags }) => {
|
||||
columns={columns}
|
||||
dataSource={list}
|
||||
loading={loading}
|
||||
empty={t('暂无申请')}
|
||||
empty={<TableEmpty />}
|
||||
pagination={{
|
||||
pageSize: 15,
|
||||
showSizeChanger: false,
|
||||
|
||||
@@ -16,6 +16,8 @@ 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 React, {
|
||||
useEffect,
|
||||
useState,
|
||||
@@ -542,8 +544,7 @@ const OrgSettings = ({ orgId, orgRole }) => {
|
||||
);
|
||||
|
||||
const copyCode = () => {
|
||||
navigator.clipboard
|
||||
.writeText(orgInfo.code)
|
||||
writeClipboardText(orgInfo.code)
|
||||
.then(() => {
|
||||
setCodeCopied(true);
|
||||
Toast.success(t('企业代码已复制到剪贴板'));
|
||||
@@ -555,8 +556,7 @@ const OrgSettings = ({ orgId, orgRole }) => {
|
||||
};
|
||||
|
||||
const copyLink = () => {
|
||||
navigator.clipboard
|
||||
.writeText(orgLoginLink)
|
||||
writeClipboardText(orgLoginLink)
|
||||
.then(() => {
|
||||
setLinkCopied(true);
|
||||
Toast.success(t('企业登录链接已复制到剪贴板'));
|
||||
|
||||
@@ -510,7 +510,7 @@ const OrgSidebar = ({
|
||||
>
|
||||
{!collapsed && (
|
||||
<div className='ui-org-identity'>
|
||||
<LayoutGrid size={22} strokeWidth={1.5} aria-hidden='true' />
|
||||
<LayoutGrid size={24} strokeWidth={1.65} aria-hidden='true' />
|
||||
<div className='ui-org-identity-copy'>
|
||||
<span className='ui-org-name' title={orgName || t('企业中心')}>
|
||||
{orgName || t('企业中心')}
|
||||
|
||||
@@ -16,6 +16,9 @@ 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, {
|
||||
useEffect,
|
||||
useState,
|
||||
@@ -33,7 +36,6 @@ import {
|
||||
Layers,
|
||||
Check,
|
||||
RefreshCw,
|
||||
Settings,
|
||||
} from 'lucide-react';
|
||||
import {
|
||||
Table,
|
||||
@@ -63,15 +65,13 @@ import {
|
||||
Alert as AntAlert,
|
||||
Button as AntButton,
|
||||
Collapse,
|
||||
Checkbox,
|
||||
Divider,
|
||||
Form as AntForm,
|
||||
Radio,
|
||||
Popover,
|
||||
} from 'antd';
|
||||
import { OrgListCard, OrgRowActions } from './components/OrgListCard';
|
||||
import OrgSideSheet from './components/OrgSideSheet';
|
||||
import OrgStateBlock from './components/OrgStateBlock';
|
||||
import TableColumnSettings from '../../components/common/table/ColumnSettings';
|
||||
|
||||
// 获取当前登录用户ID
|
||||
const getCurrentUserId = () => {
|
||||
@@ -95,6 +95,7 @@ const OrgTokens = ({ orgId, orgRole }) => {
|
||||
updateToken,
|
||||
} = useOrgTokens(orgId);
|
||||
const [page, setPage] = useState(1);
|
||||
const [pageSize, setPageSize] = useState(20);
|
||||
const [visibleColumns, setVisibleColumns] = useState([
|
||||
'name',
|
||||
'key',
|
||||
@@ -129,8 +130,8 @@ const OrgTokens = ({ orgId, orgRole }) => {
|
||||
}, [projects]);
|
||||
|
||||
useEffect(() => {
|
||||
fetch(page);
|
||||
}, [fetch, page]);
|
||||
fetch(page, pageSize);
|
||||
}, [fetch, page, pageSize]);
|
||||
|
||||
useEffect(() => {
|
||||
let alive = true;
|
||||
@@ -149,10 +150,10 @@ const OrgTokens = ({ orgId, orgRole }) => {
|
||||
const ok = await deleteToken(tokenId);
|
||||
if (ok) {
|
||||
Toast.success(t('密钥已删除'));
|
||||
fetch(page);
|
||||
fetch(page, pageSize);
|
||||
}
|
||||
},
|
||||
[deleteToken, fetch, page, t],
|
||||
[deleteToken, fetch, page, pageSize, t],
|
||||
);
|
||||
|
||||
const handleStatusToggle = useCallback(
|
||||
@@ -161,27 +162,19 @@ const OrgTokens = ({ orgId, orgRole }) => {
|
||||
const ok = await updateToken(tokenId, { status: newStatus });
|
||||
if (ok) {
|
||||
Toast.success(t('状态已更新'));
|
||||
fetch(page);
|
||||
fetch(page, pageSize);
|
||||
}
|
||||
},
|
||||
[updateToken, fetch, page, t],
|
||||
[updateToken, fetch, page, pageSize, t],
|
||||
);
|
||||
|
||||
const copyToClipboard = (text) => {
|
||||
navigator.clipboard
|
||||
.writeText(text)
|
||||
writeClipboardText(text)
|
||||
.then(() => {
|
||||
Toast.success(t('已复制到剪贴板'));
|
||||
})
|
||||
.catch(() => {
|
||||
// 降级方案
|
||||
const textarea = document.createElement('textarea');
|
||||
textarea.value = text;
|
||||
document.body.appendChild(textarea);
|
||||
textarea.select();
|
||||
document.execCommand('copy');
|
||||
document.body.removeChild(textarea);
|
||||
Toast.success(t('已复制到剪贴板'));
|
||||
Toast.error(t('复制失败,请手动复制'));
|
||||
});
|
||||
};
|
||||
|
||||
@@ -392,20 +385,6 @@ const OrgTokens = ({ orgId, orgRole }) => {
|
||||
visibleColumns.includes(column.key),
|
||||
);
|
||||
const tableColumns = selectedColumns.length ? selectedColumns : [columns[0]];
|
||||
const columnSettings = (
|
||||
<Checkbox.Group
|
||||
className='oc-token-column-options'
|
||||
value={tableColumns.map((column) => column.key)}
|
||||
options={columns.map((column) => ({
|
||||
value: column.key,
|
||||
label: column.title,
|
||||
disabled:
|
||||
tableColumns.length === 1 && tableColumns[0].key === column.key,
|
||||
}))}
|
||||
onChange={setVisibleColumns}
|
||||
/>
|
||||
);
|
||||
|
||||
return (
|
||||
<div className='uc-page oc-page'>
|
||||
<OrgPageHeader
|
||||
@@ -434,7 +413,7 @@ const OrgTokens = ({ orgId, orgRole }) => {
|
||||
<>
|
||||
<Button
|
||||
icon={<RefreshCw size={16} />}
|
||||
onClick={() => fetch(page)}
|
||||
onClick={() => fetch(page, pageSize)}
|
||||
loading={loading}
|
||||
>
|
||||
{t('刷新')}
|
||||
@@ -448,18 +427,12 @@ const OrgTokens = ({ orgId, orgRole }) => {
|
||||
{t('创建密钥')}
|
||||
</Button>
|
||||
)}
|
||||
<Popover
|
||||
trigger='click'
|
||||
placement='bottomRight'
|
||||
title={t('列设置')}
|
||||
content={columnSettings}
|
||||
>
|
||||
<AntButton
|
||||
type='text'
|
||||
aria-label={t('列设置')}
|
||||
icon={<Settings size={16} />}
|
||||
/>
|
||||
</Popover>
|
||||
<TableColumnSettings
|
||||
columns={columns}
|
||||
value={tableColumns.map((column) => column.key)}
|
||||
defaultValue={columns.map((column) => column.key)}
|
||||
onChange={setVisibleColumns}
|
||||
/>
|
||||
</>
|
||||
}
|
||||
>
|
||||
@@ -472,12 +445,16 @@ const OrgTokens = ({ orgId, orgRole }) => {
|
||||
scroll={{
|
||||
x: tableColumns.reduce((sum, column) => sum + column.width, 0),
|
||||
}}
|
||||
empty={<OrgStateBlock icon={Key} title={t('暂无密钥')} />}
|
||||
empty={<TableEmpty />}
|
||||
pagination={{
|
||||
currentPage: page,
|
||||
pageSize: 20,
|
||||
pageSize,
|
||||
total,
|
||||
onPageChange: setPage,
|
||||
onPageSizeChange: (size) => {
|
||||
setPage(1);
|
||||
setPageSize(size);
|
||||
},
|
||||
showTotal: (n) => t('共 {{total}} 条', { total: n }),
|
||||
}}
|
||||
/>
|
||||
@@ -489,7 +466,7 @@ const OrgTokens = ({ orgId, orgRole }) => {
|
||||
onClose={() => setCreateModalVisible(false)}
|
||||
createToken={createToken}
|
||||
projects={projects}
|
||||
onSuccess={() => fetch(page)}
|
||||
onSuccess={() => fetch(page, pageSize)}
|
||||
t={t}
|
||||
/>
|
||||
|
||||
@@ -507,7 +484,7 @@ const OrgTokens = ({ orgId, orgRole }) => {
|
||||
// 前端按角色粗判以决定是否展示控件;真正的授权判定在后端
|
||||
// checkOrgSkillBindingPermission(skill_manage 权限),前端放宽不会造成越权。
|
||||
canBindSkills={isAdmin}
|
||||
onSuccess={() => fetch(page)}
|
||||
onSuccess={() => fetch(page, pageSize)}
|
||||
t={t}
|
||||
/>
|
||||
|
||||
@@ -861,19 +838,12 @@ const CreateTokenModal = ({
|
||||
};
|
||||
|
||||
const copyKey = (key) => {
|
||||
navigator.clipboard
|
||||
.writeText(key)
|
||||
writeClipboardText(key)
|
||||
.then(() => {
|
||||
Toast.success(t('已复制到剪贴板'));
|
||||
})
|
||||
.catch(() => {
|
||||
const el = document.createElement('textarea');
|
||||
el.value = key;
|
||||
document.body.appendChild(el);
|
||||
el.select();
|
||||
document.execCommand('copy');
|
||||
document.body.removeChild(el);
|
||||
Toast.success(t('已复制到剪贴板'));
|
||||
Toast.error(t('复制失败,请手动复制'));
|
||||
});
|
||||
};
|
||||
|
||||
@@ -1383,24 +1353,14 @@ const ModelsSideSheet = ({ visible, onClose, token, orgId, t }) => {
|
||||
});
|
||||
|
||||
const handleCopyModel = (model) => {
|
||||
navigator.clipboard
|
||||
.writeText(model)
|
||||
writeClipboardText(model)
|
||||
.then(() => {
|
||||
setCopiedModel(model);
|
||||
Toast.success(t('已复制模型名称'));
|
||||
setTimeout(() => setCopiedModel(null), 1500);
|
||||
})
|
||||
.catch(() => {
|
||||
// fallback
|
||||
const textarea = document.createElement('textarea');
|
||||
textarea.value = model;
|
||||
document.body.appendChild(textarea);
|
||||
textarea.select();
|
||||
document.execCommand('copy');
|
||||
document.body.removeChild(textarea);
|
||||
setCopiedModel(model);
|
||||
Toast.success(t('已复制模型名称'));
|
||||
setTimeout(() => setCopiedModel(null), 1500);
|
||||
Toast.error(t('复制失败,请手动复制'));
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -0,0 +1,280 @@
|
||||
/*
|
||||
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 TableEmpty from '../../../components/common/table/TableEmpty';
|
||||
import React, { useMemo } from 'react';
|
||||
import { Card, Table, Tag } from 'antd';
|
||||
import { Clock, Download, RefreshCw } from 'lucide-react';
|
||||
import { Button, Pagination } from '@/components/ui';
|
||||
import { useTaskLogsData } from '../../../hooks/task-logs/useTaskLogsData';
|
||||
import { useIsMobile } from '../../../hooks/common/useIsMobile';
|
||||
import { timestamp2string } from '../../../helpers';
|
||||
import { getTaskLogsColumns } from '../../../components/table/task-logs/TaskLogsColumnDefs';
|
||||
import TaskLogsFilters from '../../../components/table/task-logs/TaskLogsFilters';
|
||||
import {
|
||||
exportTaskLogsPageCsv,
|
||||
useTaskPageStats,
|
||||
} from '../../../components/table/task-logs/TaskLogsActions';
|
||||
import ColumnSelectorModal from '../../../components/table/task-logs/modals/ColumnSelectorModal';
|
||||
import ContentModal from '../../../components/table/task-logs/modals/ContentModal';
|
||||
import { OrgListCard } from './OrgListCard';
|
||||
import { ColumnSettingsButton } from '../../../components/common/table/ColumnSettings';
|
||||
|
||||
// 原型 EnterpriseExpenseTasks 列宽(提交 / 结束 185、花费 110、类型 110、模型 250、任务 ID 330、状态 110、进度 155、费用 145、末列 150)
|
||||
const COLUMN_WIDTHS = {
|
||||
submit_time: 185,
|
||||
finish_time: 185,
|
||||
duration: 110,
|
||||
channel: 85,
|
||||
type: 110,
|
||||
model: 250,
|
||||
task_id: 330,
|
||||
task_status: 110,
|
||||
progress: 155,
|
||||
quota: 145,
|
||||
fail_reason: 150,
|
||||
};
|
||||
|
||||
/**
|
||||
* 企业中心「消耗明细 → 绘图与视频」(原型 .eex-task-records:筛选卡 + “任务记录”列表卡)。
|
||||
* 与原型一致,本页签使用自身筛选卡中的时间范围(默认最近 7 天,可编辑),不受“明细日志”筛选影响;
|
||||
* 数据、请求、URL 同步、分页、列显隐、复制与预览回调全部来自原 useTaskLogsData(organizationMode);
|
||||
* 列渲染复用 getTaskLogsColumns 的使用记录分支,只包一层企业页类名与原型列宽。
|
||||
*/
|
||||
const OrgTaskRecords = () => {
|
||||
const taskLogsData = useTaskLogsData({ organizationMode: true });
|
||||
const {
|
||||
t,
|
||||
logs,
|
||||
loading,
|
||||
isAdminUser,
|
||||
isRootUser,
|
||||
COLUMN_KEYS,
|
||||
copyText,
|
||||
openContentModal,
|
||||
openVideoModal,
|
||||
visibleColumns,
|
||||
} = taskLogsData;
|
||||
const isMobile = useIsMobile();
|
||||
// 仅用于“实时更新中”提示(存在进行中任务时轮询);原型无“本页统计”区块,不渲染
|
||||
const pageStats = useTaskPageStats(logs);
|
||||
|
||||
const configurableColumns = useMemo(() => {
|
||||
const base = getTaskLogsColumns({
|
||||
t,
|
||||
COLUMN_KEYS,
|
||||
copyText,
|
||||
openContentModal,
|
||||
openVideoModal,
|
||||
isAdminUser,
|
||||
usageRecordMode: true,
|
||||
isRootUser,
|
||||
});
|
||||
return base.map((column) => {
|
||||
const width = COLUMN_WIDTHS[column.key];
|
||||
switch (column.key) {
|
||||
// 原型为单行“YYYY-MM-DD HH:mm:ss”
|
||||
case COLUMN_KEYS.SUBMIT_TIME:
|
||||
case COLUMN_KEYS.FINISH_TIME:
|
||||
return {
|
||||
...column,
|
||||
width,
|
||||
render: (value) =>
|
||||
value ? (
|
||||
<span className='oc-number'>{timestamp2string(value)}</span>
|
||||
) : (
|
||||
'-'
|
||||
),
|
||||
};
|
||||
case COLUMN_KEYS.DURATION:
|
||||
return {
|
||||
...column,
|
||||
width,
|
||||
render: (...args) => (
|
||||
<span className='oc-number'>{column.render(...args)}</span>
|
||||
),
|
||||
};
|
||||
case COLUMN_KEYS.MODEL:
|
||||
return {
|
||||
...column,
|
||||
width,
|
||||
render: (...args) => (
|
||||
<span className='oc-task-model'>{column.render(...args)}</span>
|
||||
),
|
||||
};
|
||||
case COLUMN_KEYS.TASK_ID:
|
||||
return {
|
||||
...column,
|
||||
// 原型列名“任务 ID”(与筛选标签同一文案)
|
||||
title: t('任务 ID'),
|
||||
width,
|
||||
render: (...args) => {
|
||||
const node = column.render(...args);
|
||||
return (
|
||||
<span className='oc-task-id'>
|
||||
{node?.props?.children ?? node}
|
||||
</span>
|
||||
);
|
||||
},
|
||||
};
|
||||
case COLUMN_KEYS.QUOTA:
|
||||
return {
|
||||
...column,
|
||||
width,
|
||||
align: 'right',
|
||||
render: (...args) => {
|
||||
const node = column.render(...args);
|
||||
return node?.type === 'span' ? (
|
||||
<span className='oc-exp-cost'>{node.props.children}</span>
|
||||
) : (
|
||||
node
|
||||
);
|
||||
},
|
||||
};
|
||||
case COLUMN_KEYS.FAIL_REASON: {
|
||||
// 原型末列“操作”:随表格横向滚动(不固定),无可操作内容时显示“-”;
|
||||
// 预览视频链接与失败原因查看保持原节点与回调
|
||||
const { fixed: _fixed, ...rest } = column;
|
||||
return {
|
||||
...rest,
|
||||
title: t('操作'),
|
||||
width,
|
||||
render: (...args) => {
|
||||
const node = column.render(...args);
|
||||
return (
|
||||
<span className='oc-task-detail'>
|
||||
{node?.type === 'span' ? '-' : node}
|
||||
</span>
|
||||
);
|
||||
},
|
||||
};
|
||||
}
|
||||
default:
|
||||
return width ? { ...column, width } : column;
|
||||
}
|
||||
});
|
||||
}, [
|
||||
t,
|
||||
COLUMN_KEYS,
|
||||
copyText,
|
||||
openContentModal,
|
||||
openVideoModal,
|
||||
isAdminUser,
|
||||
isRootUser,
|
||||
]);
|
||||
|
||||
const columns = configurableColumns.filter(
|
||||
(column) => visibleColumns[column.key],
|
||||
);
|
||||
const scrollX = columns.reduce(
|
||||
(total, column) => total + (column.width || 120),
|
||||
0,
|
||||
);
|
||||
|
||||
return (
|
||||
<div className='oc-task-records'>
|
||||
<ColumnSelectorModal
|
||||
{...taskLogsData}
|
||||
usageRecordMode
|
||||
columns={configurableColumns}
|
||||
/>
|
||||
<ContentModal {...taskLogsData} isVideo={false} />
|
||||
{/* 视频预览弹窗:复用 ContentModal */}
|
||||
<ContentModal
|
||||
isModalOpen={taskLogsData.isVideoModalOpen}
|
||||
setIsModalOpen={taskLogsData.setIsVideoModalOpen}
|
||||
modalContent={taskLogsData.videoUrl}
|
||||
sourceUrl={taskLogsData.videoSourceUrl}
|
||||
isVideo={true}
|
||||
/>
|
||||
|
||||
{/* 原型移动端筛选卡直接展开(与“明细日志”页签一致),不设收起开关 */}
|
||||
<Card className='oc-filter-card oc-task-filter'>
|
||||
<TaskLogsFilters {...taskLogsData} usageRecordMode />
|
||||
</Card>
|
||||
|
||||
<OrgListCard
|
||||
className='oc-task-list'
|
||||
title={t('任务记录')}
|
||||
tools={
|
||||
<>
|
||||
{/* 只有真实存在进行中任务时才显示,避免误导 */}
|
||||
{pageStats.pendingCount > 0 && (
|
||||
<Tag
|
||||
bordered={false}
|
||||
color='processing'
|
||||
icon={<Clock size={12} />}
|
||||
>
|
||||
{t('实时更新中')}
|
||||
</Tag>
|
||||
)}
|
||||
{/* 导出当前页为 CSV,空列表时禁用 */}
|
||||
<Button
|
||||
icon={<Download size={16} />}
|
||||
onClick={() => exportTaskLogsPageCsv(logs, isAdminUser, t)}
|
||||
disabled={!logs || logs.length === 0}
|
||||
>
|
||||
{t('导出本页')}
|
||||
</Button>
|
||||
{/* 与筛选“搜索”同一处理函数(同步 URL 筛选条件并重新加载第 1 页) */}
|
||||
<Button
|
||||
icon={<RefreshCw size={16} />}
|
||||
onClick={() => taskLogsData.refresh()}
|
||||
loading={loading}
|
||||
>
|
||||
{t('刷新')}
|
||||
</Button>
|
||||
<ColumnSettingsButton
|
||||
open={taskLogsData.showColumnSelector}
|
||||
onClick={() => taskLogsData.setShowColumnSelector(true)}
|
||||
/>
|
||||
</>
|
||||
}
|
||||
>
|
||||
<Table
|
||||
columns={columns}
|
||||
dataSource={logs}
|
||||
rowKey='key'
|
||||
loading={loading}
|
||||
pagination={false}
|
||||
scroll={{ x: scrollX }}
|
||||
locale={{
|
||||
emptyText: <TableEmpty />,
|
||||
}}
|
||||
/>
|
||||
{taskLogsData.logCount > 0 && (
|
||||
<Pagination
|
||||
currentPage={taskLogsData.activePage}
|
||||
pageSize={taskLogsData.pageSize}
|
||||
total={taskLogsData.logCount}
|
||||
pageSizeOpts={[10, 20, 50]}
|
||||
showSizeChanger
|
||||
onPageSizeChange={taskLogsData.handlePageSizeChange}
|
||||
onPageChange={taskLogsData.handlePageChange}
|
||||
preventPageChangeOnPageSizeChange={false}
|
||||
showQuickJumper={isMobile}
|
||||
showTotal={(total) => t('共 {{total}} 条', { total })}
|
||||
/>
|
||||
)}
|
||||
</OrgListCard>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default OrgTaskRecords;
|
||||
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
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 { useMemo } from 'react';
|
||||
import { theme } from 'antd';
|
||||
import { useActualTheme } from '../../../context/Theme';
|
||||
import { brandAccentFromToken } from '../../../components/ui/UiThemeProvider';
|
||||
|
||||
/**
|
||||
* 消耗明细页(/org/logs)主题桥:只从 Ant token 推导页面局部变量,挂在页面根节点 style 上。
|
||||
* - --oc-brand:原型 --brand(页签、额度、统计图标等强调色),浅色 / 深色 / 自定义主色三态跟随 token。
|
||||
* - --oc-stat-brand-bg:统计图标浅底(原型 #b9650810 = 品牌色 6.3% 透明度)。
|
||||
* - --ur-progress-done:任务进度满格描边(原型 strokeColor = var(--brand))。
|
||||
* - --oc-task-{success|failure|pending}-{text|bg|border}:绘图与视频“本页统计”语义色(Ant success / error / warning)。
|
||||
* 不新增 ConfigProvider / 主题状态 / 存储 key;JSX 中不出现颜色字面量。
|
||||
*/
|
||||
export function useOrgLogsThemeStyle() {
|
||||
const { token } = theme.useToken();
|
||||
const dark = useActualTheme() === 'dark';
|
||||
return useMemo(
|
||||
() => ({
|
||||
'--oc-brand': brandAccentFromToken(token.colorPrimary, dark),
|
||||
'--oc-stat-brand-bg':
|
||||
'color-mix(in srgb, var(--oc-brand) 6.3%, transparent)',
|
||||
'--ur-progress-done': 'var(--oc-brand)',
|
||||
'--oc-task-success-text': token.colorSuccessText,
|
||||
'--oc-task-success-bg': token.colorSuccessBg,
|
||||
'--oc-task-success-border': token.colorSuccessBorder,
|
||||
'--oc-task-failure-text': token.colorErrorText,
|
||||
'--oc-task-failure-bg': token.colorErrorBg,
|
||||
'--oc-task-failure-border': token.colorErrorBorder,
|
||||
'--oc-task-pending-text': token.colorWarningText,
|
||||
'--oc-task-pending-bg': token.colorWarningBg,
|
||||
'--oc-task-pending-border': token.colorWarningBorder,
|
||||
}),
|
||||
[token, dark],
|
||||
);
|
||||
}
|
||||
|
||||
export default useOrgLogsThemeStyle;
|
||||
@@ -16,7 +16,13 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
||||
import React, {
|
||||
useCallback,
|
||||
useEffect,
|
||||
useMemo,
|
||||
useRef,
|
||||
useState,
|
||||
} from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { History } from 'lucide-react';
|
||||
import { Button, Spin, Table, Tag, Typography } from '@/components/ui';
|
||||
@@ -24,8 +30,6 @@ import { API } from '../../../helpers/api';
|
||||
import { showError } from '../../../helpers';
|
||||
import OrgPanel from '../components/OrgPanel';
|
||||
|
||||
const PAGE_SIZE = 20;
|
||||
|
||||
const fmtTime = (v) => (v ? new Date(v * 1000).toLocaleString() : '-');
|
||||
|
||||
// 审计 target 前缀 → 人类可读标签(与后端 afterOrgRuleChange / applyOrgConfig* 的写入口径对应)
|
||||
@@ -55,9 +59,13 @@ const OrgDsChanges = ({ orgId }) => {
|
||||
|
||||
const [requests, setRequests] = useState([]);
|
||||
const [reqPage, setReqPage] = useState(1);
|
||||
const [reqPageSize, setReqPageSize] = useState(20);
|
||||
const reqSizeRef = useRef(20);
|
||||
const [reqTotal, setReqTotal] = useState(0);
|
||||
const [audits, setAudits] = useState([]);
|
||||
const [auditPage, setAuditPage] = useState(1);
|
||||
const [auditPageSize, setAuditPageSize] = useState(20);
|
||||
const auditSizeRef = useRef(20);
|
||||
const [auditTotal, setAuditTotal] = useState(0);
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [loadError, setLoadError] = useState(false);
|
||||
@@ -68,9 +76,9 @@ const OrgDsChanges = ({ orgId }) => {
|
||||
setLoadError(false);
|
||||
try {
|
||||
// 后端同一端点按 page 同步分页两个分区;此处按需各取所需分区,互不干扰。
|
||||
const load = async (p) => {
|
||||
const load = async (p, size) => {
|
||||
const res = await API.get(
|
||||
`/api/org/data-security/changes?page=${p}&page_size=${PAGE_SIZE}`,
|
||||
`/api/org/data-security/changes?page=${p}&page_size=${size}`,
|
||||
{ headers },
|
||||
);
|
||||
if (!res.data.success) {
|
||||
@@ -82,8 +90,10 @@ const OrgDsChanges = ({ orgId }) => {
|
||||
// 两分区页码可能不同(各自独立翻页后重试):并发取两页、各取所需分区,
|
||||
// 避免"重试"退化成只刷其中一个分区(review R38 发现)。
|
||||
const [dReq, dAudit] = await Promise.all([
|
||||
load(reqP),
|
||||
auditP === reqP ? null : load(auditP),
|
||||
load(reqP, reqSizeRef.current),
|
||||
auditP === reqP && auditSizeRef.current === reqSizeRef.current
|
||||
? null
|
||||
: load(auditP, auditSizeRef.current),
|
||||
]);
|
||||
const auditSource = dAudit || dReq;
|
||||
setRequests(dReq.requests?.items || []);
|
||||
@@ -93,12 +103,12 @@ const OrgDsChanges = ({ orgId }) => {
|
||||
setAuditTotal(auditSource.audits?.total || 0);
|
||||
setAuditPage(auditP);
|
||||
} else if (section === 'requests') {
|
||||
const d = await load(reqP);
|
||||
const d = await load(reqP, reqSizeRef.current);
|
||||
setRequests(d.requests?.items || []);
|
||||
setReqTotal(d.requests?.total || 0);
|
||||
setReqPage(reqP);
|
||||
} else {
|
||||
const d = await load(auditP);
|
||||
const d = await load(auditP, auditSizeRef.current);
|
||||
setAudits(d.audits?.items || []);
|
||||
setAuditTotal(d.audits?.total || 0);
|
||||
setAuditPage(auditP);
|
||||
@@ -224,7 +234,12 @@ const OrgDsChanges = ({ orgId }) => {
|
||||
}
|
||||
pagination={{
|
||||
currentPage: reqPage,
|
||||
pageSize: PAGE_SIZE,
|
||||
pageSize: reqPageSize,
|
||||
onPageSizeChange: (size) => {
|
||||
reqSizeRef.current = size;
|
||||
setReqPageSize(size);
|
||||
fetchChanges({ reqP: 1, auditP: auditPage, section: 'requests' });
|
||||
},
|
||||
total: reqTotal,
|
||||
onPageChange: (p) =>
|
||||
fetchChanges({ reqP: p, auditP: auditPage, section: 'requests' }),
|
||||
@@ -247,7 +262,12 @@ const OrgDsChanges = ({ orgId }) => {
|
||||
}
|
||||
pagination={{
|
||||
currentPage: auditPage,
|
||||
pageSize: PAGE_SIZE,
|
||||
pageSize: auditPageSize,
|
||||
onPageSizeChange: (size) => {
|
||||
auditSizeRef.current = size;
|
||||
setAuditPageSize(size);
|
||||
fetchChanges({ reqP: reqPage, auditP: 1, section: 'audits' });
|
||||
},
|
||||
total: auditTotal,
|
||||
onPageChange: (p) =>
|
||||
fetchChanges({ reqP: reqPage, auditP: p, section: 'audits' }),
|
||||
|
||||
@@ -30,7 +30,6 @@ import { API } from '../../../helpers/api';
|
||||
import { showError } from '../../../helpers';
|
||||
import OrgPanel from '../components/OrgPanel';
|
||||
|
||||
const PAGE_SIZE = 20;
|
||||
const WINDOW_OPTIONS = [
|
||||
{ value: 24, label: '近 24 小时' },
|
||||
{ value: 24 * 7, label: '近 7 天' },
|
||||
@@ -49,6 +48,7 @@ const OrgDsHitLogs = ({ orgId }) => {
|
||||
const [windowHours, setWindowHours] = useState(24);
|
||||
const [logs, setLogs] = useState([]);
|
||||
const [page, setPage] = useState(1);
|
||||
const [pageSize, setPageSize] = useState(20);
|
||||
const [total, setTotal] = useState(0);
|
||||
const [onlySensitive, setOnlySensitive] = useState(false);
|
||||
const [loading, setLoading] = useState(true);
|
||||
@@ -94,7 +94,7 @@ const OrgDsHitLogs = ({ orgId }) => {
|
||||
setLoadError(false);
|
||||
try {
|
||||
const res = await API.get(
|
||||
`/api/org/data-security/logs?page=${p}&page_size=${PAGE_SIZE}&only_sensitive=${sensitiveOnly}`,
|
||||
`/api/org/data-security/logs?page=${p}&page_size=${pageSize}&only_sensitive=${sensitiveOnly}`,
|
||||
{ headers },
|
||||
);
|
||||
if (seq !== logsSeqRef.current) return;
|
||||
@@ -114,7 +114,7 @@ const OrgDsHitLogs = ({ orgId }) => {
|
||||
if (seq === logsSeqRef.current) setLoading(false);
|
||||
}
|
||||
},
|
||||
[headers, t],
|
||||
[headers, t, pageSize],
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
@@ -261,9 +261,13 @@ const OrgDsHitLogs = ({ orgId }) => {
|
||||
}
|
||||
pagination={{
|
||||
currentPage: page,
|
||||
pageSize: PAGE_SIZE,
|
||||
pageSize,
|
||||
total,
|
||||
onPageChange: (p) => fetchLogs(p, onlySensitive),
|
||||
onPageSizeChange: (size) => {
|
||||
setPage(1);
|
||||
setPageSize(size);
|
||||
},
|
||||
}}
|
||||
/>
|
||||
</Spin>
|
||||
|
||||
@@ -17,19 +17,11 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
import React, { useCallback, useContext, useEffect, useState } from 'react';
|
||||
import {
|
||||
Banner,
|
||||
Button,
|
||||
Card,
|
||||
Form,
|
||||
Spin,
|
||||
Typography,
|
||||
} from '@/components/ui';
|
||||
import { Banner, Button, Card, Form, Spin, Typography } from '@/components/ui';
|
||||
import {
|
||||
AlertTriangle,
|
||||
BadgePercent,
|
||||
Clock,
|
||||
Handshake,
|
||||
ShieldCheck,
|
||||
Users,
|
||||
XCircle,
|
||||
@@ -118,21 +110,7 @@ export default function PartnerConsole() {
|
||||
|
||||
return (
|
||||
// mt-[60px]:顶栏 fixed 定位需自行让位(跑马灯由 PageLayout 占位补偿)
|
||||
<div className='mt-[60px] px-2 pb-6'>
|
||||
<div className='flex items-center gap-3 mb-4'>
|
||||
<div className='p-2.5 bg-gradient-to-br from-brand-from to-brand-to rounded-xl shadow-lg text-white flex-shrink-0'>
|
||||
<Handshake size={22} />
|
||||
</div>
|
||||
<div>
|
||||
<Title heading={4} style={{ margin: 0 }}>
|
||||
{t('合作伙伴')}
|
||||
</Title>
|
||||
<Text type='tertiary' size='small'>
|
||||
{t('直接推广分佣 · 间接推广分佣 · 客户报备')}
|
||||
</Text>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className='console-content'>
|
||||
{portalClosed && (
|
||||
<Card className='!rounded-2xl shadow-sm' bodyStyle={{ padding: 40 }}>
|
||||
<div className='flex flex-col items-center text-center gap-3 max-w-md mx-auto'>
|
||||
|
||||
@@ -161,6 +161,7 @@ const PartnerCodeChip = ({ code, t }) => (
|
||||
type='button'
|
||||
onClick={async () => {
|
||||
if (await copy(code)) showSuccess(t('伙伴编号已复制'));
|
||||
else showError(t('复制失败,请手动复制'));
|
||||
}}
|
||||
className='flex items-center gap-1.5 px-2.5 py-1 rounded-md bg-brand/10 text-brand-deep hover:bg-brand/20 transition-colors text-xs font-mono font-semibold cursor-pointer border-none'
|
||||
title={t('点击复制')}
|
||||
@@ -361,6 +362,7 @@ function Overview({ dashboard, t, onGoto }) {
|
||||
|
||||
function Leads({ t, readOnly, canSubmit }) {
|
||||
const [rows, setRows] = useState([]);
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [total, setTotal] = useState(0);
|
||||
const [page, setPage] = useState(1);
|
||||
const [showSubmit, setShowSubmit] = useState(false);
|
||||
@@ -368,11 +370,20 @@ function Leads({ t, readOnly, canSubmit }) {
|
||||
const [extendTarget, setExtendTarget] = useState(null);
|
||||
|
||||
const load = useCallback(async (p = 1) => {
|
||||
const res = await API.get(`/api/partner/leads?p=${p - 1}`);
|
||||
if (res.data.success) {
|
||||
setRows(res.data.data.items || []);
|
||||
setTotal(res.data.data.total || 0);
|
||||
setPage(p);
|
||||
setLoading(true);
|
||||
try {
|
||||
const res = await API.get(`/api/partner/leads?p=${p - 1}`);
|
||||
if (res.data.success) {
|
||||
setRows(res.data.data.items || []);
|
||||
setTotal(res.data.data.total || 0);
|
||||
setPage(p);
|
||||
} else {
|
||||
showError(res.data.message);
|
||||
}
|
||||
} catch (err) {
|
||||
showError(err.message);
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
}, []);
|
||||
|
||||
@@ -476,6 +487,7 @@ function Leads({ t, readOnly, canSubmit }) {
|
||||
<Table
|
||||
columns={columns}
|
||||
dataSource={rows}
|
||||
loading={loading}
|
||||
rowKey='id'
|
||||
scroll={{ x: 'max-content' }}
|
||||
empty={
|
||||
@@ -608,16 +620,26 @@ function Leads({ t, readOnly, canSubmit }) {
|
||||
|
||||
function Customers({ t, readOnly }) {
|
||||
const [rows, setRows] = useState([]);
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [total, setTotal] = useState(0);
|
||||
const [page, setPage] = useState(1);
|
||||
const [serviceTarget, setServiceTarget] = useState(null);
|
||||
|
||||
const load = useCallback(async (p = 1) => {
|
||||
const res = await API.get(`/api/partner/customers?p=${p - 1}`);
|
||||
if (res.data.success) {
|
||||
setRows(res.data.data.items || []);
|
||||
setTotal(res.data.data.total || 0);
|
||||
setPage(p);
|
||||
setLoading(true);
|
||||
try {
|
||||
const res = await API.get(`/api/partner/customers?p=${p - 1}`);
|
||||
if (res.data.success) {
|
||||
setRows(res.data.data.items || []);
|
||||
setTotal(res.data.data.total || 0);
|
||||
setPage(p);
|
||||
} else {
|
||||
showError(res.data.message);
|
||||
}
|
||||
} catch (err) {
|
||||
showError(err.message);
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
}, []);
|
||||
|
||||
@@ -700,6 +722,7 @@ function Customers({ t, readOnly }) {
|
||||
<Table
|
||||
columns={columns}
|
||||
dataSource={rows}
|
||||
loading={loading}
|
||||
rowKey='id'
|
||||
scroll={{ x: 'max-content' }}
|
||||
empty={<Empty description={t('暂无归属客户')} />}
|
||||
|
||||
@@ -589,12 +589,10 @@ const Playground = ({ isExperienceMode = false }) => {
|
||||
|
||||
let messages = [...message];
|
||||
|
||||
if (
|
||||
!(
|
||||
messages.length === 0 ||
|
||||
messages.every((msg) => msg.role !== MESSAGE_ROLES.USER)
|
||||
)
|
||||
) {
|
||||
if (!(
|
||||
messages.length === 0 ||
|
||||
messages.every((msg) => msg.role !== MESSAGE_ROLES.USER)
|
||||
)) {
|
||||
for (let i = messages.length - 1; i >= 0; i--) {
|
||||
if (messages[i].role === MESSAGE_ROLES.USER) {
|
||||
if (inputs.imageEnabled && inputs.imageUrls) {
|
||||
@@ -1561,9 +1559,7 @@ const Playground = ({ isExperienceMode = false }) => {
|
||||
)}
|
||||
|
||||
<Layout.Content className='relative flex-1 overflow-hidden min-h-0'>
|
||||
<div
|
||||
className={`overflow-hidden flex flex-col lg:flex-row ${isExperienceMode ? 'h-full' : 'h-[calc(100vh-66px)] mt-[60px]'}`}
|
||||
>
|
||||
<div className='overflow-hidden flex flex-col lg:flex-row h-full'>
|
||||
<div
|
||||
ref={chatAreaWrapperRef}
|
||||
className='flex-1 flex flex-col min-h-0 overflow-hidden'
|
||||
|
||||
@@ -18,7 +18,7 @@ For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import React, { useState, useEffect, useMemo } from 'react';
|
||||
import { Empty as AntEmpty, Tag as AntTag } from 'antd';
|
||||
import { Button as AntButton, Empty as AntEmpty, Tag as AntTag } from 'antd';
|
||||
import {
|
||||
Typography,
|
||||
Input,
|
||||
@@ -129,7 +129,7 @@ const HistoryPanel = ({ t, refreshTrigger }) => {
|
||||
width: 240,
|
||||
render: (text) => (
|
||||
<Text
|
||||
copyable={{ content: text }}
|
||||
copyable={{ text: text }}
|
||||
className='rc-history-mono'
|
||||
ellipsis={{ showTooltip: true }}
|
||||
>
|
||||
@@ -177,13 +177,14 @@ const HistoryPanel = ({ t, refreshTrigger }) => {
|
||||
render: (_, record) => {
|
||||
if (record.status !== 'pending') return null;
|
||||
return (
|
||||
<Button
|
||||
<AntButton
|
||||
size='small'
|
||||
theme='outline'
|
||||
type='link'
|
||||
className='rc-history-complete-action'
|
||||
onClick={() => confirmAdminComplete(record.trade_no)}
|
||||
>
|
||||
{t('补单')}
|
||||
</Button>
|
||||
</AntButton>
|
||||
);
|
||||
},
|
||||
});
|
||||
|
||||
@@ -17,17 +17,12 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import React, {
|
||||
useEffect,
|
||||
useLayoutEffect,
|
||||
useRef,
|
||||
useState,
|
||||
useContext,
|
||||
} from 'react';
|
||||
import React, { useEffect, useState, useContext } from 'react';
|
||||
import { useLocation } from 'react-router-dom';
|
||||
import { Segmented, Tabs } from 'antd';
|
||||
import { Modal, Toast } from '@/components/ui';
|
||||
import UserCenterPageHeader from '../../components/common/UserCenterPageHeader';
|
||||
import { useConsolePage } from '../../components/console/ConsoleContext';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { UserContext } from '../../context/User';
|
||||
import { StatusContext } from '../../context/Status';
|
||||
@@ -60,51 +55,10 @@ import {
|
||||
} from '../../helpers/paypalPayment';
|
||||
|
||||
const Recharge = ({ embedded = false }) => {
|
||||
const consolePage = useConsolePage();
|
||||
const { t } = useTranslation();
|
||||
const { pathname } = useLocation();
|
||||
const alignStandaloneContent = !embedded && pathname === '/recharge';
|
||||
const contentRef = useRef(null);
|
||||
|
||||
useLayoutEffect(() => {
|
||||
if (!alignStandaloneContent) return undefined;
|
||||
const content = contentRef.current;
|
||||
const topbar = document.querySelector('.ui-topbar');
|
||||
if (!content || !topbar) return undefined;
|
||||
|
||||
const resizeObserver = new ResizeObserver(() => alignContent());
|
||||
const alignContent = () => {
|
||||
const label = topbar.querySelector(
|
||||
'.ui-header-navigation a[href="/market"] > span',
|
||||
);
|
||||
if (window.innerWidth > 768 && label?.getClientRects().length) {
|
||||
const inset = Math.max(
|
||||
16,
|
||||
label.getBoundingClientRect().left -
|
||||
content.getBoundingClientRect().left,
|
||||
);
|
||||
content.style.setProperty('--rc-content-inset', `${inset}px`);
|
||||
} else {
|
||||
content.style.removeProperty('--rc-content-inset');
|
||||
}
|
||||
if (label) resizeObserver.observe(label);
|
||||
const brand = topbar.querySelector('.ui-header-brand');
|
||||
if (brand) resizeObserver.observe(brand);
|
||||
};
|
||||
|
||||
// The navigation may finish loading or change language after this page mounts.
|
||||
const mutationObserver = new MutationObserver(alignContent);
|
||||
mutationObserver.observe(topbar, { childList: true, subtree: true });
|
||||
resizeObserver.observe(topbar);
|
||||
resizeObserver.observe(content);
|
||||
window.addEventListener('resize', alignContent);
|
||||
alignContent();
|
||||
return () => {
|
||||
resizeObserver.disconnect();
|
||||
mutationObserver.disconnect();
|
||||
window.removeEventListener('resize', alignContent);
|
||||
content.style.removeProperty('--rc-content-inset');
|
||||
};
|
||||
}, [alignStandaloneContent]);
|
||||
const [userState, userDispatch] = useContext(UserContext);
|
||||
const [statusState] = useContext(StatusContext);
|
||||
|
||||
@@ -779,12 +733,12 @@ const Recharge = ({ embedded = false }) => {
|
||||
|
||||
return (
|
||||
<div
|
||||
className={`ui-recharge-page ${alignStandaloneContent ? 'rc-standalone' : ''} relative w-full min-h-screen pt-[64px] ${embedded ? '' : 'bg-[var(--surface-bg-base)]'}`}
|
||||
className={`ui-recharge-page ${consolePage ? 'console-recharge' : `${alignStandaloneContent ? 'rc-standalone' : ''} relative w-full min-h-screen pt-[64px] ${embedded ? '' : 'bg-[var(--surface-bg-base)]'}`}`}
|
||||
>
|
||||
{/* 统一页面背景层 —— 走 bg-glow-* 主题变量。
|
||||
* embedded(嵌入 UserCenter/topup)时由父 shell 提供背景,此处跳过避免双层叠加;
|
||||
* 独立路由(/recharge、/console/topup)时自渲染 rich 背景 + 网格。 */}
|
||||
{!embedded && <PageBackground variant='rich' grid />}
|
||||
{!embedded && !consolePage && <PageBackground variant='rich' grid />}
|
||||
|
||||
{/* 支付确认弹窗 */}
|
||||
<PaymentConfirmModal
|
||||
@@ -851,13 +805,18 @@ const Recharge = ({ embedded = false }) => {
|
||||
|
||||
{/* 主内容区 */}
|
||||
<div
|
||||
ref={contentRef}
|
||||
className='ui-recharge-content uc-page relative z-10 max-w-7xl mx-auto'
|
||||
className={
|
||||
consolePage
|
||||
? 'ui-recharge-content console-content'
|
||||
: 'ui-recharge-content uc-page relative z-10 max-w-7xl mx-auto'
|
||||
}
|
||||
>
|
||||
<UserCenterPageHeader
|
||||
title={t('在线充值')}
|
||||
subtitle={t('管理账户余额,让每一次模型调用从容开始。')}
|
||||
/>
|
||||
{!consolePage && (
|
||||
<UserCenterPageHeader
|
||||
title={t('在线充值')}
|
||||
subtitle={t('管理账户余额,让每一次模型调用从容开始。')}
|
||||
/>
|
||||
)}
|
||||
<div className='rc-layout'>
|
||||
<WalletCard
|
||||
t={t}
|
||||
|
||||
@@ -43,10 +43,18 @@
|
||||
--rc-empty-bg: #f7f9fb;
|
||||
--rc-empty-border: #e3e9f0;
|
||||
}
|
||||
.ui-recharge-page.rc-standalone {
|
||||
padding-top: calc(
|
||||
var(--console-header-offset, 72px) - var(--content-top-offset, 0px)
|
||||
);
|
||||
}
|
||||
.ui-recharge-page.rc-standalone .ui-recharge-content {
|
||||
max-width: none;
|
||||
margin-inline: 0;
|
||||
padding-inline: var(--rc-content-inset, var(--uc-page-pad-x, 36px));
|
||||
padding-inline-start: calc(
|
||||
var(--sidebar-current-width, 216px) + var(--uc-page-pad-x, 36px)
|
||||
);
|
||||
padding-inline-end: var(--uc-page-pad-x, 36px);
|
||||
}
|
||||
@media (max-width: 768px) {
|
||||
.ui-recharge-page.rc-standalone .ui-recharge-content {
|
||||
@@ -800,6 +808,11 @@ html.dark .ui-recharge-page {
|
||||
.rc-history-table .ant-tag {
|
||||
margin-inline-end: 0;
|
||||
}
|
||||
.rc-history-complete-action.ant-btn {
|
||||
height: auto;
|
||||
padding: 0 4px;
|
||||
font-size: 13px;
|
||||
}
|
||||
.rc-history-money {
|
||||
color: var(--rc-amount);
|
||||
font-weight: 600;
|
||||
|
||||
@@ -22,7 +22,7 @@ import RedemptionsTable from '../../components/table/redemptions';
|
||||
|
||||
const Redemption = () => {
|
||||
return (
|
||||
<div className='mt-[60px] px-2'>
|
||||
<div className='console-content'>
|
||||
<RedemptionsTable />
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -203,7 +203,7 @@ const AmountOptionsManager = ({
|
||||
};
|
||||
|
||||
return (
|
||||
<div style={{ padding: '20px' }}>
|
||||
<div>
|
||||
<Card>
|
||||
<div
|
||||
style={{
|
||||
|
||||
@@ -394,8 +394,11 @@ export default function SettingImagePricing({ options, refresh }) {
|
||||
</div>
|
||||
<Table
|
||||
columns={columns}
|
||||
dataSource={configs}
|
||||
rowKey={(record, index) => `${record.model_name}-${index}`}
|
||||
dataSource={configs.map((record, index) => ({
|
||||
...record,
|
||||
key: `${record.model_name}-${index}`,
|
||||
}))}
|
||||
rowKey='key'
|
||||
pagination={false}
|
||||
empty={t('暂无图片分档计费配置')}
|
||||
/>
|
||||
|
||||
@@ -35,11 +35,7 @@ import {
|
||||
Typography,
|
||||
} from '@/components/ui';
|
||||
import { IconPlus, IconDelete, IconEdit } from '@/components/ui/icons';
|
||||
import {
|
||||
API,
|
||||
showError,
|
||||
showSuccess,
|
||||
} from '../../../helpers';
|
||||
import { API, showError, showSuccess } from '../../../helpers';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
// 视频相关的渠道类型
|
||||
@@ -306,7 +302,10 @@ export default function SettingVideoModel(props) {
|
||||
model_name: values.model_name,
|
||||
tier_param: values.tier_param || 'resolution',
|
||||
default_tier: defaultTier,
|
||||
default_duration: Math.max(0, parseInt(values.default_duration, 10) || 0),
|
||||
default_duration: Math.max(
|
||||
0,
|
||||
parseInt(values.default_duration, 10) || 0,
|
||||
),
|
||||
enabled: values.enabled !== false,
|
||||
tiers,
|
||||
};
|
||||
@@ -563,8 +562,11 @@ export default function SettingVideoModel(props) {
|
||||
<Col span={24}>
|
||||
<Table
|
||||
columns={columns}
|
||||
dataSource={models}
|
||||
rowKey={(record, index) => index}
|
||||
dataSource={models.map((record, index) => ({
|
||||
...record,
|
||||
key: index,
|
||||
}))}
|
||||
rowKey='key'
|
||||
pagination={false}
|
||||
empty={t('暂无自定义视频模型')}
|
||||
/>
|
||||
@@ -619,8 +621,11 @@ export default function SettingVideoModel(props) {
|
||||
<Col span={24}>
|
||||
<Table
|
||||
columns={pricingColumns}
|
||||
dataSource={pricingConfigs}
|
||||
rowKey={(record, index) => index}
|
||||
dataSource={pricingConfigs.map((record, index) => ({
|
||||
...record,
|
||||
key: index,
|
||||
}))}
|
||||
rowKey='key'
|
||||
pagination={false}
|
||||
empty={t('暂无按秒分档定价配置')}
|
||||
/>
|
||||
@@ -729,9 +734,7 @@ export default function SettingVideoModel(props) {
|
||||
</Modal>
|
||||
|
||||
<Modal
|
||||
title={
|
||||
editingPricingIndex >= 0 ? t('编辑定价配置') : t('添加定价配置')
|
||||
}
|
||||
title={editingPricingIndex >= 0 ? t('编辑定价配置') : t('添加定价配置')}
|
||||
visible={pricingModalVisible}
|
||||
onOk={handlePricingModalOk}
|
||||
onCancel={() => setPricingModalVisible(false)}
|
||||
@@ -754,7 +757,9 @@ export default function SettingVideoModel(props) {
|
||||
label={t('模型名称')}
|
||||
placeholder={t('请输入模型名称,如 kling-v2-master')}
|
||||
rules={[{ required: true, message: t('请输入模型名称') }]}
|
||||
extraText={t('支持前缀匹配,例如填 kling 可匹配所有 kling 开头模型')}
|
||||
extraText={t(
|
||||
'支持前缀匹配,例如填 kling 可匹配所有 kling 开头模型',
|
||||
)}
|
||||
/>
|
||||
<Form.Select
|
||||
field='tier_param'
|
||||
@@ -873,9 +878,7 @@ export default function SettingVideoModel(props) {
|
||||
step={0.01}
|
||||
style={{ width: '100%' }}
|
||||
value={row.price_per_second}
|
||||
onChange={(v) =>
|
||||
updateTierRow(idx, { price_per_second: v })
|
||||
}
|
||||
onChange={(v) => updateTierRow(idx, { price_per_second: v })}
|
||||
/>
|
||||
</Col>
|
||||
<Col span={7}>
|
||||
|
||||
@@ -41,7 +41,6 @@ const { Text } = Typography;
|
||||
|
||||
const authConfigModules = [
|
||||
'experienceCenter',
|
||||
'keyManagement',
|
||||
'userCenter',
|
||||
'pricing',
|
||||
'skillMarket',
|
||||
@@ -51,7 +50,6 @@ const authConfigModules = [
|
||||
const createDefaultHeaderNavModules = () => ({
|
||||
home: { enabled: true, groups: [] },
|
||||
experienceCenter: { enabled: true, requireAuth: false, groups: [] },
|
||||
keyManagement: { enabled: true, requireAuth: false, groups: [] },
|
||||
userCenter: { enabled: true, requireAuth: false, groups: [] },
|
||||
console: { enabled: true, groups: [] },
|
||||
pricing: { enabled: true, requireAuth: false, groups: [] },
|
||||
@@ -311,12 +309,6 @@ export default function SettingsHeaderNavModules(props) {
|
||||
description: t('AI模型体验,快速测试模型能力'),
|
||||
hasSubConfig: true,
|
||||
},
|
||||
{
|
||||
key: 'keyManagement',
|
||||
title: t('密钥管理'),
|
||||
description: t('API密钥管理与配置'),
|
||||
hasSubConfig: true,
|
||||
},
|
||||
{
|
||||
key: 'userCenter',
|
||||
title: t('用户中心'),
|
||||
|
||||
@@ -45,7 +45,6 @@ const OPTION_KEY = 'HeaderNavModulesOrgUser';
|
||||
const moduleKeys = [
|
||||
'home',
|
||||
'experienceCenter',
|
||||
'keyManagement',
|
||||
'userCenter',
|
||||
'console',
|
||||
'pricing',
|
||||
@@ -85,7 +84,6 @@ export default function SettingsOrgUserNavModules(props) {
|
||||
// 避免"打开对应开关并保存"的承诺对这些项不成立。
|
||||
const moduleConfigs = [
|
||||
{ key: 'experienceCenter', title: t('体验中心') },
|
||||
{ key: 'keyManagement', title: t('密钥管理') },
|
||||
{ key: 'userCenter', title: t('用户中心') },
|
||||
{ key: 'pricing', title: t('模型广场') },
|
||||
// 技能超市是企业员工基线里唯一默认开启的 C 端入口(方案决策点 3):
|
||||
|
||||
@@ -49,7 +49,6 @@ import { mergePayPalFeePolicyFormValues } from '../../../helpers/paypalPayment';
|
||||
|
||||
const { Text } = Typography;
|
||||
const SECRET_PLACEHOLDER = '***ALREADY_SET***';
|
||||
const PAYPAL_OPERATIONS_PAGE_SIZE = 20;
|
||||
|
||||
function normalizePayPalOperations(data) {
|
||||
if (!data || typeof data !== 'object' || Array.isArray(data)) {
|
||||
@@ -88,9 +87,15 @@ export default function SettingsPaymentGatewayPayPal(props) {
|
||||
const [fxStatus, setFxStatus] = useState(null);
|
||||
const [feePolicy, setFeePolicy] = useState(null);
|
||||
const [feeAudits, setFeeAudits] = useState([]);
|
||||
const [feeAuditLoading, setFeeAuditLoading] = useState(false);
|
||||
const feeAuditSizeRef = useRef(20);
|
||||
const [feeAuditPageSize, setFeeAuditPageSize] = useState(20);
|
||||
const [feeAuditPage, setFeeAuditPage] = useState(1);
|
||||
const [feeAuditTotal, setFeeAuditTotal] = useState(0);
|
||||
const [operations, setOperations] = useState(null);
|
||||
const [operationsLoading, setOperationsLoading] = useState(false);
|
||||
const operationsSizeRef = useRef(20);
|
||||
const [operationsPageSize, setOperationsPageSize] = useState(20);
|
||||
const [operationsPage, setOperationsPage] = useState(1);
|
||||
const [selectedOperationOrderKeys, setSelectedOperationOrderKeys] = useState(
|
||||
[],
|
||||
@@ -170,11 +175,12 @@ export default function SettingsPaymentGatewayPayPal(props) {
|
||||
const refreshFeePolicy = useCallback(
|
||||
async (page = 1, preserveDraft = false) => {
|
||||
if (!isRoot()) return;
|
||||
setFeeAuditLoading(true);
|
||||
try {
|
||||
const [policyResponse, auditResponse] = await Promise.all([
|
||||
API.get('/api/option/paypal/fee-policy'),
|
||||
API.get(
|
||||
`/api/option/paypal/fee-policy/audits?p=${page}&page_size=20`,
|
||||
`/api/option/paypal/fee-policy/audits?p=${page}&page_size=${feeAuditSizeRef.current}`,
|
||||
),
|
||||
]);
|
||||
if (policyResponse.data.success) {
|
||||
@@ -199,9 +205,13 @@ export default function SettingsPaymentGatewayPayPal(props) {
|
||||
setFeeAudits(auditData?.items || []);
|
||||
setFeeAuditPage(page);
|
||||
setFeeAuditTotal(Number(auditData?.total || 0));
|
||||
} else {
|
||||
showError(auditResponse.data.message || t('获取手续费策略失败'));
|
||||
}
|
||||
} catch (error) {
|
||||
showError(error?.response?.data?.message || t('获取手续费策略失败'));
|
||||
} finally {
|
||||
setFeeAuditLoading(false);
|
||||
}
|
||||
},
|
||||
[t],
|
||||
@@ -214,18 +224,23 @@ export default function SettingsPaymentGatewayPayPal(props) {
|
||||
const refreshOperations = useCallback(
|
||||
async (page = 1) => {
|
||||
if (!isRoot()) return;
|
||||
setOperationsLoading(true);
|
||||
try {
|
||||
const response = await API.get(
|
||||
`/api/option/paypal/operations/preflight?p=${page}&page_size=${PAYPAL_OPERATIONS_PAGE_SIZE}`,
|
||||
`/api/option/paypal/operations/preflight?p=${page}&page_size=${operationsSizeRef.current}`,
|
||||
);
|
||||
if (response?.data?.success) {
|
||||
setOperations(normalizePayPalOperations(response.data.data));
|
||||
setOperationsPage(page);
|
||||
} else {
|
||||
showError(response.data.message || t('获取 PayPal 订单预检信息失败'));
|
||||
}
|
||||
} catch (error) {
|
||||
showError(
|
||||
error?.response?.data?.message || t('获取 PayPal 订单预检信息失败'),
|
||||
);
|
||||
} finally {
|
||||
setOperationsLoading(false);
|
||||
}
|
||||
},
|
||||
[t],
|
||||
@@ -696,12 +711,18 @@ export default function SettingsPaymentGatewayPayPal(props) {
|
||||
size='small'
|
||||
pagination={{
|
||||
currentPage: feeAuditPage,
|
||||
pageSize: 20,
|
||||
pageSize: feeAuditPageSize,
|
||||
total: feeAuditTotal,
|
||||
showTotal: (total) => t('共 {{total}} 条', { total }),
|
||||
onPageChange: (page) => refreshFeePolicy(page, true),
|
||||
onPageSizeChange: (size) => {
|
||||
feeAuditSizeRef.current = size;
|
||||
setFeeAuditPageSize(size);
|
||||
refreshFeePolicy(1, true);
|
||||
},
|
||||
}}
|
||||
dataSource={feeAudits}
|
||||
loading={feeAuditLoading}
|
||||
rowKey='id'
|
||||
style={{ marginTop: 16 }}
|
||||
columns={feeAuditColumns}
|
||||
@@ -769,14 +790,21 @@ export default function SettingsPaymentGatewayPayPal(props) {
|
||||
size='small'
|
||||
rowKey='trade_no'
|
||||
dataSource={pendingOrders}
|
||||
loading={operationsLoading}
|
||||
rowSelection={{
|
||||
selectedRowKeys: selectedOperationOrderKeys,
|
||||
onChange: (keys) =>
|
||||
setSelectedOperationOrderKeys(keys.map(String)),
|
||||
}}
|
||||
pagination={{
|
||||
onPageSizeChange: (size) => {
|
||||
operationsSizeRef.current = size;
|
||||
setOperationsPageSize(size);
|
||||
setSelectedOperationOrderKeys([]);
|
||||
refreshOperations(1);
|
||||
},
|
||||
currentPage: operationsPage,
|
||||
pageSize: PAYPAL_OPERATIONS_PAGE_SIZE,
|
||||
pageSize: operationsPageSize,
|
||||
total: Number(operations?.pending_count || 0),
|
||||
showTotal: (total) => t('共 {{total}} 条', { total }),
|
||||
onPageChange: (page) => {
|
||||
|
||||
@@ -1200,7 +1200,7 @@ export default function ModelCostSettings() {
|
||||
sorter: (a, b) => a.model_name.localeCompare(b.model_name),
|
||||
render: (text, row) => (
|
||||
<div className='flex flex-col gap-1'>
|
||||
<Text copyable={{ content: text }} strong className='!text-[13px]'>
|
||||
<Text copyable={{ text: text }} strong className='!text-[13px]'>
|
||||
{text}
|
||||
</Text>
|
||||
<div className='flex flex-wrap gap-1'>
|
||||
|
||||
@@ -919,7 +919,7 @@ export default function ModelOfficialPriceSettings(props) {
|
||||
render: (text, record) => (
|
||||
<div className='flex flex-col gap-1'>
|
||||
<Typography.Text
|
||||
copyable={{ content: text }}
|
||||
copyable={{ text: text }}
|
||||
strong
|
||||
className='!text-[13px]'
|
||||
>
|
||||
@@ -1140,7 +1140,6 @@ export default function ModelOfficialPriceSettings(props) {
|
||||
/>
|
||||
<RadioGroup
|
||||
type='button'
|
||||
buttonSize='small'
|
||||
value={fillFilter}
|
||||
onChange={(e) => {
|
||||
setFillFilter(e.target.value);
|
||||
|
||||
@@ -53,7 +53,7 @@ export default function ModelSettingsVisualEditor(props) {
|
||||
const [pricingSubMode, setPricingSubMode] = useState('ratio'); // 'ratio' or 'token-price'
|
||||
const [conflictOnly, setConflictOnly] = useState(false);
|
||||
const formRef = useRef(null);
|
||||
const pageSize = 10;
|
||||
const [pageSize, setPageSize] = useState(10);
|
||||
const _quotaPerUnit = getQuotaPerUnit();
|
||||
|
||||
useEffect(() => {
|
||||
@@ -498,8 +498,12 @@ export default function ModelSettingsVisualEditor(props) {
|
||||
pageSize: pageSize,
|
||||
total: filteredModels.length,
|
||||
onPageChange: (page) => setCurrentPage(page),
|
||||
onPageSizeChange: (size) => {
|
||||
setPageSize(size);
|
||||
setCurrentPage(1);
|
||||
},
|
||||
showTotal: true,
|
||||
showSizeChanger: false,
|
||||
showSizeChanger: true,
|
||||
}}
|
||||
/>
|
||||
</Space>
|
||||
|
||||
@@ -2,14 +2,10 @@
|
||||
.settings-page {
|
||||
--settings-section-gap: 24px;
|
||||
--settings-field-gap: 24px;
|
||||
margin-top: 60px;
|
||||
padding: 0 max(0px, calc(var(--uc-page-pad-x) - 24px))
|
||||
var(--uc-page-pad-bottom);
|
||||
/* PageLayout top padding (24px) + this page's top margin (60px). */
|
||||
height: calc(100vh - 84px - var(--content-top-offset, 0px));
|
||||
height: calc(100dvh - 84px - var(--content-top-offset, 0px));
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
min-height: 0;
|
||||
overflow-y: auto;
|
||||
overflow-y: visible;
|
||||
overflow-x: hidden;
|
||||
scrollbar-gutter: stable;
|
||||
}
|
||||
@@ -92,6 +88,75 @@
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
/* Reserve one validation line so required-field errors do not shift the grid. */
|
||||
.settings-page .settings-system-form .ant-form-item,
|
||||
.settings-form-dialog .settings-system-form .ant-form-item {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.settings-page .settings-system-form .ant-form-item-control::after,
|
||||
.settings-form-dialog .settings-system-form .ant-form-item-control::after {
|
||||
display: block;
|
||||
height: 22px;
|
||||
margin-top: 2px;
|
||||
content: '';
|
||||
}
|
||||
|
||||
.settings-page
|
||||
.settings-system-form
|
||||
.ant-form-item-control:has(.ant-form-item-explain)::after,
|
||||
.settings-form-dialog
|
||||
.settings-system-form
|
||||
.ant-form-item-control:has(.ant-form-item-explain)::after {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.settings-page .settings-system-form .ant-form-item-explain,
|
||||
.settings-form-dialog .settings-system-form .ant-form-item-explain {
|
||||
min-height: 22px;
|
||||
margin-top: 2px;
|
||||
}
|
||||
|
||||
.settings-form-dialog .ant-form-item-label {
|
||||
padding-bottom: 8px;
|
||||
}
|
||||
|
||||
.settings-page .settings-system-form .grid,
|
||||
.settings-form-dialog .grid {
|
||||
column-gap: 24px;
|
||||
row-gap: 24px;
|
||||
}
|
||||
|
||||
.settings-page
|
||||
.settings-system-form
|
||||
.ant-form-item-control-input-content
|
||||
> :is(.ant-select, .ant-picker, .ant-input-number),
|
||||
.settings-form-dialog
|
||||
.settings-system-form
|
||||
.ant-form-item-control-input-content
|
||||
> :is(.ant-select, .ant-picker, .ant-input-number) {
|
||||
width: 100%;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
.settings-form-dialog :is(.ant-modal-footer, .ant-drawer-footer) .ant-btn {
|
||||
height: 34px;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.settings-form-dialog :is(.ant-modal-footer, .ant-drawer-footer) .lucide {
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
}
|
||||
|
||||
.settings-form-dialog :is(.ant-modal-footer, .ant-drawer-footer) > div {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.settings-page .ant-form-item-extra,
|
||||
.settings-page .ant-form-item-explain {
|
||||
margin-top: 6px;
|
||||
@@ -128,10 +193,7 @@
|
||||
|
||||
@media (max-width: 767px) {
|
||||
.settings-page {
|
||||
padding-inline: max(0px, calc(var(--uc-page-pad-x) - 5px));
|
||||
/* Mobile PageLayout uses 5px top padding. */
|
||||
height: calc(100vh - 65px - var(--content-top-offset, 0px));
|
||||
height: calc(100dvh - 65px - var(--content-top-offset, 0px));
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.settings-page .ant-card-body {
|
||||
|
||||
@@ -103,4 +103,10 @@
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.weyai-settings .weyai-deny-label {
|
||||
display: block;
|
||||
margin-bottom: 8px;
|
||||
line-height: 22px;
|
||||
}
|
||||
|
||||
/* 行内的"点击重试":嵌在提示句里,去掉按钮的内边距与高度,像一个链接 */
|
||||
|
||||
@@ -989,8 +989,23 @@ export default function SettingsWeyAi() {
|
||||
}
|
||||
>
|
||||
<Row gutter={16}>
|
||||
<Col span={24}>
|
||||
<Banner
|
||||
type='info'
|
||||
closeIcon={null}
|
||||
description={
|
||||
limited
|
||||
? t(
|
||||
'命中任意一项即可登录:以个人范围登录看开放分组,以企业范围登录看开放企业或企业开放分组;开放用户 ID 对两种范围都生效',
|
||||
)
|
||||
: t(
|
||||
'所有已登录用户都能使用网页端,黑名单除外。密钥默认分组仍按下面两张卡生效',
|
||||
)
|
||||
}
|
||||
/>
|
||||
</Col>
|
||||
<Col xs={24} md={12} className='mb-3'>
|
||||
<Text className='block mb-1'>{t('黑名单用户 ID')}</Text>
|
||||
<Text className='weyai-deny-label'>{t('黑名单用户 ID')}</Text>
|
||||
<TagInput
|
||||
className='w-full'
|
||||
addOnBlur
|
||||
@@ -1019,21 +1034,6 @@ export default function SettingsWeyAi() {
|
||||
)}
|
||||
</Text>
|
||||
</Col>
|
||||
<Col xs={24} md={12} className='mb-3'>
|
||||
<Banner
|
||||
type='info'
|
||||
closeIcon={null}
|
||||
description={
|
||||
limited
|
||||
? t(
|
||||
'命中任意一项即可登录:以个人范围登录看开放分组,以企业范围登录看开放企业或企业开放分组;开放用户 ID 对两种范围都生效',
|
||||
)
|
||||
: t(
|
||||
'所有已登录用户都能使用网页端,黑名单除外。密钥默认分组仍按下面两张卡生效',
|
||||
)
|
||||
}
|
||||
/>
|
||||
</Col>
|
||||
</Row>
|
||||
</Section>
|
||||
|
||||
|
||||
@@ -317,7 +317,7 @@ const Setting = () => {
|
||||
<Layout.Content>
|
||||
<Tabs
|
||||
className='settings-page-tabs'
|
||||
type='card'
|
||||
type='line'
|
||||
collapsible
|
||||
activeKey={tabActiveKey}
|
||||
onChange={(key) => onChangeTab(key)}
|
||||
|
||||
@@ -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 { ConsolePageActions } from '../../components/console/ConsolePageContainer';
|
||||
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
||||
import {
|
||||
Button,
|
||||
@@ -48,7 +49,7 @@ import {
|
||||
} from '../../components/skill';
|
||||
import './skill-platform.css';
|
||||
|
||||
const { Title, Text, Paragraph } = Typography;
|
||||
const { Text, Paragraph } = Typography;
|
||||
|
||||
const IMPORT_TERMINAL = ['succeeded', 'completed_with_errors', 'failed'];
|
||||
|
||||
@@ -599,42 +600,32 @@ const SkillPlatform = () => {
|
||||
};
|
||||
|
||||
return (
|
||||
<main className='skill-platform-page'>
|
||||
<header className='skill-platform-hero'>
|
||||
<div>
|
||||
<Title heading={2}>{t('平台 Skill 中心')}</Title>
|
||||
<Paragraph>
|
||||
{t(
|
||||
'从固定来源快照到不可变发布版本,让许可证、安全和人工审核都有证据。',
|
||||
)}
|
||||
</Paragraph>
|
||||
</div>
|
||||
<div className='skill-platform-actions'>
|
||||
<Button
|
||||
onClick={() => window.location.assign('/console/expert-platform')}
|
||||
>
|
||||
{t('专家与模型能力')}
|
||||
</Button>
|
||||
<Button icon={<IconRefresh />} onClick={loadSkills}>
|
||||
{t('刷新')}
|
||||
</Button>
|
||||
<Button
|
||||
loading={importingBundled}
|
||||
disabled={pendingImportIds.length > 0}
|
||||
onClick={importBundledPacks}
|
||||
>
|
||||
{t('一键导入内置技能包')}
|
||||
</Button>
|
||||
<Button
|
||||
theme='solid'
|
||||
type='primary'
|
||||
icon={<IconPlus />}
|
||||
onClick={() => setImportVisible(true)}
|
||||
>
|
||||
{t('导入快照')}
|
||||
</Button>
|
||||
</div>
|
||||
</header>
|
||||
<section className='skill-platform-page'>
|
||||
<ConsolePageActions>
|
||||
<Button
|
||||
onClick={() => window.location.assign('/console/expert-platform')}
|
||||
>
|
||||
{t('专家与模型能力')}
|
||||
</Button>
|
||||
<Button icon={<IconRefresh />} onClick={loadSkills}>
|
||||
{t('刷新')}
|
||||
</Button>
|
||||
<Button
|
||||
loading={importingBundled}
|
||||
disabled={pendingImportIds.length > 0}
|
||||
onClick={importBundledPacks}
|
||||
>
|
||||
{t('一键导入内置技能包')}
|
||||
</Button>
|
||||
<Button
|
||||
theme='solid'
|
||||
type='primary'
|
||||
icon={<IconPlus />}
|
||||
onClick={() => setImportVisible(true)}
|
||||
>
|
||||
{t('导入快照')}
|
||||
</Button>
|
||||
</ConsolePageActions>
|
||||
|
||||
<section className='skill-platform-metrics'>
|
||||
{Object.entries(metrics).map(([key, value]) => (
|
||||
@@ -725,7 +716,9 @@ const SkillPlatform = () => {
|
||||
String(option.value || '')
|
||||
.toLowerCase()
|
||||
.includes(needle) ||
|
||||
String(option.label || '').toLowerCase().includes(needle)
|
||||
String(option.label || '')
|
||||
.toLowerCase()
|
||||
.includes(needle)
|
||||
);
|
||||
}}
|
||||
showClear
|
||||
@@ -1114,9 +1107,7 @@ const SkillPlatform = () => {
|
||||
</Modal>
|
||||
|
||||
<Modal
|
||||
title={
|
||||
reviewDecision?.approved ? t('审核结论确认') : t('驳回原因')
|
||||
}
|
||||
title={reviewDecision?.approved ? t('审核结论确认') : t('驳回原因')}
|
||||
visible={!!reviewDecision}
|
||||
// 关闭动画期间 reviewDecision 已为 null,正文会闪成驳回分支——
|
||||
// 该弹窗内容轻量,直接关动画(R29 发现项)。
|
||||
@@ -1344,7 +1335,7 @@ const SkillPlatform = () => {
|
||||
)}
|
||||
</div>
|
||||
</Modal>
|
||||
</main>
|
||||
</section>
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
+136
-128
@@ -16,6 +16,13 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import {
|
||||
ConsoleCard,
|
||||
ConsoleSearchBar,
|
||||
ConsoleSearchActions,
|
||||
} from '../../components/console/ConsolePrimitives';
|
||||
import { ConsolePageActions } from '../../components/console/ConsolePageContainer';
|
||||
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
@@ -52,8 +59,6 @@ import { isAdmin, showError, showSuccess } from '../../helpers';
|
||||
import { renderQuota } from '../../helpers/render';
|
||||
import QuotaInput from '../../components/common/ui/QuotaInput';
|
||||
|
||||
const PAGE_SIZE = 20;
|
||||
|
||||
const statusColorMap = {
|
||||
active: 'green',
|
||||
expired: 'grey',
|
||||
@@ -125,6 +130,7 @@ const Subscription = () => {
|
||||
const [total, setTotal] = useState(0);
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [page, setPage] = useState(1);
|
||||
const [pageSize, setPageSize] = useState(20);
|
||||
|
||||
// 过滤条件
|
||||
const [keyword, setKeyword] = useState('');
|
||||
@@ -172,7 +178,7 @@ const Subscription = () => {
|
||||
const fetchList = useCallback(async () => {
|
||||
setLoading(true);
|
||||
try {
|
||||
const params = { page, page_size: PAGE_SIZE };
|
||||
const params = { page, page_size: pageSize };
|
||||
if (appliedKeyword) params.keyword = appliedKeyword;
|
||||
if (appliedUserId) params.user_id = appliedUserId;
|
||||
if (planTypes.length) params.plan_types = planTypes.join(',');
|
||||
@@ -215,6 +221,7 @@ const Subscription = () => {
|
||||
}
|
||||
}, [
|
||||
page,
|
||||
pageSize,
|
||||
appliedKeyword,
|
||||
appliedUserId,
|
||||
planTypes,
|
||||
@@ -489,116 +496,111 @@ const Subscription = () => {
|
||||
}, [t, admin]);
|
||||
|
||||
return (
|
||||
<div className='mt-[60px] p-4 sm:p-6'>
|
||||
<div className='console-content'>
|
||||
{/* 筛选区 */}
|
||||
<div className='flex flex-wrap items-center gap-2 mb-3'>
|
||||
<div className='flex items-center gap-1.5 mr-2 flex-shrink-0'>
|
||||
<CreditCard size={18} className='text-brand' />
|
||||
<span className='text-base font-bold text-gray-900 dark:text-white'>
|
||||
{t('会员卡管理')}
|
||||
</span>
|
||||
<ConsoleSearchBar formProps={{ layout: 'inline' }}>
|
||||
<div className='console-search-fields'>
|
||||
<Input
|
||||
prefix={<Search size={14} />}
|
||||
placeholder={t('搜索用户名/昵称/订单号')}
|
||||
value={keyword}
|
||||
onChange={setKeyword}
|
||||
onEnterPress={handleSearch}
|
||||
style={{ width: 240 }}
|
||||
/>
|
||||
<InputNumber
|
||||
placeholder={t('用户ID')}
|
||||
value={userId}
|
||||
onChange={setUserId}
|
||||
min={0}
|
||||
style={{ width: 110 }}
|
||||
hideButtons
|
||||
/>
|
||||
<Select
|
||||
placeholder={t('套餐类型')}
|
||||
value={planTypes}
|
||||
onChange={(v) => {
|
||||
setPage(1);
|
||||
setPlanTypes(v || []);
|
||||
}}
|
||||
multiple
|
||||
maxTagCount={2}
|
||||
style={{ width: 160 }}
|
||||
optionList={[
|
||||
{ label: t('周卡'), value: 'weekly' },
|
||||
{ label: t('月卡'), value: 'monthly' },
|
||||
{ label: t('季卡'), value: 'quarterly' },
|
||||
]}
|
||||
/>
|
||||
<Select
|
||||
placeholder={t('档位')}
|
||||
value={tiers}
|
||||
onChange={(v) => {
|
||||
setPage(1);
|
||||
setTiers(v || []);
|
||||
}}
|
||||
multiple
|
||||
maxTagCount={2}
|
||||
style={{ width: 140 }}
|
||||
optionList={[
|
||||
{ label: 'Lite', value: 'lite' },
|
||||
{ label: 'Pro', value: 'pro' },
|
||||
]}
|
||||
/>
|
||||
<Select
|
||||
placeholder={t('状态')}
|
||||
value={statuses}
|
||||
onChange={(v) => {
|
||||
setPage(1);
|
||||
setStatuses(v || []);
|
||||
}}
|
||||
multiple
|
||||
maxTagCount={2}
|
||||
style={{ width: 180 }}
|
||||
optionList={[
|
||||
{ label: t('active'), value: 'active' },
|
||||
{ label: t('expired'), value: 'expired' },
|
||||
{ label: t('canceled'), value: 'canceled' },
|
||||
{ label: t('banned'), value: 'banned' },
|
||||
]}
|
||||
/>
|
||||
<DatePicker
|
||||
type='dateRange'
|
||||
value={endDateRange}
|
||||
onChange={(d) => {
|
||||
setPage(1);
|
||||
setEndDateRange(d || null);
|
||||
}}
|
||||
placeholder={[t('到期开始'), t('到期结束')]}
|
||||
style={{ width: 280 }}
|
||||
density='compact'
|
||||
/>
|
||||
<ConsoleSearchActions
|
||||
onReset={handleReset}
|
||||
onSearch={handleSearch}
|
||||
loading={loading}
|
||||
/>
|
||||
{admin && (
|
||||
<ConsolePageActions>
|
||||
<Button
|
||||
theme='solid'
|
||||
type='primary'
|
||||
icon={<Plus size={14} />}
|
||||
onClick={openCreate}
|
||||
>
|
||||
{t('新建会员')}
|
||||
</Button>
|
||||
<Button
|
||||
type='tertiary'
|
||||
icon={<CreditCard size={14} />}
|
||||
onClick={() => navigate('/console/setting?tab=membership')}
|
||||
>
|
||||
{t('会员管理')}
|
||||
</Button>
|
||||
</ConsolePageActions>
|
||||
)}
|
||||
</div>
|
||||
<Input
|
||||
prefix={<Search size={14} />}
|
||||
placeholder={t('搜索用户名/昵称/订单号')}
|
||||
value={keyword}
|
||||
onChange={setKeyword}
|
||||
onEnterPress={handleSearch}
|
||||
style={{ width: 240 }}
|
||||
/>
|
||||
<InputNumber
|
||||
placeholder={t('用户ID')}
|
||||
value={userId}
|
||||
onChange={setUserId}
|
||||
min={0}
|
||||
style={{ width: 110 }}
|
||||
hideButtons
|
||||
/>
|
||||
<Select
|
||||
placeholder={t('套餐类型')}
|
||||
value={planTypes}
|
||||
onChange={(v) => {
|
||||
setPage(1);
|
||||
setPlanTypes(v || []);
|
||||
}}
|
||||
multiple
|
||||
maxTagCount={2}
|
||||
style={{ width: 160 }}
|
||||
optionList={[
|
||||
{ label: t('周卡'), value: 'weekly' },
|
||||
{ label: t('月卡'), value: 'monthly' },
|
||||
{ label: t('季卡'), value: 'quarterly' },
|
||||
]}
|
||||
/>
|
||||
<Select
|
||||
placeholder={t('档位')}
|
||||
value={tiers}
|
||||
onChange={(v) => {
|
||||
setPage(1);
|
||||
setTiers(v || []);
|
||||
}}
|
||||
multiple
|
||||
maxTagCount={2}
|
||||
style={{ width: 140 }}
|
||||
optionList={[
|
||||
{ label: 'Lite', value: 'lite' },
|
||||
{ label: 'Pro', value: 'pro' },
|
||||
]}
|
||||
/>
|
||||
<Select
|
||||
placeholder={t('状态')}
|
||||
value={statuses}
|
||||
onChange={(v) => {
|
||||
setPage(1);
|
||||
setStatuses(v || []);
|
||||
}}
|
||||
multiple
|
||||
maxTagCount={2}
|
||||
style={{ width: 180 }}
|
||||
optionList={[
|
||||
{ label: t('active'), value: 'active' },
|
||||
{ label: t('expired'), value: 'expired' },
|
||||
{ label: t('canceled'), value: 'canceled' },
|
||||
{ label: t('banned'), value: 'banned' },
|
||||
]}
|
||||
/>
|
||||
<DatePicker
|
||||
type='dateRange'
|
||||
value={endDateRange}
|
||||
onChange={(d) => {
|
||||
setPage(1);
|
||||
setEndDateRange(d || null);
|
||||
}}
|
||||
placeholder={[t('到期开始'), t('到期结束')]}
|
||||
style={{ width: 280 }}
|
||||
density='compact'
|
||||
/>
|
||||
<Button theme='solid' type='primary' onClick={handleSearch}>
|
||||
{t('搜索')}
|
||||
</Button>
|
||||
<Button type='tertiary' onClick={handleReset}>
|
||||
{t('重置')}
|
||||
</Button>
|
||||
{admin && (
|
||||
<>
|
||||
<Button
|
||||
theme='solid'
|
||||
type='primary'
|
||||
icon={<Plus size={14} />}
|
||||
onClick={openCreate}
|
||||
>
|
||||
{t('新建会员')}
|
||||
</Button>
|
||||
<Button
|
||||
type='tertiary'
|
||||
icon={<CreditCard size={14} />}
|
||||
onClick={() => navigate('/console/setting?tab=membership')}
|
||||
>
|
||||
{t('会员管理')}
|
||||
</Button>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
</ConsoleSearchBar>
|
||||
|
||||
{/* 快捷筛选 */}
|
||||
<div className='flex flex-wrap items-center gap-2 mb-4'>
|
||||
@@ -630,23 +632,29 @@ const Subscription = () => {
|
||||
</div>
|
||||
|
||||
{/* 表格 */}
|
||||
<Table
|
||||
columns={columns}
|
||||
dataSource={list}
|
||||
loading={loading}
|
||||
rowKey='id'
|
||||
pagination={{
|
||||
currentPage: page,
|
||||
total,
|
||||
pageSize: PAGE_SIZE,
|
||||
onPageChange: setPage,
|
||||
showTotal: true,
|
||||
showSizeChanger: false,
|
||||
}}
|
||||
scroll={{ x: 1300 }}
|
||||
size='small'
|
||||
empty={t('暂无订阅数据')}
|
||||
/>
|
||||
<ConsoleCard>
|
||||
<Table
|
||||
columns={columns}
|
||||
dataSource={list}
|
||||
loading={loading}
|
||||
rowKey='id'
|
||||
pagination={{
|
||||
currentPage: page,
|
||||
total,
|
||||
pageSize,
|
||||
onPageChange: setPage,
|
||||
onPageSizeChange: (size) => {
|
||||
setPage(1);
|
||||
setPageSize(size);
|
||||
},
|
||||
showTotal: true,
|
||||
showSizeChanger: false,
|
||||
}}
|
||||
scroll={{ x: 1300 }}
|
||||
size='middle'
|
||||
empty={t('暂无订阅数据')}
|
||||
/>
|
||||
</ConsoleCard>
|
||||
|
||||
{/* 封禁弹窗 */}
|
||||
<BanModal
|
||||
|
||||
@@ -21,7 +21,7 @@ import React from 'react';
|
||||
import TaskLogsTable from '../../components/table/task-logs';
|
||||
|
||||
const Task = () => (
|
||||
<div className='mt-[60px] px-2'>
|
||||
<div className='console-content'>
|
||||
<TaskLogsTable />
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -24,7 +24,7 @@ import AdminTokensPage from '../../components/table/admin-tokens';
|
||||
// 由 App.jsx 中的 <AdminRoute> 守卫,普通管理员可访问并编辑
|
||||
const Token = () => {
|
||||
return (
|
||||
<div className='mt-[60px] px-2'>
|
||||
<div className='console-content'>
|
||||
<AdminTokensPage />
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -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 { writeClipboardText } from '../../helpers/clipboard';
|
||||
import React, { useState, useContext, useRef } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { Link, useNavigate, useSearchParams } from 'react-router-dom';
|
||||
@@ -113,7 +114,7 @@ const Tutorial = () => {
|
||||
// 复制代码
|
||||
const copyCode = async (code, index) => {
|
||||
try {
|
||||
await navigator.clipboard.writeText(code);
|
||||
await writeClipboardText(code);
|
||||
setCopiedIndex(index);
|
||||
Toast.success(t('已复制到剪贴板'));
|
||||
setTimeout(() => setCopiedIndex(null), 2000);
|
||||
|
||||
@@ -22,7 +22,7 @@ import UsersTable from '../../components/table/users';
|
||||
|
||||
const User = () => {
|
||||
return (
|
||||
<div className='mt-[60px] px-2'>
|
||||
<div className='console-content'>
|
||||
<UsersTable />
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -192,12 +192,13 @@ const Invite = () => {
|
||||
}, []);
|
||||
|
||||
// 复制邀请链接
|
||||
const handleCopyLink = () => {
|
||||
const handleCopyLink = async () => {
|
||||
if (!affLink) {
|
||||
showError(t('邀请链接获取中,请稍后'));
|
||||
return;
|
||||
}
|
||||
copy(affLink, t('邀请链接'));
|
||||
if (await copy(affLink)) showSuccess(t('邀请链接已复制到剪切板'));
|
||||
else showError(t('复制失败,请手动复制'));
|
||||
};
|
||||
|
||||
// 划转额度
|
||||
@@ -414,14 +415,17 @@ const Invite = () => {
|
||||
className='rounded-[24px] border border-white/70 bg-white/[0.58] p-5 shadow-[0_18px_50px_rgba(15,23,42,0.07)] backdrop-blur-xl dark:border-white/10 dark:bg-white/[0.045]'
|
||||
>
|
||||
<div className='mb-4 flex items-center justify-between'>
|
||||
<span className={`flex h-10 w-10 items-center justify-center rounded-2xl ${item.tone}`}>
|
||||
<span
|
||||
className={`flex h-10 w-10 items-center justify-center rounded-2xl ${item.tone}`}
|
||||
>
|
||||
<Icon size={19} />
|
||||
</span>
|
||||
{item.label === t('\u9080\u8bf7\u4eba\u6570') && stats.rebate_rate > 0 && (
|
||||
<span className='rounded-full bg-amber-50 px-2.5 py-1 text-xs font-semibold text-amber-700 dark:bg-amber-500/[0.10] dark:text-amber-300'>
|
||||
{(stats.rebate_rate * 100).toFixed(0)}%
|
||||
</span>
|
||||
)}
|
||||
{item.label === t('\u9080\u8bf7\u4eba\u6570') &&
|
||||
stats.rebate_rate > 0 && (
|
||||
<span className='rounded-full bg-amber-50 px-2.5 py-1 text-xs font-semibold text-amber-700 dark:bg-amber-500/[0.10] dark:text-amber-300'>
|
||||
{(stats.rebate_rate * 100).toFixed(0)}%
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
<div className='text-2xl font-bold text-gray-950 dark:text-white'>
|
||||
{item.value}
|
||||
@@ -476,7 +480,11 @@ const Invite = () => {
|
||||
<p className='text-sm text-gray-500 dark:text-gray-400'>
|
||||
{stats.inviter_name || t('\u672a\u77e5\u7528\u6237')}
|
||||
<span className='ml-2 text-emerald-600 dark:text-emerald-300'>
|
||||
({t('\u60a8\u7684\u6d88\u8d39\u5c06\u4e3aTA\u5e26\u6765\u8fd4\u4f63\u6536\u76ca')})
|
||||
(
|
||||
{t(
|
||||
'\u60a8\u7684\u6d88\u8d39\u5c06\u4e3aTA\u5e26\u6765\u8fd4\u4f63\u6536\u76ca',
|
||||
)}
|
||||
)
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
@@ -514,7 +522,9 @@ const Invite = () => {
|
||||
{t('\u7ed1\u5b9a\u9080\u8bf7\u4eba')}
|
||||
</h3>
|
||||
<p className='text-sm text-gray-500 dark:text-gray-400'>
|
||||
{t('\u7ed1\u5b9a\u540e\u60a8\u7684\u6d88\u8d39\u5c06\u4e3a\u9080\u8bf7\u4eba\u5e26\u6765\u8fd4\u4f63\u6536\u76ca')}
|
||||
{t(
|
||||
'\u7ed1\u5b9a\u540e\u60a8\u7684\u6d88\u8d39\u5c06\u4e3a\u9080\u8bf7\u4eba\u5e26\u6765\u8fd4\u4f63\u6536\u76ca',
|
||||
)}
|
||||
{remainingDays > 0 && (
|
||||
<span className='ml-2 text-amber-600 dark:text-amber-300'>
|
||||
({t('\u5269\u4f59')} {remainingDays} {t('\u5929')})
|
||||
@@ -617,9 +627,15 @@ const Invite = () => {
|
||||
) : (
|
||||
<div className='grid gap-3 md:grid-cols-3'>
|
||||
{[
|
||||
t('\u9080\u8bf7\u597d\u53cb\u6ce8\u518c\u5e76\u4f7f\u7528\uff0c\u597d\u53cb\u6d88\u8d39\u540e\u60a8\u5c06\u6309\u6bd4\u4f8b\u83b7\u5f97\u8fd4\u4f63\u5956\u52b1'),
|
||||
t('\u8fd4\u4f63\u5956\u52b1\u4f1a\u7d2f\u79ef\u5230\u60a8\u7684\u9080\u8bf7\u989d\u5ea6\u4e2d\uff0c\u53ef\u901a\u8fc7"\u5212\u8f6c\u5230\u4f59\u989d"\u529f\u80fd\u8f6c\u5165\u8d26\u6237\u4f59\u989d\u4f7f\u7528'),
|
||||
t('\u9080\u8bf7\u7684\u597d\u53cb\u8d8a\u591a\u3001\u597d\u53cb\u6d88\u8d39\u8d8a\u591a\uff0c\u60a8\u83b7\u5f97\u7684\u5956\u52b1\u5c31\u8d8a\u591a'),
|
||||
t(
|
||||
'\u9080\u8bf7\u597d\u53cb\u6ce8\u518c\u5e76\u4f7f\u7528\uff0c\u597d\u53cb\u6d88\u8d39\u540e\u60a8\u5c06\u6309\u6bd4\u4f8b\u83b7\u5f97\u8fd4\u4f63\u5956\u52b1',
|
||||
),
|
||||
t(
|
||||
'\u8fd4\u4f63\u5956\u52b1\u4f1a\u7d2f\u79ef\u5230\u60a8\u7684\u9080\u8bf7\u989d\u5ea6\u4e2d\uff0c\u53ef\u901a\u8fc7"\u5212\u8f6c\u5230\u4f59\u989d"\u529f\u80fd\u8f6c\u5165\u8d26\u6237\u4f59\u989d\u4f7f\u7528',
|
||||
),
|
||||
t(
|
||||
'\u9080\u8bf7\u7684\u597d\u53cb\u8d8a\u591a\u3001\u597d\u53cb\u6d88\u8d39\u8d8a\u591a\uff0c\u60a8\u83b7\u5f97\u7684\u5956\u52b1\u5c31\u8d8a\u591a',
|
||||
),
|
||||
].map((item) => (
|
||||
<div
|
||||
key={item}
|
||||
|
||||
@@ -197,6 +197,81 @@ html.dark .usage-record-tabs .ant-tabs-ink-bar {
|
||||
.usage-record-table .ant-tag {
|
||||
margin-inline-end: 0;
|
||||
}
|
||||
/* Consumption table: the two reference images show its left and right edges. */
|
||||
.usage-record-consume-card {
|
||||
--ur-consume-first-time: #8c8c8c;
|
||||
--ur-consume-neutral-bg: #fafafa;
|
||||
}
|
||||
html.dark .usage-record-consume-card {
|
||||
--ur-consume-first-time: var(--text-secondary);
|
||||
--ur-consume-neutral-bg: var(--ui-color-fill-0);
|
||||
}
|
||||
.usage-record-consume-card .usage-record-table-head h3 {
|
||||
font-size: 14px;
|
||||
}
|
||||
.usage-logs-table.usage-record-table .ant-table {
|
||||
color: var(--ur-text);
|
||||
font-size: 14px;
|
||||
line-height: 22px;
|
||||
}
|
||||
.usage-logs-table.usage-record-table
|
||||
.ant-table.ant-table-middle
|
||||
.ant-table-thead
|
||||
> tr
|
||||
> th {
|
||||
padding-block: 0;
|
||||
padding-inline: 8px;
|
||||
background: var(--ur-head-bg);
|
||||
color: var(--ur-head-text);
|
||||
font-size: 14px;
|
||||
}
|
||||
.usage-logs-table.usage-record-table .ant-table-thead > tr > th::before {
|
||||
background: var(--ur-row-split);
|
||||
}
|
||||
.usage-logs-table.usage-record-table .ant-table-tbody > tr > td {
|
||||
height: 66.33px;
|
||||
padding: 12px 8px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.usage-logs-table.usage-record-table .usage-record-time span {
|
||||
color: var(--ur-time-date);
|
||||
}
|
||||
.usage-logs-table.usage-record-table .usage-record-use-time em {
|
||||
color: var(--ur-consume-first-time);
|
||||
}
|
||||
.usage-logs-table.usage-record-table .ant-tag {
|
||||
padding: 0 7px;
|
||||
border-radius: 6px;
|
||||
font-size: 12px;
|
||||
line-height: 20px;
|
||||
}
|
||||
.usage-logs-table.usage-record-table .usage-record-cell-channel .ant-tag,
|
||||
.usage-logs-table.usage-record-table .usage-record-cell-group .ant-tag {
|
||||
border: 0;
|
||||
background: var(--ur-consume-neutral-bg);
|
||||
color: var(--ur-text);
|
||||
}
|
||||
.usage-logs-table.usage-record-table .usage-record-use-time .ant-tag {
|
||||
padding: 0 6px;
|
||||
font-size: 11px;
|
||||
line-height: 18px;
|
||||
}
|
||||
.usage-logs-table.usage-record-table .usage-record-cost {
|
||||
color: var(--ur-cost);
|
||||
}
|
||||
.usage-logs-table.usage-record-table .usage-record-details {
|
||||
margin: 0;
|
||||
overflow: hidden;
|
||||
color: var(--ur-time-date);
|
||||
font-size: 11px;
|
||||
line-height: 20px;
|
||||
}
|
||||
.usage-logs-table.usage-record-table .usage-record-view {
|
||||
height: auto;
|
||||
padding: 0;
|
||||
font-size: 14px;
|
||||
line-height: 20px;
|
||||
}
|
||||
.usage-record-time {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
@@ -225,23 +300,12 @@ html.dark .usage-record-tabs .ant-tabs-ink-bar {
|
||||
.usage-record-copy-text:hover {
|
||||
color: var(--ui-color-primary);
|
||||
}
|
||||
/* 模型:等宽文本(复制与映射弹层沿用原有回调) */
|
||||
.usage-record-model,
|
||||
.usage-record-model .ant-tag {
|
||||
/* 模型名称以纯文本呈现,保留点击复制。 */
|
||||
.usage-record-model {
|
||||
color: var(--ur-model);
|
||||
font-family: var(--ui-font-family-mono);
|
||||
font-size: 12px;
|
||||
}
|
||||
.usage-record-model .ant-tag {
|
||||
padding: 0;
|
||||
border: 0;
|
||||
background: transparent;
|
||||
}
|
||||
.usage-record-model .ant-tag > .anticon,
|
||||
.usage-record-model .ant-tag > img,
|
||||
.usage-record-model .ant-tag > svg {
|
||||
display: none;
|
||||
}
|
||||
.usage-record-mono .ant-typography {
|
||||
color: var(--ur-text);
|
||||
font-family: var(--ui-font-family-mono);
|
||||
@@ -262,7 +326,16 @@ html.dark .usage-record-tabs .ant-tabs-ink-bar {
|
||||
font-weight: 600;
|
||||
}
|
||||
.usage-record-link {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
color: var(--ui-color-primary);
|
||||
white-space: nowrap;
|
||||
}
|
||||
/* 图标与文字同行(全局预设把 svg 设为块级会导致换行) */
|
||||
.usage-record-link svg {
|
||||
display: inline-block;
|
||||
flex: none;
|
||||
}
|
||||
.usage-record-empty-hint {
|
||||
margin-top: 4px;
|
||||
|
||||
@@ -17,7 +17,6 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import { Menu, Button } from 'antd';
|
||||
import React, { useMemo, useContext } from 'react';
|
||||
import { Link, useLocation } from 'react-router-dom';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
@@ -194,27 +193,38 @@ const UserCenterSidebar = () => {
|
||||
className='ui-user-sidebar ui-center-sidebar'
|
||||
data-collapsed={collapsed}
|
||||
>
|
||||
<Menu
|
||||
mode='inline'
|
||||
inlineCollapsed={collapsed}
|
||||
selectedKeys={[selectedKey]}
|
||||
items={items.map((item) => ({
|
||||
key: item.itemKey,
|
||||
icon: <item.icon size={16} strokeWidth={1.5} />,
|
||||
label: <Link to={item.itemKey}>{item.text}</Link>,
|
||||
}))}
|
||||
/>
|
||||
<Button
|
||||
type='text'
|
||||
className='ui-sidebar-collapse'
|
||||
<nav className='ui-center-sidebar-nav'>
|
||||
<div className='ui-org-group-items'>
|
||||
{items.map((item) => {
|
||||
const active = selectedKey === item.itemKey;
|
||||
const Icon = item.icon;
|
||||
return (
|
||||
<Link
|
||||
key={item.itemKey}
|
||||
to={item.itemKey}
|
||||
className='ui-center-menu-item'
|
||||
data-active={active || undefined}
|
||||
aria-current={active ? 'page' : undefined}
|
||||
title={collapsed ? item.text : undefined}
|
||||
>
|
||||
<Icon size={16} strokeWidth={1.5} aria-hidden='true' />
|
||||
{!collapsed && (
|
||||
<span className='ui-center-menu-label'>{item.text}</span>
|
||||
)}
|
||||
</Link>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</nav>
|
||||
<button
|
||||
type='button'
|
||||
className='ui-center-sidebar-collapse'
|
||||
onClick={toggleCollapsed}
|
||||
aria-label={collapsed ? t('展开导航') : t('收起导航')}
|
||||
icon={
|
||||
collapsed ? <ChevronRight size={16} /> : <ChevronLeft size={16} />
|
||||
}
|
||||
>
|
||||
{!collapsed && t('收起导航')}
|
||||
</Button>
|
||||
{collapsed ? <ChevronRight size={16} /> : <ChevronLeft size={16} />}
|
||||
{!collapsed && <span>{t('收起导航')}</span>}
|
||||
</button>
|
||||
</aside>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -89,7 +89,7 @@ export default function ArticleEditor({ initial, insights, onApply, onClose }) {
|
||||
title={initial.id ? '编辑文章' : '新增文章'}
|
||||
width='min(1100px, 100vw)'
|
||||
onCancel={close}
|
||||
maskClosable={false}
|
||||
maskClosable
|
||||
footer={
|
||||
<div className='website-insights-editor-footer'>
|
||||
<div className='flex gap-2'>
|
||||
|
||||
@@ -16,11 +16,13 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
import TableEmpty from '../../components/common/table/TableEmpty';
|
||||
import TableToolbar from '../../components/common/table/TableToolbar';
|
||||
import { ConsoleFilterField } from '../../components/console/ConsoleModuleFilters';
|
||||
import React, { useState } from 'react';
|
||||
import {
|
||||
Button,
|
||||
Card,
|
||||
Empty,
|
||||
Input,
|
||||
Modal,
|
||||
Select,
|
||||
@@ -167,18 +169,19 @@ export default function InsightsPanel({ value, onChange, disabled, error }) {
|
||||
key: 'actions',
|
||||
width: 160,
|
||||
render: (_, item) => (
|
||||
<div className='flex gap-2'>
|
||||
<div className='website-insights-row-actions'>
|
||||
<Button
|
||||
type='tertiary'
|
||||
theme='borderless'
|
||||
type='link'
|
||||
size='small'
|
||||
disabled={disabled}
|
||||
onClick={() => setArticle({ ...item, related: [...item.related] })}
|
||||
>
|
||||
编辑
|
||||
</Button>
|
||||
<Button
|
||||
theme='borderless'
|
||||
type='danger'
|
||||
type='link'
|
||||
size='small'
|
||||
danger
|
||||
disabled={disabled}
|
||||
onClick={() => deleteArticle(item)}
|
||||
>
|
||||
@@ -198,7 +201,11 @@ export default function InsightsPanel({ value, onChange, disabled, error }) {
|
||||
<Card
|
||||
className='website-insights-categories'
|
||||
title={
|
||||
<Typography.Title heading={6} className='truncate' title='内容分类'>
|
||||
<Typography.Title
|
||||
heading={6}
|
||||
className='website-insights-category-heading truncate'
|
||||
title='内容分类'
|
||||
>
|
||||
内容分类
|
||||
</Typography.Title>
|
||||
}
|
||||
@@ -266,43 +273,52 @@ export default function InsightsPanel({ value, onChange, disabled, error }) {
|
||||
</div>
|
||||
</Card>
|
||||
<div className='website-insights-toolbar'>
|
||||
<Input
|
||||
prefix={<IconSearch />}
|
||||
aria-label='搜索文章标题或摘要'
|
||||
placeholder='搜索文章标题或摘要'
|
||||
value={keyword}
|
||||
showClear
|
||||
onEnterPress={(event) => event.preventDefault()}
|
||||
onChange={(text) => {
|
||||
setKeyword(text);
|
||||
}}
|
||||
/>
|
||||
<Select
|
||||
aria-label='筛选文章分类'
|
||||
value={activeCategory}
|
||||
optionList={[
|
||||
{ label: '全部分类', value: 'all' },
|
||||
...value.categories.map((c) => ({ label: c.name, value: c.id })),
|
||||
]}
|
||||
onChange={selectCategory}
|
||||
/>
|
||||
<Button
|
||||
icon={<IconPlus />}
|
||||
theme='solid'
|
||||
disabled={disabled}
|
||||
onClick={() => {
|
||||
setArticle(newArticle(activeCategory));
|
||||
}}
|
||||
>
|
||||
新增文章
|
||||
</Button>
|
||||
<div className='website-insights-search-field'>
|
||||
<ConsoleFilterField label='文章标题'>
|
||||
<Input
|
||||
className='website-insights-search'
|
||||
prefix={<IconSearch />}
|
||||
aria-label='搜索文章标题或摘要'
|
||||
placeholder='搜索文章标题或摘要'
|
||||
value={keyword}
|
||||
showClear
|
||||
onEnterPress={(event) => event.preventDefault()}
|
||||
onChange={(text) => {
|
||||
setKeyword(text);
|
||||
}}
|
||||
/>
|
||||
</ConsoleFilterField>
|
||||
</div>
|
||||
</div>
|
||||
<TableToolbar title='文章列表'>
|
||||
<div className='website-insights-toolbar-actions'>
|
||||
<Select
|
||||
aria-label='筛选文章分类'
|
||||
value={activeCategory}
|
||||
optionList={[
|
||||
{ label: '全部分类', value: 'all' },
|
||||
...value.categories.map((c) => ({ label: c.name, value: c.id })),
|
||||
]}
|
||||
onChange={selectCategory}
|
||||
/>
|
||||
<Button
|
||||
icon={<IconPlus />}
|
||||
theme='solid'
|
||||
disabled={disabled}
|
||||
onClick={() => {
|
||||
setArticle(newArticle(activeCategory));
|
||||
}}
|
||||
>
|
||||
新增文章
|
||||
</Button>
|
||||
</div>
|
||||
</TableToolbar>
|
||||
<CardTable
|
||||
rowKey='id'
|
||||
columns={columns}
|
||||
dataSource={rows}
|
||||
scroll={{ x: 860 }}
|
||||
empty={<Empty description='暂无匹配的文章,请调整筛选条件或新增文章' />}
|
||||
empty={<TableEmpty />}
|
||||
hidePagination
|
||||
/>
|
||||
<Modal
|
||||
|
||||
@@ -29,13 +29,23 @@ export default function WebsiteField({
|
||||
onChange,
|
||||
onBlur,
|
||||
disabled,
|
||||
labelSuffix,
|
||||
children,
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
const field = FIELDS[name];
|
||||
return (
|
||||
<Form.Slot
|
||||
label={{ text: t(field.label), required: true, name: `website-${name}` }}
|
||||
label={{
|
||||
text: (
|
||||
<>
|
||||
{t(field.label)}
|
||||
{labelSuffix}
|
||||
</>
|
||||
),
|
||||
required: true,
|
||||
name: `website-${name}`,
|
||||
}}
|
||||
error={{
|
||||
error: error ? t(error) : undefined,
|
||||
errorMessageId: `website-${name}-error`,
|
||||
|
||||
@@ -1,16 +1,10 @@
|
||||
.website-settings-page {
|
||||
--website-insights-footer-gap: 18px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
box-sizing: border-box;
|
||||
/* Match Settings: 24px layout padding + 8px page padding on each side. */
|
||||
padding-inline: 32px;
|
||||
min-height: calc(100vh - var(--content-top-offset, 0px));
|
||||
min-height: calc(100dvh - var(--content-top-offset, 0px));
|
||||
/* PageLayout already inserts the marquee spacer above this page. */
|
||||
padding-top: calc(
|
||||
var(--app-header-height, 64px) - var(--content-top-offset, 0px) + 20px
|
||||
);
|
||||
padding-bottom: 20px;
|
||||
min-width: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.website-settings-page .website-settings-card {
|
||||
@@ -18,8 +12,43 @@
|
||||
min-height: 100%;
|
||||
}
|
||||
|
||||
.website-settings-page .website-settings-card.ant-card > .ant-card-body {
|
||||
padding-top: 8px;
|
||||
}
|
||||
|
||||
.website-settings-page .website-settings-card--error.ant-card > .ant-card-body {
|
||||
padding-top: 24px;
|
||||
}
|
||||
|
||||
.website-settings-page .website-insights-categories > .ant-card-head,
|
||||
.website-settings-page .website-insights-categories > .ant-card-body {
|
||||
padding-inline: 18px;
|
||||
}
|
||||
|
||||
.website-settings-page .website-insights-category-heading {
|
||||
margin: 0;
|
||||
line-height: 24px;
|
||||
}
|
||||
|
||||
.website-insights {
|
||||
min-width: 0;
|
||||
padding-bottom: var(--website-insights-footer-gap, 18px);
|
||||
}
|
||||
|
||||
.website-insights-row-actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
.website-insights-row-actions .ant-btn {
|
||||
height: auto;
|
||||
padding: 0 4px;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.website-settings-page .website-research-ratio-hint {
|
||||
opacity: 0.9;
|
||||
}
|
||||
|
||||
.website-settings-page .website-settings-tab-description {
|
||||
@@ -100,10 +129,28 @@
|
||||
}
|
||||
|
||||
.website-insights-toolbar {
|
||||
flex-wrap: wrap;
|
||||
flex-wrap: nowrap;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
.website-settings-page .website-insights-search-field {
|
||||
flex: 0 1 310px;
|
||||
width: 310px;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.website-settings-page .website-insights-search {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.website-insights-toolbar-actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-shrink: 0;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.website-insights-article-meta {
|
||||
display: grid;
|
||||
gap: 4px;
|
||||
@@ -195,9 +242,22 @@
|
||||
}
|
||||
|
||||
@media (max-width: 767px) {
|
||||
.website-insights-toolbar {
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.website-settings-page .website-insights-search-field {
|
||||
flex-basis: 100%;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.website-insights-toolbar-actions {
|
||||
justify-content: flex-end;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.website-settings-page {
|
||||
/* Match the shared mobile layout's 5px plus the page's 8px. */
|
||||
padding-inline: 13px;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.website-insights-editor-layout {
|
||||
|
||||
@@ -54,7 +54,6 @@ export default function WebsiteSettings() {
|
||||
const [dirty, setDirty] = useState(false);
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [loadError, setLoadError] = useState('');
|
||||
const [loadVersion, setLoadVersion] = useState(0);
|
||||
const originalConfig = useRef({});
|
||||
const savePending = useRef(false);
|
||||
useEffect(() => {
|
||||
@@ -79,7 +78,7 @@ export default function WebsiteSettings() {
|
||||
return () => {
|
||||
active = false;
|
||||
};
|
||||
}, [loadVersion]);
|
||||
}, []);
|
||||
const disabled = saving || loading || Boolean(loadError);
|
||||
useEffect(() => {
|
||||
if (!dirty) return;
|
||||
@@ -161,24 +160,17 @@ export default function WebsiteSettings() {
|
||||
childStyle={{ flex: 1, display: 'flex', flexDirection: 'column' }}
|
||||
data-testid='website-settings-loading'
|
||||
>
|
||||
<Card className='website-settings-card'>
|
||||
<Typography.Title heading={4} style={{ marginBottom: 8 }}>
|
||||
{t('官网设置')}
|
||||
</Typography.Title>
|
||||
<Typography.Paragraph type='tertiary'>
|
||||
{t('配置官网展示内容与商务联系信息')}
|
||||
</Typography.Paragraph>
|
||||
<Card
|
||||
className={`website-settings-card${loadError ? ' website-settings-card--error' : ''}`}
|
||||
>
|
||||
{loadError ? (
|
||||
<Banner
|
||||
type='danger'
|
||||
closeIcon={null}
|
||||
description={t(loadError)}
|
||||
fullMode={false}
|
||||
>
|
||||
<Button onClick={() => setLoadVersion((version) => version + 1)}>
|
||||
{t('重新加载')}
|
||||
</Button>
|
||||
</Banner>
|
||||
className='website-settings-load-error'
|
||||
style={{ marginBlock: '0 8px' }}
|
||||
/>
|
||||
) : null}
|
||||
<Tabs type='line' activeKey={activeTab} onChange={setActiveTab}>
|
||||
{TABS.map((item) => (
|
||||
@@ -217,6 +209,14 @@ export default function WebsiteSettings() {
|
||||
>
|
||||
<WebsiteField
|
||||
name={name}
|
||||
labelSuffix={
|
||||
activeTab === 'home' && name === 'teamMembers' ? (
|
||||
<span className='website-research-ratio-hint'>
|
||||
({t('研发人员占比')}:
|
||||
{values.researchRatio || t('未配置')})
|
||||
</span>
|
||||
) : undefined
|
||||
}
|
||||
value={values[name]}
|
||||
error={errors[name]}
|
||||
disabled={disabled}
|
||||
@@ -239,12 +239,6 @@ export default function WebsiteSettings() {
|
||||
/>
|
||||
)}
|
||||
</WebsiteField>
|
||||
{activeTab === 'home' && name === 'teamMembers' && (
|
||||
<Typography.Text type='tertiary' size='small'>
|
||||
{t('研发人员占比')}:
|
||||
{values.researchRatio || t('未配置')}
|
||||
</Typography.Text>
|
||||
)}
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
@@ -256,6 +250,10 @@ export default function WebsiteSettings() {
|
||||
style={{
|
||||
marginTop: 10,
|
||||
marginBottom: 2,
|
||||
marginBlock:
|
||||
activeTab === 'insights'
|
||||
? '0 var(--website-insights-footer-gap)'
|
||||
: undefined,
|
||||
paddingTop: 2,
|
||||
paddingBottom: 2,
|
||||
}}
|
||||
@@ -263,7 +261,7 @@ export default function WebsiteSettings() {
|
||||
/>
|
||||
<div
|
||||
className='flex justify-center gap-2'
|
||||
style={{ marginTop: 18 }}
|
||||
style={{ marginTop: activeTab === 'insights' ? 0 : 18 }}
|
||||
>
|
||||
<Button onClick={clear} disabled={disabled}>
|
||||
{t('清空')}
|
||||
|
||||
@@ -171,7 +171,14 @@ export function validateField(key, rawValue) {
|
||||
export function validateSettings(values) {
|
||||
return Object.fromEntries(
|
||||
[...new Set(TABS.flatMap((tab) => tab.fields))]
|
||||
.map((key) => [key, validateField(key, values[key])])
|
||||
.map((key) => [
|
||||
key,
|
||||
key === 'insights' &&
|
||||
!values.insights?.categories?.length &&
|
||||
!values.insights?.articles?.length
|
||||
? '请完善动态与洞察的配置'
|
||||
: validateField(key, values[key]),
|
||||
])
|
||||
.filter(([, error]) => error),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user