yuang-framework-ui-common 1.0.44 → 1.0.46
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
@@ -78,7 +78,7 @@ http.interceptors.response.use(async (res: any) => {
|
|
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/
|
81
|
+
router.push(`/sso/auth/index?ssoRedirectRoutePath=${encodeURIComponent(fullPath)}`);
|
82
82
|
return;
|
83
83
|
} else if (res?.data?.statusCode === 500815003) {
|
84
84
|
showErrorMessage(res?.data?.message || messageMap.requestError);
|
package/lib/utils/ssoUtils.ts
CHANGED
@@ -33,17 +33,17 @@ const getSsoLogoutUrl = (ssoRedirectUrl = '') => {
|
|
33
33
|
}
|
34
34
|
|
35
35
|
/**
|
36
|
-
* 获取sso
|
36
|
+
* 获取sso认证路由路径
|
37
37
|
* @param ssoRedirectRoutePath
|
38
38
|
*/
|
39
|
-
const
|
40
|
-
let
|
39
|
+
const getSsoAuthRoutePath = (ssoRedirectRoutePath = '') => {
|
40
|
+
let ssoAuthRoutePath = '/sso/auth/index';
|
41
41
|
if (!ssoRedirectRoutePath) {
|
42
|
-
|
42
|
+
ssoAuthRoutePath += `?ssoRedirectRoutePath=${encodeURIComponent('/sso/auth/auth-success')}`;
|
43
43
|
} else {
|
44
|
-
|
44
|
+
ssoAuthRoutePath += `?ssoRedirectRoutePath=${encodeURIComponent(ssoRedirectRoutePath)}`;
|
45
45
|
}
|
46
|
-
return
|
46
|
+
return ssoAuthRoutePath;
|
47
47
|
}
|
48
48
|
|
49
49
|
/**
|
@@ -160,7 +160,7 @@ const logoutSso = () => {
|
|
160
160
|
export {
|
161
161
|
getSsoLoginUrl,
|
162
162
|
getSsoLogoutUrl,
|
163
|
-
|
163
|
+
getSsoAuthRoutePath,
|
164
164
|
|
165
165
|
getSsoEncrypt,
|
166
166
|
getSsoEncryptList,
|
package/package.json
CHANGED
package/src/router/index.ts
CHANGED
@@ -1,17 +1,17 @@
|
|
1
1
|
import {createRouter, createWebHistory} from 'vue-router'
|
2
2
|
import {getExceptionRoutes} from '../../lib/utils/vueRouterUtils'
|
3
3
|
|
4
|
-
import { getSsoAccessToken,
|
4
|
+
import { getSsoAccessToken, getSsoAuthRoutePath } from '../../lib/utils/ssoUtils';
|
5
5
|
|
6
6
|
|
7
7
|
const router = createRouter({
|
8
8
|
history: createWebHistory(import.meta.env.BASE_URL),
|
9
9
|
routes: [
|
10
10
|
{
|
11
|
-
path: '/sso/
|
12
|
-
component: () => import('@/views/sso/
|
11
|
+
path: '/sso/auth/index',
|
12
|
+
component: () => import('@/views/sso/auth/index.vue'),
|
13
13
|
meta: {
|
14
|
-
title: '
|
14
|
+
title: '认证',
|
15
15
|
isAnonymous: true
|
16
16
|
}
|
17
17
|
},
|
@@ -53,7 +53,7 @@ const router = createRouter({
|
|
53
53
|
router.beforeEach(async (to) => {
|
54
54
|
if (!getSsoAccessToken()) {
|
55
55
|
if (!to.meta?.isAnonymous) {
|
56
|
-
return
|
56
|
+
return getSsoAuthRoutePath(to.fullPath);
|
57
57
|
}
|
58
58
|
return;
|
59
59
|
}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<template>
|
2
|
-
|
2
|
+
<div>认证中...</div>
|
3
3
|
</template>
|
4
4
|
|
5
5
|
<script setup lang="ts">
|
@@ -7,7 +7,7 @@
|
|
7
7
|
import { useRouter } from 'vue-router';
|
8
8
|
|
9
9
|
import { getSsoLoginUrl, setSsoAccessToken } from '../../../../lib/utils/ssoUtils';
|
10
|
-
import {
|
10
|
+
import { removeParameter } from '../../../../lib/utils/urlUtils';
|
11
11
|
|
12
12
|
const router = useRouter();
|
13
13
|
|
@@ -24,8 +24,8 @@
|
|
24
24
|
proxy.$http.get('/sso-api/client/sso-auth/getSsoAccessToken', { params: { ssoAuthCode: ssoAuthCode } }).then((res: any) => {
|
25
25
|
setSsoAccessToken(res.data.data);
|
26
26
|
let ssoRedirectRoutePath = router.currentRoute.value.query.ssoRedirectRoutePath as string;
|
27
|
-
ssoRedirectRoutePath = (ssoRedirectRoutePath && decodeURIComponent(ssoRedirectRoutePath)) || ('/sso/
|
28
|
-
ssoRedirectRoutePath =
|
27
|
+
ssoRedirectRoutePath = (ssoRedirectRoutePath && decodeURIComponent(ssoRedirectRoutePath)) || ('/sso/auth/auth-success' as any);
|
28
|
+
ssoRedirectRoutePath = removeParameter('ssoAuthCode', ssoRedirectRoutePath) || '';
|
29
29
|
router.push(ssoRedirectRoutePath);
|
30
30
|
});
|
31
31
|
});
|