@litianxiang/portal-core 0.2.3 → 0.2.5

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/dist/index.d.ts CHANGED
@@ -146,6 +146,7 @@ interface CoreMenuItem {
146
146
  icon?: string;
147
147
  order_num?: number;
148
148
  site?: string;
149
+ is_blank_page?: boolean;
149
150
  children?: CoreMenuItem[];
150
151
  }
151
152
  interface TransformMenuOptions {
@@ -326,8 +327,10 @@ declare function createTabStoreOptions(homePath?: string): {
326
327
  };
327
328
 
328
329
  interface BaseUserStoreLike {
329
- userno: string;
330
- username: string;
330
+ user_no: string;
331
+ user_name: string;
332
+ dept_id: string;
333
+ dept_name: string;
331
334
  access_token: string;
332
335
  refresh_token: string;
333
336
  lastActiveTime: number | null;
@@ -342,6 +345,10 @@ declare function createBaseUserState(): BaseUserStoreLike;
342
345
  */
343
346
  declare function createBaseUserGetters(): {
344
347
  getUserInfo: (state: any) => {
348
+ user_no: any;
349
+ user_name: any;
350
+ dept_id: any;
351
+ dept_name: any;
345
352
  userno: any;
346
353
  username: any;
347
354
  access_token: any;
@@ -350,6 +357,8 @@ declare function createBaseUserGetters(): {
350
357
  };
351
358
  getUserNo: (state: any) => any;
352
359
  getUserName: (state: any) => any;
360
+ getDeptId: (state: any) => any;
361
+ getDeptName: (state: any) => any;
353
362
  getUserAccessToken: (state: any) => any;
354
363
  getUserRefreshToken: (state: any) => any;
355
364
  getUserLastActiveTime: (state: any) => any;
@@ -390,6 +399,8 @@ declare function createMenuUserGetters<TUserInfo = any>(): {
390
399
  getUserInfo: (state: any) => TUserInfo;
391
400
  getUserNo: (state: any) => any;
392
401
  getUserName: (state: any) => any;
402
+ getDeptId: (state: any) => any;
403
+ getDeptName: (state: any) => any;
393
404
  getUserAccessToken: (state: any) => any;
394
405
  getUserRefreshToken: (state: any) => any;
395
406
  getUserLastActiveTime: (state: any) => any;
package/dist/index.js CHANGED
@@ -101,6 +101,7 @@ function transformMenuTree(menuList, options) {
101
101
  icon: item?.icon,
102
102
  order_num: item?.order_num,
103
103
  site: item?.site ?? defaultSite,
104
+ is_blank_page: item?.is_blank_page,
104
105
  children
105
106
  };
106
107
  });
@@ -117,6 +118,7 @@ function buildAllMenuTree(menuList) {
117
118
  icon: item.icon,
118
119
  order_num: item.order_num,
119
120
  site: item.site,
121
+ is_blank_page: item.is_blank_page,
120
122
  children: item.children && item.children.length > 0 ? buildAllMenuTree(item.children) : []
121
123
  });
122
124
  }
@@ -135,6 +137,7 @@ function buildPageMenuList(menuList) {
135
137
  icon: item.icon,
136
138
  order_num: item.order_num,
137
139
  site: item.site,
140
+ is_blank_page: item.is_blank_page,
138
141
  children: item.children ? buildPageMenuList(item.children) : []
139
142
  });
140
143
  } else if (item.children && item.children.length > 0) {
@@ -150,6 +153,7 @@ function buildPageMenuList(menuList) {
150
153
  icon: child.icon,
151
154
  order_num: child.order_num,
152
155
  site: child.site,
156
+ is_blank_page: child.is_blank_page,
153
157
  children: child.children
154
158
  });
155
159
  }
