yuang-framework-ui-common 1.0.44 → 1.0.45
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/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,7 +1,7 @@
|
|
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({
|
@@ -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
|
}
|
@@ -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
|
|
@@ -25,7 +25,7 @@
|
|
25
25
|
setSsoAccessToken(res.data.data);
|
26
26
|
let ssoRedirectRoutePath = router.currentRoute.value.query.ssoRedirectRoutePath as string;
|
27
27
|
ssoRedirectRoutePath = (ssoRedirectRoutePath && decodeURIComponent(ssoRedirectRoutePath)) || ('/sso/login/login-success' as any);
|
28
|
-
ssoRedirectRoutePath =
|
28
|
+
ssoRedirectRoutePath = removeParameter('ssoAuthCode', ssoRedirectRoutePath) || '';
|
29
29
|
router.push(ssoRedirectRoutePath);
|
30
30
|
});
|
31
31
|
});
|