yuang-framework-ui-common 1.0.46 → 1.0.48

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.
@@ -1,7 +1,7 @@
1
1
  import { http } from '../config/httpConfig';
2
2
  import { getLocalStorageItem, setLocalStorageItem, removeLocalStorageItem } from '../utils/storageUtils';
3
3
 
4
- const getGatewayConfigUrl = '/server/gateway/getGatewayConfig';
4
+ const getGatewayConfigUrl = '/server/gateway-config/getGatewayConfig';
5
5
  const initGatewayConfig = () => {
6
6
  return new Promise<void>(async resolve => {
7
7
  let res = await http.get(getGatewayConfigUrl);
@@ -48,6 +48,7 @@ http.interceptors.response.use(async (res: any) => {
48
48
  showErrorMessage(messageMap.responseSturctError);
49
49
  return Promise.reject(new Error(messageMap.responseSturctError));
50
50
  }
51
+ debugger
51
52
  if (res?.data?.statusCode !== 200) {
52
53
  // 登录过期处理
53
54
  if (res?.data?.statusCode === 401) {
@@ -4,7 +4,7 @@ import { ElMessageBox } from 'element-plus/es';
4
4
 
5
5
 
6
6
 
7
- const alertMessageBox = ({title, message, confirmButtonText, callback}: {title: string, message: string, confirmButtonText: string, callback: (param:string)=>{}}) => {
7
+ const alertMessageBox = ({title, message, confirmButtonText, callback}: {title: string, message: string, confirmButtonText: string, callback: (param:string) => void}) => {
8
8
  if(isPc()) {
9
9
  ElMessageBox.close();
10
10
  ElMessageBox.alert(message, title, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yuang-framework-ui-common",
3
- "version": "1.0.46",
3
+ "version": "1.0.48",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "scripts": {
@@ -12,7 +12,14 @@ const router = createRouter({
12
12
  component: () => import('@/views/sso/auth/index.vue'),
13
13
  meta: {
14
14
  title: '认证',
15
- isAnonymous: true
15
+ isSsoExcluded: true
16
+ }
17
+ },
18
+ {
19
+ path: '/sso/auth/auth-success',
20
+ component: () => import('@/views/sso/auth/auth-success.vue'),
21
+ meta: {
22
+ title: '认证成功',
16
23
  }
17
24
  },
18
25
  {
@@ -52,7 +59,7 @@ const router = createRouter({
52
59
  /* 路由守卫 */
53
60
  router.beforeEach(async (to) => {
54
61
  if (!getSsoAccessToken()) {
55
- if (!to.meta?.isAnonymous) {
62
+ if (!to.meta?.isSsoExcluded) {
56
63
  return getSsoAuthRoutePath(to.fullPath);
57
64
  }
58
65
  return;
@@ -3,14 +3,11 @@
3
3
  </template>
4
4
 
5
5
  <script setup lang="ts">
6
- import { onMounted, ref, getCurrentInstance } from 'vue';
7
- const { proxy } = getCurrentInstance() as any;
6
+ import { onMounted } from 'vue';
8
7
 
9
8
 
10
9
  onMounted(() => {
11
- proxy.$http.get('/sso-api/standard/framework-captcha/getCaptcha', { params: {} }).then((res: any) => {
12
10
 
13
- });
14
11
  })
15
12
  </script>
16
13
 
@@ -0,0 +1,47 @@
1
+ <template>
2
+ <h1>认证成功! {{ ssoData?.ssoTokenUser?.account }}</h1>
3
+
4
+ <h3 @click="getSsoTokenUser">获取ssoTokenUser</h3>
5
+ <h3 @click="getSsoIdentity">获取SsoIdentity</h3>
6
+
7
+ <a @click="logout">注销登录</a>
8
+ </template>
9
+
10
+ <script setup lang="ts">
11
+ import { onMounted, reactive } from 'vue';
12
+ import { ElMessage } from 'element-plus/es';
13
+
14
+ import { getSsoAccessToken, logoutSso } from '../../../../lib/utils/ssoUtils';
15
+ import { http } from '../../../../lib/config/httpConfig';
16
+
17
+ let ssoData = reactive({
18
+ ssoTokenUser: {},
19
+ ssoIdentity: {}
20
+ });
21
+
22
+ onMounted(() => {
23
+ let ssoAccessToken = getSsoAccessToken();
24
+ console.log('ssoAccessToken', ssoAccessToken);
25
+ getSsoTokenUser();
26
+ });
27
+ const getSsoTokenUser = () => {
28
+ http.get('/sso-api/client/sso-user/getSsoTokenUser').then((res: any) => {
29
+ ssoData.ssoTokenUser = res.data.data;
30
+ console.log('ssoTokenUser', ssoData.ssoTokenUser);
31
+ ElMessage.success('获取成功');
32
+ });
33
+ };
34
+ const getSsoIdentity = () => {
35
+ http.get('/sso-api/client/sso-user/getSsoIdentity', { params: { ssoClientAccount: 'yuang-sso' } }).then((res: any) => {
36
+ ssoData.ssoIdentity = res.data.data;
37
+ console.log('ssoIdentity', ssoData.ssoIdentity);
38
+ ElMessage.success('获取成功');
39
+ });
40
+ };
41
+
42
+ const logout = () => {
43
+ logoutSso();
44
+ };
45
+ </script>
46
+
47
+ <style scoped></style>
@@ -3,6 +3,7 @@
3
3
  <el-button @click="showInfoMessage('信息')">信息</el-button>
4
4
  <el-button @click="showWarningMessage('警告')">警告</el-button>
5
5
  <el-button @click="showErrorMessage('错误')">错误</el-button>
6
+
6
7
  </template>
7
8
 
8
9
  <script setup lang="ts">