分销后台前端对接与结算明细接口
- 新增 GET /admin/distribution/settlement-batches/:id/items 明细查询 - distribution-admin 重构为 react-router 多页面:仪表盘/网站/规则(启停)/订单(筛选分页)/结算(创建/明细/结算)/支付通道(绑定解绑)/账号展示(上下架) - axios 统一 401 提示,引导回主站后台登录;金额统一整数分格式化 - npm run build(tsc 严格模式) 通过
This commit is contained in:
@@ -0,0 +1,67 @@
|
||||
import { BrowserRouter, Link, Navigate, Route, Routes } from 'react-router-dom'
|
||||
import { App, ConfigProvider, Layout, Menu, Typography } from 'antd'
|
||||
import { AccountBookOutlined, ApiOutlined, DashboardOutlined, FileSearchOutlined, SettingOutlined, ShopOutlined } from '@ant-design/icons'
|
||||
import Dashboard from './pages/Dashboard'
|
||||
import Sites from './pages/Sites'
|
||||
import Rules from './pages/Rules'
|
||||
import Payments from './pages/Payments'
|
||||
import Accounts from './pages/Accounts'
|
||||
import Settlements from './pages/Settlements'
|
||||
import Orders from './pages/Orders'
|
||||
import './style.css'
|
||||
|
||||
const MENU_ITEMS = [
|
||||
{ key: '/', icon: <DashboardOutlined />, label: <Link to="/">仪表盘</Link> },
|
||||
{ key: '/sites', icon: <ShopOutlined />, label: <Link to="/sites">分销网站</Link> },
|
||||
{ key: '/sold', icon: <FileSearchOutlined />, label: <Link to="/sold">售出账号</Link> },
|
||||
{ key: '/receive', icon: <AccountBookOutlined />, label: <Link to="/receive">分销收号</Link> },
|
||||
{ key: '/settlements', icon: <AccountBookOutlined />, label: <Link to="/settlements">结算管理</Link> },
|
||||
{ key: '/payments', icon: <ApiOutlined />, label: <Link to="/payments">支付通道</Link> },
|
||||
{ key: '/accounts', icon: <SettingOutlined />, label: <Link to="/accounts">账号展示</Link> },
|
||||
{ key: '/rules', icon: <SettingOutlined />, label: <Link to="/rules">比例与税费</Link> },
|
||||
]
|
||||
|
||||
function pathToSelectedKey(pathname: string): string {
|
||||
return MENU_ITEMS.some((item) => item.key === pathname) ? pathname : '/'
|
||||
}
|
||||
|
||||
export default function AppShell() {
|
||||
return (
|
||||
<BrowserRouter>
|
||||
<ConfigProvider theme={{ token: { colorPrimary: '#1677ff', borderRadius: 6 } }}>
|
||||
<App>
|
||||
<Layout className="app">
|
||||
<Layout.Sider breakpoint="lg" collapsedWidth="0">
|
||||
<div className="brand">HFB 分销后台</div>
|
||||
<Menu
|
||||
theme="dark"
|
||||
mode="inline"
|
||||
items={MENU_ITEMS}
|
||||
defaultSelectedKeys={[pathToSelectedKey(window.location.pathname)]}
|
||||
/>
|
||||
</Layout.Sider>
|
||||
<Layout>
|
||||
<Layout.Header className="header">
|
||||
<Typography.Text>主站 hao858.com · 分销子域名 distribution.hao858.com</Typography.Text>
|
||||
</Layout.Header>
|
||||
<Layout.Content>
|
||||
<Routes>
|
||||
<Route path="/" element={<Dashboard />} />
|
||||
<Route path="/sites" element={<Sites />} />
|
||||
<Route path="/rules" element={<Rules />} />
|
||||
<Route path="/payments" element={<Payments />} />
|
||||
<Route path="/accounts" element={<Accounts />} />
|
||||
<Route path="/settlements" element={<Settlements />} />
|
||||
<Route path="/sold" element={<Orders kind="sold" />} />
|
||||
<Route path="/receive" element={<Orders kind="receive" />} />
|
||||
<Route path="/orders" element={<Orders kind="all" />} />
|
||||
<Route path="*" element={<Navigate to="/" replace />} />
|
||||
</Routes>
|
||||
</Layout.Content>
|
||||
</Layout>
|
||||
</Layout>
|
||||
</App>
|
||||
</ConfigProvider>
|
||||
</BrowserRouter>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user