AiAssistantBall.vue
42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
<template>
<!-- #ifdef APP-PLUS -->
<view v-if="visible" class="ai-ball-root">
<!-- 每日首次引导气泡(样式与分析异常气泡一致) -->
<view
v-if="guideVisible"
class="abnormal-bubble guide-bubble"
:class="{ 'guide-fade': guideFading }"
>
<text class="abnormal-msg">遇到难题?点我一下,帮您解答哦!</text>
</view>
<!-- 异常持久气泡 -->
<view
v-if="abnormalBubbleVisible"
class="abnormal-bubble"
@tap.stop="onAbnormalBubbleTap"
>
<text class="abnormal-title">分析异常</text>
<text class="abnormal-msg">{{ abnormalMessage }}</text>
<text class="abnormal-hint">点击关闭</text>
</view>
<!-- AI 悬浮球(按原型:待机圆形呼吸 / 思考中展开条形 + 声波 + 取消) -->
<view
class="fab-container"
:class="{ 'state-idle': uiState !== 'thinking', 'state-active': uiState === 'thinking' }"
@tap.stop="onBallTap"
>
<view class="fab-content-idle">
<image
class="idle-mascot-svg"
src="https://img02.glsx.com.cn/weapp/resource/app-tape/ai-assistant/side-sparkle-rise-export.svg"
mode="scaleToFill"
></image>
</view>
<view class="fab-content-active">
<image
class="thinking-orb-svg"
src="https://img02.glsx.com.cn/weapp/resource/app-tape/ai-assistant/122-eye-blink.svg"
mode="scaleToFill"
></image>
<!-- <view class="thinking-capsule-bg"></view> -->
<view class="thinking-status">
<view class="sound-wave" aria-hidden="true">
<view class="bar"></view>
<view class="bar"></view>
<view class="bar"></view>
<view class="bar"></view>
</view>
<text class="fab-active-text">正在思考中,请稍候...</text>
</view>
<view
v-if="!thinkingTapGuard"
class="fab-cancel-btn"
@tap.stop="closeResult"
>✕</view>
</view>
</view>
<!-- 操作菜单 Frame 145:锚定 FAB 上方,带底部三角指向悬浮球 -->
<view v-if="menuVisible" class="help-menu-wrap" @tap.stop>
<view class="help-menu-card">
<view class="help-menu-header">
<text class="help-menu-title">您需要什么帮助</text>
<view class="help-menu-close" @tap.stop="closeMenu">✕</view>
</view>
<view class="help-menu-body">
<view class="help-menu-action" @tap.stop="onHelpAnswer">
<text class="help-menu-action-text">✨ 帮我回答顾客刚才的问题(近1分钟)</text>
<image
class="help-menu-action-arrow"
src="https://img02.glsx.com.cn/weapp/resource/app-tape/ai-assistant/Vector.png"
mode="aspectFit"
/>
</view>
<view class="help-menu-action" @tap.stop="onUsageIntro">
<text class="help-menu-action-text">🌟 介绍下谈客助手该如何使用</text>
<image
class="help-menu-action-arrow"
src="https://img02.glsx.com.cn/weapp/resource/app-tape/ai-assistant/Vector.png"
mode="aspectFit"
/>
</view>
<view class="help-menu-divider" />
<view class="help-menu-skip" @tap.stop="toggleSkipMenu">
<view :class="['help-menu-check', { checked: skipMenu }]" />
<text class="help-menu-skip-text">下次点击直接开始思考,不再显示此菜单</text>
</view>
</view>
</view>
<view class="help-menu-tail">
<view class="help-menu-pointer" />
</view>
</view>
<!-- 使用介绍(样式与问题列表弹窗一致) -->
<view v-if="introVisible" class="help-menu-wrap" @tap.stop>
<view class="help-menu-card help-menu-card-intro">
<view class="help-menu-header">
<text class="help-menu-title">使用介绍</text>
<view class="help-menu-close" @tap.stop="closeIntro">✕</view>
</view>
<scroll-view scroll-y class="help-menu-intro-scroll">
<mp-html
:content="introText"
:markdown="true"
:selectable="true"
container-style="padding:0;line-height:1.65;font-size:28rpx;color:#292d33;"
/>
</scroll-view>
</view>
<view class="help-menu-tail">
<view class="help-menu-pointer" />
</view>
</view>
<!-- 多问题选择 Frame 145 -->
<view v-if="questionMenuVisible" class="help-menu-wrap" @tap.stop>
<view class="help-menu-card">
<view class="help-menu-header">
<text class="help-menu-title">客户当前更关注</text>
<view class="help-menu-close" @tap.stop="closeQuestionMenu">✕</view>
</view>
<view class="help-menu-body">
<view
v-for="(item, idx) in qaList"
:key="'qmenu-' + idx"
class="help-menu-action"
@tap.stop="selectQa(idx)"
>
<text class="help-menu-action-text">🌟 {{ item.query }}</text>
<image
class="help-menu-action-arrow"
src="https://img02.glsx.com.cn/weapp/resource/app-tape/ai-assistant/Vector.png"
mode="aspectFit"
/>
</view>
<view class="help-menu-divider" />
<view class="help-menu-refresh" @tap.stop="onRetakeRecording">
<view class="sprite-icon icon-refreshIcon" />
<text class="help-menu-refresh-text">未命中?重新抓取最新录音</text>
</view>
</view>
</view>
<view class="help-menu-tail">
<view class="help-menu-pointer" />
</view>
</view>
<!-- AI 流式结果(mp-html 渲染 markdown) -->
<view
v-if="resultVisible"
class="menu-mask"
:class="{ 'question-content-mask': qaList.length && selectedQaIndex >= 0 }"
@tap="closeResult"
>
<view
class="result-panel"
:class="{ 'question-content-panel': qaList.length && selectedQaIndex >= 0 }"
@tap.stop
>
<view class="result-head" :class="{ 'question-content-head': qaList.length && selectedQaIndex >= 0 }">
<view class="result-head-main">
<text class="result-title">
{{ qaList.length && selectedQaIndex >= 0 && selectedQa ? selectedQa.query : 'AI 建议' }}
</text>
<text class="result-status">
{{ streamStatusText }}<text v-if="costText">({{ costText }})</text>
</text>
</view>
<text class="result-close" :class="{ 'question-content-close': qaList.length && selectedQaIndex >= 0 }" @tap.stop="closeResult">✕</text>
</view>
<scroll-view
scroll-y
class="result-scroll"
:scroll-top="resultScrollTop"
:scroll-with-animation="true"
>
<view v-if="!streamMarkdown && streamStatus === 'uploading'" class="result-loading">
<text>正在分析录音,等待 AI 回复…</text>
</view>
<view v-if="qaList.length" class="qa-root">
<!-- 问题列表页:未选择问题时展示 -->
<view v-if="selectedQaIndex < 0">
<text class="qa-title">识别到的问题</text>
<view class="qa-list">
<view
v-for="(item, idx) in qaList"
:key="'qa-' + idx"
class="qa-item"
@tap.stop="selectQa(idx)"
>
<text class="qa-q">{{ item.query }}</text>
</view>
</view>
</view>
<!-- 内容页:展示 markdown -->
<view v-else class="qa-answer-page">
<mp-html
v-if="selectedQa && selectedQa.answer"
:key="'qa-answer-' + selectedQaIndex"
:content="selectedQa.answer"
:markdown="true"
:scroll-table="true"
:selectable="true"
container-style="padding:0;line-height:1.65;font-size:28rpx;color:#292d33;"
/>
</view>
</view>
<!-- 始终挂载 mp-html,靠 :content 增量更新实现流式渲染(v2.5.2 差量 diff) -->
<mp-html
v-show="!!streamMarkdown && !qaList.length"
ref="streamHtml"
:content="streamMarkdown"
:markdown="true"
:selectable="true"
container-style="padding:0 8rpx;line-height:1.65;font-size:26rpx;color:#1f2937;"
/>
</scroll-view>
</view>
</view>
</view>
<!-- #endif -->
</template>
<script>
// #ifdef APP-PLUS
import {
clearSkipMenu,
setSkipMenu,
shouldShowDailyGuide,
markDailyGuideShown
} from '@/utils/aiAssistant/AiAssistantPref.js'
import { storageApi } from '@/utils/cache'
import RecordService from '@/utils/recordManager/RecordService.js'
import { getAiStreamSession } from '@/utils/aiAssistant/aiStreamSession.js'
import {
trackAiBallClick,
trackAiThinkingTrigger,
trackAiQuestionSelect,
trackAiAnswerRender,
trackAiError,
AI_ERROR_TYPE
} from '@/utils/aiAssistant/aiAssistantTrack.js'
import { TransportType } from '@/utils/socket'
const DEMO_CAPTURE_SECONDS = 60
const HELP_ANSWER_REQUEST_TIMEOUT = 90000
/** 模块级会话序号,避免 uni-app 对 data 中 _ 前缀字段初始化异常 */
let helpAnswerSessionSeq = 0
const INTRO_TEXT = `# 谈客智能体使用说明
**点一下,自动提取最近 1 分钟对话,帮你回答客户。**
你不需要打字,不需要回忆客户说了什么。点击 AI 悬浮球后,系统自动截取刚才 1 分钟的录音,分析客户在关心什么,然后生成一份可以直接给客户看的解答。
## 三步搞定
1. 正常接待,系统后台静默录音
2. 被问住了?**点一下右下角 AI 球**
3. 系统自动提取最近 1 分钟对话 → 分析 → 右侧滑出解答卡片
## 它能帮你答什么?
- 客户问产品参数:透光率多少、隔热怎么样、什么材质、多厚
- 客户问质保售后:保几年、起泡褪色怎么办、是不是全国联保
- 客户问施工流程:贴多久、今天能贴吗、怎么预约
- 客户问产品功能:防晒吗、防爆吗、防刮吗、影不影响智驾信号
- 客户在两个自家产品间犹豫:威固和龙膜什么区别
## 它不会回答什么?
- 价格和折扣 —— 这些必须你亲自谈
- 竞品品牌对比 —— 转给你处理
- 赠品、保险、贷款等非轻改业务 —— 转给你处理`
// #endif
/** idle | menu | thinking */
export default {
name: 'AiAssistantBall',
props: {
visible: {
type: Boolean,
default: false
}
},
data() {
return {
uiState: 'idle',
menuVisible: false,
introVisible: false,
questionMenuVisible: false,
guideVisible: false,
guideFading: false,
skipMenu: false,
abnormalBubbleVisible: false,
abnormalMessage: '',
_guideTimer: null,
_pendingBallTap: false,
introText: INTRO_TEXT,
resultVisible: false,
streamMarkdown: '',
streamStatus: 'idle',
pcmCostMs: 0,
encodeCostMs: 0,
uploadCostMs: 0,
resultCostMs: 0,
totalCostMs: 0,
resultScrollTop: 0,
_scrollPending: false,
qaList: [],
selectedQaIndex: -1,
helpAnswerCancelled: false,
thinkingTapGuard: false,
helpAnswerGuardTimer: null
}
},
computed: {
ballLabel() {
if (this.uiState === 'thinking') return '思考'
return 'AI'
},
streamStatusText() {
const map = {
idle: '',
uploading: '上传录音中…',
streaming: '生成中…',
done: '完成',
error: '出错了'
}
return map[this.streamStatus] || ''
},
costText() {
const p = this.pcmCostMs > 0 ? `截取${this.pcmCostMs}ms` : ''
const e = this.encodeCostMs > 0 ? `编码${this.encodeCostMs}ms` : ''
const u = this.uploadCostMs > 0 ? `后端${this.uploadCostMs}ms` : ''
const r = this.resultCostMs > 0 ? `渲染${this.resultCostMs}ms` : ''
const t = this.totalCostMs > 0 ? `总${this.totalCostMs}ms` : ''
return [p, e, u, r, t].filter(Boolean).join(' | ')
},
selectedQa() {
if (!this.qaList.length) return null
if (this.selectedQaIndex < 0) return null
return this.qaList[this.selectedQaIndex] || null
}
},
watch: {
visible: {
immediate: true,
handler(val) {
// #ifdef APP-PLUS
if (val) {
this.onEnterReception()
} else {
this.resetAll()
}
// #endif
}
}
},
created() {
// #ifdef APP-PLUS
this.helpAnswerAbort = null
// #endif
},
beforeDestroy() {
this.clearGuideTimer()
this.clearThinkingTapGuard()
// #ifdef APP-PLUS
getAiStreamSession().cancel()
// #endif
},
methods: {
onEnterReception() {
// #ifdef APP-PLUS
clearSkipMenu()
this.skipMenu = false
this.tryShowDailyGuide()
// #endif
},
tryShowDailyGuide() {
// #ifdef APP-PLUS
if (!shouldShowDailyGuide()) return
this.guideVisible = true
this.guideFading = false
markDailyGuideShown()
this.clearGuideTimer()
this._guideTimer = setTimeout(() => {
this.guideFading = true
setTimeout(() => {
this.guideVisible = false
this.guideFading = false
}, 400)
}, 6000)
// #endif
},
clearGuideTimer() {
if (this._guideTimer) {
clearTimeout(this._guideTimer)
this._guideTimer = null
}
},
onBallTap() {
// #ifdef APP-PLUS
if (this.uiState === 'thinking') return
if (this.menuVisible || this.questionMenuVisible || this.introVisible) return
trackAiBallClick()
if (this.abnormalBubbleVisible) {
this.abnormalBubbleVisible = false
this._pendingBallTap = true
this.$nextTick(() => {
if (this._pendingBallTap) {
this._pendingBallTap = false
this.handleBallAction()
}
})
return
}
this.handleBallAction()
// #endif
},
onAbnormalBubbleTap() {
this.abnormalBubbleVisible = false
},
handleBallAction() {
// #ifdef APP-PLUS
if (this.uiState === 'thinking') return
if (this.menuVisible || this.questionMenuVisible || this.introVisible) return
if (this.skipMenu) {
this.startThinking()
return
}
this.uiState = 'menu'
this.menuVisible = true
// #endif
},
closeMenu() {
this.menuVisible = false
if (this.uiState === 'menu') {
this.uiState = 'idle'
}
},
closeQuestionMenu() {
this.questionMenuVisible = false
},
onRetakeRecording() {
// #ifdef APP-PLUS
this.closeQuestionMenu()
this._startHelpAnswerFlow('onRetakeRecording tapped')
// #endif
},
toggleSkipMenu() {
// #ifdef APP-PLUS
this.skipMenu = !this.skipMenu
setSkipMenu(this.skipMenu)
// #endif
},
onHelpAnswer() {
// #ifdef APP-PLUS
this.closeMenu()
this._startHelpAnswerFlow('onHelpAnswer tapped')
// #endif
},
_startHelpAnswerFlow(logMsg) {
// #ifdef APP-PLUS
if (logMsg) {
this._logAi('info', logMsg)
}
this.$nextTick(() => {
this.startThinking()
})
// #endif
},
onUsageIntro() {
// #ifdef APP-PLUS
this.closeMenu()
this.$nextTick(() => {
this.introVisible = true
})
// #endif
},
closeIntro() {
this.introVisible = false
},
async startThinking() {
// #ifdef APP-PLUS
if (this.uiState === 'thinking') {
this._logAi('warn', 'startThinking skipped: already thinking')
return
}
const sessionId = ++helpAnswerSessionSeq
this.helpAnswerCancelled = false
this.helpAnswerAbort = null
this.uiState = 'thinking'
this._armThinkingTapGuard()
this.menuVisible = false
this.introVisible = false
this.questionMenuVisible = false
this.resultVisible = false
this.streamMarkdown = ''
this.streamStatus = 'uploading'
this.pcmCostMs = 0
this.encodeCostMs = 0
this.uploadCostMs = 0
this.resultCostMs = 0
this.totalCostMs = 0
this.resultScrollTop = 0
this.qaList = []
this.selectedQaIndex = -1
trackAiThinkingTrigger(DEMO_CAPTURE_SECONDS)
this._logAi('info', `startThinking session=${sessionId}`)
await this.$nextTick()
const isCancelled = () =>
this.helpAnswerCancelled || sessionId !== helpAnswerSessionSeq
try {
await this.runHelpAnswerFlowHttp(sessionId, isCancelled)
if (isCancelled()) {
this._logAi('info', 'startThinking done but cancelled, skip result')
this._resetThinkingIfNeeded()
return
}
this.streamStatus = 'done'
this.uiState = 'idle'
} catch (e) {
if (isCancelled() || this._isHelpAnswerAbortError(e)) {
this._logAi('info', `startThinking cancelled: ${(e && e.message) || e}`)
this._resetThinkingIfNeeded()
return
}
this._logAi('error', `startThinking failed: ${(e && e.message) || e}`)
trackAiError(this._resolveAiErrorType(e))
this.streamStatus = 'error'
this.uiState = 'idle'
this.resultVisible = false
this.showAbnormalBubble(e.message || '分析失败,请稍后重试')
} finally {
if (!isCancelled()) {
this.helpAnswerAbort = null
}
}
// #endif
},
selectQa(idx) {
const item = this.qaList[idx]
if (item) {
trackAiQuestionSelect(idx, item.query || '')
}
this.selectedQaIndex = idx
if (this.questionMenuVisible) {
this.questionMenuVisible = false
this.resultVisible = true
}
if (item && item.answer) {
this._trackAnswerRenderForIntent(idx)
}
},
/** 打开面板即开始监听/模拟流式 markdown,边收边渲染 */
beginStreamSession() {
// #ifdef APP-PLUS
return new Promise((resolve, reject) => {
getAiStreamSession().start({
onUpdate: ({ markdown }) => {
if (!markdown) return
this.streamStatus = 'streaming'
this.streamMarkdown = markdown
this.scrollStreamToBottom()
},
onDone: () => {
this.streamStatus = 'done'
this.uiState = 'idle'
this.scrollStreamToBottom()
resolve()
},
onError: (err) => {
reject(err)
}
})
})
// #endif
},
scrollStreamToBottom() {
if (this._scrollPending) return
this._scrollPending = true
this.$nextTick(() => {
this.resultScrollTop = this.resultScrollTop === 99999 ? 99998 : 99999
this._scrollPending = false
})
},
async runHelpAnswerFlowHttp(sessionId, isCancelled) {
// #ifdef APP-PLUS
if (isCancelled()) {
this._logAi(
'warn',
`runHelpAnswerFlowHttp skipped: cancelled before start session=${sessionId} current=${helpAnswerSessionSeq} flag=${this.helpAnswerCancelled}`
)
return
}
const recordService = RecordService.getInstance()
const tTotalStart = Date.now()
const tPcmStart = Date.now()
this._logAi('info', `captureRecentAudio ${DEMO_CAPTURE_SECONDS}s`)
const buffer = recordService.captureRecentAudio(DEMO_CAPTURE_SECONDS, 'pcm')
this.pcmCostMs = Date.now() - tPcmStart
if (!buffer || !buffer.byteLength) {
throw new Error('暂无录音数据,请确认接待录音已开始')
}
const client = recordService.getAiClient()
if (!client) {
throw new Error('AI 未初始化(请先开始接待)')
}
if (client.transport !== TransportType.HTTP) {
throw new Error('当前接待使用 WebSocket 模式,HTTP 请求未启用')
}
const tEncodeStart = Date.now()
const audioBase64 = uni.arrayBufferToBase64(buffer)
this.encodeCostMs = Date.now() - tEncodeStart
if (isCancelled()) {
this._logAi('warn', 'runHelpAnswerFlowHttp cancelled after encode')
return
}
this._logAi(
'info',
`encode ${this.encodeCostMs}ms, request POST /api/audio/chat session=${sessionId}`
)
const userInfo = storageApi.getUserInfo() || {}
let res
const tReqStart = Date.now()
try {
res = await client.request({
url: '/api/audio/chat',
method: 'POST',
timeout: HELP_ANSWER_REQUEST_TIMEOUT,
data: {
message: '将语音的内容转写,并提取客户提出的问题',
audio: audioBase64,
sample_rate: 16000,
sample_width: 2,
channels: 1,
phone: userInfo.phone || ''
},
onTask: (task) => {
this.helpAnswerAbort = () => {
try {
task.abort()
} catch (e) {
// ignore abort errors
}
}
if (isCancelled()) {
this.helpAnswerAbort()
}
}
})
} catch (e) {
const errMsg = (e && (e.errMsg || e.message)) || ''
this.uploadCostMs = Date.now() - tReqStart
if (isCancelled()) {
this._logAi('info', `request cancelled/failed: ${errMsg}`)
return
}
if (this._isHelpAnswerAbortError(e)) {
if (this._isHelpAnswerNetworkError(e)) {
this._logAi('error', `request /api/audio/chat network failed: ${errMsg}`)
throw new Error('AI 服务连接失败,请稍后重试')
}
this._logAi('info', `request cancelled/failed: ${errMsg}`)
return
}
this._logAi('error', `request /api/audio/chat failed: ${errMsg}`)
throw e
}
this.uploadCostMs = Date.now() - tReqStart
if (isCancelled()) {
this._logAi('warn', 'response ignored: cancelled')
return
}
const status = res && res.statusCode
if (typeof status === 'number' && (status < 200 || status >= 300)) {
const bodyPreview = (() => {
try {
return JSON.stringify((res && res.data) || {}).slice(0, 800)
} catch (e) {
return String((res && res.data) || '')
}
})()
this._logAi('error', `response non-2xx status=${status} body=${bodyPreview}`)
throw new Error(`HTTP ${status}`)
}
const tParseStart = Date.now()
const payload = res && res.data
this._logAi(
'info',
`response /api/audio/chat status=${status} => ${JSON.stringify(payload || {}).slice(0, 800)}`
)
if (isCancelled()) {
this._logAi('warn', 'parse skipped: cancelled')
return
}
const list = Array.isArray(payload)
? payload
: payload && payload.type === 'result' && Array.isArray(payload.content)
? payload.content
: null
if (!Array.isArray(list)) {
throw new Error(`AI 接口返回异常: ${JSON.stringify(payload || {}).slice(0, 240)}`)
}
this.qaList = list
.map((x) => ({
query: (x && x.query) || '',
answer: (x && x.answer) || ''
}))
.filter((x) => x.query || x.answer)
this.resultCostMs = Date.now() - tParseStart
this.totalCostMs = Date.now() - tTotalStart
if (!this.qaList.length) {
this._logAi('info', 'response empty, no questions to show')
trackAiError(AI_ERROR_TYPE.NO_ANSWER)
return
}
if (isCancelled()) {
this._logAi('warn', 'show result skipped: cancelled')
return
}
if (this.qaList.length > 1) {
this.selectedQaIndex = -1
this.questionMenuVisible = true
this.resultVisible = false
} else {
this.questionMenuVisible = false
this.selectedQaIndex = 0
this.resultVisible = true
if (this.qaList[0] && this.qaList[0].answer) {
this._trackAnswerRenderForIntent(0)
}
}
// #endif
},
_trackAnswerRenderForIntent(intentId) {
const renderStart = Date.now()
this.$nextTick(() => {
trackAiAnswerRender(intentId, Date.now() - renderStart)
})
},
_resolveAiErrorType(err) {
const msg = String((err && (err.errMsg || err.message)) || '')
if (/timeout/i.test(msg)) return AI_ERROR_TYPE.TIMEOUT
if (this._isHelpAnswerNetworkError(err) || /连接失败|network/i.test(msg)) {
return AI_ERROR_TYPE.NETWORK
}
return AI_ERROR_TYPE.OTHER
},
_logAi(level, msg) {
// #ifdef APP-PLUS
const text = `[AiAssistant] ${msg}`
const logger = uni.$logger && uni.$logger.local
if (logger && logger[level]) {
logger[level](text)
}
if (typeof plus !== 'undefined' && plus.console && plus.console.log) {
plus.console.log(text)
}
// #endif
},
_armThinkingTapGuard() {
this.thinkingTapGuard = true
this.clearThinkingTapGuard()
this.helpAnswerGuardTimer = setTimeout(() => {
this.thinkingTapGuard = false
this.helpAnswerGuardTimer = null
}, 400)
},
clearThinkingTapGuard() {
if (this.helpAnswerGuardTimer) {
clearTimeout(this.helpAnswerGuardTimer)
this.helpAnswerGuardTimer = null
}
},
_isHelpAnswerAbortError(err) {
const msg = String((err && (err.errMsg || err.message)) || '')
return /abort|cancel/i.test(msg)
},
_isHelpAnswerNetworkError(err) {
const msg = String((err && (err.errMsg || err.message)) || '')
return /failed to connect|statusCode:-1|network|econn|timeout/i.test(msg)
},
_resetThinkingIfNeeded() {
if (this.uiState !== 'thinking') return
this.uiState = 'idle'
this.streamStatus = 'idle'
},
_cancelHelpAnswerFlow(reason) {
helpAnswerSessionSeq += 1
this.helpAnswerCancelled = true
this._logAi('info', `helpAnswer flow cancelled: ${reason || 'unknown'}`)
if (this.helpAnswerAbort) {
try {
this.helpAnswerAbort()
} catch (e) {
// ignore abort errors
}
this.helpAnswerAbort = null
}
},
closeResult() {
if (this.thinkingTapGuard) {
this._logAi('info', 'closeResult ignored: thinking tap guard')
return
}
if (this.uiState === 'thinking' || this.helpAnswerAbort) {
this._cancelHelpAnswerFlow('closeResult')
}
// #ifdef APP-PLUS
getAiStreamSession().cancel()
// #endif
this.resultVisible = false
this.questionMenuVisible = false
this.qaList = []
this.selectedQaIndex = -1
if (this.uiState === 'thinking') {
this.uiState = 'idle'
}
this.streamStatus = 'idle'
},
showAbnormalBubble(message) {
this.abnormalMessage = message
this.abnormalBubbleVisible = true
if (uni.$logger && uni.$logger.local && uni.$logger.local.warn) {
uni.$logger.local.warn(`[AiAssistant] ${message}`)
}
},
resetAll() {
this.clearGuideTimer()
this.clearThinkingTapGuard()
this.thinkingTapGuard = false
if (this.uiState === 'thinking' || this.helpAnswerAbort) {
this._cancelHelpAnswerFlow('resetAll')
}
// #ifdef APP-PLUS
getAiStreamSession().cancel()
// #endif
this.uiState = 'idle'
this.menuVisible = false
this.introVisible = false
this.questionMenuVisible = false
this.resultVisible = false
this.streamMarkdown = ''
this.streamStatus = 'idle'
this.pcmCostMs = 0
this.encodeCostMs = 0
this.uploadCostMs = 0
this.resultCostMs = 0
this.totalCostMs = 0
this.guideVisible = false
this.guideFading = false
this.abnormalBubbleVisible = false
this._pendingBallTap = false
this.qaList = []
this.selectedQaIndex = -1
}
}
}
</script>
<style lang="scss" scoped>
.ai-ball-root {
position: fixed;
left: 128rpx;
bottom: 184rpx;
z-index: 100015;
pointer-events: none;
}
.guide-bubble {
pointer-events: none;
opacity: 1;
transition: opacity 0.3s ease;
&.guide-fade {
opacity: 0;
}
}
.abnormal-bubble {
position: absolute;
left: 0;
bottom: 110rpx;
width: 520rpx;
padding: 18rpx 18rpx 18rpx 22rpx;
background: rgba(255, 255, 255, 0.98);
border: 1px solid rgba(255, 255, 255, 0.8);
border-radius: 16rpx;
pointer-events: auto;
box-shadow: 0 12rpx 32rpx rgba(0, 0, 0, 0.15);
display: flex;
align-items: center;
gap: 14rpx;
}
.abnormal-title {
display: none;
}
.abnormal-msg {
display: block;
flex: 1;
color: #1f2937;
font-size: 24rpx;
line-height: 1.4;
}
.abnormal-hint {
display: none;
}
/* FAB - AI 悬浮球(按原型) */
.fab-container {
position: relative;
pointer-events: auto;
height: 112rpx;
border-radius: 56rpx;
display: flex;
align-items: center;
justify-content: center;
overflow: hidden;
transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.fab-container.state-idle {
width: 112rpx;
background: transparent;
border: none;
box-shadow: none;
overflow: visible;
animation: none;
}
.fab-container.state-active {
width: 520rpx;
height: 184rpx;
background: transparent;
box-shadow: none;
border: none;
overflow: visible;
animation: none;
pointer-events: none;
}
.fab-content-idle {
display: flex;
align-items: center;
justify-content: center;
}
/* Frame 139 SVG: 48px × 48px */
.idle-mascot-svg {
display: block;
width: 160rpx;
height: 160rpx;
}
.fab-content-active {
position: relative;
display: none;
width: 520rpx;
height: 184rpx;
padding: 0;
box-sizing: border-box;
align-items: center;
justify-content: center;
}
.thinking-orb-svg {
position: absolute;
left: 0;
top: -4px;
width: 520rpx;
height: 184rpx;
display: block;
}
.thinking-capsule-bg {
position: absolute;
left: 0;
bottom: 0;
width: 500rpx;
height: 96rpx;
border-radius: 48rpx;
background: linear-gradient(90deg, #61c0ff 0%, #2c66f7 100%);
z-index: 1;
}
.thinking-status {
position: absolute;
left: 42rpx;
right: 132rpx;
bottom: 6rpx;
height: 96rpx;
display: flex;
align-items: center;
gap: 12rpx;
z-index: 2;
}
.fab-container.state-active .fab-content-idle {
display: none;
}
.fab-container.state-active .fab-content-active {
display: flex;
}
.fab-active-text {
flex: 1;
min-width: 0;
color: #fff;
font-size: 30rpx;
font-weight: 500;
line-height: 96rpx;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.fab-cancel-btn {
position: absolute;
right: 68rpx;
bottom: 34rpx;
width: 40rpx;
height: 40rpx;
border-radius: 0;
background: transparent;
border: none;
display: flex;
align-items: center;
justify-content: center;
color: #fff;
font-size: 40rpx;
line-height: 40rpx;
z-index: 3;
pointer-events: auto;
}
@keyframes fab-breathing {
0% {
transform: scale(1);
box-shadow: 0 8rpx 24rpx rgba(14, 165, 233, 0.4);
}
50% {
transform: scale(1.05);
box-shadow: 0 16rpx 36rpx rgba(52, 211, 153, 0.6);
}
100% {
transform: scale(1);
box-shadow: 0 8rpx 24rpx rgba(14, 165, 233, 0.4);
}
}
/* 声波动效 */
.sound-wave {
display: flex;
gap: 5rpx;
height: 30rpx;
align-items: center;
flex-shrink: 0;
}
.sound-wave .bar {
width: 4rpx;
background: #fff;
border-radius: 4rpx;
animation: fab-wave 1s infinite ease-in-out;
}
.sound-wave .bar:nth-child(1) {
height: 14rpx;
animation-delay: 0s;
}
.sound-wave .bar:nth-child(2) {
height: 30rpx;
animation-delay: 0.2s;
}
.sound-wave .bar:nth-child(3) {
height: 22rpx;
animation-delay: 0.4s;
}
.sound-wave .bar:nth-child(4) {
height: 12rpx;
animation-delay: 0.6s;
}
@keyframes fab-wave {
0%,
100% {
transform: scaleY(0.4);
}
50% {
transform: scaleY(1);
}
}
/* Frame 145 帮助菜单 */
.help-menu-wrap {
position: absolute;
left: 0;
bottom: 110rpx;
width: 720rpx;
display: flex;
flex-direction: column;
align-items: flex-start;
pointer-events: auto;
}
.help-menu-card {
width: 720rpx;
box-sizing: border-box;
background: #ffffff;
border-radius: 32rpx;
box-shadow: 0 8rpx 32rpx rgba(0, 0, 0, 0.3);
overflow: hidden;
padding-bottom: 48rpx;
}
.help-menu-header {
display: flex;
flex-direction: row;
align-items: flex-start;
padding: 32rpx 48rpx;
background: linear-gradient(180deg, #e6f0ff 0%, #ffffff 40%, #ffffff 100%);
border-radius: 32rpx 32rpx 0 0;
}
.help-menu-title {
flex: 1;
min-width: 0;
font-weight: 500;
font-size: 36rpx;
line-height: 42rpx;
color: #292d33;
}
.help-menu-close {
width: 40rpx;
height: 40rpx;
flex-shrink: 0;
display: flex;
align-items: center;
justify-content: center;
color: #999ea8;
font-size: 32rpx;
line-height: 40rpx;
}
.help-menu-body {
display: flex;
flex-direction: column;
padding: 0 48rpx;
gap: 28rpx;
}
.help-menu-action {
display: flex;
flex-direction: row;
align-items: center;
padding: 32rpx 24rpx;
gap: 16rpx;
min-height: 96rpx;
box-sizing: border-box;
background: linear-gradient(180deg, rgba(210, 234, 255, 0.3) 0%, rgba(255, 255, 255, 0.3) 100%);
border: 1px solid #ffffff;
box-shadow: 0 4rpx 12rpx rgba(44, 102, 247, 0.1);
border-radius: 32rpx;
}
.help-menu-action-text {
flex: 1;
min-width: 0;
font-weight: 400;
font-size: 28rpx;
line-height: 32rpx;
color: #292d33;
}
.help-menu-action-arrow {
width: 30rpx;
height: 30rpx;
flex-shrink: 0;
display: block;
min-width: 30rpx;
min-height: 30rpx;
}
.help-menu-divider {
height: 0;
border-top: 1px solid #f5f7fa;
}
.help-menu-skip {
display: flex;
flex-direction: row;
align-items: center;
padding: 8rpx 0;
gap: 8rpx;
}
.help-menu-check {
width: 32rpx;
height: 32rpx;
border: 1px solid #999ea8;
border-radius: 4rpx;
flex-shrink: 0;
box-sizing: border-box;
&.checked {
background: #2c66f7;
border-color: #2c66f7;
position: relative;
&::after {
content: '';
position: absolute;
left: 8rpx;
top: 2rpx;
width: 8rpx;
height: 16rpx;
border: solid #fff;
border-width: 0 2rpx 2rpx 0;
transform: rotate(45deg);
}
}
}
.help-menu-skip-text {
font-weight: 400;
font-size: 26rpx;
line-height: 30rpx;
color: #999ea8;
}
.help-menu-refresh {
display: flex;
flex-direction: row;
align-items: center;
padding: 8rpx 0;
gap: 8rpx;
}
.help-menu-refresh-text {
font-weight: 400;
font-size: 26rpx;
line-height: 30rpx;
color: #999ea8;
}
.help-menu-tail {
width: 100%;
padding: 0 32rpx;
box-sizing: border-box;
}
.help-menu-pointer {
width: 24rpx;
height: 16rpx;
background: #ffffff;
clip-path: polygon(50% 100%, 0 0, 100% 0);
}
.help-menu-card-intro {
max-height: 70vh;
display: flex;
flex-direction: column;
padding-bottom: 24rpx;
}
.help-menu-intro-scroll {
flex: 1;
min-height: 0;
max-height: 58vh;
padding: 0 48rpx 8rpx;
box-sizing: border-box;
}
/* Popup(按原型:锚定 FAB 上方;不使用全屏 overlay) */
.popup-menu {
position: absolute;
left: 0;
bottom: 220rpx; /* FAB 上方 */
width: 620rpx;
background: rgba(255, 255, 255, 0.98);
border: 1px solid rgba(255, 255, 255, 0.8);
border-radius: 20rpx;
box-shadow: 0 20rpx 40rpx rgba(0, 0, 0, 0.15);
padding: 24rpx;
backdrop-filter: blur(16px);
}
.popup-header-row {
display: flex;
align-items: flex-start;
justify-content: space-between;
gap: 16rpx;
margin-bottom: 18rpx;
}
.popup-header {
font-weight: 700;
color: #111827;
font-size: 30rpx;
}
.popup-close-btn {
width: 56rpx;
height: 56rpx;
border-radius: 28rpx;
background: #f3f4f6;
color: #4b5563;
display: flex;
align-items: center;
justify-content: center;
flex-shrink: 0;
}
.popup-btn {
width: 100%;
border-radius: 16rpx;
background: #f4f4f5;
padding: 22rpx 24rpx;
margin-bottom: 16rpx;
}
.popup-btn.primary {
background: linear-gradient(135deg, #e0f2fe, #dcfce7);
border: 1px solid #bae6fd;
}
.popup-btn-title {
color: #1f2937;
font-size: 28rpx;
font-weight: 600;
line-height: 1.35;
}
.popup-divider {
height: 2rpx;
background: #e5e7eb;
margin: 18rpx 0;
}
.popup-skip {
display: flex;
align-items: center;
gap: 16rpx;
}
.popup-skip-text {
font-size: 24rpx;
color: #6b7280;
line-height: 1.35;
}
.popup-body {
display: block;
color: #4b5563;
font-size: 26rpx;
line-height: 1.7;
white-space: pre-line;
}
.menu-mask {
position: fixed;
left: 0;
right: 0;
top: 0;
bottom: 0;
z-index: 100016;
pointer-events: auto;
background: rgba(0, 0, 0, 0.45);
display: flex;
align-items: flex-end;
justify-content: center;
}
.menu-mask.question-content-mask {
align-items: stretch;
justify-content: flex-start;
padding-left: 0;
}
.menu-panel,
.intro-panel {
width: 100%;
padding: 32rpx 32rpx calc(32rpx + env(safe-area-inset-bottom));
background: #fff;
border-radius: 24rpx 24rpx 0 0;
box-sizing: border-box;
}
.menu-title {
display: block;
font-size: 32rpx;
font-weight: 700;
color: #1a1a1a;
margin-bottom: 24rpx;
}
.menu-item {
padding: 24rpx;
border-radius: 16rpx;
background: #f5f5f5;
margin-bottom: 16rpx;
&.primary {
background: linear-gradient(135deg, #ede9fe, #e0e7ff);
border: 1px solid #c7d2fe;
}
}
.menu-item-title {
display: block;
font-size: 30rpx;
font-weight: 600;
color: #1a1a1a;
}
.menu-item-desc {
display: block;
margin-top: 8rpx;
font-size: 24rpx;
color: #6b7280;
line-height: 1.4;
}
.menu-skip {
display: flex;
align-items: center;
gap: 16rpx;
padding: 20rpx 8rpx;
margin-top: 8rpx;
}
.skip-check {
width: 36rpx;
height: 36rpx;
border-radius: 8rpx;
border: 2rpx solid #9ca3af;
flex-shrink: 0;
&.checked {
background: #6366f1;
border-color: #6366f1;
position: relative;
&::after {
content: '';
position: absolute;
left: 10rpx;
top: 4rpx;
width: 10rpx;
height: 18rpx;
border: solid #fff;
border-width: 0 3rpx 3rpx 0;
transform: rotate(45deg);
}
}
}
.skip-text {
font-size: 26rpx;
color: #4b5563;
}
.menu-close {
display: block;
text-align: center;
margin-top: 24rpx;
font-size: 28rpx;
color: #6b7280;
&.center {
margin-top: 32rpx;
}
}
.intro-body {
display: block;
font-size: 26rpx;
color: #4b5563;
line-height: 1.7;
white-space: pre-line;
}
.result-panel {
width: 100%;
max-height: 78vh;
background: #fff;
border-radius: 24rpx 24rpx 0 0;
display: flex;
flex-direction: column;
box-sizing: border-box;
padding-bottom: env(safe-area-inset-bottom);
}
.result-panel.question-content-panel {
width: 400px;
height: 100%;
max-height: none;
border-radius: 0 24px 24px 0;
box-shadow: 4px 0 16px rgba(44, 102, 247, 0.1);
padding-bottom: 0;
}
.result-head {
display: flex;
align-items: flex-start;
justify-content: space-between;
padding: 28rpx 32rpx 16rpx;
border-bottom: 1px solid #eee;
}
.result-head.question-content-head {
height: 53px;
padding: 28px 24px 16px 24px;
align-items: center;
flex-shrink: 0;
}
.result-head.question-content-head .result-head-main {
overflow: hidden;
}
.result-head.question-content-head .result-title {
font-size: 18px;
line-height: 21px;
font-weight: 500;
color: #292d33;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.result-head.question-content-head .result-status {
display: none;
}
.result-head-main {
flex: 1;
min-width: 0;
}
.result-title {
display: block;
font-size: 32rpx;
font-weight: 700;
color: #111827;
}
.result-status {
display: block;
margin-top: 8rpx;
font-size: 24rpx;
color: #6366f1;
}
.result-close {
font-size: 28rpx;
color: #6b7280;
padding: 8rpx 0 8rpx 24rpx;
}
.result-close.question-content-close {
width: 20px;
height: 20px;
min-width: 20px;
padding: 0;
font-size: 20px;
line-height: 20px;
text-align: center;
color: #999ea8;
}
.result-scroll {
flex: 1;
max-height: 62vh;
padding: 20rpx 24rpx 32rpx;
box-sizing: border-box;
}
.question-content-panel .result-scroll {
flex: 1;
min-height: 0;
max-height: none;
height: auto;
padding: 20px 24px 24px;
}
.qa-root {
padding: 8rpx 8rpx 24rpx;
}
.qa-title {
display: block;
font-size: 26rpx;
font-weight: 600;
color: #111827;
margin: 8rpx 0 12rpx;
}
.qa-list {
display: flex;
flex-direction: column;
gap: 12rpx;
}
.qa-item {
padding: 16rpx 18rpx;
border-radius: 14rpx;
background: #f3f4f6;
border: 1px solid #e5e7eb;
}
.qa-item.active {
background: #eef2ff;
border-color: #c7d2fe;
}
.qa-q {
color: #111827;
font-size: 26rpx;
line-height: 1.45;
}
.qa-answer {
margin-top: 18rpx;
padding: 16rpx 18rpx;
border-radius: 14rpx;
background: #ffffff;
border: 1px solid #e5e7eb;
}
.qa-answer-title {
display: block;
color: #4f46e5;
font-size: 24rpx;
font-weight: 600;
margin-bottom: 10rpx;
}
.qa-hint {
display: block;
margin-top: 14rpx;
padding: 12rpx 16rpx;
border-radius: 12rpx;
background: #f9fafb;
border: 1px dashed #e5e7eb;
color: #6b7280;
font-size: 24rpx;
}
.question-content-panel .qa-root {
padding: 0;
}
.qa-answer-page {
padding-top: 0;
}
.qa-answer-page ::v-deep .md-table {
display: block;
width: 100%;
overflow-x: auto;
border-collapse: collapse;
margin: 12px 0;
}
.qa-answer-page ::v-deep .md-th,
.qa-answer-page ::v-deep .md-td {
border: 1px solid #e5e7eb;
padding: 8px 10px;
font-size: 26rpx;
line-height: 1.5;
vertical-align: top;
}
.qa-answer-page ::v-deep .md-th {
background: #f5f7fa;
font-weight: 500;
color: #292d33;
}
.qa-answer-page ::v-deep .md-td {
color: #4b5563;
}
.qa-answer-page ::v-deep h2,
.qa-answer-page ::v-deep h3 {
margin: 16px 0 8px;
font-size: 30rpx;
font-weight: 600;
color: #292d33;
}
.qa-answer-page ::v-deep p {
margin: 8px 0;
}
.qa-answer-page ::v-deep ul,
.qa-answer-page ::v-deep ol {
padding-left: 20px;
margin: 8px 0;
}
.qa-answer-page ::v-deep blockquote {
margin: 12px 0;
padding: 8px 12px;
border-left: 3px solid #2c66f7;
background: #f5f8ff;
color: #4b5563;
}
.result-loading {
padding: 48rpx 0;
text-align: center;
color: #9ca3af;
font-size: 26rpx;
}
</style>