|
@@ -6,6 +6,8 @@ import logo from '../public/logo.svg'
|
|
|
import BasicModal, { BasicDrawer } from '@/components/Modal'
|
|
import BasicModal, { BasicDrawer } from '@/components/Modal'
|
|
|
// import ws, { onMessage } from '@/utils/ws'
|
|
// import ws, { onMessage } from '@/utils/ws'
|
|
|
import { tryChangeWorkStatus } from './components/RightContent/Book'
|
|
import { tryChangeWorkStatus } from './components/RightContent/Book'
|
|
|
|
|
+import { getAuthCache, setAuthCache } from './utils/auth'
|
|
|
|
|
+import { LAYOUT_COLLAPSED_KEY } from './utils/cache/cacheEnum'
|
|
|
|
|
|
|
|
const loginPath = '/user/login'
|
|
const loginPath = '/user/login'
|
|
|
|
|
|
|
@@ -42,12 +44,13 @@ export async function getInitialState() {
|
|
|
// })
|
|
// })
|
|
|
// }
|
|
// }
|
|
|
|
|
|
|
|
|
|
+ const collapsed = getAuthCache(LAYOUT_COLLAPSED_KEY) || false
|
|
|
return {
|
|
return {
|
|
|
fetchUserInfo,
|
|
fetchUserInfo,
|
|
|
fetchPermData,
|
|
fetchPermData,
|
|
|
permData,
|
|
permData,
|
|
|
...userInfo,
|
|
...userInfo,
|
|
|
- settings: {}
|
|
|
|
|
|
|
+ settings: { collapsed, defaultCollapsed: collapsed }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
return {
|
|
return {
|
|
@@ -57,7 +60,12 @@ export async function getInitialState() {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-export const layout = ({ initialState }) => {
|
|
|
|
|
|
|
+export const layout = ({ initialState, setInitialState }) => {
|
|
|
|
|
+ const onCollapse = collapsed => {
|
|
|
|
|
+ setInitialState({ ...initialState, settings: { ...initialState.settings, collapsed } })
|
|
|
|
|
+ setAuthCache(LAYOUT_COLLAPSED_KEY, collapsed)
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
return {
|
|
return {
|
|
|
logo,
|
|
logo,
|
|
|
rightContentRender: () => <RightContent />,
|
|
rightContentRender: () => <RightContent />,
|
|
@@ -97,6 +105,8 @@ export const layout = ({ initialState }) => {
|
|
|
// </div>
|
|
// </div>
|
|
|
// ],
|
|
// ],
|
|
|
// menuHeaderRender: false,
|
|
// menuHeaderRender: false,
|
|
|
- ...initialState?.settings
|
|
|
|
|
|
|
+ ...initialState?.settings,
|
|
|
|
|
+ breakpoint: false,
|
|
|
|
|
+ onCollapse
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|