gant-core 0.1.27 → 0.1.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/cli/index.js CHANGED
@@ -48724,7 +48724,7 @@ const createCwdConfig = (cwd, name, vue) => {
48724
48724
  };
48725
48725
 
48726
48726
  var name = "gant-core";
48727
- var version = "0.1.27";
48727
+ var version = "0.1.28";
48728
48728
  var description = "";
48729
48729
  var main = "lib/index.js";
48730
48730
  var bin = {
package/lib/index.d.ts CHANGED
@@ -2098,6 +2098,7 @@ declare class UserStore {
2098
2098
  userSetting: {
2099
2099
  [type: string]: any;
2100
2100
  };
2101
+ users: User[];
2101
2102
  getUserIdentity(): UserIdentityType;
2102
2103
  setUserIdentity(identity: Partial<UserIdentityType>): UserIdentityType;
2103
2104
  clearUserIdentity(): void;
package/lib/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import axios__default from 'axios';
2
2
  export * from 'axios';
3
- import { forEach, groupBy, reduce, find, pick, get as get$1, uniqueId, omit, isEmpty, cloneDeep, mapValues, uniqBy, toLower, isObject, mergeWith, has, join } from 'lodash-es';
3
+ import { forEach, groupBy, reduce, find, pick, get as get$1, uniqueId, omit, isEmpty, findIndex, cloneDeep, mapValues, uniqBy, toLower, isObject, mergeWith, has, join } from 'lodash-es';
4
4
  import mitt from 'mitt';
5
5
 
6
6
  class InterceptorManager {
@@ -658,6 +658,7 @@ class UserStore {
658
658
  functions = []; //用户授权功能点
659
659
  delegations = []; //用户代理信息
660
660
  userSetting = {};
661
+ users = [];
661
662
  getUserIdentity() {
662
663
  if (!isEmpty(this.userIdentity))
663
664
  return this.userIdentity;
@@ -716,9 +717,14 @@ class UserStore {
716
717
  delete this.userSetting[key];
717
718
  };
718
719
  getUserInfo = async (userId, userLoginName) => {
719
- if (userLoginName)
720
- return getUserByUserLoginNameApi(userId);
721
- return await getUserByIdApi(userId);
720
+ const index = findIndex(this.users, (itemUser) => userLoginName ? itemUser.userLoginName === userId : itemUser.id === userId);
721
+ if (index > -1)
722
+ return get$1(this.users, `[${index}]`);
723
+ const userInfo = userLoginName
724
+ ? await getUserByUserLoginNameApi(userId)
725
+ : await getUserByIdApi(userId);
726
+ this.users.push(userInfo);
727
+ return userInfo;
722
728
  };
723
729
  }
724
730