ソースを参照

增加tenantCode

louhangfei 2 年 前
コミット
e290d0b6e7
5 ファイル変更12 行追加2 行削除
  1. 2 0
      .env
  2. 1 1
      src/api/system/user.ts
  3. 2 0
      src/hooks/setting/index.ts
  4. 3 1
      src/store/modules/user.ts
  5. 4 0
      types/config.d.ts

+ 2 - 0
.env

@@ -15,3 +15,5 @@ VITE_GLOB_LOGIN_APP = '/skyeye-login/#/'
 VITE_GLOB_SKYEYE_WORLD = /skyeye-world/
 
 VITE_GLOB_APP_PC = /skyeyev3pc/
+
+VITE_GLOB_TENANT_CODE=shangfei

+ 1 - 1
src/api/system/user.ts

@@ -15,7 +15,7 @@ export interface BasicPageParams {
 /**
  * @description: 获取用户信息
  */
-export function getUserInfo(params) {
+export function getUserInfo(params: { tenantCode?: string }) {
   return http.request({
     url: '/login/info',
     method: 'POST',

+ 2 - 0
src/hooks/setting/index.ts

@@ -16,6 +16,7 @@ export const useGlobSetting = (): Readonly<GlobConfig> => {
     VITE_GLOB_LOGIN_APP,
     VITE_GLOB_SKYEYE_WORLD,
     VITE_GLOB_APP_PC,
+    VITE_GLOB_TENANT_CODE,
   } = getAppEnvConfig();
 
   if (!/[a-zA-Z\_]*/.test(VITE_GLOB_APP_SHORT_NAME)) {
@@ -37,6 +38,7 @@ export const useGlobSetting = (): Readonly<GlobConfig> => {
     loginApp: VITE_GLOB_LOGIN_APP,
     skyeyeWorldUrl: VITE_GLOB_SKYEYE_WORLD,
     appPCUrl: VITE_GLOB_APP_PC,
+    tenantCode: VITE_GLOB_TENANT_CODE,
   };
   return glob as Readonly<GlobConfig>;
 };

+ 3 - 1
src/store/modules/user.ts

@@ -7,7 +7,9 @@ import { ResultEnum } from '@/enums/httpEnum';
 const Storage = createStorage({ storage: localStorage });
 import { getUserInfo, login } from '@/api/system/user';
 import { storage } from '@/utils/Storage';
+import { useGlobSetting } from '@/hooks/setting';
 
+const { tenantCode } = useGlobSetting();
 export interface IUserState {
   token: string;
   username: string;
@@ -97,7 +99,7 @@ export const useUserStore = defineStore({
     // 获取用户信息
     GetInfo() {
       return new Promise((resolve, reject) => {
-        getUserInfo()
+        getUserInfo({ tenantCode })
           .then((res) => {
             const result = res;
             if (result.permissions && result.permissions.length) {

+ 4 - 0
types/config.d.ts

@@ -83,6 +83,8 @@ export interface GlobEnvConfig {
   VITE_GLOB_SKYEYE_WORLD: string;
   /** PC模块登录地址 */
   VITE_GLOB_APP_PC: string;
+
+  VITE_GLOB_TENANT_CODE: string;
 }
 export interface GlobConfig {
   // 标题
@@ -99,4 +101,6 @@ export interface GlobConfig {
   prodMock: boolean;
   // 图片访问地址
   imgUrl: string | undefined;
+
+  tenantCode: string;
 }