From a24a4bc4a95d24c3174ec11aabd6cbe457608595 Mon Sep 17 00:00:00 2001 From: zhuyue Date: Thu, 2 Sep 2021 14:23:06 +0800 Subject: [PATCH] feat: Add user-center page add user-center page Change-Id: Ic973390c74ede418426e101fc71a01a67e3bee42 --- src/api/keystone/user.js | 4 +- src/asset/image/profile.svg | 17 ++++ .../Layout/GlobalHeader/AvatarDropdown.jsx | 4 + .../Layout/GlobalHeader/RightContent.jsx | 10 ++- src/layouts/Base/index.jsx | 17 +++- src/layouts/user-menu.jsx | 36 ++++++++ src/pages/basic/routes/index.js | 7 ++ src/pages/user-center/App.jsx | 21 +++++ .../containers/UserCenter/index.jsx | 87 +++++++++++++++++++ .../containers/UserCenter/styles.less | 46 ++++++++++ src/pages/user-center/routes/index.js | 34 ++++++++ src/utils/index.js | 3 + 12 files changed, 277 insertions(+), 9 deletions(-) create mode 100644 src/asset/image/profile.svg create mode 100644 src/layouts/user-menu.jsx create mode 100644 src/pages/user-center/App.jsx create mode 100644 src/pages/user-center/containers/UserCenter/index.jsx create mode 100644 src/pages/user-center/containers/UserCenter/styles.less create mode 100644 src/pages/user-center/routes/index.js diff --git a/src/api/keystone/user.js b/src/api/keystone/user.js index 570130b5..54983ffc 100644 --- a/src/api/keystone/user.js +++ b/src/api/keystone/user.js @@ -55,7 +55,7 @@ export const fetchUserDetails = (userId) => * @param {String} data.user.email The email for the user. * @param {String} data.user.password The password for the user. * @param {String} data.user.phone The phone for the user. - * @param {String} data.user.real_name The true name for the user. + * @param {String} data.user.real_name The real name for the user. * @param {Boolean} data.user.enabled Default value : true * @param {String} data.user.description The description for the user. * @returns {Promise} @@ -75,7 +75,7 @@ export const createUser = (data) => * @param {String} data.user.name The name for the user. * @param {String} data.user.email The email for the user. * @param {String} data.user.phone The phone for the user. - * @param {String} data.user.real_name The true name for the user. + * @param {String} data.user.real_name The real name for the user. * @param {String} data.user.description The description for the user. * @returns {Promise} */ diff --git a/src/asset/image/profile.svg b/src/asset/image/profile.svg new file mode 100644 index 00000000..004980da --- /dev/null +++ b/src/asset/image/profile.svg @@ -0,0 +1,17 @@ + + + profile + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/components/Layout/GlobalHeader/AvatarDropdown.jsx b/src/components/Layout/GlobalHeader/AvatarDropdown.jsx index dfb42d6b..39b3a13d 100644 --- a/src/components/Layout/GlobalHeader/AvatarDropdown.jsx +++ b/src/components/Layout/GlobalHeader/AvatarDropdown.jsx @@ -152,6 +152,10 @@ class AvatarDropdown extends React.Component { shape="circle" icon={} className={styles.avatar} + onClick={() => { + const { rootStore } = this.props; + rootStore.routing.push('/user/center'); + }} /> {/* */} {/* {currentUser.name} */} diff --git a/src/components/Layout/GlobalHeader/RightContent.jsx b/src/components/Layout/GlobalHeader/RightContent.jsx index e7ebc321..3b3e63f2 100644 --- a/src/components/Layout/GlobalHeader/RightContent.jsx +++ b/src/components/Layout/GlobalHeader/RightContent.jsx @@ -14,6 +14,7 @@ import React from 'react'; import { Button, Col, Row } from 'antd'; +import { isUserCenterPage } from 'utils'; import Avatar from './AvatarDropdown'; import styles from './index.less'; @@ -29,10 +30,13 @@ const gotoConsole = (type, props) => { }; const GlobalHeaderRight = (props) => { - const { isAdminPage = false, rootStore: { hasAdminPageRole = false } = {} } = - props; + const { + isAdminPage = false, + rootStore: { hasAdminPageRole = false } = {}, + location: { pathname }, + } = props; let linkRender = null; - if (isAdminPage) { + if (isAdminPage || isUserCenterPage(pathname)) { linkRender = (