2dae55741e
- services/enterprise.js:/enterprise/tasks* (发标/提交发布/竞标列表/评标中标/验收) - platform/Enterprise.jsx:service 角色门户(登录墙+角色校验) · 发标表单:模式/可见性/预算/名额/竞标报名·中标数/接单条件JSON/托管方式 + C端可见/公有/独占 · 我的任务列表 + 竞标查看/评标中标 + 验收通过(结算)/驳回 + 重新上架 - 路由 #/enterprise;浅色 token 样式
114 lines
3.9 KiB
React
114 lines
3.9 KiB
React
import React from 'react';
|
|
import Home from './user/Home';
|
|
import System from './platform/System';
|
|
import Structures from './platform/Structures';
|
|
import Schedule from './platform/Schedule';
|
|
import Cards from './platform/Cards';
|
|
import Tools from './platform/Tools';
|
|
import OPCTest from './user/OPCTest';
|
|
import Events from './user/Events';
|
|
import EventDetail from './user/EventDetail';
|
|
import PolicyTest from './user/PolicyTest';
|
|
import StartPlan from './user/StartPlan';
|
|
import OPCSurvey from './user/OPCSurvey';
|
|
import Profile from './user/Profile';
|
|
import PineHome from './platform/PineHome';
|
|
import PineOps from './platform/PineOps';
|
|
import PineBookings from './platform/PineBookings';
|
|
import PineEvents from './platform/PineEvents';
|
|
import PineTests from './platform/PineTests';
|
|
import ReportHome from './platform/report/ReportHome';
|
|
import ReportBiz from './platform/report/ReportBiz';
|
|
import ReportPolicy from './platform/report/ReportPolicy';
|
|
import ReportData from './platform/report/ReportData';
|
|
import PineLogs from './platform/PineLogs';
|
|
import Login from './platform/Login';
|
|
import { ParticleField } from './components/organisms';
|
|
import { isAuthed } from './services/auth';
|
|
import { initTheme } from './services/theme';
|
|
import ParkApply from './user/ParkApply';
|
|
import CertApply from './user/CertApply';
|
|
import ParkTransfer from './user/ParkTransfer';
|
|
import Content from './user/Content';
|
|
import ContentDetail from './user/ContentDetail';
|
|
import Tasks from './user/Tasks';
|
|
import TaskDetail from './user/TaskDetail';
|
|
import Enterprise from './platform/Enterprise';
|
|
|
|
/* 公开路由(无需登录) */
|
|
const PUBLIC_ROUTES = [
|
|
{ path: '', Page: Home },
|
|
{ path: 'events', Page: Events },
|
|
{ path: 'event-detail', Page: EventDetail },
|
|
{ path: 'opc-test', Page: OPCTest },
|
|
{ path: 'policy-test', Page: PolicyTest },
|
|
{ path: 'start-plan', Page: StartPlan },
|
|
{ path: 'survey', Page: OPCSurvey },
|
|
{ path: 'park-apply', Page: ParkApply },
|
|
{ path: 'cert-apply', Page: CertApply },
|
|
{ path: 'park-transfer', Page: ParkTransfer },
|
|
{ path: 'content', Page: Content },
|
|
{ path: 'content-detail', Page: ContentDetail },
|
|
{ path: 'tasks', Page: Tasks },
|
|
{ path: 'task-detail', Page: TaskDetail },
|
|
{ path: 'enterprise', Page: Enterprise },
|
|
{ path: 'profile', Page: Profile }
|
|
];
|
|
|
|
/* 内部路由(/pine,需登录) */
|
|
const PINE_ROUTES = [
|
|
{ path: 'pine', Page: PineHome },
|
|
{ path: 'pine/ops', Page: PineOps },
|
|
{ path: 'pine/bookings', Page: PineBookings },
|
|
{ path: 'pine/events', Page: PineEvents },
|
|
{ path: 'pine/tests', Page: PineTests },
|
|
{ path: 'pine/logs', Page: PineLogs },
|
|
{ path: 'pine/report', Page: ReportHome },
|
|
{ path: 'pine/report/biz', Page: ReportBiz },
|
|
{ path: 'pine/report/policy', Page: ReportPolicy },
|
|
{ path: 'pine/report/data', Page: ReportData },
|
|
{ path: 'pine/system', Page: System },
|
|
{ path: 'pine/structures', Page: Structures },
|
|
{ path: 'pine/schedule', Page: Schedule },
|
|
{ path: 'pine/cards', Page: Cards },
|
|
{ path: 'pine/tools', Page: Tools }
|
|
];
|
|
|
|
const ALL_ROUTES = [...PUBLIC_ROUTES, ...PINE_ROUTES];
|
|
const isPine = (p) => p === 'pine' || p.startsWith('pine/');
|
|
|
|
function parseHash() {
|
|
return window.location.hash.replace(/^#\/?/, '').split('?')[0].trim();
|
|
}
|
|
|
|
export default function App() {
|
|
const [path, setPath] = React.useState(parseHash);
|
|
|
|
React.useEffect(() => {
|
|
initTheme();
|
|
const onHash = () => setPath(parseHash());
|
|
window.addEventListener('hashchange', onHash);
|
|
return () => window.removeEventListener('hashchange', onHash);
|
|
}, []);
|
|
|
|
const route = ALL_ROUTES.find((r) => r.path === path) || PUBLIC_ROUTES[0];
|
|
|
|
// 路由守卫:内部路由未登录 → 登录门(目标路径回传,登录后跳回)
|
|
if (isPine(route.path) && !isAuthed()) {
|
|
return (
|
|
<>
|
|
<ParticleField />
|
|
<Login target={route.path} />
|
|
</>
|
|
);
|
|
}
|
|
|
|
const { Page } = route;
|
|
return (
|
|
<>
|
|
<ParticleField />
|
|
<Page key={path} />
|
|
</>
|
|
);
|
|
}
|