feat: 修改部分文案及删除多余内容
This commit is contained in:
22
src/App.tsx
22
src/App.tsx
@@ -1,20 +1,30 @@
|
||||
import { useEffect, memo } from 'react';
|
||||
import './App.less';
|
||||
import { useLocation, useNavigate, Outlet } from 'react-router-dom';
|
||||
import Header from '@views/header'
|
||||
import { memo, useEffect } from 'react'
|
||||
import { Outlet, useLocation, useNavigate } from 'react-router-dom'
|
||||
import './App.less'
|
||||
|
||||
const App = () => {
|
||||
const location = useLocation();
|
||||
const location = useLocation()
|
||||
const navigate = useNavigate()
|
||||
useEffect(() => {
|
||||
if (location.pathname === '/') {
|
||||
const userInfoStorage = localStorage.getItem('userInfo')
|
||||
if (!userInfoStorage) {
|
||||
return window.location.replace('/login')
|
||||
}
|
||||
navigate('/question-bank')
|
||||
}
|
||||
}, [location])
|
||||
return (
|
||||
<div className="app-main" style={{ padding: location.pathname === '/login' ? '66px 0 0' : '66px 16px 32px' }}>
|
||||
<div
|
||||
className='app-main'
|
||||
style={{ padding: location.pathname === '/login' ? '66px 0 0' : '66px 16px 32px' }}
|
||||
>
|
||||
<Header />
|
||||
<div className='content-box' style={{ width: location.pathname === '/login' ? '100%' : '1439px' }}>
|
||||
<div
|
||||
className='content-box'
|
||||
style={{ width: location.pathname === '/login' ? '100%' : '1439px' }}
|
||||
>
|
||||
<Outlet />
|
||||
</div>
|
||||
</div>
|
||||
|
Reference in New Issue
Block a user