@litianxiang/portal-core 0.2.3 → 0.2.4

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
@@ -326,8 +326,10 @@ declare function createTabStoreOptions(homePath?: string): {
326
326
  };
327
327
 
328
328
  interface BaseUserStoreLike {
329
- userno: string;
330
- username: string;
329
+ user_no: string;
330
+ user_name: string;
331
+ dept_id: string;
332
+ dept_name: string;
331
333
  access_token: string;
332
334
  refresh_token: string;
333
335
  lastActiveTime: number | null;
@@ -342,6 +344,10 @@ declare function createBaseUserState(): BaseUserStoreLike;
342
344
  */
343
345
  declare function createBaseUserGetters(): {
344
346
  getUserInfo: (state: any) => {
347
+ user_no: any;
348
+ user_name: any;
349
+ dept_id: any;
350
+ dept_name: any;
345
351
  userno: any;
346
352
  username: any;
347
353
  access_token: any;
@@ -350,6 +356,8 @@ declare function createBaseUserGetters(): {
350
356
  };
351
357
  getUserNo: (state: any) => any;
352
358
  getUserName: (state: any) => any;
359
+ getDeptId: (state: any) => any;
360
+ getDeptName: (state: any) => any;
353
361
  getUserAccessToken: (state: any) => any;
354
362
  getUserRefreshToken: (state: any) => any;
355
363
  getUserLastActiveTime: (state: any) => any;
@@ -390,6 +398,8 @@ declare function createMenuUserGetters<TUserInfo = any>(): {
390
398
  getUserInfo: (state: any) => TUserInfo;
391
399
  getUserNo: (state: any) => any;
392
400
  getUserName: (state: any) => any;
401
+ getDeptId: (state: any) => any;
402
+ getDeptName: (state: any) => any;
393
403
  getUserAccessToken: (state: any) => any;
394
404
  getUserRefreshToken: (state: any) => any;
395
405
  getUserLastActiveTime: (state: any) => any;
package/dist/index.js CHANGED
@@ -473,7 +473,7 @@ function createAuthHttpClient(options) {
473
473
  getLoadingStore,
474
474
  authLoginUrl,
475
475
  ssoStorageKey = AUTH_CONFIG.ssoStorageKey,
476
- refreshUrl = "/proxy/auth/api/token/refresh",
476
+ refreshUrl = "/proxy/sys/auth/api/token/refresh",
477
477
  inactiveExpireMs,
478
478
  inactiveBufferMs,
479
479
  onShowError
@@ -875,8 +875,10 @@ function createTabStoreOptions(homePath = DEFAULT_HOME_PATH) {
875
875
  // src/user/user.ts
876
876
  function createBaseUserState() {
877
877
  return {
878
- userno: "",
879
- username: "",
878
+ user_no: "",
879
+ user_name: "",
880
+ dept_id: "",
881
+ dept_name: "",
880
882
  access_token: "",
881
883
  refresh_token: "",
882
884
  lastActiveTime: null
@@ -886,16 +888,24 @@ function createBaseUserGetters() {
886
888
  return {
887
889
  // 获取完整用户信息
888
890
  getUserInfo: (state) => ({
889
- userno: state.userno,
890
- username: state.username,
891
+ user_no: state.user_no ?? state.userno ?? "",
892
+ user_name: state.user_name ?? state.username ?? "",
893
+ dept_id: state.dept_id ?? "",
894
+ dept_name: state.dept_name ?? "",
895
+ userno: state.user_no ?? state.userno ?? "",
896
+ username: state.user_name ?? state.username ?? "",
891
897
  access_token: state.access_token,
892
898
  refresh_token: state.refresh_token,
893
899
  lastActiveTime: state.lastActiveTime
894
900
  }),
895
901
  // 获取用户工号
896
- getUserNo: (state) => state.userno,
902
+ getUserNo: (state) => state.user_no ?? state.userno,
897
903
  // 获取用户姓名
898
- getUserName: (state) => state.username,
904
+ getUserName: (state) => state.user_name ?? state.username,
905
+ // 获取用户部门ID
906
+ getDeptId: (state) => state.dept_id,
907
+ // 获取用户部门名称
908
+ getDeptName: (state) => state.dept_name,
899
909
  // 获取用户access_token
900
910
  getUserAccessToken: (state) => state.access_token,
901
911
  // 获取用户refresh_token
@@ -909,8 +919,10 @@ function createBaseUserActions(options) {
909
919
  return {
910
920
  // 设置用户信息
911
921
  setUserInfo(userInfo) {
912
- this.userno = userInfo.userno;
913
- this.username = userInfo.username;
922
+ this.user_no = userInfo.user_no ?? userInfo.userno ?? "";
923
+ this.user_name = userInfo.user_name ?? userInfo.username ?? "";
924
+ this.dept_id = userInfo.dept_id ?? "";
925
+ this.dept_name = userInfo.dept_name ?? "";
914
926
  this.access_token = userInfo.access_token;
915
927
  this.refresh_token = userInfo.refresh_token;
916
928
  this.lastActiveTime = userInfo.lastActiveTime;
@@ -933,8 +945,10 @@ function createBaseUserActions(options) {
933
945
  },
934
946
  // 清除用户信息
935
947
  clearUserInfo() {
936
- this.userno = "";
937
- this.username = "";
948
+ this.user_no = "";
949
+ this.user_name = "";
950
+ this.dept_id = "";
951
+ this.dept_name = "";
938
952
  this.access_token = "";
939
953
  this.refresh_token = "";
940
954
  this.lastActiveTime = null;
@@ -943,8 +957,10 @@ function createBaseUserActions(options) {
943
957
  }
944
958
  function createMenuUserState() {
945
959
  return {
946
- userno: "",
947
- username: "",
960
+ user_no: "",
961
+ user_name: "",
962
+ dept_id: "",
963
+ dept_name: "",
948
964
  access_token: "",
949
965
  refresh_token: "",
950
966
  lastActiveTime: null,
@@ -957,17 +973,25 @@ function createMenuUserGetters() {
957
973
  return {
958
974
  // 获取完整用户信息
959
975
  getUserInfo: (state) => ({
960
- userno: state.userno,
961
- username: state.username,
976
+ user_no: state.user_no ?? state.userno ?? "",
977
+ user_name: state.user_name ?? state.username ?? "",
978
+ dept_id: state.dept_id ?? "",
979
+ dept_name: state.dept_name ?? "",
980
+ userno: state.user_no ?? state.userno ?? "",
981
+ username: state.user_name ?? state.username ?? "",
962
982
  access_token: state.access_token,
963
983
  refresh_token: state.refresh_token,
964
984
  lastActiveTime: state.lastActiveTime,
965
985
  all_menu: state.all_menu
966
986
  }),
967
987
  // 获取用户工号
968
- getUserNo: (state) => state.userno,
988
+ getUserNo: (state) => state.user_no ?? state.userno,
969
989
  // 获取用户姓名
970
- getUserName: (state) => state.username,
990
+ getUserName: (state) => state.user_name ?? state.username,
991
+ // 获取用户部门ID
992
+ getDeptId: (state) => state.dept_id,
993
+ // 获取用户部门名称
994
+ getDeptName: (state) => state.dept_name,
971
995
  // 获取用户access_token
972
996
  getUserAccessToken: (state) => state.access_token,
973
997
  // 获取用户refresh_token
@@ -1003,13 +1027,19 @@ function syncFromAuthStoreToStore(store, options) {
1003
1027
  const accessToken = window.localStorage.getItem(fallbackAccessTokenKey);
1004
1028
  if (!accessToken) return false;
1005
1029
  store.access_token = accessToken;
1030
+ store.user_no = "";
1031
+ store.user_name = "";
1032
+ store.dept_id = "";
1033
+ store.dept_name = "";
1006
1034
  store.lastActiveTime = Date.now();
1007
1035
  return true;
1008
1036
  }
1009
1037
  const data = JSON.parse(raw);
1010
1038
  if (!data || !data.access_token) return false;
1011
- store.userno = data.userno || "";
1012
- store.username = data.username || "";
1039
+ store.user_no = data.user_no ?? data.userno ?? "";
1040
+ store.user_name = data.user_name ?? data.username ?? "";
1041
+ store.dept_id = data.dept_id ?? "";
1042
+ store.dept_name = data.dept_name ?? "";
1013
1043
  store.access_token = data.access_token || "";
1014
1044
  store.refresh_token = data.refresh_token || "";
1015
1045
  store.lastActiveTime = data.lastActiveTime ?? null;
@@ -1031,8 +1061,10 @@ function createMenuUserActions(options) {
1031
1061
  return {
1032
1062
  // 设置用户信息
1033
1063
  setUserInfo(userInfo) {
1034
- this.userno = userInfo.userno;
1035
- this.username = userInfo.username;
1064
+ this.user_no = userInfo.user_no ?? userInfo.userno ?? "";
1065
+ this.user_name = userInfo.user_name ?? userInfo.username ?? "";
1066
+ this.dept_id = userInfo.dept_id ?? "";
1067
+ this.dept_name = userInfo.dept_name ?? "";
1036
1068
  this.access_token = userInfo.access_token;
1037
1069
  this.refresh_token = userInfo.refresh_token;
1038
1070
  this.lastActiveTime = userInfo.lastActiveTime;
@@ -1075,8 +1107,10 @@ function createMenuUserActions(options) {
1075
1107
  },
1076
1108
  // 清除用户信息
1077
1109
  clearUserInfo() {
1078
- this.userno = "";
1079
- this.username = "";
1110
+ this.user_no = "";
1111
+ this.user_name = "";
1112
+ this.dept_id = "";
1113
+ this.dept_name = "";
1080
1114
  this.access_token = "";
1081
1115
  this.refresh_token = "";
1082
1116
  this.lastActiveTime = null;
@@ -1090,7 +1124,7 @@ async function fetchUserMenuForStore(store, options) {
1090
1124
  const { http, site, transformMenuData, getALLMenu, filterOptions } = options;
1091
1125
  if (!store.access_token) return false;
1092
1126
  try {
1093
- const response = await http.post("/proxy/auth/api/user_menu_all", { site });
1127
+ const response = await http.post("/proxy/sys/auth/api/user_menu_all", { site });
1094
1128
  if (response.code === 200) {
1095
1129
  const menuTree = transformMenuData(response.data);
1096
1130
  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.4",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "dist/index.js",