diff --git a/src/Page.tsx b/src/Page.tsx index e4c9ba9..5fca4e9 100644 --- a/src/Page.tsx +++ b/src/Page.tsx @@ -1,6 +1,7 @@ import React from 'react'; import { HashRouter as Router, Route, Switch, Redirect } from 'react-router-dom'; import NotFound from './components/pages/NotFound'; +import Register from './components/pages/Register'; import Login from './components/pages/Login'; import App from './App'; @@ -11,6 +12,7 @@ export default () => ( + diff --git a/src/components/HeaderCustom.tsx b/src/components/HeaderCustom.tsx index 2f34c59..ba77452 100644 --- a/src/components/HeaderCustom.tsx +++ b/src/components/HeaderCustom.tsx @@ -93,14 +93,15 @@ const HeaderCustom = (props: HeaderCustomProps) => { onClick={props.toggle} /> )} + 地铁换乘站换乘客流预测系统 - + {/* - + */} diff --git a/src/components/index.tsx b/src/components/index.tsx index 1dccd6e..bd3d989 100644 --- a/src/components/index.tsx +++ b/src/components/index.tsx @@ -36,6 +36,8 @@ import UserManage from './management/UserManage'; import BlankPage from './management/BlankPage'; import StationInfo from './station/StationInfo'; import PredictInfo from './station/PredictInfo'; +import StationManage from './management/StationManage'; +import ChangePwd from './user/ChangePwd'; const WysiwygBundle = Loadable({ // 按需加载富文本配置 @@ -77,4 +79,6 @@ export default { BlankPage, StationInfo, PredictInfo, + StationManage, + ChangePwd, } as any; diff --git a/src/components/management/StationManage.tsx b/src/components/management/StationManage.tsx new file mode 100644 index 0000000..830f3c8 --- /dev/null +++ b/src/components/management/StationManage.tsx @@ -0,0 +1,316 @@ +import React from 'react'; +import { Button, Table } from 'antd'; + +const StationManage = () => { + const columns = [ + { + title: 'ID', + dataIndex: 'id', + key: 'id', + sorter: (a: any, b: any) => a.id - b.id, + }, + { + title: '站点名称', + dataIndex: 'name', + key: 'name', + }, + { + title: '所属线路', + dataIndex: 'route', + key: 'route', + }, + { + title: '操作', + render: (record: any) => ( +
+ + +
+ ), + }, + ]; + const data = [ + { + id: 1, + name: 'F7', + route: '1号线', + }, + { + id: 2, + name: 'F6', + route: '1号线', + }, + { + id: 3, + name: 'F5', + route: '1号线', + }, + { + id: 4, + name: 'F4', + route: '1号线', + }, + { + id: 5, + name: 'F3', + route: '1号线', + }, + { + id: 6, + name: 'F2', + route: '1号线', + }, + { + id: 7, + name: 'F1', + route: '1号线', + }, + { + id: 8, + name: 'F9', + route: '1号线', + }, + { + id: 9, + name: 'F11', + route: '1号线', + }, + { + id: 10, + name: 'F12', + route: '1号线', + }, + { + id: 11, + name: 'F13', + route: '1号线', + }, + { + id: 12, + name: 'F14', + route: '1号线', + }, + { + id: 13, + name: 'F15', + route: '1号线', + }, + { + id: 14, + name: 'F16', + route: '1号线', + }, + { + id: 15, + name: 'F17', + route: '1号线', + }, + { + id: 16, + name: 'F18', + route: '1号线', + }, + { + id: 17, + name: 'S1', + route: '2号线', + }, + { + id: 18, + name: 'S2', + route: '2号线', + }, + { + id: 19, + name: 'S3', + route: '2号线', + }, + { + id: 20, + name: 'S4', + route: '2号线', + }, + { + id: 21, + name: 'S5', + route: '2号线', + }, + { + id: 22, + name: 'S6', + route: '2号线', + }, + { + id: 23, + name: 'FS8', + route: '2号线', + }, + { + id: 24, + name: 'S8', + route: '2号线', + }, + { + id: 25, + name: 'S9', + route: '2号线', + }, + { + id: 26, + name: 'S10', + route: '2号线', + }, + { + id: 27, + name: 'S12', + route: '2号线', + }, + { + id: 28, + name: 'S13', + route: '2号线', + }, + { + id: 29, + name: 'S14', + route: '2号线', + }, + { + id: 30, + name: 'S15', + route: '2号线', + }, + { + id: 31, + name: 'S16', + route: '2号线', + }, + { + id: 32, + name: 'S17', + route: '2号线', + }, + { + id: 33, + name: 'S18', + route: '2号线', + }, + { + id: 34, + name: 'S19', + route: '2号线', + }, + { + id: 35, + name: 'S20', + route: '2号线', + }, + { + id: 36, + name: 'T16', + route: '3号线', + }, + { + id: 37, + name: 'T15', + route: '3号线', + }, + { + id: 38, + name: 'FT10', + route: '3号线', + }, + { + id: 39, + name: 'T13', + route: '3号线', + }, + { + id: 40, + name: 'T12', + route: '3号线', + }, + { + id: 41, + name: 'ST11', + route: '3号线', + }, + { + id: 42, + name: 'T10', + route: '3号线', + }, + { + id: 43, + name: 'T9', + route: '3号线', + }, + { + id: 44, + name: 'T8', + route: '3号线', + }, + { + id: 45, + name: 'T7', + route: '3号线', + }, + { + id: 46, + name: 'T6', + route: '3号线', + }, + { + id: 47, + name: 'T5', + route: '3号线', + }, + { + id: 48, + name: 'T4', + route: '3号线', + }, + { + id: 49, + name: 'T3', + route: '3号线', + }, + { + id: 50, + name: 'T2', + route: '3号线', + }, + { + id: 51, + name: 'T1', + route: '3号线', + }, + ]; + return ( +
+ + record.id} /> + + + ); +}; + +export default StationManage; diff --git a/src/components/pages/Login.tsx b/src/components/pages/Login.tsx index e2d6617..ec0f0f7 100644 --- a/src/components/pages/Login.tsx +++ b/src/components/pages/Login.tsx @@ -40,10 +40,10 @@ const Login = (props: LoginProps) => { if (res.data.success) { let user = { uid: res.data.id, - role: res.data.role === 1 ? '系统管理员' : '访客', + role: res.data.role == 1 ? '系统管理员' : '访客', roleType: res.data.role, username: values.userName, - permissions: res.data.role === 1 ? ['auth/admin'] : [], + permissions: res.data.role == 1 ? ['auth/admin'] : [], }; setAlita('auth', user); } diff --git a/src/components/pages/Register.tsx b/src/components/pages/Register.tsx new file mode 100644 index 0000000..dc2b30b --- /dev/null +++ b/src/components/pages/Register.tsx @@ -0,0 +1,68 @@ +/** + * Created by hao.cheng on 2017/4/16. + */ +import React, { useEffect } from 'react'; +import { Button, Form, Input } from 'antd'; +import { PwaInstaller } from '../widget'; +import { useAlita } from 'redux-alita'; +import { RouteComponentProps } from 'react-router'; +import { FormProps } from 'antd/lib/form'; +import umbrella from 'umbrella-storage'; +import { GithubOutlined, LockOutlined, UserOutlined } from '@ant-design/icons'; +import { useUpdateEffect } from 'ahooks'; + +const FormItem = Form.Item; +type RegisterProps = { + setAlitaState: (param: any) => void; + auth: any; +} & RouteComponentProps & + FormProps; + +const Register = (props: RegisterProps) => { + return ( +
+
+
+ 用户注册 +
+
+ + } placeholder="Username" /> + + + } + type="password" + placeholder="Password" + /> + + + } + type="password" + placeholder="Password Confirm" + /> + + + + + +
+
+ ); +}; + +export default Register; diff --git a/src/components/station/PredictInfo.tsx b/src/components/station/PredictInfo.tsx index 0d4a508..645e976 100644 --- a/src/components/station/PredictInfo.tsx +++ b/src/components/station/PredictInfo.tsx @@ -15,13 +15,13 @@ const StationInfo = () => { return ( - + - + - + ); diff --git a/src/components/station/StationInfo.tsx b/src/components/station/StationInfo.tsx index d7ab6b1..f5a4c4f 100644 --- a/src/components/station/StationInfo.tsx +++ b/src/components/station/StationInfo.tsx @@ -46,7 +46,12 @@ const StationInfo = (props: StationInfoProps) => {

站点名称: {props.query.station}

地址: xx省 xx市 xx区 xx路 xxx号

出入口数量:{Math.floor(Math.random() * 5) + 1}

-

进站人数: {Math.floor(Math.random() * 100)}

+

+ {['ST', 'FS', 'FT'].some((ele) => String(props.query.station).startsWith(ele)) + ? '换乘' + : '近站'} + 人数: {Math.floor(Math.random() * 100)} +

出站人数: {Math.floor(Math.random() * 100)}

站点图片:

{images.length > 0 ? ( diff --git a/src/components/user/ChangePwd.tsx b/src/components/user/ChangePwd.tsx new file mode 100644 index 0000000..3c73cb4 --- /dev/null +++ b/src/components/user/ChangePwd.tsx @@ -0,0 +1,20 @@ +import React from 'react'; +import { Button, Card, Divider, Input, Table } from 'antd'; + +const ChangePwd = () => { + return ( +
+ + + + + + + + + +
+ ); +}; + +export default ChangePwd; diff --git a/src/components/visualize/TrailwayRoute.tsx b/src/components/visualize/TrailwayRoute.tsx index eb42860..9c8bf4a 100644 --- a/src/components/visualize/TrailwayRoute.tsx +++ b/src/components/visualize/TrailwayRoute.tsx @@ -3,6 +3,7 @@ */ import React, { Component } from 'react'; import ReactEcharts from 'echarts-for-react'; +import { RouteComponentProps, withRouter } from 'react-router-dom'; var stations = [ { @@ -518,11 +519,15 @@ const option = { }, ], }; -class TrailwayRoute extends Component { +class TrailwayRoute extends Component { render() { return ( + this.props.history.push('/app/station?station=' + params.data.name), + }} style={{ height: '700px', width: '1400px' }} className={'react_for_echarts'} /> @@ -530,4 +535,4 @@ class TrailwayRoute extends Component { } } -export default TrailwayRoute; +export default withRouter(TrailwayRoute); diff --git a/src/routes/config.ts b/src/routes/config.ts index 267c5cd..c338729 100644 --- a/src/routes/config.ts +++ b/src/routes/config.ts @@ -159,7 +159,7 @@ const menus: { }, { key: '/app/predict', - title: '人流预测', + title: '中转人流预测', icon: 'bars', component: 'PredictInfo', }, @@ -175,6 +175,12 @@ const menus: { component: 'UserManage', requireAuth: 'auth/admin', }, + { + key: '/app/manage/station', + title: '车站信息管理', + component: 'StationManage', + requireAuth: 'auth/admin', + }, // { // key: '/app/extension/visitor', // title: '访客模式', @@ -205,6 +211,18 @@ const menus: { // }, ], }, + { + key: '/app/user', + title: '用户', + icon: 'bars', + subs: [ + { + key: '/app/user/pwd', + title: '更改密码', + component: 'ChangePwd', + }, + ], + }, ], others: [], // 非菜单相关路由 };