|
@@ -14,7 +14,7 @@ import { reject } from 'lodash';
|
|
|
const layoutActionRef = createRef();
|
|
const layoutActionRef = createRef();
|
|
|
|
|
|
|
|
const { query = {}, pathname } = history.location;
|
|
const { query = {}, pathname } = history.location;
|
|
|
-const { redirect, hospSign='dOBHdoPmJgPGnMSH' } = query;
|
|
|
|
|
|
|
+const { redirect, hospSign = 'dOBHdoPmJgPGnMSH' } = query;
|
|
|
const isDev = process.env.NODE_ENV === 'development';
|
|
const isDev = process.env.NODE_ENV === 'development';
|
|
|
const loginParams = localStorage.getItem('loginParams');
|
|
const loginParams = localStorage.getItem('loginParams');
|
|
|
|
|
|
|
@@ -37,15 +37,25 @@ let requestMethod = 'get';
|
|
|
|
|
|
|
|
/** 获取用户信息比较慢的时候会展示一个 loading */
|
|
/** 获取用户信息比较慢的时候会展示一个 loading */
|
|
|
|
|
|
|
|
|
|
+console.log({ location });
|
|
|
|
|
+
|
|
|
|
|
+const { search } = location;
|
|
|
|
|
+
|
|
|
|
|
+let urlStr = search.split('?')[1]
|
|
|
|
|
+const urlSearchParams = new URLSearchParams(urlStr)
|
|
|
|
|
+const urlParamsResult = Object.fromEntries(urlSearchParams.entries());
|
|
|
|
|
+
|
|
|
|
|
+const {token} = urlParamsResult
|
|
|
|
|
+
|
|
|
|
|
|
|
|
const userData = {
|
|
const userData = {
|
|
|
avatar: "https://gw.alipayobjects.com/zos/antfincdn/XAosXuNZyF/BiazfanxmamNRoxxVxka.png",
|
|
avatar: "https://gw.alipayobjects.com/zos/antfincdn/XAosXuNZyF/BiazfanxmamNRoxxVxka.png",
|
|
|
name: "中台管理员",
|
|
name: "中台管理员",
|
|
|
- token: "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjEwMzE5MDM2MzYyLCJ1c2VySWQiOjEwM30.w3R4Y18g-rCTu1w01BKKJZSY3FUQSRUuKK-AKSgWQCY",
|
|
|
|
|
|
|
+ token:token,
|
|
|
userid: 103
|
|
userid: 103
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-localStorage.setItem('userData',JSON.stringify(userData))
|
|
|
|
|
|
|
+localStorage.setItem('userData', JSON.stringify(userData))
|
|
|
|
|
|
|
|
export const initialStateConfig = {
|
|
export const initialStateConfig = {
|
|
|
loading: <PageLoading />,
|
|
loading: <PageLoading />,
|
|
@@ -57,7 +67,7 @@ export const initialStateConfig = {
|
|
|
export async function getInitialState() {
|
|
export async function getInitialState() {
|
|
|
|
|
|
|
|
const fetchUserInfo = async () => {
|
|
const fetchUserInfo = async () => {
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
//const userData = localStorage.getItem('userData');
|
|
//const userData = localStorage.getItem('userData');
|
|
|
if (userData) {
|
|
if (userData) {
|
|
|
return userData;
|
|
return userData;
|
|
@@ -276,8 +286,8 @@ const mappingIcon = menuData => {
|
|
|
export const layout = async ({ initialState }) => {
|
|
export const layout = async ({ initialState }) => {
|
|
|
|
|
|
|
|
return {
|
|
return {
|
|
|
- headerTitleRender:false,
|
|
|
|
|
- headerRender:false,
|
|
|
|
|
|
|
+ headerTitleRender: false,
|
|
|
|
|
+ headerRender: false,
|
|
|
rightContentRender: () => <RightContent />,
|
|
rightContentRender: () => <RightContent />,
|
|
|
disableContentMargin: false,
|
|
disableContentMargin: false,
|
|
|
waterMarkProps: {
|
|
waterMarkProps: {
|
|
@@ -288,7 +298,7 @@ export const layout = async ({ initialState }) => {
|
|
|
onPageChange: () => {
|
|
onPageChange: () => {
|
|
|
const { location } = history; // 如果没有登录,重定向到 login
|
|
const { location } = history; // 如果没有登录,重定向到 login
|
|
|
if (!initialState?.currentUser && location.pathname !== '/user/login') {
|
|
if (!initialState?.currentUser && location.pathname !== '/user/login') {
|
|
|
- history.push(loginPath);
|
|
|
|
|
|
|
+ history.push(loginPath);
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
menu: {
|
|
menu: {
|