|
@@ -1,6 +1,6 @@
|
|
|
import { PageLoading } from '@ant-design/pro-layout';
|
|
|
import { history, useModel } from 'umi';
|
|
|
-import UserStorage from '@/config/sagacare/sagacare_user';
|
|
|
+import { queryTenantData } from '@/services/sagacare_service/member';
|
|
|
|
|
|
/** 获取用户信息比较慢的时候会展示一个 loading */
|
|
|
export const initialStateConfig = {
|
|
@@ -13,7 +13,7 @@ export const initialStateConfig = {
|
|
|
export async function getInitialState(): Promise<{
|
|
|
projectId: String;
|
|
|
currentUser?: API.CurrentUser;
|
|
|
- fetchUser?: () => Promise<API.CurrentUser | undefined>;
|
|
|
+ companyConfig?: any;
|
|
|
//fetchUserInfo?: () => Promise<API.CurrentUser | undefined>;
|
|
|
}> {
|
|
|
const { location } = history;
|
|
@@ -27,40 +27,31 @@ export async function getInitialState(): Promise<{
|
|
|
//debugger;
|
|
|
let currentUser = {
|
|
|
appId: 'wxda2ef261ac3cca32',
|
|
|
- companyId: '17fe48afcdde4d6797583c6d6270a035', // 'ff80c708fe72446eb790b764c3a7b66b',
|
|
|
+ companyId: '17fe48afcdde4d6797583c6d6270a035', // ff80c708fe72446eb790b764c3a7b66b,
|
|
|
loginType: 'app',
|
|
|
manageUserType: 3,
|
|
|
name: '赵静',
|
|
|
openId: 'oDcGY5Qq3Vk-7WKTNsn-lLGNT118',
|
|
|
phone: '13810794283',
|
|
|
- projectId: 'Pj1101080259', //'Pj1101099999',
|
|
|
+ projectId: 'Pj1101080259', // Pj1101099999
|
|
|
userId: 'db445a9cd7be4341a14448928014605c',
|
|
|
};
|
|
|
- let projectId = 'Pj1101080259'; // 'Pj1101099999';
|
|
|
+ let projectId = 'Pj1101080259'; // Pj1101099999
|
|
|
if (location.pathname.indexOf('login') == -1 && token) {
|
|
|
var localUser = localStorage.getItem('user') || '';
|
|
|
currentUser = JSON.parse(localUser);
|
|
|
projectId = currentUser?.projectId;
|
|
|
}
|
|
|
-
|
|
|
- if (projectId == 'Pj3301100002') {
|
|
|
- //之江项目 验证token
|
|
|
- // currentUser = await fetchUser();
|
|
|
- } else {
|
|
|
- //非之江项目
|
|
|
- let tempUser = {
|
|
|
- name: '行政测试',
|
|
|
- phone: '17611228068',
|
|
|
- id: '9a1ecfbacb6b4f249bf2dd3ec7793ead',
|
|
|
- };
|
|
|
-
|
|
|
- var userObj = UserStorage.getInstance();
|
|
|
- userObj.setUser(tempUser);
|
|
|
+ let companyConfig = {};
|
|
|
+ if (currentUser.userId) {
|
|
|
+ const res = await queryTenantData(currentUser);
|
|
|
+ companyConfig = res.data;
|
|
|
}
|
|
|
|
|
|
return {
|
|
|
projectId,
|
|
|
currentUser,
|
|
|
+ companyConfig,
|
|
|
};
|
|
|
}
|
|
|
|