diff --git a/src/common/menu.js b/src/common/menu.js index 50f8a46406f846851b9a4423428b9dfbdf444ab4..6dd6911d747720e0eabc6b393e694b9bff25e5ff 100644 --- a/src/common/menu.js +++ b/src/common/menu.js @@ -113,6 +113,17 @@ const menuData = [{ name: '注册结果', path: 'register-result', }], +}, { + name: '个人页', + icon: 'user', + path: 'user-profile', + children: [{ + name: '个人中心', + path: 'user-center', + }, { + name: '个人设置', + path: 'userinfo', + }], }]; function formatter(data, parentPath = '/', parentAuthority) { diff --git a/src/common/router.js b/src/common/router.js index cbd584efbc96b5cfc4e1c17ac8d4305026a6259c..6c9e54e1c99cf4c8f6e23ff3b335b780594fd110 100644 --- a/src/common/router.js +++ b/src/common/router.js @@ -151,9 +151,6 @@ export const getRouterData = (app) => { '/exception/trigger': { component: dynamicWrapper(app, ['error'], () => import('../routes/Exception/triggerException')), }, - '/user-center': { - component: dynamicWrapper(app, ['list', 'user', 'project'], () => import('../routes/UserCenter')), - }, '/user': { component: dynamicWrapper(app, [], () => import('../layouts/UserLayout')), }, @@ -166,20 +163,23 @@ export const getRouterData = (app) => { '/user/register-result': { component: dynamicWrapper(app, [], () => import('../routes/User/RegisterResult')), }, - '/userinfo': { - component: dynamicWrapper(app, ['geographic'], () => import('../routes/Userinfo/Info')), + '/user-profile/user-center': { + component: dynamicWrapper(app, ['list', 'user', 'project'], () => import('../routes/UserProfile/UserCenter')), + }, + '/user-profile/userinfo': { + component: dynamicWrapper(app, ['geographic'], () => import('../routes/UserProfile/Userinfo/Info')), }, - '/userinfo/base': { - component: dynamicWrapper(app, ['geographic'], () => import('../routes/Userinfo/BaseView')), + '/user-profile/userinfo/base': { + component: dynamicWrapper(app, ['geographic'], () => import('../routes/UserProfile/Userinfo/BaseView')), }, - '/userinfo/safe': { - component: dynamicWrapper(app, ['geographic'], () => import('../routes/Userinfo/SafeView')), + '/user-profile/userinfo/safe': { + component: dynamicWrapper(app, ['geographic'], () => import('../routes/UserProfile/Userinfo/SafeView')), }, - '/userinfo/account': { - component: dynamicWrapper(app, ['geographic'], () => import('../routes/Userinfo/AccountView')), + '/user-profile/userinfo/account': { + component: dynamicWrapper(app, ['geographic'], () => import('../routes/UserProfile/Userinfo/AccountView')), }, - '/userinfo/message': { - component: dynamicWrapper(app, ['geographic'], () => import('../routes/Userinfo/MessageView')), + '/user-profile/userinfo/message': { + component: dynamicWrapper(app, ['geographic'], () => import('../routes/UserProfile/Userinfo/MessageView')), }, // '/user/:id': { // component: dynamicWrapper(app, [], () => import('../routes/User/SomeComponent')), diff --git a/src/layouts/BasicLayout.js b/src/layouts/BasicLayout.js index 732b13f37885d7620b714de95cfc49c4e20b1190..ab85895758ae98ab284eb2084a1765d4c19a8005 100644 --- a/src/layouts/BasicLayout.js +++ b/src/layouts/BasicLayout.js @@ -128,7 +128,7 @@ class BasicLayout extends React.PureComponent { } handleMenuClick = ({ key }) => { if (key === 'userCenter') { - this.props.dispatch(routerRedux.push('/user-center')); + this.props.dispatch(routerRedux.push('/user-profile/user-center')); return; } if (key === 'triggerError') { @@ -136,7 +136,7 @@ class BasicLayout extends React.PureComponent { return; } if (key === 'userinfo') { - this.props.dispatch(routerRedux.push('/userinfo/base')); + this.props.dispatch(routerRedux.push('/user-profile/userinfo/base')); return; } if (key === 'logout') { diff --git a/src/routes/UserCenter.js b/src/routes/UserProfile/UserCenter.js similarity index 97% rename from src/routes/UserCenter.js rename to src/routes/UserProfile/UserCenter.js index c7d17c20ac36994b9b317afab592d8495d632711..b09d49270649dbdc3cc65cc0e381b8657bc03c9d 100644 --- a/src/routes/UserCenter.js +++ b/src/routes/UserProfile/UserCenter.js @@ -5,12 +5,12 @@ import moment from 'moment'; import numeral from 'numeral'; import { List, Card, Row, Col, Icon, Dropdown, Menu, Avatar, Tag, Divider, Tooltip, Spin, Input } from 'antd'; -import AvatarList from '../components/AvatarList'; -import { formatWan } from '../utils/utils'; +import AvatarList from '../../components/AvatarList'; +import { formatWan } from '../../utils/utils'; import styles from './UserCenter.less'; -import stylesArticles from './List/Articles.less'; -import stylesApplications from './List/Applications.less'; -import stylesProjects from './List/Projects.less'; +import stylesArticles from '../List/Articles.less'; +import stylesApplications from '../List/Applications.less'; +import stylesProjects from '../List/Projects.less'; @connect(({ list, loading, user, project }) => ({ list, diff --git a/src/routes/UserCenter.less b/src/routes/UserProfile/UserCenter.less similarity index 97% rename from src/routes/UserCenter.less rename to src/routes/UserProfile/UserCenter.less index b74e91b7b981ea09aa0cd1f476c9d4edbe1c9f4f..88a657702af402680df126276f63a6c43842736d 100644 --- a/src/routes/UserCenter.less +++ b/src/routes/UserProfile/UserCenter.less @@ -1,5 +1,5 @@ @import '~antd/lib/style/themes/default.less'; -@import "../utils/utils.less"; +@import "../../utils/utils.less"; .avatarHolder { text-align: center; diff --git a/src/routes/Userinfo/AccountView.js b/src/routes/UserProfile/Userinfo/AccountView.js similarity index 100% rename from src/routes/Userinfo/AccountView.js rename to src/routes/UserProfile/Userinfo/AccountView.js diff --git a/src/routes/Userinfo/BaseView.js b/src/routes/UserProfile/Userinfo/BaseView.js similarity index 100% rename from src/routes/Userinfo/BaseView.js rename to src/routes/UserProfile/Userinfo/BaseView.js diff --git a/src/routes/Userinfo/BaseView.less b/src/routes/UserProfile/Userinfo/BaseView.less similarity index 100% rename from src/routes/Userinfo/BaseView.less rename to src/routes/UserProfile/Userinfo/BaseView.less diff --git a/src/routes/Userinfo/GeographicView.js b/src/routes/UserProfile/Userinfo/GeographicView.js similarity index 100% rename from src/routes/Userinfo/GeographicView.js rename to src/routes/UserProfile/Userinfo/GeographicView.js diff --git a/src/routes/Userinfo/GeographicView.less b/src/routes/UserProfile/Userinfo/GeographicView.less similarity index 100% rename from src/routes/Userinfo/GeographicView.less rename to src/routes/UserProfile/Userinfo/GeographicView.less diff --git a/src/routes/Userinfo/Info.js b/src/routes/UserProfile/Userinfo/Info.js similarity index 89% rename from src/routes/Userinfo/Info.js rename to src/routes/UserProfile/Userinfo/Info.js index 135b337db049c164184386eb12151dd5817d1baa..d8b6edd7a2f34c8c4ad03b3f23083ad36c3d1f8d 100644 --- a/src/routes/Userinfo/Info.js +++ b/src/routes/UserProfile/Userinfo/Info.js @@ -3,7 +3,7 @@ import { connect } from 'dva'; import { Route, routerRedux, Switch, Redirect } from 'dva/router'; import { Menu } from 'antd'; import styles from './Info.less'; -import { getRoutes } from '../../utils/utils'; +import { getRoutes } from '../../../utils/utils'; const { Item } = Menu; @@ -36,7 +36,7 @@ export default class Info extends Component { return menuMap[this.state.selectKey]; }; selectKey = ({ key }) => { - this.props.dispatch(routerRedux.push(`/userinfo/${key}`)); + this.props.dispatch(routerRedux.push(`/user-profile/userinfo/${key}`)); this.setState({ selectKey: key, }); @@ -70,7 +70,7 @@ export default class Info extends Component { exact={item.exact} /> ))} - + diff --git a/src/routes/Userinfo/Info.less b/src/routes/UserProfile/Userinfo/Info.less similarity index 100% rename from src/routes/Userinfo/Info.less rename to src/routes/UserProfile/Userinfo/Info.less diff --git a/src/routes/Userinfo/MessageView.js b/src/routes/UserProfile/Userinfo/MessageView.js similarity index 100% rename from src/routes/Userinfo/MessageView.js rename to src/routes/UserProfile/Userinfo/MessageView.js diff --git a/src/routes/Userinfo/PhoneView.js b/src/routes/UserProfile/Userinfo/PhoneView.js similarity index 100% rename from src/routes/Userinfo/PhoneView.js rename to src/routes/UserProfile/Userinfo/PhoneView.js diff --git a/src/routes/Userinfo/PhoneView.less b/src/routes/UserProfile/Userinfo/PhoneView.less similarity index 100% rename from src/routes/Userinfo/PhoneView.less rename to src/routes/UserProfile/Userinfo/PhoneView.less diff --git a/src/routes/Userinfo/SafeView.js b/src/routes/UserProfile/Userinfo/SafeView.js similarity index 100% rename from src/routes/Userinfo/SafeView.js rename to src/routes/UserProfile/Userinfo/SafeView.js