From 6d619771248c34da25a5881592050b8aa679f2d3 Mon Sep 17 00:00:00 2001 From: ddcat1115 Date: Fri, 2 Mar 2018 17:18:13 +0800 Subject: [PATCH] adjust category --- src/common/menu.js | 11 ++++++++ src/common/router.js | 26 +++++++++---------- src/layouts/BasicLayout.js | 4 +-- src/routes/{ => UserProfile}/UserCenter.js | 10 +++---- src/routes/{ => UserProfile}/UserCenter.less | 2 +- .../{ => UserProfile}/Userinfo/AccountView.js | 0 .../{ => UserProfile}/Userinfo/BaseView.js | 0 .../{ => UserProfile}/Userinfo/BaseView.less | 0 .../Userinfo/GeographicView.js | 0 .../Userinfo/GeographicView.less | 0 src/routes/{ => UserProfile}/Userinfo/Info.js | 6 ++--- .../{ => UserProfile}/Userinfo/Info.less | 0 .../{ => UserProfile}/Userinfo/MessageView.js | 0 .../{ => UserProfile}/Userinfo/PhoneView.js | 0 .../{ => UserProfile}/Userinfo/PhoneView.less | 0 .../{ => UserProfile}/Userinfo/SafeView.js | 0 16 files changed, 35 insertions(+), 24 deletions(-) rename src/routes/{ => UserProfile}/UserCenter.js (97%) rename src/routes/{ => UserProfile}/UserCenter.less (97%) rename src/routes/{ => UserProfile}/Userinfo/AccountView.js (100%) rename src/routes/{ => UserProfile}/Userinfo/BaseView.js (100%) rename src/routes/{ => UserProfile}/Userinfo/BaseView.less (100%) rename src/routes/{ => UserProfile}/Userinfo/GeographicView.js (100%) rename src/routes/{ => UserProfile}/Userinfo/GeographicView.less (100%) rename src/routes/{ => UserProfile}/Userinfo/Info.js (89%) rename src/routes/{ => UserProfile}/Userinfo/Info.less (100%) rename src/routes/{ => UserProfile}/Userinfo/MessageView.js (100%) rename src/routes/{ => UserProfile}/Userinfo/PhoneView.js (100%) rename src/routes/{ => UserProfile}/Userinfo/PhoneView.less (100%) rename src/routes/{ => UserProfile}/Userinfo/SafeView.js (100%) diff --git a/src/common/menu.js b/src/common/menu.js index 50f8a464..6dd6911d 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 cbd584ef..6c9e54e1 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 732b13f3..ab858957 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 c7d17c20..b09d4927 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 b74e91b7..88a65770 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 135b337d..d8b6edd7 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 -- GitLab