yuang-framework-ui-common 1.0.79 → 1.0.81

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.
@@ -28,8 +28,8 @@ const http = axios.create({
28
28
  // baseURL: apiBaseUrl,
29
29
  timeout: 10000,
30
30
  headers: {},
31
- // 关键:允许跨域请求携带凭证(Cookie等)
32
- withCredentials: true,
31
+ // 允许跨域请求携带凭证(Cookie等),在本地开发与网关api不是同域,访问api会报错:各种跨域访问,比如:http://localhost:8000/gateway-server/sso-api/client/sso-user/getSsoIdentity
32
+ withCredentials: import.meta.env.VITE_PROFILES_ACTIVE === 'dev' ? true : false,
33
33
  })
34
34
 
35
35
 
@@ -84,7 +84,7 @@ http.interceptors.response.use(async (res: any) => {
84
84
  if (gatewayPublicKey) {
85
85
  res.config.headers["Gateway-Public-Key"] = gatewayPublicKey;
86
86
  }
87
- return axios.request(res.config);
87
+ return http.request(res.config);
88
88
  } else if (res?.data?.statusCode === 500815001) {
89
89
  showErrorMessage(res?.data?.message || messageMap.requestError);
90
90
  clearSsoAccessToken();
@@ -97,7 +97,7 @@ http.interceptors.response.use(async (res: any) => {
97
97
  if (ssoAccessToken) {
98
98
  res.config.headers["Sso-Access-Token"] = ssoAccessToken;
99
99
  }
100
- return axios.request(res.config);
100
+ return http.request(res.config);
101
101
  } else if (res?.data?.statusCode === 500815006) {
102
102
  // 这里存疑: 返回500815004 的时候获取router为null
103
103
  const fullPath = router.currentRoute.value.fullPath;
@@ -60,4 +60,6 @@ export interface FrameworkBaseQueryParam {
60
60
  uimsApplicationIdForEqual?: string;
61
61
  /** 上级id */
62
62
  parentIdForEqual?: string;
63
+ /** id */
64
+ idForEqual?: string;
63
65
  }
@@ -0,0 +1,22 @@
1
+ import type { FrameworkBase, FrameworkBaseQueryParam } from '../framework/frameworkBase';
2
+
3
+ /**
4
+ * 网关路由
5
+ */
6
+ export interface GatewayRoute extends FrameworkBase {
7
+ routeId?: string;
8
+ routeName?: string;
9
+ forwardTargetUri?: string;
10
+ predicateRoutePath?: string;
11
+ status?: number;
12
+
13
+ }
14
+
15
+ /**
16
+ * 网关路由搜索条件
17
+ */
18
+ export interface UimsApiQueryParam extends FrameworkBaseQueryParam {
19
+ routeIdForLike?: string;
20
+ routeNameForLike?: string;
21
+ statusForEqual?: number;
22
+ }
@@ -5,7 +5,7 @@
5
5
  * @param src
6
6
  * @param callback
7
7
  */
8
- const loadScript = (src, callback) => {
8
+ const loadScript = (src: string, callback: ()=>{}) => {
9
9
  if (!src) {
10
10
  console.error("[src]为空");
11
11
  return;
@@ -21,7 +21,7 @@ const loadScript = (src, callback) => {
21
21
  }, false);
22
22
  } else if (script.attachEvent) {
23
23
  script.attachEvent('onreadystatechange', function () {
24
- var target = window.event.srcElement as any;
24
+ var target = window.event?.srcElement as any;
25
25
  if (target.readyState == 'loaded') {
26
26
  callback && callback();
27
27
  }
@@ -36,7 +36,7 @@ const loadScript = (src, callback) => {
36
36
  * @param src
37
37
  * @param callback
38
38
  */
39
- const loadLink = (href: string, callback) => {
39
+ const loadLink = (href: string, callback: ()=>{}) => {
40
40
  if (!href) {
41
41
  console.error("[href]为空");
42
42
  return;
@@ -52,7 +52,7 @@ const loadLink = (href: string, callback) => {
52
52
  }, false);
53
53
  } else if (link.attachEvent) {
54
54
  link.attachEvent('onreadystatechange', function () {
55
- var target = window.event.srcElement as any;
55
+ var target = window.event?.srcElement as any;
56
56
  if (target.readyState == 'loaded') {
57
57
  callback && callback();
58
58
  }
@@ -66,7 +66,7 @@ const loadLink = (href: string, callback) => {
66
66
  * @param src
67
67
  * @param callback
68
68
  */
69
- const loadIframe = (src: string, callback) => {
69
+ const loadIframe = (src: string, callback: ()=>{}) => {
70
70
  if (!src) {
71
71
  console.error("[src]为空");
72
72
  return;
@@ -82,7 +82,7 @@ const loadIframe = (src: string, callback) => {
82
82
  }, false);
83
83
  } else if (iframe.attachEvent) {
84
84
  iframe.attachEvent('onreadystatechange', function () {
85
- var target = window.event.srcElement as any;
85
+ var target = window.event?.srcElement as any;
86
86
  if (target.readyState == 'loaded') {
87
87
  callback && callback();
88
88
  }
@@ -2,7 +2,7 @@
2
2
  * 判断session存储数据是否过期
3
3
  * @param key
4
4
  */
5
- const isSessionStorageExpired = (key) => {
5
+ const isSessionStorageExpired = (key: string) => {
6
6
  const value = sessionStorage.getItem(key);
7
7
  if (!value) {
8
8
  return false;
@@ -27,7 +27,7 @@ const isSessionStorageExpired = (key) => {
27
27
  * @param value
28
28
  * @param expiresTime 过期时间,单位:秒
29
29
  */
30
- const setSessionStorageItem = (key, value, expiresTime) => {
30
+ const setSessionStorageItem = (key: string, value: string, expiresTime: number) => {
31
31
  if(!key) {
32
32
  console.error('参数[key]为空')
33
33
  return;
@@ -45,7 +45,7 @@ const setSessionStorageItem = (key, value, expiresTime) => {
45
45
  * 获取session存储数据
46
46
  * @param key
47
47
  */
48
- const getSessionStorageItem = (key) => {
48
+ const getSessionStorageItem = (key: string) => {
49
49
  if (isSessionStorageExpired(key)) {
50
50
  return null;
51
51
  }
@@ -64,7 +64,7 @@ const getSessionStorageItem = (key) => {
64
64
  * 删除session存储数据
65
65
  * @param key
66
66
  */
67
- const removeSessionStorageItem = (key) => {
67
+ const removeSessionStorageItem = (key: string) => {
68
68
  sessionStorage.removeItem(key);
69
69
  }
70
70
 
@@ -73,7 +73,7 @@ const removeSessionStorageItem = (key) => {
73
73
  * 判断local存储数据是否过期
74
74
  * @param key
75
75
  */
76
- const isLocalStorageExpired = (key) => {
76
+ const isLocalStorageExpired = (key: string) => {
77
77
  const value = localStorage.getItem(key);
78
78
  if (!value) {
79
79
  return false;
@@ -99,7 +99,7 @@ const isLocalStorageExpired = (key) => {
99
99
  * @param value
100
100
  * @param expiresTime 过期时间,单位:秒
101
101
  */
102
- const setLocalStorageItem = (key, value, expiresTime) => {
102
+ const setLocalStorageItem = (key: string, value: string, expiresTime: number) => {
103
103
  if(!key) {
104
104
  console.error('参数[key]为空')
105
105
  return;
@@ -117,7 +117,7 @@ const setLocalStorageItem = (key, value, expiresTime) => {
117
117
  * 获取local存储数据
118
118
  * @param key
119
119
  */
120
- const getLocalStorageItem = (key) => {
120
+ const getLocalStorageItem = (key: string) => {
121
121
  if (isLocalStorageExpired(key)) {
122
122
  return null;
123
123
  }
@@ -136,7 +136,7 @@ const getLocalStorageItem = (key) => {
136
136
  * 删除local存储数据
137
137
  * @param key
138
138
  */
139
- const removeLocalStorageItem = (key) => {
139
+ const removeLocalStorageItem = (key: string) => {
140
140
  localStorage.removeItem(key);
141
141
  }
142
142
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yuang-framework-ui-common",
3
- "version": "1.0.79",
3
+ "version": "1.0.81",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "scripts": {