提交 c78b458c 作者: 郁骅焌

个人中心

上级 14373d7a
...@@ -2,7 +2,8 @@ const routes = [ ...@@ -2,7 +2,8 @@ const routes = [
'/system/role', '/system/role',
'/system/menu', '/system/menu',
'/system/dept', '/system/dept',
'/system/user' '/system/user',
'/system/center'
] ]
export default { export default {
......
...@@ -98,6 +98,11 @@ export default defineConfig({ ...@@ -98,6 +98,11 @@ export default defineConfig({
icon: 'SolutionOutlined', icon: 'SolutionOutlined',
component: './user/manage', component: './user/manage',
}, },
{
path: '/system/center',
name: 'center',
component: './user/center',
},
], ],
}, },
{ {
......
...@@ -22,6 +22,7 @@ const MenuTree = (props, ref) => { ...@@ -22,6 +22,7 @@ const MenuTree = (props, ref) => {
const [halfCheckedKeys, setHalfCheckedKeys] = useState([]) const [halfCheckedKeys, setHalfCheckedKeys] = useState([])
const [selectedKeys, setSelectedKeys] = useState([]); const [selectedKeys, setSelectedKeys] = useState([]);
const [autoExpandParent, setAutoExpandParent] = useState(true); const [autoExpandParent, setAutoExpandParent] = useState(true);
const [checkStrictly, setCheckStrictly] = useState(true)
const queryMenu = async () => { const queryMenu = async () => {
const res = await getMenu() const res = await getMenu()
...@@ -66,13 +67,14 @@ const MenuTree = (props, ref) => { ...@@ -66,13 +67,14 @@ const MenuTree = (props, ref) => {
useImperativeHandle(ref, () => ({ useImperativeHandle(ref, () => ({
setCheckedKeys, setCheckedKeys,
getCheckedKeys, getCheckedKeys,
getHalfCheckedKeys getHalfCheckedKeys,
setCheckStrictly
})) }))
return ( return (
<SageTree <SageTree
checkable checkable
// checkStrictly // checkStrictly={checkStrictly}
onExpand={onExpand} onExpand={onExpand}
expandedKeys={expandedKeys} expandedKeys={expandedKeys}
autoExpandParent={autoExpandParent} autoExpandParent={autoExpandParent}
......
import { message } from 'antd' import { message } from 'antd'
const sageMessage = { const SageMessage = {
success: (text) => message.success(text) success: (text) => message.success(text)
} }
export default sageMessage export default SageMessage
...@@ -4,7 +4,7 @@ import ActionSet from './ActionSet' ...@@ -4,7 +4,7 @@ import ActionSet from './ActionSet'
import SageModal from './Modal' import SageModal from './Modal'
import SageForm from './Form' import SageForm from './Form'
import SageTree from './Tree' import SageTree from './Tree'
import sageMessage from './Message' import SageMessage from './Message'
import SageLayoutLR from './Layout/LayoutLR' import SageLayoutLR from './Layout/LayoutLR'
export { export {
...@@ -15,5 +15,5 @@ export { ...@@ -15,5 +15,5 @@ export {
SageModal, SageModal,
SageForm, SageForm,
SageTree, SageTree,
sageMessage SageMessage
} }
...@@ -31,6 +31,11 @@ class AvatarDropdown extends React.Component { ...@@ -31,6 +31,11 @@ class AvatarDropdown extends React.Component {
return; return;
} }
if (key === 'center') {
this.props.goCenter()
return;
}
history.push(`/account/${key}`); history.push(`/account/${key}`);
}; };
...@@ -45,12 +50,6 @@ class AvatarDropdown extends React.Component { ...@@ -45,12 +50,6 @@ class AvatarDropdown extends React.Component {
const menuHeaderDropdown = ( const menuHeaderDropdown = (
<Menu className={styles.menu} selectedKeys={[]} onClick={this.onMenuClick}> <Menu className={styles.menu} selectedKeys={[]} onClick={this.onMenuClick}>
{menu && ( {menu && (
<Menu.Item key="center">
<UserOutlined />
个人中心
</Menu.Item>
)}
{menu && (
<Menu.Item key="settings"> <Menu.Item key="settings">
<SettingOutlined /> <SettingOutlined />
个人设置 个人设置
...@@ -58,6 +57,10 @@ class AvatarDropdown extends React.Component { ...@@ -58,6 +57,10 @@ class AvatarDropdown extends React.Component {
)} )}
{menu && <Menu.Divider />} {menu && <Menu.Divider />}
<Menu.Item key="center">
<UserOutlined />
个人中心
</Menu.Item>
<Menu.Item key="logout"> <Menu.Item key="logout">
<LogoutOutlined /> <LogoutOutlined />
退出登录 退出登录
......
...@@ -21,6 +21,10 @@ const GlobalHeaderRight = props => { ...@@ -21,6 +21,10 @@ const GlobalHeaderRight = props => {
className = `${styles.right} ${styles.dark}`; className = `${styles.right} ${styles.dark}`;
} }
const goCenter = () => {
props.goCenter()
}
return ( return (
<div className={className}> <div className={className}>
{/* <HeaderSearch {/* <HeaderSearch
...@@ -61,7 +65,7 @@ const GlobalHeaderRight = props => { ...@@ -61,7 +65,7 @@ const GlobalHeaderRight = props => {
// </a> // </a>
// </Tooltip> // </Tooltip>
} }
<Avatar /> <Avatar goCenter={goCenter} />
{REACT_APP_ENV && ( {REACT_APP_ENV && (
<span> <span>
<Tag color={ENVTagColor[REACT_APP_ENV]}>{REACT_APP_ENV}</Tag> <Tag color={ENVTagColor[REACT_APP_ENV]}>{REACT_APP_ENV}</Tag>
......
...@@ -161,9 +161,16 @@ const TabBar = (props, ref) => { ...@@ -161,9 +161,16 @@ const TabBar = (props, ref) => {
</Menu> </Menu>
); );
const getPanes = () => {
return panes
}
// 暴露外部方法 // 暴露外部方法
useImperativeHandle(ref, () => ({ useImperativeHandle(ref, () => ({
onChange, onChange,
getPanes,
setPanes,
setActiveKey
})); }));
return ( return (
......
export default {
IconUrl: '//at.alicdn.com/t/font_1873986_zq2zexdsrnm.js'
}
...@@ -13,6 +13,7 @@ import RightContent from '@/components/GlobalHeader/RightContent'; ...@@ -13,6 +13,7 @@ import RightContent from '@/components/GlobalHeader/RightContent';
import TabBar from '@/components/TabBar'; import TabBar from '@/components/TabBar';
import GlobalFooter from '@/components/GlobalFooter'; import GlobalFooter from '@/components/GlobalFooter';
import { getAuthorityFromRouter } from '@/utils/utils'; import { getAuthorityFromRouter } from '@/utils/utils';
import config from '@/config.js'
import logo from '../assets/logo.svg'; import logo from '../assets/logo.svg';
import './BasicLayout.less' import './BasicLayout.less'
...@@ -20,7 +21,7 @@ import './BasicLayout.less' ...@@ -20,7 +21,7 @@ import './BasicLayout.less'
const { REACT_APP_ENV } = process.env; const { REACT_APP_ENV } = process.env;
const IconFont = createFromIconfontCN({ const IconFont = createFromIconfontCN({
scriptUrl: '//at.alicdn.com/t/font_1873986_46xeik9dra8.js', scriptUrl: config.IconUrl,
}); });
const { SubMenu } = Menu; const { SubMenu } = Menu;
...@@ -240,7 +241,21 @@ const BasicLayout = (props) => { ...@@ -240,7 +241,21 @@ const BasicLayout = (props) => {
* init variables * init variables
*/ */
console.log(props.children) // 跳转到个人中心
const goCenter = () => {
checkMenuOpen('/system/center')
handleSelectMenu({key: '/system/center'})
// const panes = tabBarRef.current.getPanes()
// if (!panes.some(item => item.key === '/system/center')) {
// panes.push({
// title: '个人中心',
// key: '/system/center'
// })
// tabBarRef.current.setPanes(panes);
// }
// tabBarRef.current.setActiveKey('/system/center');
// history.push('/system/center');
}
return ( return (
...@@ -277,9 +292,10 @@ const BasicLayout = (props) => { ...@@ -277,9 +292,10 @@ const BasicLayout = (props) => {
collapsed ? <MenuUnfoldOutlined style={{ fontSize: '20px' }} /> : <MenuFoldOutlined style={{ fontSize: '20px' }} /> collapsed ? <MenuUnfoldOutlined style={{ fontSize: '20px' }} /> : <MenuFoldOutlined style={{ fontSize: '20px' }} />
} }
</div> </div>
<RightContent /> <RightContent goCenter={goCenter} />
</div> </div>
<TabBar ref={tabBarRef} <TabBar
ref={tabBarRef}
currentUser={currentUser} currentUser={currentUser}
menuTree={menuTree} menuTree={menuTree}
setSelectedKeys={setSelectedKeys} setSelectedKeys={setSelectedKeys}
......
import React, { useState, useEffect, useRef } from 'react' import React, { useState, useEffect, useRef } from 'react'
import { PageHeaderWrapper } from '@ant-design/pro-layout' import { PageHeaderWrapper } from '@ant-design/pro-layout'
import { SageTable, SageModal, SageButton, sageMessage, ActionSet } from '@/components/Common' import { SageTable, SageModal, SageButton, SageMessage, ActionSet } from '@/components/Common'
import { PlusOutlined, EditOutlined, DeleteOutlined, VerticalAlignBottomOutlined, VerticalAlignTopOutlined } from '@ant-design/icons'; import { PlusOutlined, EditOutlined, DeleteOutlined, VerticalAlignBottomOutlined, VerticalAlignTopOutlined } from '@ant-design/icons';
import moment from 'moment'; import moment from 'moment';
import { getEnumDropDownList } from '@/services/enum' import { getEnumDropDownList } from '@/services/enum'
...@@ -199,7 +199,7 @@ const CrudList = () => { ...@@ -199,7 +199,7 @@ const CrudList = () => {
const res = await removeCrud({ idArr: [record.id] }) const res = await removeCrud({ idArr: [record.id] })
if (res.isSuccess) { if (res.isSuccess) {
sageMessage.success('删除成功') SageMessage.success('删除成功')
tableRef.current.reloadTable() tableRef.current.reloadTable()
} }
} }
...@@ -426,7 +426,7 @@ const CrudList = () => { ...@@ -426,7 +426,7 @@ const CrudList = () => {
const rowRecords = tableRef.current.getSelectedRowKeys() const rowRecords = tableRef.current.getSelectedRowKeys()
const res = await removeCrud({ idArr: rowRecords }) const res = await removeCrud({ idArr: rowRecords })
if (res.isSuccess) { if (res.isSuccess) {
sageMessage.success('删除成功') SageMessage.success('删除成功')
tableRef.current.reloadTable() tableRef.current.reloadTable()
} }
} }
...@@ -504,7 +504,7 @@ const CrudList = () => { ...@@ -504,7 +504,7 @@ const CrudList = () => {
setModalLoading(false) setModalLoading(false)
if (res.isSuccess) { if (res.isSuccess) {
sageMessage.success('保存成功') SageMessage.success('保存成功')
modalRef.current.setVisible(false) modalRef.current.setVisible(false)
tableRef.current.reloadTable() tableRef.current.reloadTable()
} }
......
import React, { useState, useEffect, useRef } from 'react' import React, { useState, useEffect, useRef } from 'react'
import { PageHeaderWrapper } from '@ant-design/pro-layout' import { PageHeaderWrapper } from '@ant-design/pro-layout'
import { Switch, Modal } from 'antd' import { Switch, Modal } from 'antd'
import { SageTable, SageModal, SageButton, sageMessage, ActionSet } from '@/components/Common' import { SageTable, SageModal, SageButton, SageMessage, ActionSet } from '@/components/Common'
import { PlusOutlined, EditOutlined, SwapOutlined, ExclamationCircleOutlined, DeleteOutlined, VerticalAlignBottomOutlined, VerticalAlignTopOutlined } from '@ant-design/icons'; import { PlusOutlined, EditOutlined, SwapOutlined, ExclamationCircleOutlined, DeleteOutlined, VerticalAlignBottomOutlined, VerticalAlignTopOutlined } from '@ant-design/icons';
import moment from 'moment'; import moment from 'moment';
import { getEnumDropDownList } from '@/services/enum' import { getEnumDropDownList } from '@/services/enum'
...@@ -110,7 +110,7 @@ const DeptList = () => { ...@@ -110,7 +110,7 @@ const DeptList = () => {
const res = await removeDept({ id: record.id }) const res = await removeDept({ id: record.id })
if (res.isSuccess) { if (res.isSuccess) {
sageMessage.success('删除成功') SageMessage.success('删除成功')
tableRef.current.reloadTable() tableRef.current.reloadTable()
} }
} }
...@@ -138,7 +138,7 @@ const DeptList = () => { ...@@ -138,7 +138,7 @@ const DeptList = () => {
} }
loopChangeStatus(tableData) loopChangeStatus(tableData)
tableRef.current.setDataSource(tableData) tableRef.current.setDataSource(tableData)
sageMessage.success(checked ? '启用成功' : '禁用成功') SageMessage.success(checked ? '启用成功' : '禁用成功')
} }
}, },
onCancel: () => { onCancel: () => {
...@@ -253,7 +253,7 @@ const DeptList = () => { ...@@ -253,7 +253,7 @@ const DeptList = () => {
const rowRecords = tableRef.current.getSelectedRowKeys() const rowRecords = tableRef.current.getSelectedRowKeys()
const res = await removeDept({ idArr: rowRecords }) const res = await removeDept({ idArr: rowRecords })
if (res.isSuccess) { if (res.isSuccess) {
sageMessage.success('删除成功') SageMessage.success('删除成功')
tableRef.current.reloadTable() tableRef.current.reloadTable()
} }
} }
...@@ -314,7 +314,7 @@ const DeptList = () => { ...@@ -314,7 +314,7 @@ const DeptList = () => {
setModalLoading(false) setModalLoading(false)
if (res.isSuccess) { if (res.isSuccess) {
sageMessage.success('保存成功') SageMessage.success('保存成功')
modalRef.current.setVisible(false) modalRef.current.setVisible(false)
tableRef.current.reloadTable() tableRef.current.reloadTable()
} }
......
import React, { useState, useEffect, useRef } from 'react' import React, { useState, useEffect, useRef } from 'react'
import { PageHeaderWrapper } from '@ant-design/pro-layout' import { PageHeaderWrapper } from '@ant-design/pro-layout'
import { SageTable, SageModal, SageButton, sageMessage, ActionSet } from '@/components/Common' import { SageTable, SageModal, SageButton, SageMessage, ActionSet } from '@/components/Common'
import { createFromIconfontCN, PlusOutlined, EditOutlined, ReloadOutlined, SwapOutlined, DeleteOutlined, VerticalAlignBottomOutlined, VerticalAlignTopOutlined } from '@ant-design/icons'; import { createFromIconfontCN, PlusOutlined, EditOutlined, ReloadOutlined, SwapOutlined, DeleteOutlined, VerticalAlignBottomOutlined, VerticalAlignTopOutlined } from '@ant-design/icons';
import moment from 'moment'; import moment from 'moment';
import config from '@/config'
import { getEnumDropDownList } from '@/services/enum' import { getEnumDropDownList } from '@/services/enum'
import { queryMenu, updateMenu, addMenu, removeMenu, getMenuDetail, clearMenu } from './service'; import { queryMenu, updateMenu, addMenu, removeMenu, getMenuDetail, clearMenu } from './service';
import CreateForm from './components/CreateForm' import CreateForm from './components/CreateForm'
import UpdateForm from './components/UpdateForm' import UpdateForm from './components/UpdateForm'
const IconFont = createFromIconfontCN({ const IconFont = createFromIconfontCN({
scriptUrl: '//at.alicdn.com/t/font_1873986_46xeik9dra8.js', scriptUrl: config.IconUrl,
}); });
// 详情数据 // 详情数据
...@@ -113,7 +114,7 @@ const MenuList = () => { ...@@ -113,7 +114,7 @@ const MenuList = () => {
const res = await removeMenu({ id: record.id }) const res = await removeMenu({ id: record.id })
if (res.isSuccess) { if (res.isSuccess) {
sageMessage.success('删除成功') SageMessage.success('删除成功')
tableRef.current.reloadTable() tableRef.current.reloadTable()
} }
} }
...@@ -262,7 +263,7 @@ const MenuList = () => { ...@@ -262,7 +263,7 @@ const MenuList = () => {
const rowRecords = tableRef.current.getSelectedRowKeys() const rowRecords = tableRef.current.getSelectedRowKeys()
const res = await removeMenu({ idArr: rowRecords }) const res = await removeMenu({ idArr: rowRecords })
if (res.isSuccess) { if (res.isSuccess) {
sageMessage.success('删除成功') SageMessage.success('删除成功')
tableRef.current.reloadTable() tableRef.current.reloadTable()
} }
} }
...@@ -281,7 +282,7 @@ const MenuList = () => { ...@@ -281,7 +282,7 @@ const MenuList = () => {
const onRefreshMenu = async () => { const onRefreshMenu = async () => {
const res = await clearMenu() const res = await clearMenu()
if (res.isSuccess) { if (res.isSuccess) {
sageMessage.success('菜单更新成功') SageMessage.success('菜单更新成功')
} }
} }
...@@ -335,7 +336,7 @@ const MenuList = () => { ...@@ -335,7 +336,7 @@ const MenuList = () => {
setModalLoading(false) setModalLoading(false)
if (res.isSuccess) { if (res.isSuccess) {
sageMessage.success('保存成功') SageMessage.success('保存成功')
modalRef.current.setVisible(false) modalRef.current.setVisible(false)
tableRef.current.reloadTable() tableRef.current.reloadTable()
} }
......
import React, { useState, useRef } from 'react' import React, { useState, useRef } from 'react'
import { PageHeaderWrapper } from '@ant-design/pro-layout' import { PageHeaderWrapper } from '@ant-design/pro-layout'
import { Card, Switch, Modal } from 'antd' import { Card, Switch, Modal } from 'antd'
import { SageLayoutLR, SageTable, SageModal, SageForm, SageButton, sageMessage, ActionSet } from '@/components/Common' import { SageLayoutLR, SageTable, SageModal, SageForm, SageButton, SageMessage, ActionSet } from '@/components/Common'
import { MenuTree } from '@/components/Business' import { MenuTree } from '@/components/Business'
import { PlusOutlined, CheckOutlined, ExclamationCircleOutlined } from '@ant-design/icons'; import { PlusOutlined, CheckOutlined, ExclamationCircleOutlined } from '@ant-design/icons';
import { queryRule, updateRule, addRule, removeRule, getRuleDetail, openOrClose } from './service'; import { queryRule, updateRule, addRule, removeRule, getRuleDetail, openOrClose } from './service';
...@@ -86,7 +86,7 @@ const TableList = () => { ...@@ -86,7 +86,7 @@ const TableList = () => {
const res = await removeRule({ id: record.id }) const res = await removeRule({ id: record.id })
if (res.isSuccess) { if (res.isSuccess) {
sageMessage.success('删除成功') SageMessage.success('删除成功')
tableRef.current.reloadTable() tableRef.current.reloadTable()
} }
} }
...@@ -124,7 +124,7 @@ const TableList = () => { ...@@ -124,7 +124,7 @@ const TableList = () => {
} }
} }
tableRef.current.setDataSource(tableData) tableRef.current.setDataSource(tableData)
sageMessage.success(checked ? '启用成功' : '禁用成功') SageMessage.success(checked ? '启用成功' : '禁用成功')
} }
}, },
onCancel: () => { onCancel: () => {
...@@ -241,7 +241,7 @@ const TableList = () => { ...@@ -241,7 +241,7 @@ const TableList = () => {
setModalLoading(false) setModalLoading(false)
if (res.isSuccess) { if (res.isSuccess) {
sageMessage.success('保存成功') SageMessage.success('保存成功')
modalRef.current.setVisible(false) modalRef.current.setVisible(false)
tableRef.current.reloadTable() tableRef.current.reloadTable()
} }
...@@ -261,7 +261,7 @@ const TableList = () => { ...@@ -261,7 +261,7 @@ const TableList = () => {
const res = await updateRule(pp) const res = await updateRule(pp)
if (res.isSuccess) { if (res.isSuccess) {
sageMessage.success('保存成功') SageMessage.success('保存成功')
} }
} }
......
import React, { useState, useRef, useEffect } from 'react'
import { PageHeaderWrapper } from '@ant-design/pro-layout'
import { Card, Switch, Modal } from 'antd'
import { connect } from 'umi'
import { SageLayoutLR, SageTable, SageModal, SageForm, SageButton, SageMessage, ActionSet } from '@/components/Common'
import { getUserDetail } from '@/pages/user/manage/service'
import style from './style.less'
const Center = (props) => {
const [userDetail, setUserDetail] = useState({})
const requestCenterInfo = async () => {
const res = await getUserDetail({id: props.user.currentUser.userId})
if (res.isSuccess) {
setUserDetail(res.data)
}
}
useEffect(() => {
requestCenterInfo()
}, [])
return (
<PageHeaderWrapper>
<SageLayoutLR
leftWidth="300"
left={
<Card title="个人信息" size="small" style={{ height: '100%' }}>
<div>
<div className={style["center-avator"]}>
<img src="" width="120" height="120" />
</div>
<div className={style["user-info"]}>
<div></div>
</div>
</div>
</Card>
}
right={
<div style={{ paddingLeft: 12, height: '100%' }}>
<Card title="基本资料" size="small" style={{ height: '100%' }}>
修改密码
</Card>
</div>
}
/>
</PageHeaderWrapper>
)
}
export default connect(({user}) => ({user}))(Center)
.center-avator {
margin: 12px 0;
text-align: center;
}
...@@ -2,7 +2,7 @@ import React, { useState, useRef } from 'react' ...@@ -2,7 +2,7 @@ import React, { useState, useRef } from 'react'
import { PageHeaderWrapper } from '@ant-design/pro-layout' import { PageHeaderWrapper } from '@ant-design/pro-layout'
import { Card, Modal, Switch } from 'antd' import { Card, Modal, Switch } from 'antd'
import moment from 'moment' import moment from 'moment'
import { SageLayoutLR, SageTable, SageModal, SageForm, SageButton, sageMessage, ActionSet } from '@/components/Common' import { SageLayoutLR, SageTable, SageModal, SageForm, SageButton, SageMessage, ActionSet } from '@/components/Common'
import { DeptTree } from '@/components/Business' import { DeptTree } from '@/components/Business'
import { PlusOutlined, RedoOutlined, ExclamationCircleOutlined } from '@ant-design/icons'; import { PlusOutlined, RedoOutlined, ExclamationCircleOutlined } from '@ant-design/icons';
import { queryUser, updateUser, addUser, removeUser, getUserDetail, openOrClose } from './service'; import { queryUser, updateUser, addUser, removeUser, getUserDetail, openOrClose } from './service';
...@@ -102,7 +102,7 @@ const TableList = () => { ...@@ -102,7 +102,7 @@ const TableList = () => {
const res = await removeUser({ id: record.loginId }) const res = await removeUser({ id: record.loginId })
if (res.isSuccess) { if (res.isSuccess) {
sageMessage.success('删除成功') SageMessage.success('删除成功')
tableRef.current.reloadTable() tableRef.current.reloadTable()
} }
} }
...@@ -124,7 +124,7 @@ const TableList = () => { ...@@ -124,7 +124,7 @@ const TableList = () => {
} }
} }
tableRef.current.setDataSource(tableData) tableRef.current.setDataSource(tableData)
sageMessage.success(checked ? '启用成功' : '禁用成功') SageMessage.success(checked ? '启用成功' : '禁用成功')
} }
}, },
onCancel: () => { onCancel: () => {
...@@ -249,7 +249,7 @@ const TableList = () => { ...@@ -249,7 +249,7 @@ const TableList = () => {
setModalLoading(false) setModalLoading(false)
if (res.isSuccess) { if (res.isSuccess) {
sageMessage.success('保存成功') SageMessage.success('保存成功')
modalRef.current.setVisible(false) modalRef.current.setVisible(false)
tableRef.current.reloadTable() tableRef.current.reloadTable()
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论