|
@@ -44,10 +44,11 @@ function Layout() {
|
|
|
|
|
|
|
|
// 当前路径选中的左侧菜单
|
|
// 当前路径选中的左侧菜单
|
|
|
const location = useLocation()
|
|
const location = useLocation()
|
|
|
- const [path, setPath] = useState('')
|
|
|
|
|
const sroolRef = useRef<HTMLDivElement>(null)
|
|
const sroolRef = useRef<HTMLDivElement>(null)
|
|
|
const sroolTimeRef = useRef(-1)
|
|
const sroolTimeRef = useRef(-1)
|
|
|
|
|
|
|
|
|
|
+ const [acPageName, setAcPageName] = useState(['', ''])
|
|
|
|
|
+
|
|
|
useEffect(() => {
|
|
useEffect(() => {
|
|
|
if (loding) {
|
|
if (loding) {
|
|
|
const arr = location.pathname.split('/')
|
|
const arr = location.pathname.split('/')
|
|
@@ -69,8 +70,13 @@ function Layout() {
|
|
|
}
|
|
}
|
|
|
}, 200)
|
|
}, 200)
|
|
|
}
|
|
}
|
|
|
|
|
+ const pathRes = pathTemp.split('_')[0]
|
|
|
|
|
|
|
|
- setPath(pathTemp)
|
|
|
|
|
|
|
+ tabLeftArr.forEach(v1 => {
|
|
|
|
|
+ v1.son.forEach(v2 => {
|
|
|
|
|
+ if (v2.path === pathRes) setAcPageName([v1.name, v2.name])
|
|
|
|
|
+ })
|
|
|
|
|
+ })
|
|
|
}
|
|
}
|
|
|
}, [location, loding])
|
|
}, [location, loding])
|
|
|
|
|
|
|
@@ -222,20 +228,6 @@ function Layout() {
|
|
|
// 点击用户 出来 退出登录 修改密码
|
|
// 点击用户 出来 退出登录 修改密码
|
|
|
const [isUserBtnShow, setIsUserBtnShow] = useState(false)
|
|
const [isUserBtnShow, setIsUserBtnShow] = useState(false)
|
|
|
|
|
|
|
|
- // path的高亮判断
|
|
|
|
|
- const pathAcFu = useCallback(
|
|
|
|
|
- (url: string) => {
|
|
|
|
|
- let flag = false
|
|
|
|
|
- if (url === '/') {
|
|
|
|
|
- if (path.includes('/_') || path === '/') flag = true
|
|
|
|
|
- } else {
|
|
|
|
|
- if (path.includes(url)) flag = true
|
|
|
|
|
- }
|
|
|
|
|
- return flag
|
|
|
|
|
- },
|
|
|
|
|
- [path]
|
|
|
|
|
- )
|
|
|
|
|
-
|
|
|
|
|
return (
|
|
return (
|
|
|
<div className={styles.Layout}>
|
|
<div className={styles.Layout}>
|
|
|
{/* 左边 */}
|
|
{/* 左边 */}
|
|
@@ -252,7 +244,11 @@ function Layout() {
|
|
|
hidden={!v.son.length || (v.son.length === 1 && v.son[0].name === '藏品详情')}
|
|
hidden={!v.son.length || (v.son.length === 1 && v.son[0].name === '藏品详情')}
|
|
|
>
|
|
>
|
|
|
<div
|
|
<div
|
|
|
- className={classNames('layoutLRowBoxTxt', v.show ? 'layoutLRowBoxTxtShow' : '')}
|
|
|
|
|
|
|
+ className={classNames(
|
|
|
|
|
+ 'layoutLRowBoxTxt',
|
|
|
|
|
+ v.show ? 'layoutLRowBoxTxtShow' : '',
|
|
|
|
|
+ acPageName[0] === v.name ? 'layoutLRowBoxTxtShowAc' : ''
|
|
|
|
|
+ )}
|
|
|
onClick={() => {
|
|
onClick={() => {
|
|
|
setList(
|
|
setList(
|
|
|
list.map(c => ({
|
|
list.map(c => ({
|
|
@@ -273,10 +269,10 @@ function Layout() {
|
|
|
hidden={v2.id >= 9901}
|
|
hidden={v2.id >= 9901}
|
|
|
className={classNames(
|
|
className={classNames(
|
|
|
'layoutLRowBoxRow',
|
|
'layoutLRowBoxRow',
|
|
|
- pathAcFu(v2.path) ? 'active' : '',
|
|
|
|
|
|
|
+ acPageName[1] === v2.name ? 'active' : '',
|
|
|
v.show ? '' : 'layoutLRowBoxRowHide'
|
|
v.show ? '' : 'layoutLRowBoxRowHide'
|
|
|
)}
|
|
)}
|
|
|
- ref={pathAcFu(v2.path) ? sroolRef : null}
|
|
|
|
|
|
|
+ ref={acPageName[1] === v2.name ? sroolRef : null}
|
|
|
onClick={() => pathCutFu(v2)}
|
|
onClick={() => pathCutFu(v2)}
|
|
|
>
|
|
>
|
|
|
{v2.name}
|
|
{v2.name}
|