yuang-framework-ui-common 1.0.32 → 1.0.34
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/config/httpConfig.ts
CHANGED
@@ -63,24 +63,24 @@ http.interceptors.response.use(async (res: any) => {
|
|
63
63
|
}
|
64
64
|
});
|
65
65
|
return Promise.reject(new Error(res?.data?.message));
|
66
|
-
} else if (res?.data?.statusCode ===
|
66
|
+
} else if (res?.data?.statusCode === 500822001) {
|
67
67
|
clearGatewayConfig();
|
68
68
|
showErrorMessage(messageMap.requestError || messageMap.requestError);
|
69
69
|
return Promise.reject(new Error(res?.data?.message));
|
70
|
-
} else if (res?.data?.statusCode ===
|
70
|
+
} else if (res?.data?.statusCode === 500815001) {
|
71
71
|
showErrorMessage(res?.data?.message || messageMap.requestError);
|
72
72
|
clearSsoAccessToken();
|
73
73
|
window.location.href = getSsoLoginUrl() || '';
|
74
74
|
return Promise.reject(new Error(res?.data?.message));
|
75
|
-
} else if (res?.data?.statusCode ===
|
75
|
+
} else if (res?.data?.statusCode === 500815005) {
|
76
76
|
await refreshSsoAccessToken(res);
|
77
77
|
// 重发请求
|
78
78
|
return axios.request(res.config);
|
79
|
-
}
|
79
|
+
} else if (res?.data?.statusCode === 500815006) {
|
80
80
|
const fullPath = router.currentRoute.value.fullPath;
|
81
|
-
router.push(`/sso/login/index?redirectRoutePath=${fullPath}`);
|
81
|
+
router.push(`/sso/login/index?redirectRoutePath=${encodeURIComponent(fullPath)}`);
|
82
82
|
return;
|
83
|
-
} else if (res?.data?.statusCode ===
|
83
|
+
} else if (res?.data?.statusCode === 500815003) {
|
84
84
|
showErrorMessage(res?.data?.message || messageMap.requestError);
|
85
85
|
return Promise.reject(new Error(res?.data?.message));
|
86
86
|
}
|
@@ -95,7 +95,7 @@ http.interceptors.response.use(async (res: any) => {
|
|
95
95
|
if (statusCode !== 200) {
|
96
96
|
errorMessage = message;
|
97
97
|
}
|
98
|
-
|
98
|
+
errorMessage = errorMessage || messageMap.requestError
|
99
99
|
} else {
|
100
100
|
errorMessage = error?.message || messageMap.requestError;
|
101
101
|
}
|
package/lib/utils/objectUtils.ts
CHANGED
@@ -1,5 +1,45 @@
|
|
1
|
-
|
1
|
+
|
2
|
+
/**
|
3
|
+
* 浅度克隆对象
|
4
|
+
* @param obj
|
5
|
+
* @returns {{}|*}
|
6
|
+
*/
|
7
|
+
const shallowClone = (obj) => {
|
8
|
+
return Object.assign({}, obj);
|
9
|
+
}
|
10
|
+
|
11
|
+
|
12
|
+
/**
|
13
|
+
* 深度克隆对象
|
14
|
+
* @param obj
|
15
|
+
* @returns {{}|*}
|
16
|
+
*/
|
17
|
+
const deepClone = (obj) => {
|
18
|
+
let result;
|
19
|
+
const type = typeOf(obj);
|
20
|
+
if (type === 'Object') result = {};
|
21
|
+
else if (type === 'Array') result = [];
|
22
|
+
else return obj;
|
23
|
+
Object.keys(obj).forEach(key => {
|
24
|
+
const copy = obj[key], cType = typeOf(copy);
|
25
|
+
if (cType === 'Object' || cType === 'Array') result[key] = deepClone(copy);
|
26
|
+
else result[key] = obj[key];
|
27
|
+
});
|
28
|
+
return result;
|
29
|
+
}
|
30
|
+
/**
|
31
|
+
* 获取变量类型
|
32
|
+
* @param obj
|
33
|
+
* @returns {string}
|
34
|
+
*/
|
35
|
+
const typeOf = (obj) => {
|
36
|
+
if (obj === null) return 'Null';
|
37
|
+
if (obj === undefined) return 'Undefined';
|
38
|
+
return Object.prototype.toString.call(obj).slice(8, -1);
|
39
|
+
};
|
2
40
|
|
3
41
|
export {
|
4
|
-
|
42
|
+
shallowClone,
|
43
|
+
deepClone,
|
44
|
+
typeOf,
|
5
45
|
}
|
package/package.json
CHANGED
@@ -22,9 +22,8 @@
|
|
22
22
|
|
23
23
|
proxy.$http.get('/sso-api/client/auth/getSsoAccessToken', { params: { code: code } }).then((res: any) => {
|
24
24
|
setSsoAccessToken(res.data.data);
|
25
|
-
let redirectRoutePath = router.currentRoute.value.query.redirectRoutePath
|
26
|
-
redirectRoutePath =
|
27
|
-
|
25
|
+
let redirectRoutePath = router.currentRoute.value.query.redirectRoutePath as string;
|
26
|
+
redirectRoutePath = decodeURIComponent(redirectRoutePath) || ('/sso/login/login-success' as any);
|
28
27
|
router.push(redirectRoutePath);
|
29
28
|
});
|
30
29
|
});
|