@@ -473,7 +477,7 @@ function createAuthHttpClient(options) {
473
477
  getLoadingStore,
474
478
  authLoginUrl,
475
479
  ssoStorageKey = AUTH_CONFIG.ssoStorageKey,
476
- refreshUrl = "/proxy/auth/api/token/refresh",
480
+ refreshUrl = "/proxy/sys/auth/api/token/refresh",
477
481
  inactiveExpireMs,
478
482
  inactiveBufferMs,
479
483
  onShowError
@@ -875,8 +879,10 @@ function createTabStoreOptions(homePath = DEFAULT_HOME_PATH) {
875
879
  // src/user/user.ts
876
880
  function createBaseUserState() {
877
881
  return {
878
- userno: "",
879
- username: "",
882
+ user_no: "",
883
+ user_name: "",
884
+ dept_id: "",
885
+ dept_name: "",
880
886
  access_token: "",
881
887
  refresh_token: "",
882
888
  lastActiveTime: null
@@ -886,16 +892,24 @@ function createBaseUserGetters() {
886
892
  return {
887
893
  // 获取完整用户信息
888
894
  getUserInfo: (state) => ({
889
- userno: state.userno,
890
- username: state.username,
895
+ user_no: state.user_no ?? state.userno ?? "",
896
+ user_name: state.user_name ?? state.username ?? "",
897
+ dept_id: state.dept_id ?? "",
898
+ dept_name: state.dept_name ?? "",
899
+ userno: state.user_no ?? state.userno ?? "",
900
+ username: state.user_name ?? state.username ?? "",
891
901
  access_token: state.access_token,
892
902
  refresh_token: state.refresh_token,
893
903
  lastActiveTime: state.lastActiveTime
894
904
  }),
895
905
  // 获取用户工号
896
- getUserNo: (state) => state.userno,
906
+ getUserNo: (state) => state.user_no ?? state.userno,
897
907
  // 获取用户姓名
898
- getUserName: (state) => state.username,
908
+ getUserName: (state) => state.user_name ?? state.username,
909
+ // 获取用户部门ID
910
+ getDeptId: (state) => state.dept_id,
911
+ // 获取用户部门名称
912
+ getDeptName: (state) => state.dept_name,
899
913
  // 获取用户access_token
900
914
  getUserAccessToken: (state) => state.access_token,
901
915
  // 获取用户refresh_token
@@ -909,8 +923,10 @@ function createBaseUserActions(options) {
909
923
  return {
910
924
  // 设置用户信息
911
925
  setUserInfo(userInfo) {
912
- this.userno = userInfo.userno;
913
- this.username = userInfo.username;
926
+ this.user_no = userInfo.user_no ?? userInfo.userno ?? "";
927
+ this.user_name = userInfo.user_name ?? userInfo.username ?? "";
928
+ this.dept_id = userInfo.dept_id ?? "";
929
+ this.dept_name = userInfo.dept_name ?? "";
914
930
  this.access_token = userInfo.access_token;
915
931
  this.refresh_token = userInfo.refresh_token;
916
932
  this.lastActiveTime = userInfo.lastActiveTime;
@@ -933,8 +949,10 @@ function createBaseUserActions(options) {
933
949
  },
934
950
  // 清除用户信息
935
951
  clearUserInfo() {
936
- this.userno = "";
937
- this.username = "";
952
+ this.user_no = "";
953
+ this.user_name = "";
954
+ this.dept_id = "";
955
+ this.dept_name = "";
938
956
  this.access_token = "";
939
957
  this.refresh_token = "";
940
958
  this.lastActiveTime = null;
@@ -943,8 +961,10 @@ function createBaseUserActions(options) {
943
961
  }
944
962
  function createMenuUserState() {
945
963
  return {
946
- userno: "",
947
- username: "",
964
+ user_no: "",
965
+ user_name: "",
966
+ dept_id: "",
967
+ dept_name: "",
948
968
  access_token: "",
949
969
  refresh_token: "",
950
970
  lastActiveTime: null,
@@ -957,17 +977,25 @@ function createMenuUserGetters() {
957
977
  return {
958
978
  // 获取完整用户信息
959
979
  getUserInfo: (state) => ({
960
- userno: state.userno,
961
- username: state.username,
980
+ user_no: state.user_no ?? state.userno ?? "",
981
+ user_name: state.user_name ?? state.username ?? "",
982
+ dept_id: state.dept_id ?? "",
983
+ dept_name: state.dept_name ?? "",
984
+ userno: state.user_no ?? state.userno ?? "",
985
+ username: state.user_name ?? state.username ?? "",
962
986
  access_token: state.access_token,
963
987
  refresh_token: state.refresh_token,
964
988
  lastActiveTime: state.lastActiveTime,
965
989
  all_menu: state.all_menu
966
990
  }),
967
991
  // 获取用户工号
968
- getUserNo: (state) => state.userno,
992
+ getUserNo: (state) => state.user_no ?? state.userno,
969
993
  // 获取用户姓名
970
- getUserName: (state) => state.username,
994
+ getUserName: (state) => state.user_name ?? state.username,
995
+ // 获取用户部门ID
996
+ getDeptId: (state) => state.dept_id,
997
+ // 获取用户部门名称
998
+ getDeptName: (state) => state.dept_name,
971
999
  // 获取用户access_token
972
1000
  getUserAccessToken: (state) => state.access_token,
973
1001
  // 获取用户refresh_token
@@ -982,9 +1010,12 @@ function createMenuUserGetters() {
982
1010
  isMenuLoaded: (state) => state.menuLoaded
983
1011
  };
984
1012
  }
1013
+ function isBlankPageMenu(item) {
1014
+ return item?.is_blank_page === true || item?.is_blank_page === "true" || item?.is_blank_page === 1;
1015
+ }
985
1016
  function filterSidebarMenu(menus, options) {
986
1017
  const exclude = options?.excludeCategories ?? ["button", "flow-module", "flow-page"];
987
- return (menus || []).filter((item) => !exclude.includes(item?.category)).map((item) => ({
1018
+ return (menus || []).filter((item) => !exclude.includes(item?.category) && !isBlankPageMenu(item)).map((item) => ({
988
1019
  ...item,
989
1020
  children: item.children && item.children.length > 0 ? filterSidebarMenu(item.children, options) : []
990
1021
  }));
@@ -1003,13 +1034,19 @@ function syncFromAuthStoreToStore(store, options) {
1003
1034
  const accessToken = window.localStorage.getItem(fallbackAccessTokenKey);
1004
1035
  if (!accessToken) return false;
1005
1036
  store.access_token = accessToken;
1037
+ store.user_no = "";
1038
+ store.user_name = "";
1039
+ store.dept_id = "";
1040
+ store.dept_name = "";
1006
1041
  store.lastActiveTime = Date.now();
1007
1042
  return true;
1008
1043
  }
1009
1044
  const data = JSON.parse(raw);
1010
1045
  if (!data || !data.access_token) return false;
1011
- store.userno = data.userno || "";
1012
- store.username = data.username || "";
1046
+ store.user_no = data.user_no ?? data.userno ?? "";
1047
+ store.user_name = data.user_name ?? data.username ?? "";
1048
+ store.dept_id = data.dept_id ?? "";
1049
+ store.dept_name = data.dept_name ?? "";
1013
1050
  store.access_token = data.access_token || "";
1014
1051
  store.refresh_token = data.refresh_token || "";
1015
1052
  store.lastActiveTime = data.lastActiveTime ?? null;
@@ -1031,8 +1068,10 @@ function createMenuUserActions(options) {
1031
1068
  return {
1032
1069
  // 设置用户信息
1033
1070
  setUserInfo(userInfo) {
1034
- this.userno = userInfo.userno;
1035
- this.username = userInfo.username;
1071
+ this.user_no = userInfo.user_no ?? userInfo.userno ?? "";
1072
+ this.user_name = userInfo.user_name ?? userInfo.username ?? "";
1073
+ this.dept_id = userInfo.dept_id ?? "";
1074
+ this.dept_name = userInfo.dept_name ?? "";
1036
1075
  this.access_token = userInfo.access_token;
1037
1076
  this.refresh_token = userInfo.refresh_token;
1038
1077
  this.lastActiveTime = userInfo.lastActiveTime;
@@ -1075,8 +1114,10 @@ function createMenuUserActions(options) {
1075
1114
  },
1076
1115
  // 清除用户信息
1077
1116
  clearUserInfo() {
1078
- this.userno = "";
1079
- this.username = "";
1117
+ this.user_no = "";
1118
+ this.user_name = "";
1119
+ this.dept_id = "";
1120
+ this.dept_name = "";
1080
1121
  this.access_token = "";
1081
1122
  this.refresh_token = "";
1082
1123
  this.lastActiveTime = null;
@@ -1090,7 +1131,7 @@ async function fetchUserMenuForStore(store, options) {
1090
1131
  const { http, site, transformMenuData, getALLMenu, filterOptions } = options;
1091
1132
  if (!store.access_token) return false;
1092
1133
  try {
1093
- const response = await http.post("/proxy/auth/api/user_menu_all", { site });
1134
+ const response = await http.post("/proxy/sys/auth/api/user_menu_all", { site });
1094
1135
  if (response.code === 200) {
1095
1136
  const menuTree = transformMenuData(response.data);
1096
1137
  const allMenu = getALLMenu(menuTree);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@litianxiang/portal-core",
3
- "version": "0.2.3",
3
+ "version": "0.2.5",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "dist/index.js",