bhd-components 0.6.6 → 0.6.8
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.
- package/dist/{869a16fb.esm.es5.development.js → 12224038.esm.es5.development.js} +1 -1
- package/dist/{c220442c.esm.es5.production.js → 600075bb.esm.es5.production.js} +1 -1
- package/dist/index.esm.es5.development.css +730 -722
- package/dist/index.esm.es5.development.js +227 -152
- package/dist/index.esm.es5.production.css +1 -1
- package/dist/index.esm.es5.production.js +1 -1
- package/es2017/customerService/function.js +19 -12
- package/es2017/customerService/historyFun.js +26 -17
- package/es2017/customerService/index.js +176 -121
- package/es2017/customerService/index.module.less +6 -20
- package/es2017/customerService/index2.module.less +6 -20
- package/esm/customerService/function.js +19 -12
- package/esm/customerService/historyFun.js +26 -17
- package/esm/customerService/index.js +180 -121
- package/esm/customerService/index.module.less +6 -20
- package/esm/customerService/index2.module.less +6 -20
- package/package.json +1 -1
|
@@ -183,12 +183,10 @@
|
|
|
183
183
|
width: 100%;
|
|
184
184
|
.main {
|
|
185
185
|
max-width: 80%;
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
// }
|
|
191
|
-
// }
|
|
186
|
+
|
|
187
|
+
.main_content_flag{
|
|
188
|
+
width: 100%;
|
|
189
|
+
}
|
|
192
190
|
.main_content_flag:hover{
|
|
193
191
|
.operate_modal {
|
|
194
192
|
// display: block;
|
|
@@ -197,21 +195,9 @@
|
|
|
197
195
|
}
|
|
198
196
|
.main_content {
|
|
199
197
|
position: relative;
|
|
200
|
-
|
|
201
|
-
// .operate_modal {
|
|
202
|
-
// // display: block;
|
|
203
|
-
// visibility: visible;
|
|
204
|
-
// }
|
|
205
|
-
// }
|
|
206
|
-
|
|
198
|
+
|
|
207
199
|
.content {
|
|
208
|
-
|
|
209
|
-
// .operate_modal {
|
|
210
|
-
// // display: block;
|
|
211
|
-
// visibility: visible;
|
|
212
|
-
// }
|
|
213
|
-
// }
|
|
214
|
-
|
|
200
|
+
|
|
215
201
|
max-width: 100%;
|
|
216
202
|
// width: 100%;
|
|
217
203
|
//以下优化ai返回的内容的样式
|
|
@@ -34,19 +34,26 @@ var serverUrl = function() {
|
|
|
34
34
|
};
|
|
35
35
|
//复制内容
|
|
36
36
|
var copyText = function(text) {
|
|
37
|
-
// text是复制文本
|
|
38
|
-
// 创建input元素
|
|
39
|
-
|
|
40
|
-
// 给input元素赋值需要复制的文本
|
|
41
|
-
el.setAttribute("value", text);
|
|
42
|
-
// 将input元素插入页面
|
|
43
|
-
document.body.appendChild(el);
|
|
44
|
-
// 选中input元素的文本
|
|
45
|
-
el.select();
|
|
46
|
-
// 复制内容到剪贴板
|
|
37
|
+
// // text是复制文本
|
|
38
|
+
// // 创建input元素
|
|
39
|
+
// const el = document.createElement("textarea");
|
|
40
|
+
// // 给input元素赋值需要复制的文本
|
|
41
|
+
// el.setAttribute("value", text);
|
|
42
|
+
// // 将input元素插入页面
|
|
43
|
+
// document.body.appendChild(el);
|
|
44
|
+
// // 选中input元素的文本
|
|
45
|
+
// el.select();
|
|
46
|
+
// // 复制内容到剪贴板
|
|
47
|
+
// document.execCommand("copy");
|
|
48
|
+
// // 删除input元素
|
|
49
|
+
// document.body.removeChild(el);
|
|
50
|
+
// return true;
|
|
51
|
+
var tempInput = document.createElement("textarea");
|
|
52
|
+
document.body.appendChild(tempInput);
|
|
53
|
+
tempInput.value = text;
|
|
54
|
+
tempInput.select();
|
|
47
55
|
document.execCommand("copy");
|
|
48
|
-
|
|
49
|
-
document.body.removeChild(el);
|
|
56
|
+
document.body.removeChild(tempInput);
|
|
50
57
|
return true;
|
|
51
58
|
};
|
|
52
59
|
//获取当前时间
|
|
@@ -280,6 +280,7 @@ var HistoryFun = function(props) {
|
|
|
280
280
|
}),
|
|
281
281
|
/*#__PURE__*/ _jsx("span", {
|
|
282
282
|
onClick: function() {
|
|
283
|
+
loadSpecifiedData();
|
|
283
284
|
onClose();
|
|
284
285
|
},
|
|
285
286
|
children: /*#__PURE__*/ _jsx(CustomClose, {})
|
|
@@ -351,13 +352,18 @@ var HistoryFun = function(props) {
|
|
|
351
352
|
var span = "";
|
|
352
353
|
var time = "";
|
|
353
354
|
if (item.count == 1) {
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
}
|
|
355
|
+
var reg = /[`~!@#$%^&*()_\-+=<>?:"{}|,.\/;'\\[\]·~!@#¥%……&*()——\-+={}|《》?:“”【】、;‘’,。、]/im;
|
|
356
|
+
//搜索内容是否有特殊字符
|
|
357
|
+
if (reg.test(keyWordProblem)) {
|
|
358
|
+
span = item.message.replaceAll(keyWordProblem, function(e) {
|
|
359
|
+
return "<span class=".concat(styles.sign, ">").concat(e, "</span>");
|
|
360
|
+
});
|
|
361
|
+
} else {
|
|
362
|
+
span = item.message.replaceAll(new RegExp(keyWordProblem, "ig"), function(i) {
|
|
363
|
+
// console.log(i,'skdcnsdjk')
|
|
364
|
+
return "<span class=".concat(styles.sign, ">").concat(i, "</span>");
|
|
365
|
+
});
|
|
366
|
+
}
|
|
361
367
|
var currentTime = getDataTime(-1, 1); //当前时间
|
|
362
368
|
var createdAt = getDataTime(item.createdAt, 1);
|
|
363
369
|
if (currentTime == createdAt) {
|
|
@@ -439,16 +445,19 @@ var HistoryFun = function(props) {
|
|
|
439
445
|
} else {
|
|
440
446
|
time = getDataTime(list.updatedAt);
|
|
441
447
|
}
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
448
|
+
var reg = /[`~!@#$%^&*()_\-+=<>?:"{}|,.\/;'\\[\]·~!@#¥%……&*()——\-+={}|《》?:“”【】、;‘’,。、]/im;
|
|
449
|
+
var span = "";
|
|
450
|
+
//搜索内容是否有特殊字符
|
|
451
|
+
if (reg.test(keyWordProblem)) {
|
|
452
|
+
span = list.message.replaceAll(keyWordProblem, function(e) {
|
|
453
|
+
return "<span class=".concat(styles.sign, ">").concat(e, "</span>");
|
|
454
|
+
});
|
|
455
|
+
} else {
|
|
456
|
+
span = list.message.replaceAll(new RegExp(keyWordProblem, "ig"), function(i) {
|
|
457
|
+
// console.log(i,'skdcnsdjk')
|
|
458
|
+
return "<span class=".concat(styles.sign, ">").concat(i, "</span>");
|
|
459
|
+
});
|
|
460
|
+
}
|
|
452
461
|
return /*#__PURE__*/ _jsxs("div", {
|
|
453
462
|
className: styles.list,
|
|
454
463
|
onClick: function() {
|
|
@@ -94,34 +94,32 @@ var CustomerService = function(props) {
|
|
|
94
94
|
var clientHeight = container.clientHeight;
|
|
95
95
|
var scrollHeight = container.scrollHeight;
|
|
96
96
|
// console.log(scrollTop,clientHeight,scrollHeight,'333dfkvmdfv')
|
|
97
|
-
if (clientHeight + scrollTop + 0.5 >= scrollHeight) {
|
|
98
|
-
|
|
99
|
-
// console.log(
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
listTimer.current = setTimeout(function() {
|
|
97
|
+
if (clientHeight + scrollTop + 0.5 >= scrollHeight && pageNumHistory > 1) {
|
|
98
|
+
// if (pageNumHistory > 1) {
|
|
99
|
+
// console.log(pageNumHistory,'pageNumpageNumpageNum')
|
|
100
|
+
var number = pageNumHistory - 1;
|
|
101
|
+
setPageNumHistory(number);
|
|
102
|
+
clearTimeout(listTimer.current);
|
|
103
|
+
listTimer.current = setTimeout(function() {
|
|
104
|
+
if (number > 0) {
|
|
105
|
+
setBottomLoading(true);
|
|
107
106
|
getHistoryMessage(number, 4);
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
107
|
+
setLastId("");
|
|
108
|
+
} else {
|
|
109
|
+
setPageNumHistory(0);
|
|
110
|
+
}
|
|
111
|
+
}, 1000);
|
|
112
|
+
// } else {
|
|
113
|
+
// }
|
|
112
114
|
}
|
|
113
115
|
if (scrollTop == 0 && pageCount > pageNum && pageCount > 0) {
|
|
114
116
|
console.log("到顶了", pageNum);
|
|
115
|
-
// if(pageNum == 1){
|
|
116
|
-
// setFirstpage(true);//代表是否存在第一页
|
|
117
|
-
// }
|
|
118
117
|
setLoading(true);
|
|
119
118
|
var number1 = pageNum + 1;
|
|
120
119
|
setPageNum(function(pageNum) {
|
|
121
120
|
return pageNum + 1;
|
|
122
121
|
});
|
|
123
122
|
listTimer.current = setTimeout(function() {
|
|
124
|
-
console.log("下拉加载下一页", number1);
|
|
125
123
|
getHistoryMessage(number1, 2);
|
|
126
124
|
}, 1000);
|
|
127
125
|
}
|
|
@@ -346,17 +344,19 @@ var CustomerService = function(props) {
|
|
|
346
344
|
setCitationContent({});
|
|
347
345
|
http.post("".concat(urllocation, "/chat-service/public/v1.0/history-messages"), obj).then(function(res) {
|
|
348
346
|
if (res.data.id) {
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
347
|
+
if (pageNumHistory <= 1) {
|
|
348
|
+
setHistoryMessageList(function(historyMessageList) {
|
|
349
|
+
var newHistoryMessageList = historyMessageList.concat(_object_spread_props(_object_spread({}, obj), {
|
|
350
|
+
id: res.data.id,
|
|
351
|
+
upvoted: false,
|
|
352
|
+
downvoted: false,
|
|
353
|
+
quotedMessage: "",
|
|
354
|
+
createdAt: getDataTime(-1),
|
|
355
|
+
extraInfo: JSON.stringify(obj.extraInfos)
|
|
356
|
+
}));
|
|
357
|
+
return newHistoryMessageList;
|
|
358
|
+
});
|
|
359
|
+
}
|
|
360
360
|
scrollToBottom();
|
|
361
361
|
if (type == 4) {
|
|
362
362
|
sendGreetingMessage(6);
|
|
@@ -469,21 +469,23 @@ var CustomerService = function(props) {
|
|
|
469
469
|
} else if (userData.modules.some(function(item) {
|
|
470
470
|
return item.short == "AIservice";
|
|
471
471
|
})) {
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
472
|
+
if (pageNumHistory <= 1) {
|
|
473
|
+
setHistoryMessageList(function(historyMessageList) {
|
|
474
|
+
var newHistoryMessageList = historyMessageList.concat({
|
|
475
|
+
roomId: roomId,
|
|
476
|
+
sender: mid,
|
|
477
|
+
recevier: "AI",
|
|
478
|
+
message: keyWord,
|
|
479
|
+
quotedMessage: citationContent.content,
|
|
480
|
+
id: "654321",
|
|
481
|
+
upvoted: false,
|
|
482
|
+
downvoted: false,
|
|
483
|
+
createdAt: getDataTime(-1),
|
|
484
|
+
extraInfo: JSON.stringify([])
|
|
485
|
+
});
|
|
486
|
+
return newHistoryMessageList;
|
|
484
487
|
});
|
|
485
|
-
|
|
486
|
-
});
|
|
488
|
+
}
|
|
487
489
|
setFinished(false);
|
|
488
490
|
aiSendQuestions(3, {
|
|
489
491
|
//相关数据
|
|
@@ -501,32 +503,36 @@ var CustomerService = function(props) {
|
|
|
501
503
|
};
|
|
502
504
|
//向知识库发送问题 或答案 type:1 发送问题 2 接受答案
|
|
503
505
|
var sendingExistingIssues = function(type, obj, questions) {
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
506
|
+
if (pageNumHistory <= 1) {
|
|
507
|
+
setHistoryMessageList(function(historyMessageList) {
|
|
508
|
+
var newHistoryMessageList = historyMessageList.concat(_object_spread_props(_object_spread({}, obj), {
|
|
509
|
+
id: null,
|
|
510
|
+
upvoted: false,
|
|
511
|
+
downvoted: false,
|
|
512
|
+
createdAt: getDataTime(-1),
|
|
513
|
+
extraInfo: JSON.stringify(obj.extraInfos)
|
|
514
|
+
}));
|
|
515
|
+
return newHistoryMessageList;
|
|
516
|
+
});
|
|
517
|
+
scrollToBottom();
|
|
518
|
+
}
|
|
515
519
|
http.post("".concat(urllocation, "/chat-service/public/v1.0/history-messages"), obj).then(function(res) {
|
|
516
520
|
if (res.data.id) {
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
521
|
+
if (pageNumHistory <= 1) {
|
|
522
|
+
//更新聊天记录id
|
|
523
|
+
setHistoryMessageList(function(historyMessageList) {
|
|
524
|
+
var newHistoryMessageList = historyMessageList.map(function(item) {
|
|
525
|
+
if (item.id == null) {
|
|
526
|
+
return _object_spread_props(_object_spread({}, item), {
|
|
527
|
+
id: res.data.id
|
|
528
|
+
});
|
|
529
|
+
} else {
|
|
530
|
+
return item;
|
|
531
|
+
}
|
|
532
|
+
});
|
|
533
|
+
return newHistoryMessageList;
|
|
527
534
|
});
|
|
528
|
-
|
|
529
|
-
});
|
|
535
|
+
}
|
|
530
536
|
}
|
|
531
537
|
if (type == 1) {
|
|
532
538
|
//发送答案,调用自动回答
|
|
@@ -591,39 +597,42 @@ var CustomerService = function(props) {
|
|
|
591
597
|
setTimeout(function() {
|
|
592
598
|
setQuestionsList([]);
|
|
593
599
|
}, 2000);
|
|
600
|
+
// console.log(pageNumHistory,44444444444444);
|
|
594
601
|
//占位信息
|
|
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
|
-
|
|
602
|
+
if (pageNumHistory <= 1) {
|
|
603
|
+
setHistoryMessageList(function(historyMessageList) {
|
|
604
|
+
if (type == 2) {
|
|
605
|
+
return historyMessageList.map(function(item) {
|
|
606
|
+
if (item.id == id) {
|
|
607
|
+
return {
|
|
608
|
+
roomId: roomId,
|
|
609
|
+
sender: "AI",
|
|
610
|
+
recevier: mid,
|
|
611
|
+
message: "正在输入...",
|
|
612
|
+
id: "123456",
|
|
613
|
+
createdAt: getDataTime(-1),
|
|
614
|
+
extraInfo: null
|
|
615
|
+
};
|
|
616
|
+
} else {
|
|
617
|
+
return item;
|
|
618
|
+
}
|
|
619
|
+
});
|
|
620
|
+
} else {
|
|
621
|
+
return historyMessageList.concat({
|
|
622
|
+
roomId: roomId,
|
|
623
|
+
sender: "AI",
|
|
624
|
+
recevier: mid,
|
|
625
|
+
message: "正在输入...",
|
|
626
|
+
id: "123456",
|
|
627
|
+
createdAt: getDataTime(-1),
|
|
628
|
+
extraInfo: null
|
|
629
|
+
});
|
|
630
|
+
}
|
|
631
|
+
});
|
|
632
|
+
setTimeout(function() {
|
|
633
|
+
scrollToBottom();
|
|
634
|
+
}, 10);
|
|
635
|
+
}
|
|
627
636
|
//使用fetchEventSource接收数据
|
|
628
637
|
var eventSource = fetchEventSource("".concat(urllocation, "/chat-service/public/v1.0/chat-with-ai/messages"), {
|
|
629
638
|
method: "POST",
|
|
@@ -744,7 +753,9 @@ var CustomerService = function(props) {
|
|
|
744
753
|
};
|
|
745
754
|
//渲染AI回答
|
|
746
755
|
var renderAiAnswer = function(msg, message_id, type) {
|
|
756
|
+
// console.log(pageNumHistory,5555555);
|
|
747
757
|
// console.log(aiSendQuestions().abort(),'slkdsdsdsd')
|
|
758
|
+
if (pageNumHistory > 1) return;
|
|
748
759
|
var obj = msg;
|
|
749
760
|
var id = msg.messageId;
|
|
750
761
|
setHistoryMessageList(function(historyMessageList) {
|
|
@@ -796,9 +807,9 @@ var CustomerService = function(props) {
|
|
|
796
807
|
return newHistoryMessageList2;
|
|
797
808
|
}
|
|
798
809
|
});
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
810
|
+
setTimeout(function() {
|
|
811
|
+
scrollToBottom();
|
|
812
|
+
}, 10);
|
|
802
813
|
};
|
|
803
814
|
//问题记录到实验报告中
|
|
804
815
|
var testLabQuestion = function(title, content, teachId) {
|
|
@@ -844,7 +855,7 @@ var CustomerService = function(props) {
|
|
|
844
855
|
};
|
|
845
856
|
//获取历史消息 flag:1,历史记录点击定位,2,代表是上拉加载,3,存在新的消息-->老师回答等,4,下拉加载,滚动到底部时,主要用于查看历史记录
|
|
846
857
|
var getHistoryMessage = function(pageNum, flag) {
|
|
847
|
-
var id = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "1";
|
|
858
|
+
var id = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "1", raw_data = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : [];
|
|
848
859
|
clearTimeout(roomMessage.current);
|
|
849
860
|
// console.log(pageNum,flag,'dkfjvndfjvndfkvdf')
|
|
850
861
|
// flag == 1 时已经设置好了位置标记
|
|
@@ -861,10 +872,11 @@ var CustomerService = function(props) {
|
|
|
861
872
|
}
|
|
862
873
|
var rid = flag == 3 ? id : roomId;
|
|
863
874
|
if (rid == "") return;
|
|
875
|
+
var page = pageNum ? pageNum : 1;
|
|
864
876
|
return http.get("".concat(urllocation, "/chat-service/public/v1.0/history-messages"), {
|
|
865
877
|
params: {
|
|
866
878
|
roomId: rid,
|
|
867
|
-
page:
|
|
879
|
+
page: page,
|
|
868
880
|
maxPageSize: 30,
|
|
869
881
|
direction: "desc"
|
|
870
882
|
}
|
|
@@ -876,6 +888,13 @@ var CustomerService = function(props) {
|
|
|
876
888
|
var total = res.data.total;
|
|
877
889
|
var maxPageSize = 30;
|
|
878
890
|
var dataList = res.data.messages.reverse();
|
|
891
|
+
//历史记录点击进来的,多加载一页,防止定位不准
|
|
892
|
+
if (flag == 1 && page > 1) {
|
|
893
|
+
var markPage = page - 1;
|
|
894
|
+
setPageNumHistory(markPage);
|
|
895
|
+
getHistoryMessage(page - 1, 5, "1", dataList);
|
|
896
|
+
return;
|
|
897
|
+
}
|
|
879
898
|
setPageCount(Math.ceil(total / maxPageSize));
|
|
880
899
|
var newHistoryMessageList = [];
|
|
881
900
|
setHistoryMessageList(function(historyMessageList) {
|
|
@@ -884,6 +903,9 @@ var CustomerService = function(props) {
|
|
|
884
903
|
if (flag == 1) {
|
|
885
904
|
newHistoryMessageList = dataList;
|
|
886
905
|
}
|
|
906
|
+
if (flag == 5) {
|
|
907
|
+
newHistoryMessageList = raw_data.concat(dataList);
|
|
908
|
+
}
|
|
887
909
|
if (flag == 4) {
|
|
888
910
|
newHistoryMessageList = historyMessageList.concat(dataList); //下拉加载,向后追加内容
|
|
889
911
|
}
|
|
@@ -905,6 +927,7 @@ var CustomerService = function(props) {
|
|
|
905
927
|
totalNumber = newHistoryMessageList.length;
|
|
906
928
|
return newHistoryMessageList;
|
|
907
929
|
});
|
|
930
|
+
// console.log(lastId,'lastIdlastId-------')
|
|
908
931
|
//如果在跟老师的聊天窗口,用于找到与老师的最新的聊天,并不在与老师对话的窗口中,并聊天窗口相同
|
|
909
932
|
try {
|
|
910
933
|
if (stepIds != undefined && stepIds != "" && (showType == 3 || showType == 4)) {
|
|
@@ -986,6 +1009,7 @@ var CustomerService = function(props) {
|
|
|
986
1009
|
if (!lastId && originList != newList) {
|
|
987
1010
|
setTimeout(function() {
|
|
988
1011
|
scrollToBottom();
|
|
1012
|
+
readMessage(roomId, urllocation, userData, http);
|
|
989
1013
|
}, 100);
|
|
990
1014
|
}
|
|
991
1015
|
}
|
|
@@ -1237,13 +1261,12 @@ var CustomerService = function(props) {
|
|
|
1237
1261
|
container.scrollTop = 60;
|
|
1238
1262
|
try {
|
|
1239
1263
|
setTimeout(function() {
|
|
1240
|
-
|
|
1264
|
+
var top = showType == 1 || showType == 3 ? $("#li_flag").offset().top - 20 : $("#chat_content_modal #li_flag").offset().top - $("#chat_content_modal").offset().top + 24;
|
|
1265
|
+
// let top =
|
|
1241
1266
|
// showType == 1 || showType == 3
|
|
1242
|
-
// ? $("#li_flag").offset().top
|
|
1267
|
+
// ? $("#li_flag").offset().top
|
|
1243
1268
|
// : $("#chat_content_modal #li_flag").offset().top -
|
|
1244
|
-
// $("#chat_content_modal").offset().top
|
|
1245
|
-
// 24;
|
|
1246
|
-
var top = showType == 1 || showType == 3 ? $("#li_flag").offset().top : $("#chat_content_modal #li_flag").offset().top - $("#chat_content_modal").offset().top;
|
|
1269
|
+
// $("#chat_content_modal").offset().top;
|
|
1247
1270
|
// console.log(top2,top,444444444444)
|
|
1248
1271
|
$("#".concat(showType == 1 || showType == 3 ? "chat_content" : "chat_content_modal")).animate({
|
|
1249
1272
|
scrollTop: top
|
|
@@ -2126,7 +2149,7 @@ var CustomerService = function(props) {
|
|
|
2126
2149
|
var placeholder = "";
|
|
2127
2150
|
var disabled = false;
|
|
2128
2151
|
if (voiceRecordingStatus == 2) {
|
|
2129
|
-
placeholder = "
|
|
2152
|
+
placeholder = "正在录制语音,再次点击麦克风结束录制。";
|
|
2130
2153
|
} else if (voiceRecordingStatus == 1) {
|
|
2131
2154
|
placeholder = "正在语音识别文字,请稍后...";
|
|
2132
2155
|
} else if (!finished) {
|
|
@@ -2194,15 +2217,21 @@ var CustomerService = function(props) {
|
|
|
2194
2217
|
setButtomHei(45);
|
|
2195
2218
|
return;
|
|
2196
2219
|
}
|
|
2197
|
-
}
|
|
2220
|
+
}
|
|
2198
2221
|
//跟老师对话
|
|
2199
2222
|
var roomList = contactsList;
|
|
2200
2223
|
if (roomList.length > 0 && roomList[0].roomId != roomId) {
|
|
2201
2224
|
sendToTeacher(2);
|
|
2202
2225
|
} else {
|
|
2203
|
-
|
|
2226
|
+
clearTimeout(timer.current);
|
|
2204
2227
|
setQuestionsList([]);
|
|
2228
|
+
setAnswerMode(-1);
|
|
2205
2229
|
setTeacherList([]);
|
|
2230
|
+
setHistoryMessageList(function(historyMessageList) {
|
|
2231
|
+
return historyMessageList.filter(function(item) {
|
|
2232
|
+
return item.id != "-1";
|
|
2233
|
+
});
|
|
2234
|
+
});
|
|
2206
2235
|
sendMessage("", 0);
|
|
2207
2236
|
}
|
|
2208
2237
|
setButtomHei(45);
|
|
@@ -2303,6 +2332,15 @@ var CustomerService = function(props) {
|
|
|
2303
2332
|
if (roomList.length > 0 && roomList[0].roomId != roomId) {
|
|
2304
2333
|
sendToTeacher(2);
|
|
2305
2334
|
} else {
|
|
2335
|
+
clearTimeout(timer.current);
|
|
2336
|
+
setQuestionsList([]);
|
|
2337
|
+
setAnswerMode(-1);
|
|
2338
|
+
setTeacherList([]);
|
|
2339
|
+
setHistoryMessageList(function(historyMessageList) {
|
|
2340
|
+
return historyMessageList.filter(function(item) {
|
|
2341
|
+
return item.id != "-1";
|
|
2342
|
+
});
|
|
2343
|
+
});
|
|
2306
2344
|
sendMessage("", 0);
|
|
2307
2345
|
}
|
|
2308
2346
|
onEvent(serverName + serverUrl(), "click_智能问答_ Enter", "提交");
|
|
@@ -2351,9 +2389,19 @@ var CustomerService = function(props) {
|
|
|
2351
2389
|
bottom: "".concat(buttomHei + 14, "px")
|
|
2352
2390
|
},
|
|
2353
2391
|
children: teacherList.map(function(item) {
|
|
2354
|
-
var
|
|
2355
|
-
|
|
2356
|
-
|
|
2392
|
+
var reg = /[`~!@#$%^&*()_\-+=<>?:"{}|,.\/;'\\[\]·~!@#¥%……&*()——\-+={}|《》?:“”【】、;‘’,。、]/im;
|
|
2393
|
+
var span = "";
|
|
2394
|
+
//搜索内容是否有特殊字符
|
|
2395
|
+
if (reg.test(keyWord)) {
|
|
2396
|
+
span = item.name.replaceAll(keyWord, function(e) {
|
|
2397
|
+
return "<span class=".concat(styles.sign, ">").concat(e, "</span>");
|
|
2398
|
+
});
|
|
2399
|
+
} else {
|
|
2400
|
+
span = item.name.replaceAll(new RegExp(keyWord, "ig"), function(i) {
|
|
2401
|
+
// console.log(i,'skdcnsdjk')
|
|
2402
|
+
return "<span class=".concat(styles.sign, ">").concat(i, "</span>");
|
|
2403
|
+
});
|
|
2404
|
+
}
|
|
2357
2405
|
return /*#__PURE__*/ _jsx("p", {
|
|
2358
2406
|
className: styles.item,
|
|
2359
2407
|
children: /*#__PURE__*/ _jsx("span", {
|
|
@@ -2374,9 +2422,19 @@ var CustomerService = function(props) {
|
|
|
2374
2422
|
bottom: "".concat(buttomHei + 6, "px")
|
|
2375
2423
|
},
|
|
2376
2424
|
children: questionsList.map(function(item) {
|
|
2377
|
-
var
|
|
2378
|
-
|
|
2379
|
-
|
|
2425
|
+
var reg = /[`~!@#$%^&*()_\-+=<>?:"{}|,.\/;'\\[\]·~!@#¥%……&*()——\-+={}|《》?:“”【】、;‘’,。、]/im;
|
|
2426
|
+
var span = "";
|
|
2427
|
+
//搜索内容是否有特殊字符
|
|
2428
|
+
if (reg.test(keyWord)) {
|
|
2429
|
+
span = item.question.replaceAll(keyWord, function(e) {
|
|
2430
|
+
return "<span class=".concat(styles.sign, ">").concat(e, "</span>");
|
|
2431
|
+
});
|
|
2432
|
+
} else {
|
|
2433
|
+
span = item.question.replaceAll(new RegExp(keyWord, "ig"), function(i) {
|
|
2434
|
+
// console.log(i,'skdcnsdjk')
|
|
2435
|
+
return "<span class=".concat(styles.sign, ">").concat(i, "</span>");
|
|
2436
|
+
});
|
|
2437
|
+
}
|
|
2380
2438
|
return /*#__PURE__*/ _jsx("p", {
|
|
2381
2439
|
className: styles.item,
|
|
2382
2440
|
children: /*#__PURE__*/ _jsx("span", {
|
|
@@ -2396,25 +2454,26 @@ var CustomerService = function(props) {
|
|
|
2396
2454
|
};
|
|
2397
2455
|
//加载指定数据,点击历史记录
|
|
2398
2456
|
var loadSpecifiedData = function(renewRoomId, page, id, receiver) {
|
|
2457
|
+
// let renewRoomId = '4a615d7126b343f78d10dcb06dbc29b0';
|
|
2458
|
+
// let page = 1;
|
|
2459
|
+
// let id = '0e459f0a3a62438698f170b42b94d150';
|
|
2460
|
+
// let receiver = mid;
|
|
2399
2461
|
if (page != 1) {
|
|
2400
2462
|
setPageNumHistory(page);
|
|
2401
2463
|
}
|
|
2402
|
-
setPageNum(page);
|
|
2403
2464
|
setLastId(id); //用于定位
|
|
2465
|
+
setPageNum(page);
|
|
2404
2466
|
//如果是当前聊天室
|
|
2405
2467
|
if (renewRoomId == roomId) {
|
|
2406
2468
|
getHistoryMessage(page, 1);
|
|
2407
2469
|
} else {
|
|
2408
2470
|
setRoomId(renewRoomId);
|
|
2409
|
-
// if (childRef.current) {
|
|
2410
2471
|
if (receiver != mid) {
|
|
2411
2472
|
createRooms(receiver);
|
|
2412
2473
|
}
|
|
2413
2474
|
setTimeout(function() {
|
|
2414
|
-
// childRef.current.roomsListTimer();
|
|
2415
2475
|
roomsListTimer();
|
|
2416
2476
|
}, 500);
|
|
2417
|
-
// }
|
|
2418
2477
|
}
|
|
2419
2478
|
setShowContacts(true);
|
|
2420
2479
|
};
|