af-mobile-client-vue3 1.4.88 → 1.4.90

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.
Files changed (39) hide show
  1. package/__dummy__ +9 -9
  2. package/build/vite/optimize.ts +36 -36
  3. package/package.json +2 -2
  4. package/public/favicon.svg +4 -4
  5. package/scripts/verifyCommit.js +19 -19
  6. package/src/components/common/MateChat/apiService.ts +21 -0
  7. package/src/components/common/MateChat/components/MateChatContent.vue +119 -7
  8. package/src/components/common/MateChat/components/MateChatHeader.vue +337 -337
  9. package/src/components/common/MateChat/components/PromptList/PromptList.vue +27 -13
  10. package/src/components/common/MateChat/composables/useMateChat.ts +10 -1
  11. package/src/components/common/MateChat/types.ts +16 -0
  12. package/src/components/data/UserDetail/types.ts +1 -1
  13. package/src/components/data/XReportGrid/XAddReport/index.ts +1 -1
  14. package/src/components/data/XReportGrid/XReportDrawer/index.ts +1 -1
  15. package/src/components/data/XTag/index.vue +10 -10
  16. package/src/hooks/useCommon.ts +9 -9
  17. package/src/plugins/AppData.ts +38 -38
  18. package/src/router/invoiceRoutes.ts +33 -33
  19. package/src/services/api/common.ts +109 -109
  20. package/src/services/api/manage.ts +8 -8
  21. package/src/services/api/search.ts +16 -16
  22. package/src/services/restTools.ts +56 -56
  23. package/src/stores/modules/user.ts +1 -1
  24. package/src/utils/authority-utils.ts +84 -84
  25. package/src/utils/crypto.ts +39 -39
  26. package/src/utils/runEvalFunction.ts +13 -13
  27. package/src/views/component/EvaluateRecordView/index.vue +40 -40
  28. package/src/views/component/MateChat/MateChatView.vue +10 -10
  29. package/src/views/component/XCellDetailView/index.vue +217 -217
  30. package/src/views/component/XCellListView/index.vue +8 -5
  31. package/src/views/component/XFormView/index.vue +2 -2
  32. package/src/views/component/XReportFormIframeView/index.vue +47 -47
  33. package/src/views/component/XReportFormView/index.vue +13 -13
  34. package/src/views/component/XSignatureView/index.vue +50 -50
  35. package/src/views/component/notice.vue +46 -46
  36. package/src/views/component/topNav.vue +36 -36
  37. package/src/views/invoiceShow/index.vue +61 -61
  38. package/src/views/user/login/index.vue +22 -22
  39. package/vite.config.ts +2 -9
