|
@@ -29,6 +29,21 @@ import { getUserInfoByIdAPI } from '@/store/action/Z6user'
|
|
import { maiDianFu } from '@/components/ZmaiDian'
|
|
import { maiDianFu } from '@/components/ZmaiDian'
|
|
|
|
|
|
function Layout() {
|
|
function Layout() {
|
|
|
|
+ // 字典加载完毕才加载别的
|
|
|
|
+ const [isLoding, setIsLoding] = useState(false)
|
|
|
|
+
|
|
|
|
+ const dispatch = useDispatch()
|
|
|
|
+
|
|
|
|
+ // 很多地方会用到的下拉框 或者级联数据
|
|
|
|
+ useEffect(() => {
|
|
|
|
+ // 获取全部级联数据
|
|
|
|
+ dispatch(
|
|
|
|
+ Z1_APIgetDict(undefined, () => {
|
|
|
|
+ setIsLoding(true)
|
|
|
|
+ })
|
|
|
|
+ )
|
|
|
|
+ }, [dispatch])
|
|
|
|
+
|
|
// 获取最新用户信息 存到本地
|
|
// 获取最新用户信息 存到本地
|
|
const getUserInfoFu = useCallback(async () => {
|
|
const getUserInfoFu = useCallback(async () => {
|
|
const userInfoJting = getTokenInfo()
|
|
const userInfoJting = getTokenInfo()
|
|
@@ -79,14 +94,6 @@ function Layout() {
|
|
// 获取用户信息
|
|
// 获取用户信息
|
|
const { userInfo, passEditShow } = useSelector((state: RootState) => state.A0Layout)
|
|
const { userInfo, passEditShow } = useSelector((state: RootState) => state.A0Layout)
|
|
|
|
|
|
- const dispatch = useDispatch()
|
|
|
|
-
|
|
|
|
- // 很多地方会用到的下拉框 或者级联数据
|
|
|
|
- useEffect(() => {
|
|
|
|
- // 获取全部级联数据
|
|
|
|
- dispatch(Z1_APIgetDict())
|
|
|
|
- }, [dispatch])
|
|
|
|
-
|
|
|
|
// 当前路径选中的左侧菜单
|
|
// 当前路径选中的左侧菜单
|
|
const location = useLocation()
|
|
const location = useLocation()
|
|
const [path, setPath] = useState('')
|
|
const [path, setPath] = useState('')
|
|
@@ -369,23 +376,25 @@ function Layout() {
|
|
{/* 右边主体 */}
|
|
{/* 右边主体 */}
|
|
<div className='layoutRightMain'>
|
|
<div className='layoutRightMain'>
|
|
{/* 二级路由页面 */}
|
|
{/* 二级路由页面 */}
|
|
- <div className='mainBoxR'>
|
|
|
|
- <React.Suspense fallback={<SpinLoding />}>
|
|
|
|
- <Switch>
|
|
|
|
- {/* 左侧tab栏页面 */}
|
|
|
|
- {RouterCom.map(v => (
|
|
|
|
- <AuthRoute key={v.id} exact path={v.path} component={v.Com} />
|
|
|
|
- ))}
|
|
|
|
-
|
|
|
|
- {/* 非tab栏页面 */}
|
|
|
|
- {routerSon.map(v => (
|
|
|
|
- <AuthRoute key={v.id} exact path={v.path} component={v.Com} />
|
|
|
|
- ))}
|
|
|
|
-
|
|
|
|
- <Route path='*' component={NotFound} />
|
|
|
|
- </Switch>
|
|
|
|
- </React.Suspense>
|
|
|
|
- </div>
|
|
|
|
|
|
+ {isLoding ? (
|
|
|
|
+ <div className='mainBoxR'>
|
|
|
|
+ <React.Suspense fallback={<SpinLoding />}>
|
|
|
|
+ <Switch>
|
|
|
|
+ {/* 左侧tab栏页面 */}
|
|
|
|
+ {RouterCom.map(v => (
|
|
|
|
+ <AuthRoute key={v.id} exact path={v.path} component={v.Com} />
|
|
|
|
+ ))}
|
|
|
|
+
|
|
|
|
+ {/* 非tab栏页面 */}
|
|
|
|
+ {routerSon.map(v => (
|
|
|
|
+ <AuthRoute key={v.id} exact path={v.path} component={v.Com} />
|
|
|
|
+ ))}
|
|
|
|
+
|
|
|
|
+ <Route path='*' component={NotFound} />
|
|
|
|
+ </Switch>
|
|
|
|
+ </React.Suspense>
|
|
|
|
+ </div>
|
|
|
|
+ ) : null}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
|