feat(admin-frontend): 重做登录回跳与仪表盘样式
重构管理端登录、主布局和仪表盘,统一为 Apple 风格 并移除高成本装饰层以提升页面流畅度。 补充仪表盘统计、趋势、排行和系统状态接口封装, 同时完善受保护路由的 redirect 回跳逻辑。
This commit is contained in:
@@ -1,8 +1,55 @@
|
||||
import { adminClient } from './client'
|
||||
import type { ApiResponse, SystemStatus } from '@/types/api'
|
||||
import type {
|
||||
ApiResponse,
|
||||
DashboardStats,
|
||||
OrderTrendData,
|
||||
QueueStats,
|
||||
SystemStatus,
|
||||
TrafficRankResponse,
|
||||
} from '@/types/api'
|
||||
|
||||
export function getSystemStatus(): Promise<ApiResponse<SystemStatus>> {
|
||||
function unwrap<T>(url: string, params?: Record<string, unknown>): Promise<ApiResponse<T>> {
|
||||
return adminClient
|
||||
.get<ApiResponse<SystemStatus>>('/system/getSystemStatus')
|
||||
.get<ApiResponse<T>>(url, { params })
|
||||
.then((res) => res.data)
|
||||
}
|
||||
|
||||
export function getDashboardStats(): Promise<ApiResponse<DashboardStats>> {
|
||||
return unwrap<DashboardStats>('/stat/getStats')
|
||||
}
|
||||
|
||||
export function getOrderTrend(params: {
|
||||
startDate: string
|
||||
endDate: string
|
||||
type?: 'paid_total' | 'paid_count' | 'commission_total' | 'commission_count'
|
||||
}): Promise<ApiResponse<OrderTrendData>> {
|
||||
return unwrap<OrderTrendData>('/stat/getOrder', {
|
||||
start_date: params.startDate,
|
||||
end_date: params.endDate,
|
||||
type: params.type,
|
||||
})
|
||||
}
|
||||
|
||||
export function getTrafficRank(params: {
|
||||
type: 'node' | 'user'
|
||||
startTime: number
|
||||
endTime: number
|
||||
}): Promise<TrafficRankResponse> {
|
||||
return adminClient
|
||||
.get<TrafficRankResponse>('/stat/getTrafficRank', {
|
||||
params: {
|
||||
type: params.type,
|
||||
start_time: params.startTime,
|
||||
end_time: params.endTime,
|
||||
},
|
||||
})
|
||||
.then((res) => res.data)
|
||||
}
|
||||
|
||||
export function getSystemStatus(): Promise<ApiResponse<SystemStatus>> {
|
||||
return unwrap<SystemStatus>('/system/getSystemStatus')
|
||||
}
|
||||
|
||||
export function getQueueStats(): Promise<ApiResponse<QueueStats>> {
|
||||
return unwrap<QueueStats>('/system/getQueueStats')
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user