@opentiny/vue-docs 3.24.6 → 3.25.0

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 (104) hide show
  1. package/demos/apis/button.js +15 -0
  2. package/demos/apis/calendar-view.js +3 -2
  3. package/demos/apis/chart-demo.js +1 -1
  4. package/demos/apis/chart-docs.js +1 -1
  5. package/demos/apis/chart-events.js +1 -1
  6. package/demos/apis/chart-question.js +1 -1
  7. package/demos/apis/chart.js +1 -1
  8. package/demos/apis/form.js +3 -0
  9. package/demos/apis/grid.js +76 -16
  10. package/demos/mobile-first/app/button/type.vue +1 -1
  11. package/demos/mobile-first/app/button/webdoc/button.js +2 -2
  12. package/demos/pc/app/action-menu/basic-usage-composition-api.vue +1 -1
  13. package/demos/pc/app/action-menu/basic-usage.vue +1 -1
  14. package/demos/pc/app/action-menu/card-mode-composition-api.vue +1 -1
  15. package/demos/pc/app/action-menu/card-mode.vue +1 -1
  16. package/demos/pc/app/action-menu/disabled-composition-api.vue +2 -2
  17. package/demos/pc/app/action-menu/disabled.vue +2 -2
  18. package/demos/pc/app/action-menu/events-composition-api.vue +1 -1
  19. package/demos/pc/app/action-menu/events.vue +1 -1
  20. package/demos/pc/app/action-menu/icon-composition-api.vue +2 -2
  21. package/demos/pc/app/action-menu/icon.vue +2 -2
  22. package/demos/pc/app/action-menu/max-show-num-composition-api.vue +1 -1
  23. package/demos/pc/app/action-menu/max-show-num.vue +1 -1
  24. package/demos/pc/app/action-menu/more-text-composition-api.vue +1 -1
  25. package/demos/pc/app/action-menu/more-text.vue +1 -1
  26. package/demos/pc/app/action-menu/popper-class-composition-api.vue +1 -1
  27. package/demos/pc/app/action-menu/popper-class.vue +1 -1
  28. package/demos/pc/app/action-menu/slot-item-composition-api.vue +1 -1
  29. package/demos/pc/app/action-menu/slot-item.vue +1 -1
  30. package/demos/pc/app/action-menu/spacing-composition-api.vue +1 -1
  31. package/demos/pc/app/action-menu/spacing.vue +1 -1
  32. package/demos/pc/app/action-menu/text-field-composition-api.vue +1 -1
  33. package/demos/pc/app/action-menu/text-field.spec.ts +1 -1
  34. package/demos/pc/app/action-menu/text-field.vue +1 -1
  35. package/demos/pc/app/button/icon-composition-api.vue +3 -1
  36. package/demos/pc/app/button/icon.vue +3 -1
  37. package/demos/pc/app/button/webdoc/button.js +3 -2
  38. package/demos/pc/app/calendar-view/calendar-mode-composition-api.vue +7 -1
  39. package/demos/pc/app/calendar-view/calendar-mode.spec.ts +3 -0
  40. package/demos/pc/app/calendar-view/calendar-mode.vue +7 -1
  41. package/demos/pc/app/carousel/webdoc/carousel.js +0 -18
  42. package/demos/pc/app/date-panel/custom-week.spec.ts +2 -2
  43. package/demos/pc/app/grid/base/basic-usage-composition-api.vue +1 -17
  44. package/demos/pc/app/grid/custom/column-fixed.spec.js +2 -1
  45. package/demos/pc/app/grid/custom/page-size.spec.js +1 -1
  46. package/demos/pc/app/grid/data-source/request-service.spec.js +1 -1
  47. package/demos/pc/app/grid/data-source/static-data.spec.js +1 -1
  48. package/demos/pc/app/grid/edit/scrollbar-not-blur-composition-api.vue +119 -0
  49. package/demos/pc/app/grid/edit/scrollbar-not-blur.spec.ts +28 -0
  50. package/demos/pc/app/grid/edit/scrollbar-not-blur.vue +129 -0
  51. package/demos/pc/app/grid/editor/custom-edit.spec.js +7 -2
  52. package/demos/pc/app/grid/empty/empty-data-iscenter.spec.js +1 -1
  53. package/demos/pc/app/grid/event/toolbar-button-click-event.spec.js +1 -1
  54. package/demos/pc/app/grid/expand/expand-trigger-slot-composition-api.vue +85 -0
  55. package/demos/pc/app/grid/expand/expand-trigger-slot.spec.ts +11 -0
  56. package/demos/pc/app/grid/expand/expand-trigger-slot.vue +95 -0
  57. package/demos/pc/app/grid/expand/set-row-expansion.spec.js +4 -0
  58. package/demos/pc/app/grid/filter/default-filter-composition-api.vue +6 -0
  59. package/demos/pc/app/grid/filter/default-filter.vue +6 -0
  60. package/demos/pc/app/grid/filter/default-relation.spec.js +1 -1
  61. package/demos/pc/app/grid/filter/server-filter.spec.js +1 -1
  62. package/demos/pc/app/grid/fixed/right-fixed-composition-api.vue +4 -4
  63. package/demos/pc/app/grid/fixed/right-fixed.vue +4 -4
  64. package/demos/pc/app/grid/footer/footer-summation-empty.spec.js +0 -1
  65. package/demos/pc/app/grid/large-data/full-data-loading.spec.js +10 -3
  66. package/demos/pc/app/grid/large-data/virtual-rolling.spec.js +9 -2
  67. package/demos/pc/app/grid/mouse-keyboard/keyboard-navigation.spec.js +4 -1
  68. package/demos/pc/app/grid/renderer/inner-renderer-date-composition-api.vue +4 -3
  69. package/demos/pc/app/grid/renderer/inner-renderer-date.spec.js +2 -2
  70. package/demos/pc/app/grid/renderer/inner-renderer-date.vue +3 -3
  71. package/demos/pc/app/grid/renderer/inner-renderer.spec.js +4 -0
  72. package/demos/pc/app/grid/size/max-min-grid-height.spec.js +2 -2
  73. package/demos/pc/app/grid/sort/combinations-sort.spec.js +2 -2
  74. package/demos/pc/app/grid/webdoc/grid-edit.js +12 -0
  75. package/demos/pc/app/grid/webdoc/grid-empty.js +1 -1
  76. package/demos/pc/app/grid/webdoc/grid-expand.js +11 -0
  77. package/demos/pc/app/icon/iconGroups.js +1 -0
  78. package/demos/pc/app/popeditor/conditions.spec.ts +1 -1
  79. package/demos/pc/app/select/nest-grid-remote.spec.ts +3 -3
  80. package/demos/pc/app/select/nest-grid.spec.ts +1 -1
  81. package/demos/pc/app/select/nest-radio-grid-much-data.spec.ts +5 -7
  82. package/demos/pc/webdoc/changelog-en.md +270 -197
  83. package/demos/pc/webdoc/changelog.md +82 -256
  84. package/package.json +19 -23
  85. package/playground/App.vue +2 -2
  86. package/src/App.vue +1 -18
  87. package/src/components/float-settings.vue +0 -13
  88. package/src/composable/utils.ts +2 -162
  89. package/src/i18n/index.js +1 -2
  90. package/src/main.js +1 -10
  91. package/src/router.js +0 -12
  92. package/src/tools/appData.js +2 -11
  93. package/src/views/components-doc/common.vue +0 -6
  94. package/src/components/MessageCard.vue +0 -117
  95. package/src/components/tiny-robot-chat.vue +0 -128
  96. package/src/composable/DifyModelProvider.ts +0 -65
  97. package/src/composable/useTinyRobot.ts +0 -167
  98. package/src/views/comprehensive/Demo.vue +0 -212
  99. package/src/views/comprehensive/index.vue +0 -380
  100. package/src/views/comprehensive/products.json +0 -98
  101. package/src/views/comprehensive/types/index.ts +0 -37
  102. package/src/views/remoter/index.vue +0 -63
  103. package/src/views/remoter/sound.vue +0 -349
  104. /package/demos/pc/app/grid/expand/{expand-config.spec.js → expand-config.spec.ts} +0 -0
