feat: 自行开发设计 ui样式优化 超管端-控制台 相关的页面
This commit is contained in:
+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' />}
|
||||
|
||||
Reference in New Issue
Block a user