|
|
@@ -47,28 +47,30 @@ function Layout() {
|
|
|
const sroolTimeRef = useRef(-1)
|
|
|
|
|
|
useEffect(() => {
|
|
|
- const arr = location.pathname.split('/')
|
|
|
- let pathTemp = '/'
|
|
|
- if (arr[1]) pathTemp = '/' + arr[1]
|
|
|
-
|
|
|
- // 滚动到中间
|
|
|
- clearTimeout(sroolTimeRef.current)
|
|
|
- if (pathTemp !== '/goodsLook') {
|
|
|
- sroolTimeRef.current = window.setTimeout(() => {
|
|
|
- if (sroolRef.current) {
|
|
|
- const dom = document.querySelector('.layoutLeftMain') as HTMLDivElement
|
|
|
- if (dom) {
|
|
|
- dom.scrollTo({
|
|
|
- top: sroolRef.current.offsetTop - 350,
|
|
|
- behavior: 'smooth'
|
|
|
- })
|
|
|
+ if (loding) {
|
|
|
+ const arr = location.pathname.split('/')
|
|
|
+ let pathTemp = '/'
|
|
|
+ if (arr[1]) pathTemp = '/' + arr[1]
|
|
|
+
|
|
|
+ // 滚动到中间
|
|
|
+ clearTimeout(sroolTimeRef.current)
|
|
|
+ if (pathTemp !== '/goodsLook') {
|
|
|
+ sroolTimeRef.current = window.setTimeout(() => {
|
|
|
+ if (sroolRef.current) {
|
|
|
+ const dom = document.querySelector('.layoutLeftMain') as HTMLDivElement
|
|
|
+ if (dom) {
|
|
|
+ dom.scrollTo({
|
|
|
+ top: sroolRef.current.offsetTop - 350,
|
|
|
+ behavior: 'smooth'
|
|
|
+ })
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
- }, 200)
|
|
|
- }
|
|
|
+ }, 200)
|
|
|
+ }
|
|
|
|
|
|
- setPath(pathTemp)
|
|
|
- }, [location])
|
|
|
+ setPath(pathTemp)
|
|
|
+ }
|
|
|
+ }, [location, loding])
|
|
|
|
|
|
const [routerSonRes, setRouterSonRes] = useState<RouterTypeRow[]>([])
|
|
|
|
|
|
@@ -79,7 +81,7 @@ function Layout() {
|
|
|
const res = await I6_APIgetInfo(userInfo.roleId)
|
|
|
|
|
|
if (res.code === 0) {
|
|
|
- const isOkIdArr: number[] = [9901]
|
|
|
+ let isOkIdArr: number[] = [9901]
|
|
|
|
|
|
const roleArr: TypeI6Role[] = res.data.permission
|
|
|
|
|
|
@@ -104,7 +106,7 @@ function Layout() {
|
|
|
;[750].forEach(v => {
|
|
|
isOkIdArr.push(v)
|
|
|
})
|
|
|
- }
|
|
|
+ } else if (isOkIdArr.includes(750)) isOkIdArr = isOkIdArr.filter(v => v !== 750)
|
|
|
|
|
|
// 页面权限id,存到仓库
|
|
|
store.dispatch({ type: 'layout/authorityIds', payload: isOkIdArr })
|