yuang-framework-ui-common 1.0.93 → 1.0.95
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/favicon.ico +0 -0
- package/dist/yuang-framework-ui-common.es.js +4 -0
- package/dist/yuang-framework-ui-common.umd.js +1 -0
- package/lib/config/applicationConfig.ts +2 -7
- package/lib/config/gatewayConfig.ts +1 -2
- package/lib/config/httpConfig.ts +3 -3
- package/lib/hooks/framework/frameworkGroup.ts +1 -2
- package/lib/hooks/uims/uimsApplication.ts +3 -3
- package/lib/utils/ssoUtils.ts +2 -2
- package/package.json +1 -1
- package/src/main.ts +0 -1
- package/src/router/index.ts +9 -9
- package/src/views/sso/{sso-auth → client/sso-auth}/auth-success.vue +2 -3
- package/src/views/sso/{sso-auth → client/sso-auth}/index.vue +2 -3
package/dist/favicon.ico
ADDED
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(e,n){typeof exports=="object"&&typeof module<"u"?module.exports=n():typeof define=="function"&&define.amd?define(n):(e=typeof globalThis<"u"?globalThis:e||self,e["yuang-framework-ui-common"]=n())})(this,function(){"use strict";return{}});
|
|
@@ -14,7 +14,6 @@ import { http } from './httpConfig';
|
|
|
14
14
|
|
|
15
15
|
const application = {
|
|
16
16
|
gatewayServerBaseUrl: '',
|
|
17
|
-
apiBaseUrl: '',
|
|
18
17
|
uimsApplicationCode: ''
|
|
19
18
|
};
|
|
20
19
|
|
|
@@ -28,13 +27,9 @@ const initApplication = (app: any, config: any) => {
|
|
|
28
27
|
} else {
|
|
29
28
|
app.use(vant);
|
|
30
29
|
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
} else {
|
|
34
|
-
http.defaults.baseURL = config?.gatewayServerBaseUrl;
|
|
35
|
-
}
|
|
30
|
+
http.defaults.baseURL = config?.gatewayServerBaseUrl;
|
|
31
|
+
|
|
36
32
|
application.gatewayServerBaseUrl = Object.freeze(config.gatewayServerBaseUrl);
|
|
37
|
-
application.apiBaseUrl = Object.freeze(config.apiBaseUrl);
|
|
38
33
|
application.uimsApplicationCode = Object.freeze(config.uimsApplicationCode);
|
|
39
34
|
|
|
40
35
|
// 小程序没有window,暂时这样
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { http } from '../config/httpConfig';
|
|
2
2
|
import { getLocalStorageItem, setLocalStorageItem, removeLocalStorageItem } from '../utils/storageUtils';
|
|
3
|
-
import { application } from "./applicationConfig";
|
|
4
3
|
|
|
5
4
|
const initGateway = () => {
|
|
6
5
|
return new Promise<void>(async resolve => {
|
|
7
|
-
let res = await http.get(
|
|
6
|
+
let res = await http.get(`/server/gateway-config/getGatewayConfig`);
|
|
8
7
|
setLocalStorageItem("gatewayAccessToken", res.data.data.gatewayAccessToken, res.data.data.gatewayTimeout);
|
|
9
8
|
setLocalStorageItem("gatewayPublicKey", res.data.data.gatewayPublicKey, res.data.data.gatewayTimeout);
|
|
10
9
|
resolve();
|
package/lib/config/httpConfig.ts
CHANGED
|
@@ -36,7 +36,7 @@ const http = axios.create({
|
|
|
36
36
|
/* 请求拦截 */
|
|
37
37
|
http.interceptors.request.use(async config => {
|
|
38
38
|
let gatewayAccessToken = getLocalStorageItem("gatewayAccessToken") ?? '';
|
|
39
|
-
if (!gatewayAccessToken && config.url !=
|
|
39
|
+
if (!gatewayAccessToken && config.url != `/server/gateway-config/getGatewayConfig`) {
|
|
40
40
|
await initGateway();
|
|
41
41
|
}
|
|
42
42
|
|
|
@@ -102,7 +102,7 @@ http.interceptors.response.use(async (res: any) => {
|
|
|
102
102
|
} else if (res?.data?.statusCode === 500815006) {
|
|
103
103
|
// 这里存疑: 返回500815004 的时候获取router为null
|
|
104
104
|
const fullPath = router.currentRoute.value.fullPath;
|
|
105
|
-
router.push(`/sso/sso-auth/index?ssoRedirectRoutePath=${encodeURIComponent(fullPath)}`);
|
|
105
|
+
router.push(`/sso/client/sso-auth/index?ssoRedirectRoutePath=${encodeURIComponent(fullPath)}`);
|
|
106
106
|
return;
|
|
107
107
|
} else if (res?.data?.statusCode === 500815003) {
|
|
108
108
|
showErrorMessage(res?.data?.message || messageMap.requestError);
|
|
@@ -187,7 +187,7 @@ const refreshSsoAccessToken = (res: any) => {
|
|
|
187
187
|
config.params = {
|
|
188
188
|
ssoRefreshToken: ssoRefreshToken,
|
|
189
189
|
}
|
|
190
|
-
http.get(
|
|
190
|
+
http.get(`/sso-api/client/sso-auth/getSsoRefreshToken`, config).then(res => {
|
|
191
191
|
if (res?.data?.statusCode !== 200) {
|
|
192
192
|
if (res?.data?.statusCode === 500815001) {
|
|
193
193
|
clearSsoAccessToken();
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { nextTick } from 'vue';
|
|
2
2
|
import { http } from '../../../lib/config/httpConfig';
|
|
3
|
-
import { application } from '../../../lib/config/applicationConfig';
|
|
4
3
|
|
|
5
4
|
/**
|
|
6
5
|
* 处理分组树默认展开节点,由于树组件的默认展开节点是异步的,所以需要手动处理默认展开节点
|
|
@@ -10,7 +9,7 @@ const handleFrameworkGroupTreeDefaultExpandNode = async ({ id, treeId }) => {
|
|
|
10
9
|
console.error(`参数[treeId]不存在`);
|
|
11
10
|
return;
|
|
12
11
|
}
|
|
13
|
-
const res = await http.post(
|
|
12
|
+
const res = await http.post(`/framework-api/core/framework-group/selectAncestorList`, { idForEqual: id, isReverseAncestorList: true });
|
|
14
13
|
const ancestorList = res.data.data;
|
|
15
14
|
expandNodeImpl({ ancestorList, index: 0, treeId });
|
|
16
15
|
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { http } from '../../../lib/config/httpConfig';
|
|
2
|
-
import { application } from '../../../lib/config/applicationConfig';
|
|
3
2
|
|
|
4
3
|
// import { toTree } from 'yuang-framework-ui-pc/es';
|
|
5
4
|
|
|
@@ -10,7 +9,7 @@ const queryUimsApplicationTreeData = ({ applicationName }) => {
|
|
|
10
9
|
return new Promise((resolve, reject) => {
|
|
11
10
|
const data = { parentIdForEqual: '0', nameForLike: applicationName };
|
|
12
11
|
// prettier-ignore
|
|
13
|
-
http.post(
|
|
12
|
+
http.post(`/uims-api/admin/uims-application/selectPage`, data).then(res=>{
|
|
14
13
|
const listData = [
|
|
15
14
|
{
|
|
16
15
|
id: '0',
|
|
@@ -28,8 +27,9 @@ const queryUimsApplicationTreeData = ({ applicationName }) => {
|
|
|
28
27
|
parentIdField: 'parentId'
|
|
29
28
|
});
|
|
30
29
|
resolve({ treeData });
|
|
31
|
-
}).catch(() => {
|
|
30
|
+
}).catch((ex) => {
|
|
32
31
|
reject();
|
|
32
|
+
console.error(ex);
|
|
33
33
|
});
|
|
34
34
|
});
|
|
35
35
|
};
|
package/lib/utils/ssoUtils.ts
CHANGED
|
@@ -87,9 +87,9 @@ const getSsoAuthRoutePath = (ssoRedirectRoutePath = '') => {
|
|
|
87
87
|
if(getIsDebug()) {
|
|
88
88
|
debugger;
|
|
89
89
|
}
|
|
90
|
-
let ssoAuthRoutePath = '/sso/sso-auth/index';
|
|
90
|
+
let ssoAuthRoutePath = '/sso/client/sso-auth/index';
|
|
91
91
|
if (!ssoRedirectRoutePath) {
|
|
92
|
-
ssoAuthRoutePath += `?ssoRedirectRoutePath=${encodeURIComponent('/sso/sso-auth/auth-success')}`;
|
|
92
|
+
ssoAuthRoutePath += `?ssoRedirectRoutePath=${encodeURIComponent('/sso/client/sso-auth/auth-success')}`;
|
|
93
93
|
} else {
|
|
94
94
|
ssoAuthRoutePath += `?ssoRedirectRoutePath=${encodeURIComponent(ssoRedirectRoutePath)}`;
|
|
95
95
|
}
|
package/package.json
CHANGED
package/src/main.ts
CHANGED
|
@@ -13,7 +13,6 @@ app.use(router)
|
|
|
13
13
|
|
|
14
14
|
const config = {
|
|
15
15
|
gatewayServerBaseUrl: import.meta.env.VITE_GATEWAY_SERVER_BASE_URL,
|
|
16
|
-
apiBaseUrl: import.meta.env.VITE_API_BASE_URL,
|
|
17
16
|
uimsApplicationCode: import.meta.env.VITE_UIMS_APPLICATION_CODE
|
|
18
17
|
};
|
|
19
18
|
initApplication(app, config);
|
package/src/router/index.ts
CHANGED
|
@@ -8,16 +8,16 @@ const router = createRouter({
|
|
|
8
8
|
history: createWebHistory(import.meta.env.BASE_URL),
|
|
9
9
|
routes: [
|
|
10
10
|
{
|
|
11
|
-
path: '/sso/sso-auth/index',
|
|
12
|
-
component: () => import('@/views/sso/sso-auth/index.vue'),
|
|
11
|
+
path: '/sso/client/sso-auth/index',
|
|
12
|
+
component: () => import('@/views/sso/client/sso-auth/index.vue'),
|
|
13
13
|
meta: {
|
|
14
14
|
title: '认证',
|
|
15
|
-
|
|
15
|
+
isSsoClientExcluded: true
|
|
16
16
|
}
|
|
17
17
|
},
|
|
18
18
|
{
|
|
19
|
-
path: '/sso/sso-auth/auth-success',
|
|
20
|
-
component: () => import('@/views/sso/sso-auth/auth-success.vue'),
|
|
19
|
+
path: '/sso/client/sso-auth/auth-success',
|
|
20
|
+
component: () => import('@/views/sso/client/sso-auth/auth-success.vue'),
|
|
21
21
|
meta: {
|
|
22
22
|
title: '认证成功',
|
|
23
23
|
}
|
|
@@ -46,21 +46,21 @@ const router = createRouter({
|
|
|
46
46
|
path: '/utils/gateway-utils',
|
|
47
47
|
component: () => import('@/views/utils/gateway-utils.vue'),
|
|
48
48
|
meta: {
|
|
49
|
-
|
|
49
|
+
isSsoClientExcluded: true
|
|
50
50
|
}
|
|
51
51
|
},
|
|
52
52
|
{
|
|
53
53
|
path: '/utils/http-utils',
|
|
54
54
|
component: () => import('@/views/utils/http-utils.vue'),
|
|
55
55
|
meta: {
|
|
56
|
-
|
|
56
|
+
isSsoClientExcluded: true
|
|
57
57
|
}
|
|
58
58
|
},
|
|
59
59
|
{
|
|
60
60
|
path: '/hooks/framework/framework-sse-client',
|
|
61
61
|
component: () => import('@/views/hooks/framework/framework-sse-client.vue'),
|
|
62
62
|
meta: {
|
|
63
|
-
|
|
63
|
+
isSsoClientExcluded: false
|
|
64
64
|
}
|
|
65
65
|
},
|
|
66
66
|
|
|
@@ -79,7 +79,7 @@ const router = createRouter({
|
|
|
79
79
|
/* 路由守卫 */
|
|
80
80
|
router.beforeEach(async (to) => {
|
|
81
81
|
if (!getSsoAccessToken()) {
|
|
82
|
-
if (!to.meta?.
|
|
82
|
+
if (!to.meta?.isSsoClientExcluded) {
|
|
83
83
|
return getSsoAuthRoutePath(to.fullPath);
|
|
84
84
|
}
|
|
85
85
|
return;
|
|
@@ -13,7 +13,6 @@
|
|
|
13
13
|
|
|
14
14
|
import { getSsoAccessToken, logoutSso } from '../../../../lib/utils/ssoUtils';
|
|
15
15
|
import { http } from '../../../../lib/config/httpConfig';
|
|
16
|
-
import { application } from "../../../../lib/config/applicationConfig";
|
|
17
16
|
|
|
18
17
|
let ssoData = reactive({
|
|
19
18
|
ssoTokenUser: {},
|
|
@@ -25,14 +24,14 @@
|
|
|
25
24
|
getSsoTokenUser();
|
|
26
25
|
});
|
|
27
26
|
const getSsoTokenUser = () => {
|
|
28
|
-
http.get(
|
|
27
|
+
http.get(`/sso-api/client/sso-user/getSsoTokenUser`).then((res: any) => {
|
|
29
28
|
ssoData.ssoTokenUser = res.data.data;
|
|
30
29
|
console.log('ssoTokenUser', ssoData.ssoTokenUser);
|
|
31
30
|
ElMessage.success('获取成功');
|
|
32
31
|
});
|
|
33
32
|
};
|
|
34
33
|
const getSsoIdentity = () => {
|
|
35
|
-
http.get(
|
|
34
|
+
http.get(`/sso-api/client/sso-user/getSsoIdentity`).then((res: any) => {
|
|
36
35
|
ssoData.ssoIdentity = res.data.data;
|
|
37
36
|
console.log('ssoIdentity', ssoData.ssoIdentity);
|
|
38
37
|
ElMessage.success('获取成功');
|
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
import { getCurrentInstance, onMounted } from 'vue';
|
|
7
7
|
import { useRouter } from 'vue-router';
|
|
8
8
|
|
|
9
|
-
import { application } from '../../../../lib/config/applicationConfig';
|
|
10
9
|
import { getSsoAuthUrl, setSsoAccessToken } from '../../../../lib/utils/ssoUtils';
|
|
11
10
|
import { removeParameter } from '../../../../lib/utils/urlUtils';
|
|
12
11
|
import { http } from '../../../../lib/config/httpConfig';
|
|
@@ -23,10 +22,10 @@
|
|
|
23
22
|
return;
|
|
24
23
|
}
|
|
25
24
|
|
|
26
|
-
http.get(
|
|
25
|
+
http.get(`/sso-api/client/sso-auth/getSsoAccessToken`, { params: { ssoAuthCode: ssoAuthCode } }).then((res: any) => {
|
|
27
26
|
setSsoAccessToken(res.data.data);
|
|
28
27
|
let ssoRedirectRoutePath = router.currentRoute.value.query.ssoRedirectRoutePath as string;
|
|
29
|
-
ssoRedirectRoutePath = (ssoRedirectRoutePath && decodeURIComponent(ssoRedirectRoutePath)) || ('/sso/sso-auth/auth-success' as any);
|
|
28
|
+
ssoRedirectRoutePath = (ssoRedirectRoutePath && decodeURIComponent(ssoRedirectRoutePath)) || ('/sso/client/sso-auth/auth-success' as any);
|
|
30
29
|
ssoRedirectRoutePath = removeParameter('ssoAuthCode', ssoRedirectRoutePath) || '';
|
|
31
30
|
router.push(ssoRedirectRoutePath);
|
|
32
31
|
});
|