yuang-framework-ui-common 1.0.69 → 1.0.71

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.
@@ -99,7 +99,7 @@ http.interceptors.response.use(async (res: any) => {
99
99
  } else if (res?.data?.statusCode === 500815006) {
100
100
  // 这里存疑: 返回500815004 的时候获取router为null
101
101
  const fullPath = router.currentRoute.value.fullPath;
102
- router.push(`/sso/auth/index?ssoRedirectRoutePath=${encodeURIComponent(fullPath)}`);
102
+ router.push(`/sso/sso-auth/index?ssoRedirectRoutePath=${encodeURIComponent(fullPath)}`);
103
103
  return;
104
104
  } else if (res?.data?.statusCode === 500815003) {
105
105
  showErrorMessage(res?.data?.message || messageMap.requestError);
@@ -1,61 +1,3 @@
1
- import { http } from '../../../lib/config/httpConfig';
2
- import { application } from '../../../lib/config/applicationConfig';
3
1
 
4
- import { getShortUuid } from '../../../lib/utils/uuidUtils';
5
2
 
6
- const initFrameworkGroup = ({ frameworkGroupCode }) => {
7
- return new Promise((resolve) => {
8
- // prettier-ignore
9
- http.post(`${application.gatewayServerBaseUrl}/uims-api/core/framework-group/selectPage`, { codeForEqual: frameworkGroupCode }).then((res) => {
10
- if (res.data.data.records.length == 0) {
11
- const formData = {
12
- id: '',
13
- name: '全部分组',
14
- code: frameworkGroupCode,
15
- parentId: ''
16
- };
17
- http
18
- .post('/uims-api/core/framework-group/insertInfo', formData)
19
- .then((res) => {
20
- formData.id = res.data.data.id;
21
- resolve(formData);
22
- })
23
- .catch(() => {
24
- //
25
- });
26
- } else {
27
- resolve(res.data.data.records[0]);
28
- }
29
- }).catch(() => {
30
- //
31
- });
32
- });
33
- };
34
-
35
- const saveFrameworkGroup = ({ isAddForm, editForm }) => {
36
- return new Promise((resolve, reject) => {
37
- editForm.code = editForm.code || getShortUuid();
38
- // prettier-ignore
39
- http.post(`/uims-api/core/framework-group/${isAddForm ? 'insertInfo' : 'updateInfo'}`, editForm).then((res) => {
40
- if (!editForm.id) {
41
- editForm.id = res.data.data.id;
42
- }
43
- resolve({ group: editForm });
44
- }).catch(() => {
45
- reject();
46
- });
47
- });
48
- };
49
- const deleteFrameworkGroup = ({ editForm }) => {
50
- return new Promise((resolve, reject) => {
51
- // prettier-ignore
52
- http.get(`/uims-api/core/framework-group/deleteInfo`, { params: { id: editForm.id } }).then((res) => {
53
- res;
54
- resolve({ group: editForm });
55
- }).catch(() => {
56
- reject();
57
- });
58
- });
59
- };
60
-
61
- export { initFrameworkGroup, saveFrameworkGroup, deleteFrameworkGroup };
3
+ export { };
@@ -51,6 +51,14 @@ export class FrameworkSseClient {
51
51
  try {
52
52
  this.eventSource = new EventSource(this.url);
53
53
 
54
+ // 监听服务端发送的 clientId 事件
55
+ this.eventSource.addEventListener('clientId', (event) => {
56
+ const clientId = event.data;
57
+ console.log('My clientId:', clientId);
58
+ // 保存到 localStorage 或内存中,用于后续业务请求
59
+ localStorage.setItem('sseClientId', clientId);
60
+ });
61
+
54
62
  // 处理消息事件
55
63
  this.eventSource.onmessage = (event) => {
56
64
  this.messageHandler(event.data, event);
@@ -0,0 +1,38 @@
1
+ import type { FrameworkBase, FrameworkBaseQueryParam } from '../framework/frameworkBase';
2
+
3
+ /**
4
+ * sso用户踪迹
5
+ */
6
+ export interface SsoUserTrace extends FrameworkBase {
7
+ account?: string;
8
+ status?: number;
9
+
10
+ loginTime?: Date;
11
+ logoutTime?: Date;
12
+
13
+ authCode?: string;
14
+ authCodeCreateTime?: Date;
15
+ authCodeExpireTime?: Date;
16
+
17
+ accessToken?: string;
18
+ accessTokenCreateTime?: Date;
19
+ accessTokenExpireTime?: Date;
20
+
21
+
22
+ refreshToken?: string;
23
+ refreshTokenCreateTime?: Date;
24
+ refreshTokenExpireTime?: Date;
25
+
26
+ tgt?: string;
27
+ tgtCreateTime?: Date;
28
+ tgtExpireTime?: Date;
29
+
30
+ }
31
+
32
+ /**
33
+ * sso用户踪迹搜索条件
34
+ */
35
+ export interface SsoUserTraceQueryParam extends FrameworkBaseQueryParam {
36
+ accountForLike?: string;
37
+ statusForEqual?: string;
38
+ }
@@ -45,9 +45,9 @@ const getSsoLogoutUrl = (ssoRedirectUrl = '') => {
45
45
  * @param ssoRedirectRoutePath
46
46
  */
47
47
  const getSsoAuthRoutePath = (ssoRedirectRoutePath = '') => {
48
- let ssoAuthRoutePath = '/sso/auth/index';
48
+ let ssoAuthRoutePath = '/sso/sso-auth/index';
49
49
  if (!ssoRedirectRoutePath) {
50
- ssoAuthRoutePath += `?ssoRedirectRoutePath=${encodeURIComponent('/sso/auth/auth-success')}`;
50
+ ssoAuthRoutePath += `?ssoRedirectRoutePath=${encodeURIComponent('/sso/sso-auth/auth-success')}`;
51
51
  } else {
52
52
  ssoAuthRoutePath += `?ssoRedirectRoutePath=${encodeURIComponent(ssoRedirectRoutePath)}`;
53
53
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yuang-framework-ui-common",
3
- "version": "1.0.69",
3
+ "version": "1.0.71",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "scripts": {
@@ -8,23 +8,23 @@ const router = createRouter({
8
8
  history: createWebHistory(import.meta.env.BASE_URL),
9
9
  routes: [
10
10
  {
11
- path: '/sso/auth/index',
12
- component: () => import('@/views/sso/auth/index.vue'),
11
+ path: '/sso/sso-auth/index',
12
+ component: () => import('@/views/sso/sso-auth/index.vue'),
13
13
  meta: {
14
14
  title: '认证',
15
15
  isSsoExcluded: true
16
16
  }
17
17
  },
18
18
  {
19
- path: '/sso/auth/auth-success',
20
- component: () => import('@/views/sso/auth/auth-success.vue'),
19
+ path: '/sso/sso-auth/auth-success',
20
+ component: () => import('@/views/sso/sso-auth/auth-success.vue'),
21
21
  meta: {
22
22
  title: '认证成功',
23
23
  }
24
24
  },
25
25
  {
26
- path: '/config/gateway-config',
27
- component: () => import('@/views/config/gateway-config.vue')
26
+ path: '/gateway/gateway-config',
27
+ component: () => import('@/views/gateway/gateway-config.vue')
28
28
  },
29
29
  {
30
30
  path: '/utils/aes-utils',
@@ -1,15 +1,22 @@
1
1
  <template>
2
- <div id="messageContainer"></div>
2
+ <div>
3
+
4
+ <div id="messageContainer"></div>
5
+ <el-button @click="sendMessage">发送消息</el-button>
6
+ </div>
3
7
  </template>
4
8
 
5
9
  <script setup lang="ts">
6
10
  import { onMounted, ref } from 'vue';
7
11
  import { FrameworkSseClient } from '../../../../lib/hooks/framework/frameworkSseClient';
12
+ import { http } from '../../../../lib/config/httpConfig';
8
13
 
9
14
  // 初始化 SSE 客户端
10
15
  const frameworkSseClient = new FrameworkSseClient (
11
- 'http://localhost:8290/framework-api/web/framework-sse/connect',
16
+ '/framework-api/standard/framework-sse/connect',
12
17
  (data) => {
18
+ debugger
19
+ console.log('data', data);
13
20
  // 处理接收到的消息
14
21
  const container = document.getElementById('messageContainer');
15
22
  if (container) {
@@ -36,6 +43,12 @@ window.addEventListener('beforeunload', () => {
36
43
  frameworkSseClient.close();
37
44
  });
38
45
 
46
+ const sendMessage = ()=>{
47
+ http.post(`/framework-api/standard/framework-sse/send/3220bfd9-050e-435d-88d7-77b4a1dbf7cf`, { message: "测试" }).then((res) => {
48
+
49
+ });
50
+ }
51
+
39
52
  </script>
40
53
 
41
54
  <style scoped>
@@ -26,7 +26,7 @@
26
26
  http.get(`${application.gatewayServerBaseUrl}/sso-api/client/sso-auth/getSsoAccessToken`, { params: { ssoAuthCode: ssoAuthCode } }).then((res: any) => {
27
27
  setSsoAccessToken(res.data.data);
28
28
  let ssoRedirectRoutePath = router.currentRoute.value.query.ssoRedirectRoutePath as string;
29
- ssoRedirectRoutePath = (ssoRedirectRoutePath && decodeURIComponent(ssoRedirectRoutePath)) || ('/sso/auth/auth-success' as any);
29
+ ssoRedirectRoutePath = (ssoRedirectRoutePath && decodeURIComponent(ssoRedirectRoutePath)) || ('/sso/sso-auth/auth-success' as any);
30
30
  ssoRedirectRoutePath = removeParameter('ssoAuthCode', ssoRedirectRoutePath) || '';
31
31
  router.push(ssoRedirectRoutePath);
32
32
  });