package/__dummy__ CHANGED
@@ -1,10 +1,10 @@
1
- {
2
- "cells": [],
3
- "metadata": {
4
- "language_info": {
5
- "name": "python"
6
- }
7
- },
8
- "nbformat": 4,
9
- "nbformat_minor": 2
1
+ {
2
+ "cells": [],
3
+ "metadata": {
4
+ "language_info": {
5
+ "name": "python"
6
+ }
7
+ },
8
+ "nbformat": 4,
9
+ "nbformat_minor": 2
10
10
  }
@@ -1,36 +1,36 @@
1
- const include = [
2
- 'axios',
3
- 'echarts',
4
- 'lodash-es',
5
- 'resize-detector',
6
- 'vant/es',
7
- 'vant/es/cell-group/style/index',
8
- 'vant/es/popup/style/index',
9
- 'vant/es/picker/style/index',
10
- 'vant/es/cell/style/index',
11
- 'vant/es/switch/style/index',
12
- 'vant/es/space/style/index',
13
- 'vant/es/button/style/index',
14
- 'vant/es/empty/style/index',
15
- 'vant/es/icon/style/index',
16
- 'vant/es/stepper/style/index',
17
- 'vant/es/image/style/index',
18
- 'vant/es/form/style/index',
19
- 'vant/es/field/style/index',
20
- 'vant/es/notify/style/index',
21
- 'vant/es/config-provider/style/index',
22
- 'vant/es/nav-bar/style/index',
23
- 'vant/es/tabbar/style/index',
24
- 'vant/es/tabbar-item/style/index',
25
- 'vant/es/list/style/index',
26
- 'vant/es/text-ellipsis/style/index',
27
- // 确保 @matechat/core 及其依赖 xss 被正确预构建
28
- '@matechat/core',
29
- ]
30
-
31
- const exclude = [
32
- '@iconify/json',
33
- '@iconify/vue',
34
- ]
35
-
36
- export { exclude, include }
1
+ const include = [
2
+ 'axios',
3
+ 'echarts',
4
+ 'lodash-es',
5
+ 'resize-detector',
6
+ 'vant/es',
7
+ 'vant/es/cell-group/style/index',
8
+ 'vant/es/popup/style/index',
9
+ 'vant/es/picker/style/index',
10
+ 'vant/es/cell/style/index',
11
+ 'vant/es/switch/style/index',
12
+ 'vant/es/space/style/index',
13
+ 'vant/es/button/style/index',
14
+ 'vant/es/empty/style/index',
15
+ 'vant/es/icon/style/index',
16
+ 'vant/es/stepper/style/index',
17
+ 'vant/es/image/style/index',
18
+ 'vant/es/form/style/index',
19
+ 'vant/es/field/style/index',
20
+ 'vant/es/notify/style/index',
21
+ 'vant/es/config-provider/style/index',
22
+ 'vant/es/nav-bar/style/index',
23
+ 'vant/es/tabbar/style/index',
24
+ 'vant/es/tabbar-item/style/index',
25
+ 'vant/es/list/style/index',
26
+ 'vant/es/text-ellipsis/style/index',
27
+ // 确保 @matechat/core 及其依赖 xss 被正确预构建
28
+ '@matechat/core',
29
+ ]
30
+
31
+ const exclude = [
32
+ '@iconify/json',
33
+ '@iconify/vue',
34
+ ]
35
+
36
+ export { exclude, include }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "af-mobile-client-vue3",
3
3
  "type": "module",
4
- "version": "1.4.88",
4
+ "version": "1.4.90",
5
5
  "packageManager": "pnpm@10.13.1",
6
6
  "description": "Vue + Vite component lib",
7
7
  "engines": {
@@ -22,7 +22,7 @@
22
22
  },
23
23
  "dependencies": {
24
24
  "@iconify/vue": "4.3.0",
25
- "@matechat/core": "^1.10.0",
25
+ "@matechat/core": "^1.11.1",
26
26
  "@micro-zoe/micro-app": "1.0.0-rc.26",
27
27
  "@unhead/vue": "2.0.12",
28
28
  "@vant/area-data": "^2.0.0",
@@ -1,4 +1,4 @@
1
- <svg t="1709866807903" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4913" width="32" height="32">
2
- <path d="M512 598.528a111.232 111.232 0 0 0-111.232 111.2064V870.4h222.464v-160.6656c0-61.44-49.792-111.232-111.232-111.232z m0 58.0608c-30.72 0-55.6032 24.9088-55.6032 55.6288v105.0368h111.2064v-105.0368c0-30.72-24.8832-55.6288-55.6032-55.6288z" fill="#FB4D31" p-id="4914"></path>
3
- <path d="M542.08 270.208l45.2608-78.5408a24.5248 24.5248 0 0 0 0-25.6A26.4448 26.4448 0 0 0 564.1472 153.6a26.3424 26.3424 0 0 0-22.5792 13.44L512 217.6256l-29.5424-50.5344c-4.5824-8.192-13.184-13.312-22.5536-13.4912a26.4448 26.4448 0 0 0-23.2448 12.4928 24.5248 24.5248 0 0 0 0 25.6l45.2352 78.5152L156.928 832.768a24.4736 24.4736 0 0 0 0.3328 25.088c4.8384 7.8336 13.3888 12.544 22.5792 12.5184h664.3456c9.3184 0 17.92-4.7616 22.6304-12.4672a24.4736 24.4736 0 0 0 0.3072-25.088l-325.0176-562.688v0.0512zM619.52 816.64h-33.3568c-12.3648 0-9.6768 0.1024-65.0496 0H512c-55.3728 0.1024-24.704 0-61.7984 0H225.28L512 322.1248 798.72 816.64h-179.2z" fill="#000000" p-id="4915"></path>
4
- </svg>
1
+ <svg t="1709866807903" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4913" width="32" height="32">
2
+ <path d="M512 598.528a111.232 111.232 0 0 0-111.232 111.2064V870.4h222.464v-160.6656c0-61.44-49.792-111.232-111.232-111.232z m0 58.0608c-30.72 0-55.6032 24.9088-55.6032 55.6288v105.0368h111.2064v-105.0368c0-30.72-24.8832-55.6288-55.6032-55.6288z" fill="#FB4D31" p-id="4914"></path>
3
+ <path d="M542.08 270.208l45.2608-78.5408a24.5248 24.5248 0 0 0 0-25.6A26.4448 26.4448 0 0 0 564.1472 153.6a26.3424 26.3424 0 0 0-22.5792 13.44L512 217.6256l-29.5424-50.5344c-4.5824-8.192-13.184-13.312-22.5536-13.4912a26.4448 26.4448 0 0 0-23.2448 12.4928 24.5248 24.5248 0 0 0 0 25.6l45.2352 78.5152L156.928 832.768a24.4736 24.4736 0 0 0 0.3328 25.088c4.8384 7.8336 13.3888 12.544 22.5792 12.5184h664.3456c9.3184 0 17.92-4.7616 22.6304-12.4672a24.4736 24.4736 0 0 0 0.3072-25.088l-325.0176-562.688v0.0512zM619.52 816.64h-33.3568c-12.3648 0-9.6768 0.1024-65.0496 0H512c-55.3728 0.1024-24.704 0-61.7984 0H225.28L512 322.1248 798.72 816.64h-179.2z" fill="#000000" p-id="4915"></path>
4
+ </svg>
@@ -1,19 +1,19 @@
1
- import fs from 'node:fs'
2
-
3
- // import process from 'node:process'
4
-
5
- const msg = fs.readFileSync('.git/COMMIT_EDITMSG', 'utf-8').trim()
6
-
7
- const commitRE = /^(?:revert: )?(?:feat|fix|docs|dx|style|refactor|perf|test|workflow|build|ci|chore|types|wip|release)(?:\(.+\))?: .{1,50}/
8
- // const mergeRe = /^(Merge pull request|Merge branch)/
9
-
10
- if (!commitRE.test(msg)) {
11
- // if (!mergeRe.test(msg)) {
12
- // console.log('git commit unpass')
13
- // console.error('git commit error, needs title(scope): desc')
14
- // process.exit(1)
15
- // }
16
- }
17
- else {
18
- console.log('git commit pass')
19
- }
1
+ import fs from 'node:fs'
2
+
3
+ // import process from 'node:process'
4
+
5
+ const msg = fs.readFileSync('.git/COMMIT_EDITMSG', 'utf-8').trim()
6
+
7
+ const commitRE = /^(?:revert: )?(?:feat|fix|docs|dx|style|refactor|perf|test|workflow|build|ci|chore|types|wip|release)(?:\(.+\))?: .{1,50}/
8
+ // const mergeRe = /^(Merge pull request|Merge branch)/
9
+
10
+ if (!commitRE.test(msg)) {
11
+ // if (!mergeRe.test(msg)) {
12
+ // console.log('git commit unpass')
13
+ // console.error('git commit error, needs title(scope): desc')
14
+ // process.exit(1)
15
+ // }
16
+ }
17
+ else {
18
+ console.log('git commit pass')
19
+ }
@@ -40,6 +40,19 @@ export function generateOutLinkUid(): string {
40
40
  return `${type}_${userId}`
41
41
  }
42
42
 
43
+ /**
44
+ * 获取用户平台 OpenID
45
+ * @returns OpenID
46
+ */
47
+ export function getOpenId(): string {
48
+ const userStore = useUserStore()
49
+ const userInfo = userStore.getUserInfo()
50
+ if (userInfo.platformUserId) {
51
+ return userInfo.platformUserId
52
+ }
53
+ return null
54
+ }
55
+
43
56
  /**
44
57
  * 发送聊天请求
45
58
  * @param content 用户输入的内容
@@ -58,6 +71,10 @@ export function chatCompletions(
58
71
  chatId,
59
72
  stream: false,
60
73
  detail: false,
74
+ variables: {
75
+ openid: getOpenId(),
76
+ // openid: 'oUx6l5gyHp3JNt9465QCKZOgjB9E',
77
+ },
61
78
  messages: [
62
79
  {
63
80
  role: 'user',
@@ -142,6 +159,10 @@ export async function chatCompletionsStream(
142
159
  chatId,
143
160
  stream: true,
144
161
  detail: false,
162
+ variables: {
163
+ openid: getOpenId(),
164
+ // openid: 'oYt6WtxACKSH4XmIe0E3jUvx70U0',
165
+ },
145
166
  messages: [
146
167
  {
147
168
  role: 'user',
@@ -1,5 +1,5 @@
1
1
  <script setup lang="ts">
2
- import type { MateChatConfig } from '@af-mobile-client-vue3/components/common/MateChat/types'
2
+ import type { MateChatConfig, MateChatOptionsMessage } from '@af-mobile-client-vue3/components/common/MateChat/types'
3
3
  import liuliLogo from '@af-mobile-client-vue3/assets/img/component/liuli.png'
4
4
  import userAvatarImg from '@af-mobile-client-vue3/components/common/MateChat/assets/035-avatar-13.svg'
5
5
  import MateChatHeader from '@af-mobile-client-vue3/components/common/MateChat/components/MateChatHeader.vue'
@@ -45,10 +45,10 @@ function onCardClick(msg: any) {
45
45
  router.push(msg.action.path)
46
46
  }
47
47
  }
48
- function parseCard(content: string) {
48
+ function parseStructured(content: string): any | null {
49
49
  try {
50
50
  const data = JSON.parse(content)
51
- if (data && data.msgType === 'card') {
51
+ if (data && (data.msgType === 'card' || data.msgType === 'options')) {
52
52
  return data
53
53
  }
54
54
  }
@@ -56,6 +56,46 @@ function parseCard(content: string) {
56
56
  return null
57
57
  }
58
58
 
59
+ function parseCard(content: string) {
60
+ const data = parseStructured(content)
61
+ if (data && data.msgType === 'card') {
62
+ return data
63
+ }
64
+ return null
65
+ }
66
+
67
+ function parseOptions(content: string): MateChatOptionsMessage | null {
68
+ const data = parseStructured(content) as MateChatOptionsMessage | null
69
+ if (!data || data.msgType !== 'options') {
70
+ return null
71
+ }
72
+ if (!Array.isArray(data.options)) {
73
+ return null
74
+ }
75
+ return data
76
+ }
77
+
78
+ function getDisplayContent(content: string): string {
79
+ const card = parseCard(content)
80
+ if (card) {
81
+ return card.msg || ''
82
+ }
83
+
84
+ const opt = parseOptions(content)
85
+ if (opt) {
86
+ return opt.msg || ''
87
+ }
88
+
89
+ return content
90
+ }
91
+
92
+ function handleOptionClick(item: any) {
93
+ const text = item?.sendText || item?.send || item?.value || item?.label
94
+ if (typeof text === 'string' && text.trim()) {
95
+ onSubmit(text)
96
+ }
97
+ }
98
+
59
99
  // 消息容器的 ref
60
100
  const messageContainerRef = ref<HTMLElement | null>(null)
61
101
  // 滚动锚点的 ref
@@ -161,7 +201,7 @@ function handleSelectSession(session: { chatId: string, title: string, lastTime:
161
201
  />
162
202
  <McBubble v-else :content="msg.content" :avatar-config="{ imgSrc: liuliLogo }" :loading="msg.loading">
163
203
  <McMarkdownCard
164
- :content="parseCard(msg.content) ? (parseCard(msg.content).msg || '') : msg.content"
204
+ :content="getDisplayContent(msg.content)"
165
205
  :typing="msg.typing === true"
166
206
  />
167
207
  <template v-if="parseCard(msg.content)">
@@ -174,12 +214,26 @@ function handleSelectSession(session: { chatId: string, title: string, lastTime:
174
214
  </div>
175
215
  </div>
176
216
  </template>
217
+ <template v-else-if="parseOptions(msg.content) && !msg.loading">
218
+ <PromptList
219
+ class="mc-options"
220
+ :list="(parseOptions(msg.content)?.options || []).map((opt, i) => ({
221
+ value: opt.value || String(i),
222
+ label: opt.label,
223
+ desc: opt.desc,
224
+ sendText: opt.send || opt.label,
225
+ }))"
226
+ :direction="parseOptions(msg.content)?.direction || 'vertical'"
227
+ :variant="parseOptions(msg.content)?.variant || 'default'"
228
+ @item-click="handleOptionClick"
229
+ />
230
+ </template>
177
231
  </McBubble>
178
232
  </template>
179
233
  <!-- 滚动锚点 -->
180
234
  <div ref="scrollAnchorRef" class="scroll-anchor" />
181
235
  </McLayoutContent>
182
- <div class="shortcut" style="display: flex; align-items: center; gap: 8px">
236
+ <!-- <div class="shortcut" style="display: flex; align-items: center; gap: 8px">
183
237
  <PromptList
184
238
  v-if="!startPage && simplePrompt && simplePrompt.length"
185
239
  :list="simplePrompt"
@@ -189,8 +243,8 @@ function handleSelectSession(session: { chatId: string, title: string, lastTime:
189
243
  style="flex: 1"
190
244
  @item-click="onSubmit($event.desc)"
191
245
  />
192
- </div>
193
- <McLayoutSender>
246
+ </div> -->
247
+ <McLayoutSender class="mc-layout-sender">
194
248
  <McInput
195
249
  :value="inputValue"
196
250
  placeholder="请输入您的问题,我会为您解答"
@@ -223,12 +277,36 @@ function handleSelectSession(session: { chatId: string, title: string, lastTime:
223
277
  box-shadow: 0 25px 70px rgba(0, 0, 0, 0.2);
224
278
  }
225
279
 
280
+ .mc-layout-sender {
281
+ background: #ffffff;
282
+ z-index: 10;
283
+ position: relative;
284
+ }
285
+
226
286
  /* 移动端适配 */
227
287
  @media (max-width: 768px) {
228
288
  .chat-card {
229
289
  border-radius: 16px;
230
290
  padding: 8px;
231
291
  }
292
+
293
+ // 修复移动端键盘弹出时的布局问题
294
+ :deep(.mc-layout-sender) {
295
+ background: #ffffff;
296
+ z-index: 100;
297
+ padding-bottom: env(safe-area-inset-bottom);
298
+ // border-top: 1px solid #f0f0f0;
299
+ }
300
+
301
+ .shortcut {
302
+ padding: 0 4px;
303
+ // 键盘弹出时,如果空间不足,允许快捷入口滚动而不是挤压
304
+ overflow-x: auto;
305
+ -webkit-overflow-scrolling: touch;
306
+ &::-webkit-scrollbar {
307
+ display: none;
308
+ }
309
+ }
232
310
  }
233
311
 
234
312
  .content-container {
@@ -267,6 +345,40 @@ function handleSelectSession(session: { chatId: string, title: string, lastTime:
267
345
  color: #86909c;
268
346
  }
269
347
 
348
+ :deep(.mc-options.prompt-list) {
349
+ gap: 8px;
350
+ }
351
+
352
+ :deep(.mc-options .prompt-item) {
353
+ padding: 10px 12px;
354
+ gap: 10px;
355
+ border-radius: 10px;
356
+ border: 1px solid rgba(94, 124, 224, 0.12);
357
+ background: rgba(94, 124, 224, 0.06);
358
+ }
359
+
360
+ :deep(.mc-options .prompt-item:hover) {
361
+ transform: none;
362
+ box-shadow: none;
363
+ border-color: rgba(94, 124, 224, 0.18);
364
+ background: rgba(94, 124, 224, 0.08);
365
+ }
366
+
367
+ :deep(.mc-options .prompt-item__label) {
368
+ font-size: 13px;
369
+ line-height: 18px;
370
+ margin-bottom: 2px;
371
+ }
372
+
373
+ :deep(.mc-options .prompt-item__desc) {
374
+ font-size: 12px;
375
+ line-height: 16px;
376
+ display: -webkit-box;
377
+ -webkit-line-clamp: 2;
378
+ -webkit-box-orient: vertical;
379
+ overflow: hidden;
380
+ }
381
+
270
382
  .input-foot-wrapper {
271
383
  display: flex;
272
384
  justify-content: space-between;