@@ -1,380 +0,0 @@
1
- <template>
2
- <div class="header">
3
- <div class="qr-code-trigger" @click="showQrCode = true">
4
- <IconAi class="qr-icon" />
5
- <div class="qr-text-wrapper">
6
- <span class="qr-label">手机遥控</span>
7
- <span class="qr-desc">扫码体验移动端操作</span>
8
- </div>
9
- </div>
10
- </div>
11
- <div class="app-container">
12
- <!-- 主体内容区域 -->
13
- <div class="main-content">
14
- <Demo />
15
- </div>
16
- <div class="right-panel" :class="{ collapsed: !appData.showTinyRobot }">
17
- <tiny-robot-chat :prompt-items="promptItems" :suggestion-pill-items="suggestionPillItems" />
18
- </div>
19
- <IconAi @click="appData.showTinyRobot = !appData.showTinyRobot" class="style-settings-icon"></IconAi>
20
- </div>
21
-
22
- <!-- QR Code Modal -->
23
- <Teleport to="body">
24
- <div class="qr-modal" v-if="showQrCode" @click.self="showQrCode = false">
25
- <div class="qr-modal-content">
26
- <div class="qr-modal-header">
27
- <h3>手机遥控体验</h3>
28
- </div>
29
- <div class="qr-modal-body">
30
- <div class="qr-wrapper">
31
- <tiny-qr-code :value="sessionUrl" :size="200" color="#1677ff"></tiny-qr-code>
32
- <div class="qr-status">
33
- <div class="status-dot"></div>
34
- <span>链接已生成</span>
35
- </div>
36
- </div>
37
- <div class="qr-instructions">
38
- <p class="instruction-title">使用说明</p>
39
- <ol class="instruction-steps">
40
- <li>使用微信扫一扫,扫描上方二维码</li>
41
- <li>然后点击微信右上角的 "..." 图标</li>
42
- <li>选择在默认浏览器中打开</li>
43
- <li>可以选择直接语音交互也可使用AI对话框进行交互</li>
44
- </ol>
45
- </div>
46
- </div>
47
- </div>
48
- </div>
49
- </Teleport>
50
- </template>
51
-
52
- <script setup lang="ts">
53
- import { watch, ref, h } from 'vue'
54
- import TinyRobotChat from '@/components/tiny-robot-chat.vue'
55
- import { globalConversation } from '@/composable/utils'
56
- import { IconAi } from '@opentiny/tiny-robot-svgs'
57
- import CryptoJS from 'crypto-js'
58
- import { TinyQrCode } from '@opentiny/vue'
59
- import Demo from './Demo.vue'
60
- import { appData } from '@/tools/appData'
61
-
62
- appData.showTinyRobot = true
63
- const showQrCode = ref(false)
64
- const sessionUrl = ref('placeholder')
65
-
66
- const promptItems = [
67
- {
68
- label: '识别网页的内容',
69
- description: '帮我在商品列表中查询最贵的手机和最便宜的笔记本',
70
- icon: h('span', { style: { fontSize: '18px' } }, '💡')
71
- },
72
- {
73
- label: '智能操作网页',
74
- description: '帮我在商品列表中删除最贵的且分类为手机的商品',
75
- icon: h('span', { style: { fontSize: '18px' } }, '🕹')
76
- },
77
- {
78
- label: '智能操作网页',
79
- description: '帮我在商品列表中添加一个华为p60品牌的手机商品',
80
- icon: h('span', { style: { fontSize: '18px' } }, '🕹')
81
- }
82
- ]
83
-
84
- const suggestionPillItems = [
85
- {
86
- id: '1',
87
- text: '商品列表',
88
- icon: h('span', { style: { fontSize: '18px' } }, '🏢')
89
- }
90
- ]
91
-
92
- watch(
93
- () => globalConversation.sessionId,
94
- (newVal) => {
95
- if (newVal) {
96
- const encryptedId = CryptoJS.AES.encrypt(newVal, 'secret-session-id').toString()
97
-
98
- const secretId = encodeURIComponent(encryptedId)
99
- sessionUrl.value = `https://agent.icjs.ink?id=${secretId}`
100
- }
101
- },
102
- { immediate: true }
103
- )
104
- </script>
105
-
106
- <style scoped>
107
- .header {
108
- width: calc(100% - 502px);
109
- display: flex;
110
- justify-content: space-between;
111
- align-items: center;
112
- padding: 10px 20px;
113
- background-color: #f5f5f5;
114
- }
115
-
116
- .qr-code-trigger {
117
- display: flex;
118
- align-items: center;
119
- cursor: pointer;
120
- padding: 12px 20px;
121
- border-radius: 12px;
122
- transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
123
- background: linear-gradient(135deg, #1677ff 0%, #06b6d4 100%);
124
- position: relative;
125
- overflow: hidden;
126
- }
127
-
128
- .qr-code-trigger::before {
129
- content: '';
130
- position: absolute;
131
- top: 0;
132
- left: 0;
133
- width: 100%;
134
- height: 100%;
135
- background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0));
136
- transform: translateX(-100%);
137
- transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
138
- }
139
-
140
- .qr-code-trigger:hover {
141
- transform: translateY(-2px);
142
- box-shadow: 0 8px 20px rgba(22, 119, 255, 0.3);
143
- }
144
-
145
- .qr-code-trigger:hover::before {
146
- transform: translateX(100%);
147
- }
148
-
149
- .qr-icon {
150
- font-size: 24px;
151
- margin-right: 12px;
152
- color: white;
153
- filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
154
- animation: float 3s ease-in-out infinite;
155
- }
156
-
157
- .qr-text-wrapper {
158
- display: flex;
159
- flex-direction: column;
160
- }
161
-
162
- .qr-label {
163
- font-size: 16px;
164
- font-weight: 600;
165
- color: white;
166
- margin-bottom: 2px;
167
- text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
168
- }
169
-
170
- .qr-desc {
171
- font-size: 13px;
172
- color: rgba(255, 255, 255, 0.9);
173
- text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
174
- }
175
-
176
- @keyframes float {
177
- 0%,
178
- 100% {
179
- transform: translateY(0);
180
- }
181
- 50% {
182
- transform: translateY(-3px);
183
- }
184
- }
185
-
186
- .qr-modal {
187
- position: fixed;
188
- top: 0;
189
- left: 0;
190
- width: 100%;
191
- height: 100%;
192
- background-color: rgba(0, 0, 0, 0.5);
193
- display: flex;
194
- justify-content: center;
195
- align-items: center;
196
- z-index: 1000;
197
- animation: fadeIn 0.3s ease;
198
- }
199
-
200
- .qr-modal-content {
201
- background: white;
202
- border-radius: 12px;
203
- padding: 32px;
204
- width: 460px;
205
- box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
206
- }
207
-
208
- .qr-modal-header {
209
- margin-bottom: 32px;
210
- }
211
-
212
- .qr-modal-header h3 {
213
- font-size: 22px;
214
- font-weight: 600;
215
- color: #1f2937;
216
- }
217
-
218
- .close-icon {
219
- cursor: pointer;
220
- font-size: 20px;
221
- color: #999;
222
- transition: color 0.3s;
223
- }
224
-
225
- .close-icon:hover {
226
- color: #666;
227
- }
228
-
229
- .qr-modal-body {
230
- display: flex;
231
- flex-direction: column;
232
- align-items: center;
233
- }
234
-
235
- .qr-wrapper {
236
- background-color: #f8f9fa;
237
- padding: 24px;
238
- border-radius: 8px;
239
- display: flex;
240
- flex-direction: column;
241
- align-items: center;
242
- margin-bottom: 24px;
243
- position: relative;
244
- animation: glow 2s ease-in-out infinite;
245
- }
246
-
247
- .qr-wrapper::before {
248
- content: '';
249
- position: absolute;
250
- top: -2px;
251
- left: -2px;
252
- right: -2px;
253
- bottom: -2px;
254
- background: linear-gradient(45deg, #1677ff, #10b981, #1677ff);
255
- border-radius: 10px;
256
- z-index: -1;
257
- filter: blur(8px);
258
- opacity: 0.5;
259
- transition: opacity 0.3s ease;
260
- }
261
-
262
- .qr-wrapper:hover::before {
263
- opacity: 0.7;
264
- }
265
-
266
- @keyframes glow {
267
- 0% {
268
- box-shadow: 0 0 5px rgba(22, 119, 255, 0.2), 0 0 10px rgba(22, 119, 255, 0.2), 0 0 15px rgba(22, 119, 255, 0.2);
269
- }
270
- 50% {
271
- box-shadow: 0 0 10px rgba(22, 119, 255, 0.3), 0 0 20px rgba(22, 119, 255, 0.3), 0 0 30px rgba(22, 119, 255, 0.3);
272
- }
273
- 100% {
274
- box-shadow: 0 0 5px rgba(22, 119, 255, 0.2), 0 0 10px rgba(22, 119, 255, 0.2), 0 0 15px rgba(22, 119, 255, 0.2);
275
- }
276
- }
277
-
278
- .qr-status {
279
- display: flex;
280
- align-items: center;
281
- margin-top: 16px;
282
- background: #fff;
283
- padding: 6px 12px;
284
- border-radius: 16px;
285
- box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
286
- }
287
-
288
- .status-dot {
289
- width: 8px;
290
- height: 8px;
291
- background-color: #10b981;
292
- border-radius: 50%;
293
- margin-right: 8px;
294
- animation: pulse 2s infinite;
295
- }
296
-
297
- .qr-instructions {
298
- background-color: #f8f9fa;
299
- border-radius: 8px;
300
- padding: 20px;
301
- }
302
-
303
- .instruction-title {
304
- font-size: 16px;
305
- font-weight: 500;
306
- color: #1f2937;
307
- margin-bottom: 12px;
308
- }
309
-
310
- .instruction-steps {
311
- margin: 0;
312
- padding-left: 20px;
313
- }
314
-
315
- .instruction-steps li {
316
- color: #4b5563;
317
- margin-bottom: 8px;
318
- font-size: 14px;
319
- }
320
-
321
- .instruction-steps li:last-child {
322
- margin-bottom: 0;
323
- }
324
-
325
- @keyframes pulse {
326
- 0% {
327
- box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4);
328
- }
329
- 70% {
330
- box-shadow: 0 0 0 6px rgba(16, 185, 129, 0);
331
- }
332
- 100% {
333
- box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
334
- }
335
- }
336
-
337
- @keyframes fadeIn {
338
- from {
339
- opacity: 0;
340
- }
341
- to {
342
- opacity: 1;
343
- }
344
- }
345
-
346
- .app-container {
347
- display: flex;
348
- height: 100%;
349
- position: relative;
350
- }
351
-
352
- .main-content {
353
- padding: 10px 10px;
354
- height: 100%;
355
- width: calc(100% - 502px);
356
- position: relative;
357
- }
358
-
359
- .right-panel {
360
- width: 480px;
361
- height: 100%;
362
- position: relative;
363
- background: #fff;
364
- border-left: 1px solid #e4e7ed;
365
- }
366
-
367
- .right-panel.collapsed {
368
- width: 0;
369
- overflow: hidden;
370
- }
371
-
372
- .style-settings-icon {
373
- position: fixed;
374
- bottom: 100px;
375
- right: 100px;
376
- font-size: 24px;
377
- z-index: 30;
378
- cursor: pointer;
379
- }
380
- </style>
@@ -1,98 +0,0 @@
1
- [
2
- {
3
- "id": 1,
4
- "name": "iPhone 16",
5
- "price": 5999,
6
- "description": "苹果手机",
7
- "image": "https://agent.icjs.ink/images/iphone.jpg",
8
- "category": "phones",
9
- "stock": 100,
10
- "status": "on",
11
- "createdAt": "2024-03-20",
12
- "updatedAt": "2025-05-29T21:56:30.481Z"
13
- },
14
- {
15
- "id": 2,
16
- "name": "MacBook Pro",
17
- "price": 12999,
18
- "description": "笔记本电脑",
19
- "image": "https://agent.icjs.ink/images/macbook.jpg",
20
- "category": "laptops",
21
- "stock": 50,
22
- "status": "off",
23
- "createdAt": "2024-03-20",
24
- "updatedAt": "2024-03-20"
25
- },
26
- {
27
- "id": 3,
28
- "name": "iPad",
29
- "price": 2399,
30
- "description": "平板电脑",
31
- "image": "https://agent.icjs.ink/images/ipad.jpg",
32
- "category": "tablets",
33
- "stock": 12999,
34
- "status": "on",
35
- "createdAt": "2025-05-27T00:49:29.993Z",
36
- "updatedAt": "2025-05-29T16:11:49.743Z"
37
- },
38
- {
39
- "id": 4,
40
- "name": "Huawei Pura 70",
41
- "price": 6499,
42
- "description": "华为手机",
43
- "image": "https://agent.icjs.ink/images/huawei-pura.jpg",
44
- "category": "phones",
45
- "stock": 1999,
46
- "status": "on",
47
- "createdAt": "2025-05-27T00:54:38.771Z",
48
- "updatedAt": "2025-05-29T22:29:40.124Z"
49
- },
50
- {
51
- "id": 5,
52
- "name": "Huawei Mate XT ultimate",
53
- "price": 23999,
54
- "description": "华为手机 非凡大师",
55
- "image": "https://agent.icjs.ink/images/huawei-mate.jpg",
56
- "category": "phones",
57
- "stock": 100,
58
- "status": "on",
59
- "createdAt": "2025-05-27T00:54:38.771Z",
60
- "updatedAt": "2025-05-30T17:40:59.199Z"
61
- },
62
- {
63
- "id": 6,
64
- "name": "小米15",
65
- "price": 4999,
66
- "description": "小米手机",
67
- "image": "https://agent.icjs.ink/images/xiaomi-15.jpg",
68
- "category": "phones",
69
- "stock": 222,
70
- "status": "off",
71
- "createdAt": "2025-05-29T00:30:02.226Z",
72
- "updatedAt": "2025-05-29T16:14:35.150Z"
73
- },
74
- {
75
- "id": 7,
76
- "name": "小米 13",
77
- "price": 3999,
78
- "description": "小米手机",
79
- "image": "https://agent.icjs.ink/images/xiaomi-13.jpg",
80
- "category": "phones",
81
- "stock": 2222,
82
- "status": "on",
83
- "createdAt": "2025-05-29T00:32:46.308Z",
84
- "updatedAt": "2025-05-30T21:28:28.543Z"
85
- },
86
- {
87
- "id": 8,
88
- "name": "Vivo X90",
89
- "price": 2999,
90
- "description": "Vivo手机",
91
- "image": "https://agent.icjs.ink/images/vivo-x90.jpg",
92
- "category": "phones",
93
- "stock": 3999,
94
- "status": "on",
95
- "createdAt": "2025-05-27T00:54:38.771Z",
96
- "updatedAt": "2025-05-30T17:40:59.199Z"
97
- }
98
- ]
@@ -1,37 +0,0 @@
1
- // 用户类型
2
- export interface User {
3
- id: number
4
- username: string
5
- avatar?: string
6
- }
7
-
8
- // 商品类型
9
- export interface Product {
10
- id: number
11
- name: string
12
- price: number
13
- description?: string
14
- image: string
15
- category: string
16
- stock: number
17
- status: 'on' | 'off' // on: 上架, off: 下架
18
- createdAt?: string
19
- updatedAt?: string
20
- }
21
-
22
- // 登录表单类型
23
- export interface LoginForm {
24
- username: string
25
- password: string
26
- }
27
-
28
- // 商品表单类型
29
- export interface ProductForm {
30
- name: string
31
- price: number
32
- description: string
33
- image: string
34
- category: string
35
- stock: number
36
- status: 'on' | 'off'
37
- }
@@ -1,63 +0,0 @@
1
- <script setup lang="ts">
2
- // 导入 CryptoJS 库
3
- import CryptoJS from 'crypto-js'
4
- import { reactive } from 'vue'
5
- import { TinyButton, TinyDrawer } from '@opentiny/vue'
6
- import RobotChat from '../../components/tiny-robot-chat.vue'
7
- import Sound from './sound.vue'
8
- import { globalConversation } from '../../composable/utils'
9
-
10
- // 加密密钥,需要和生成二维码的页面保持一致
11
- const secretKey = 'secret-session-id'
12
- // 获取 URL 参数
13
- const urlParams = new URLSearchParams(window.location.search)
14
- const encryptedId = urlParams.get('id')
15
- const state = reactive({ isShow: true, showChat: false, showSound: false })
16
-
17
- if (encryptedId) {
18
- // 解密 id
19
- const bytes = CryptoJS.AES.decrypt(encryptedId, secretKey)
20
- const originalText = bytes.toString(CryptoJS.enc.Utf8)
21
- // 存储解密后的 id 到 window.sessionId
22
- globalConversation.sessionId = originalText
23
- }
24
- const showMoter = (type) => {
25
- state.isShow = false
26
- state[type] = true
27
- }
28
- </script>
29
-
30
- <template>
31
- <div>
32
- <RobotChat v-if="state.showChat" />
33
- <Sound v-if="state.showSound" />
34
- <tiny-drawer
35
- v-if="state.isShow"
36
- title="请选择控制器"
37
- placement="bottom"
38
- :mask-closable="false"
39
- :show-close="false"
40
- v-model:visible="state.isShow"
41
- height="400px"
42
- >
43
- <div class="link-box">
44
- <tiny-button @click="showMoter('showSound')" type="info" size="large">语音控制器</tiny-button>
45
-
46
- <tiny-button @click="showMoter('showChat')" type="info" size="large">综合控制器</tiny-button>
47
- </div>
48
- </tiny-drawer>
49
- </div>
50
- </template>
51
-
52
- <style scoped lang="less">
53
- .link-box {
54
- display: flex;
55
- flex-direction: column;
56
- justify-content: center;
57
- align-items: center;
58
-
59
- .tiny-button {
60
- margin-bottom: 20px;
61
- }
62
- }
63
- </style>