|
@@ -8,20 +8,22 @@ import { Button, Form, Input, Modal } from 'antd'
|
|
|
import { Base64 } from 'js-base64'
|
|
import { Base64 } from 'js-base64'
|
|
|
import encodeStr from '@/utils/pass'
|
|
import encodeStr from '@/utils/pass'
|
|
|
import { passWordEditAPI } from '@/store/action/layout'
|
|
import { passWordEditAPI } from '@/store/action/layout'
|
|
|
-import { changSetFu, getTokenInfo, removeTokenInfo } from '@/utils/storage'
|
|
|
|
|
|
|
+import { getTokenInfo, removeTokenInfo } from '@/utils/storage'
|
|
|
import { MessageFu } from '@/utils/message'
|
|
import { MessageFu } from '@/utils/message'
|
|
|
import NotFound from '@/components/NotFound'
|
|
import NotFound from '@/components/NotFound'
|
|
|
import classNames from 'classnames'
|
|
import classNames from 'classnames'
|
|
|
import tabLeftArr, { routerSon, RouterType, RouterTypeRow } from './data'
|
|
import tabLeftArr, { routerSon, RouterType, RouterTypeRow } from './data'
|
|
|
import MyPopconfirm from '@/components/MyPopconfirm'
|
|
import MyPopconfirm from '@/components/MyPopconfirm'
|
|
|
-import store from '@/store'
|
|
|
|
|
|
|
+import store, { RootState } from '@/store'
|
|
|
import SpinLodingSon from '@/components/SpinLodingSon'
|
|
import SpinLodingSon from '@/components/SpinLodingSon'
|
|
|
import { DownOutlined, RightOutlined } from '@ant-design/icons'
|
|
import { DownOutlined, RightOutlined } from '@ant-design/icons'
|
|
|
import { I6_APIgetInfo } from '@/store/action/Isystem/I6role'
|
|
import { I6_APIgetInfo } from '@/store/action/Isystem/I6role'
|
|
|
import { TypeI6Role } from '../Isystem/I6role/data'
|
|
import { TypeI6Role } from '../Isystem/I6role/data'
|
|
|
-import { useDispatch } from 'react-redux'
|
|
|
|
|
|
|
+import { useDispatch, useSelector } from 'react-redux'
|
|
|
import { I2_APIgetDict } from '@/store/action/Isystem/I2dict'
|
|
import { I2_APIgetDict } from '@/store/action/Isystem/I2dict'
|
|
|
import { E1_APIgetTree } from '@/store/action/Eculture/E1tag'
|
|
import { E1_APIgetTree } from '@/store/action/Eculture/E1tag'
|
|
|
|
|
+import { baseURL } from '@/utils/http'
|
|
|
|
|
+import baseTouXiangImg from '@/assets/img/user.png'
|
|
|
|
|
|
|
|
function Layout() {
|
|
function Layout() {
|
|
|
const [loding, setLoding] = useState(false)
|
|
const [loding, setLoding] = useState(false)
|
|
@@ -39,8 +41,12 @@ function Layout() {
|
|
|
}, [dispatch])
|
|
}, [dispatch])
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
useEffect(() => {
|
|
|
|
|
+ // 用户信息存到仓库
|
|
|
|
|
+ store.dispatch({ type: 'layout/userInfo', payload: (getTokenInfo() || {}).user })
|
|
|
getListFu()
|
|
getListFu()
|
|
|
}, [getListFu])
|
|
}, [getListFu])
|
|
|
|
|
+ // 获取用户信息
|
|
|
|
|
+ const { userInfo, passEditShow } = useSelector((state: RootState) => state.A0Layout)
|
|
|
|
|
|
|
|
// 当前路径选中的左侧菜单
|
|
// 当前路径选中的左侧菜单
|
|
|
const location = useLocation()
|
|
const location = useLocation()
|
|
@@ -123,20 +129,23 @@ function Layout() {
|
|
|
const tempArr: RouterTypeRow[] = []
|
|
const tempArr: RouterTypeRow[] = []
|
|
|
|
|
|
|
|
// 权限数据存到仓库
|
|
// 权限数据存到仓库
|
|
|
- const roleArrStoreArr: RouterTypeRow[] = []
|
|
|
|
|
|
|
+ const roleArrStoreArr: RouterType = []
|
|
|
|
|
|
|
|
tabLeftArr.forEach(v1 => {
|
|
tabLeftArr.forEach(v1 => {
|
|
|
if (v1.son && v1.son[0]) {
|
|
if (v1.son && v1.son[0]) {
|
|
|
|
|
+ const obj = {
|
|
|
|
|
+ ...v1,
|
|
|
|
|
+ son: [] as RouterTypeRow[]
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
v1.son.forEach(v2 => {
|
|
v1.son.forEach(v2 => {
|
|
|
if (isOkIdArr.includes(v2.id)) {
|
|
if (isOkIdArr.includes(v2.id)) {
|
|
|
tempArr.push(v2)
|
|
tempArr.push(v2)
|
|
|
-
|
|
|
|
|
// 过滤掉 藏品详情 页
|
|
// 过滤掉 藏品详情 页
|
|
|
- if (v2.id < 9901) {
|
|
|
|
|
- roleArrStoreArr.push({ ...v2, authority: true })
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ if (v2.id < 9901) obj.son.push({ ...v2, authority: true })
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
|
|
+ roleArrStoreArr.push(obj)
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
|
|
|
|
@@ -195,12 +204,9 @@ function Layout() {
|
|
|
// 点击跳转
|
|
// 点击跳转
|
|
|
const pathCutFu = useCallback((item: RouterTypeRow) => {
|
|
const pathCutFu = useCallback((item: RouterTypeRow) => {
|
|
|
history.push(item.path)
|
|
history.push(item.path)
|
|
|
- if (item.name !== '工作台') changSetFu(item)
|
|
|
|
|
|
|
+ // if (item.name !== '工作台') changSetFu(item)
|
|
|
}, [])
|
|
}, [])
|
|
|
|
|
|
|
|
- // 修改密码相关
|
|
|
|
|
- const [open, setOpen] = useState(false)
|
|
|
|
|
-
|
|
|
|
|
// 拿到新密码的输入框的值
|
|
// 拿到新密码的输入框的值
|
|
|
const oldPasswordValue = useRef('')
|
|
const oldPasswordValue = useRef('')
|
|
|
|
|
|
|
@@ -219,6 +225,7 @@ function Layout() {
|
|
|
const res: any = await passWordEditAPI(obj)
|
|
const res: any = await passWordEditAPI(obj)
|
|
|
if (res.code === 0) {
|
|
if (res.code === 0) {
|
|
|
MessageFu.success('修改成功!')
|
|
MessageFu.success('修改成功!')
|
|
|
|
|
+ store.dispatch({ type: 'layout/passEditShow', payload: false })
|
|
|
loginExit()
|
|
loginExit()
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -298,7 +305,9 @@ function Layout() {
|
|
|
onMouseLeave={() => setIsUserBtnShow(false)}
|
|
onMouseLeave={() => setIsUserBtnShow(false)}
|
|
|
>
|
|
>
|
|
|
<div className='userNameBox' onClick={() => setIsUserBtnShow(true)}>
|
|
<div className='userNameBox' onClick={() => setIsUserBtnShow(true)}>
|
|
|
- {getTokenInfo().user.realName || getTokenInfo().user.userName || '匿名'}
|
|
|
|
|
|
|
+ <img src={userInfo.thumb ? baseURL + userInfo.thumb : baseTouXiangImg} alt='' />
|
|
|
|
|
+
|
|
|
|
|
+ {userInfo.realName || userInfo.userName || '匿名'}
|
|
|
|
|
|
|
|
<div className='userInco userInco2'>
|
|
<div className='userInco userInco2'>
|
|
|
<CaretRightOutlined />
|
|
<CaretRightOutlined />
|
|
@@ -307,7 +316,11 @@ function Layout() {
|
|
|
|
|
|
|
|
<div className='userSet'>
|
|
<div className='userSet'>
|
|
|
<div>
|
|
<div>
|
|
|
- <span onClick={() => setOpen(true)}>修改密码</span>
|
|
|
|
|
|
|
+ <span
|
|
|
|
|
+ onClick={() => store.dispatch({ type: 'layout/passEditShow', payload: true })}
|
|
|
|
|
+ >
|
|
|
|
|
+ 修改密码
|
|
|
|
|
+ </span>
|
|
|
<MyPopconfirm txtK='退出登录' onConfirm={loginExit} Dom='退出登录' loc='bottom' />
|
|
<MyPopconfirm txtK='退出登录' onConfirm={loginExit} Dom='退出登录' loc='bottom' />
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
@@ -340,9 +353,9 @@ function Layout() {
|
|
|
{/* 点击修改密码打开的对话框 */}
|
|
{/* 点击修改密码打开的对话框 */}
|
|
|
<Modal
|
|
<Modal
|
|
|
destroyOnClose
|
|
destroyOnClose
|
|
|
- open={open}
|
|
|
|
|
|
|
+ open={passEditShow}
|
|
|
title='修改密码'
|
|
title='修改密码'
|
|
|
- onCancel={() => setOpen(false)}
|
|
|
|
|
|
|
+ onCancel={() => store.dispatch({ type: 'layout/passEditShow', payload: false })}
|
|
|
footer={
|
|
footer={
|
|
|
[] // 设置footer为空,去掉 取消 确定默认按钮
|
|
[] // 设置footer为空,去掉 取消 确定默认按钮
|
|
|
}
|
|
}
|
|
@@ -389,7 +402,9 @@ function Layout() {
|
|
|
</Form.Item>
|
|
</Form.Item>
|
|
|
|
|
|
|
|
<Form.Item wrapperCol={{ offset: 14, span: 16 }}>
|
|
<Form.Item wrapperCol={{ offset: 14, span: 16 }}>
|
|
|
- <Button onClick={() => setOpen(false)}>取消</Button>
|
|
|
|
|
|
|
+ <Button onClick={() => store.dispatch({ type: 'layout/passEditShow', payload: false })}>
|
|
|
|
|
+ 取消
|
|
|
|
|
+ </Button>
|
|
|
 
|
|
 
|
|
|
<Button type='primary' htmlType='submit'>
|
|
<Button type='primary' htmlType='submit'>
|
|
|
确定
|
|
确定
|