bhd-components 0.6.6 → 0.6.7
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/{c220442c.esm.es5.production.js → 0acf50ef.esm.es5.production.js} +1 -1
- package/dist/{869a16fb.esm.es5.development.js → 4fa3313f.esm.es5.development.js} +1 -1
- package/dist/index.esm.es5.development.js +221 -142
- 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 +171 -112
- package/esm/customerService/function.js +19 -12
- package/esm/customerService/historyFun.js +26 -17
- package/esm/customerService/index.js +175 -112
- package/package.json +1 -1
|
@@ -32,19 +32,26 @@ const serverUrl = ()=>{
|
|
|
32
32
|
};
|
|
33
33
|
//复制内容
|
|
34
34
|
const copyText = (text)=>{
|
|
35
|
-
// text是复制文本
|
|
36
|
-
// 创建input元素
|
|
37
|
-
const el = document.createElement("
|
|
38
|
-
// 给input元素赋值需要复制的文本
|
|
39
|
-
el.setAttribute("value", text);
|
|
40
|
-
// 将input元素插入页面
|
|
41
|
-
document.body.appendChild(el);
|
|
42
|
-
// 选中input元素的文本
|
|
43
|
-
el.select();
|
|
44
|
-
// 复制内容到剪贴板
|
|
35
|
+
// // text是复制文本
|
|
36
|
+
// // 创建input元素
|
|
37
|
+
// const el = document.createElement("textarea");
|
|
38
|
+
// // 给input元素赋值需要复制的文本
|
|
39
|
+
// el.setAttribute("value", text);
|
|
40
|
+
// // 将input元素插入页面
|
|
41
|
+
// document.body.appendChild(el);
|
|
42
|
+
// // 选中input元素的文本
|
|
43
|
+
// el.select();
|
|
44
|
+
// // 复制内容到剪贴板
|
|
45
|
+
// document.execCommand("copy");
|
|
46
|
+
// // 删除input元素
|
|
47
|
+
// document.body.removeChild(el);
|
|
48
|
+
// return true;
|
|
49
|
+
var tempInput = document.createElement("textarea");
|
|
50
|
+
document.body.appendChild(tempInput);
|
|
51
|
+
tempInput.value = text;
|
|
52
|
+
tempInput.select();
|
|
45
53
|
document.execCommand("copy");
|
|
46
|
-
|
|
47
|
-
document.body.removeChild(el);
|
|
54
|
+
document.body.removeChild(tempInput);
|
|
48
55
|
return true;
|
|
49
56
|
};
|
|
50
57
|
//获取当前时间
|
|
@@ -275,6 +275,7 @@ const HistoryFun = (props)=>{
|
|
|
275
275
|
}),
|
|
276
276
|
/*#__PURE__*/ _jsx("span", {
|
|
277
277
|
onClick: ()=>{
|
|
278
|
+
loadSpecifiedData();
|
|
278
279
|
onClose();
|
|
279
280
|
},
|
|
280
281
|
children: /*#__PURE__*/ _jsx(CustomClose, {})
|
|
@@ -346,13 +347,18 @@ const HistoryFun = (props)=>{
|
|
|
346
347
|
let span = "";
|
|
347
348
|
let time = "";
|
|
348
349
|
if (item.count == 1) {
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
}
|
|
350
|
+
let reg = /[`~!@#$%^&*()_\-+=<>?:"{}|,.\/;'\\[\]·~!@#¥%……&*()——\-+={}|《》?:“”【】、;‘’,。、]/im;
|
|
351
|
+
//搜索内容是否有特殊字符
|
|
352
|
+
if (reg.test(keyWordProblem)) {
|
|
353
|
+
span = item.message.replaceAll(keyWordProblem, (e)=>{
|
|
354
|
+
return `<span class=${styles.sign}>${e}</span>`;
|
|
355
|
+
});
|
|
356
|
+
} else {
|
|
357
|
+
span = item.message.replaceAll(new RegExp(keyWordProblem, "ig"), (i)=>{
|
|
358
|
+
// console.log(i,'skdcnsdjk')
|
|
359
|
+
return `<span class=${styles.sign}>${i}</span>`;
|
|
360
|
+
});
|
|
361
|
+
}
|
|
356
362
|
let currentTime = getDataTime(-1, 1); //当前时间
|
|
357
363
|
let createdAt = getDataTime(item.createdAt, 1);
|
|
358
364
|
if (currentTime == createdAt) {
|
|
@@ -434,16 +440,19 @@ const HistoryFun = (props)=>{
|
|
|
434
440
|
} else {
|
|
435
441
|
time = getDataTime(list.updatedAt);
|
|
436
442
|
}
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
443
|
+
let reg = /[`~!@#$%^&*()_\-+=<>?:"{}|,.\/;'\\[\]·~!@#¥%……&*()——\-+={}|《》?:“”【】、;‘’,。、]/im;
|
|
444
|
+
let span = '';
|
|
445
|
+
//搜索内容是否有特殊字符
|
|
446
|
+
if (reg.test(keyWordProblem)) {
|
|
447
|
+
span = list.message.replaceAll(keyWordProblem, (e)=>{
|
|
448
|
+
return `<span class=${styles.sign}>${e}</span>`;
|
|
449
|
+
});
|
|
450
|
+
} else {
|
|
451
|
+
span = list.message.replaceAll(new RegExp(keyWordProblem, "ig"), (i)=>{
|
|
452
|
+
// console.log(i,'skdcnsdjk')
|
|
453
|
+
return `<span class=${styles.sign}>${i}</span>`;
|
|
454
|
+
});
|
|
455
|
+
}
|
|
447
456
|
return /*#__PURE__*/ _jsxs("div", {
|
|
448
457
|
className: styles.list,
|
|
449
458
|
onClick: ()=>{
|
|
@@ -99,21 +99,24 @@ const CustomerService = (props)=>{
|
|
|
99
99
|
const clientHeight = container.clientHeight;
|
|
100
100
|
const scrollHeight = container.scrollHeight;
|
|
101
101
|
// console.log(scrollTop,clientHeight,scrollHeight,'333dfkvmdfv')
|
|
102
|
-
if (clientHeight + scrollTop + 0.5 >= scrollHeight) {
|
|
102
|
+
if (clientHeight + scrollTop + 0.5 >= scrollHeight && pageNumHistory > 1) {
|
|
103
103
|
console.log("到底部了22222");
|
|
104
|
-
//
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
104
|
+
// if (pageNumHistory > 1) {
|
|
105
|
+
// console.log(pageNumHistory,'pageNumpageNumpageNum')
|
|
106
|
+
let number = pageNumHistory - 1;
|
|
107
|
+
setPageNumHistory(number);
|
|
108
|
+
clearTimeout(listTimer.current);
|
|
109
|
+
listTimer.current = setTimeout(()=>{
|
|
110
|
+
if (number > 0) {
|
|
111
|
+
setBottomLoading(true);
|
|
112
112
|
getHistoryMessage(number, 4);
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
}
|
|
113
|
+
} else {
|
|
114
|
+
setPageNumHistory(0);
|
|
115
|
+
}
|
|
116
|
+
}, 100);
|
|
117
|
+
// } else {
|
|
118
|
+
// setLastId("");
|
|
119
|
+
// }
|
|
117
120
|
}
|
|
118
121
|
if (scrollTop == 0 && pageCount > pageNum && pageCount > 0) {
|
|
119
122
|
console.log("到顶了", pageNum);
|
|
@@ -343,17 +346,19 @@ const CustomerService = (props)=>{
|
|
|
343
346
|
setCitationContent({});
|
|
344
347
|
http.post(`${urllocation}/chat-service/public/v1.0/history-messages`, obj).then((res)=>{
|
|
345
348
|
if (res.data.id) {
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
349
|
+
if (pageNumHistory <= 1) {
|
|
350
|
+
setHistoryMessageList((historyMessageList)=>{
|
|
351
|
+
let newHistoryMessageList = historyMessageList.concat(_object_spread_props(_object_spread({}, obj), {
|
|
352
|
+
id: res.data.id,
|
|
353
|
+
upvoted: false,
|
|
354
|
+
downvoted: false,
|
|
355
|
+
quotedMessage: "",
|
|
356
|
+
createdAt: getDataTime(-1),
|
|
357
|
+
extraInfo: JSON.stringify(obj.extraInfos)
|
|
358
|
+
}));
|
|
359
|
+
return newHistoryMessageList;
|
|
360
|
+
});
|
|
361
|
+
}
|
|
357
362
|
scrollToBottom();
|
|
358
363
|
if (type == 4) {
|
|
359
364
|
sendGreetingMessage(6);
|
|
@@ -460,21 +465,23 @@ const CustomerService = (props)=>{
|
|
|
460
465
|
setQuestionsList([]);
|
|
461
466
|
setCitationContent({});
|
|
462
467
|
} else if (userData.modules.some((item)=>item.short == "AIservice")) {
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
468
|
+
if (pageNumHistory <= 1) {
|
|
469
|
+
setHistoryMessageList((historyMessageList)=>{
|
|
470
|
+
let newHistoryMessageList = historyMessageList.concat({
|
|
471
|
+
roomId: roomId,
|
|
472
|
+
sender: mid,
|
|
473
|
+
recevier: "AI",
|
|
474
|
+
message: keyWord,
|
|
475
|
+
quotedMessage: citationContent.content,
|
|
476
|
+
id: "654321",
|
|
477
|
+
upvoted: false,
|
|
478
|
+
downvoted: false,
|
|
479
|
+
createdAt: getDataTime(-1),
|
|
480
|
+
extraInfo: JSON.stringify([])
|
|
481
|
+
});
|
|
482
|
+
return newHistoryMessageList;
|
|
475
483
|
});
|
|
476
|
-
|
|
477
|
-
});
|
|
484
|
+
}
|
|
478
485
|
setFinished(false);
|
|
479
486
|
aiSendQuestions(3, {
|
|
480
487
|
//相关数据
|
|
@@ -492,32 +499,36 @@ const CustomerService = (props)=>{
|
|
|
492
499
|
};
|
|
493
500
|
//向知识库发送问题 或答案 type:1 发送问题 2 接受答案
|
|
494
501
|
const sendingExistingIssues = (type, obj, questions)=>{
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
502
|
+
if (pageNumHistory <= 1) {
|
|
503
|
+
setHistoryMessageList((historyMessageList)=>{
|
|
504
|
+
let newHistoryMessageList = historyMessageList.concat(_object_spread_props(_object_spread({}, obj), {
|
|
505
|
+
id: null,
|
|
506
|
+
upvoted: false,
|
|
507
|
+
downvoted: false,
|
|
508
|
+
createdAt: getDataTime(-1),
|
|
509
|
+
extraInfo: JSON.stringify(obj.extraInfos)
|
|
510
|
+
}));
|
|
511
|
+
return newHistoryMessageList;
|
|
512
|
+
});
|
|
513
|
+
scrollToBottom();
|
|
514
|
+
}
|
|
506
515
|
http.post(`${urllocation}/chat-service/public/v1.0/history-messages`, obj).then((res)=>{
|
|
507
516
|
if (res.data.id) {
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
517
|
+
if (pageNumHistory <= 1) {
|
|
518
|
+
//更新聊天记录id
|
|
519
|
+
setHistoryMessageList((historyMessageList)=>{
|
|
520
|
+
let newHistoryMessageList = historyMessageList.map((item)=>{
|
|
521
|
+
if (item.id == null) {
|
|
522
|
+
return _object_spread_props(_object_spread({}, item), {
|
|
523
|
+
id: res.data.id
|
|
524
|
+
});
|
|
525
|
+
} else {
|
|
526
|
+
return item;
|
|
527
|
+
}
|
|
528
|
+
});
|
|
529
|
+
return newHistoryMessageList;
|
|
518
530
|
});
|
|
519
|
-
|
|
520
|
-
});
|
|
531
|
+
}
|
|
521
532
|
}
|
|
522
533
|
if (type == 1) {
|
|
523
534
|
//发送答案,调用自动回答
|
|
@@ -580,39 +591,42 @@ const CustomerService = (props)=>{
|
|
|
580
591
|
setTimeout(()=>{
|
|
581
592
|
setQuestionsList([]);
|
|
582
593
|
}, 2000);
|
|
594
|
+
// console.log(pageNumHistory,44444444444444);
|
|
583
595
|
//占位信息
|
|
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
|
-
|
|
596
|
+
if (pageNumHistory <= 1) {
|
|
597
|
+
setHistoryMessageList((historyMessageList)=>{
|
|
598
|
+
if (type == 2) {
|
|
599
|
+
return historyMessageList.map((item)=>{
|
|
600
|
+
if (item.id == id) {
|
|
601
|
+
return {
|
|
602
|
+
roomId: roomId,
|
|
603
|
+
sender: "AI",
|
|
604
|
+
recevier: mid,
|
|
605
|
+
message: "正在输入...",
|
|
606
|
+
id: "123456",
|
|
607
|
+
createdAt: getDataTime(-1),
|
|
608
|
+
extraInfo: null
|
|
609
|
+
};
|
|
610
|
+
} else {
|
|
611
|
+
return item;
|
|
612
|
+
}
|
|
613
|
+
});
|
|
614
|
+
} else {
|
|
615
|
+
return historyMessageList.concat({
|
|
616
|
+
roomId: roomId,
|
|
617
|
+
sender: "AI",
|
|
618
|
+
recevier: mid,
|
|
619
|
+
message: "正在输入...",
|
|
620
|
+
id: "123456",
|
|
621
|
+
createdAt: getDataTime(-1),
|
|
622
|
+
extraInfo: null
|
|
623
|
+
});
|
|
624
|
+
}
|
|
625
|
+
});
|
|
626
|
+
setTimeout(()=>{
|
|
627
|
+
scrollToBottom();
|
|
628
|
+
}, 10);
|
|
629
|
+
}
|
|
616
630
|
//使用fetchEventSource接收数据
|
|
617
631
|
const eventSource = fetchEventSource(`${urllocation}/chat-service/public/v1.0/chat-with-ai/messages`, {
|
|
618
632
|
method: "POST",
|
|
@@ -725,7 +739,9 @@ const CustomerService = (props)=>{
|
|
|
725
739
|
};
|
|
726
740
|
//渲染AI回答
|
|
727
741
|
const renderAiAnswer = (msg, message_id, type)=>{
|
|
742
|
+
// console.log(pageNumHistory,5555555);
|
|
728
743
|
// console.log(aiSendQuestions().abort(),'slkdsdsdsd')
|
|
744
|
+
if (pageNumHistory > 1) return;
|
|
729
745
|
let obj = msg;
|
|
730
746
|
let id = msg.messageId;
|
|
731
747
|
setHistoryMessageList((historyMessageList)=>{
|
|
@@ -822,7 +838,7 @@ const CustomerService = (props)=>{
|
|
|
822
838
|
});
|
|
823
839
|
};
|
|
824
840
|
//获取历史消息 flag:1,历史记录点击定位,2,代表是上拉加载,3,存在新的消息-->老师回答等,4,下拉加载,滚动到底部时,主要用于查看历史记录
|
|
825
|
-
const getHistoryMessage = (pageNum, flag, id = "1")=>{
|
|
841
|
+
const getHistoryMessage = (pageNum, flag, id = "1", raw_data = [])=>{
|
|
826
842
|
clearTimeout(roomMessage.current);
|
|
827
843
|
// console.log(pageNum,flag,'dkfjvndfjvndfkvdf')
|
|
828
844
|
// flag == 1 时已经设置好了位置标记
|
|
@@ -839,10 +855,11 @@ const CustomerService = (props)=>{
|
|
|
839
855
|
}
|
|
840
856
|
let rid = flag == 3 ? id : roomId;
|
|
841
857
|
if (rid == "") return;
|
|
858
|
+
let page = pageNum ? pageNum : 1;
|
|
842
859
|
return http.get(`${urllocation}/chat-service/public/v1.0/history-messages`, {
|
|
843
860
|
params: {
|
|
844
861
|
roomId: rid,
|
|
845
|
-
page:
|
|
862
|
+
page: page,
|
|
846
863
|
maxPageSize: 30,
|
|
847
864
|
direction: "desc"
|
|
848
865
|
}
|
|
@@ -854,6 +871,13 @@ const CustomerService = (props)=>{
|
|
|
854
871
|
let total = res.data.total;
|
|
855
872
|
let maxPageSize = 30;
|
|
856
873
|
let dataList = res.data.messages.reverse();
|
|
874
|
+
//历史记录点击进来的,多加载一页,防止定位不准
|
|
875
|
+
if (flag == 1 && page > 1) {
|
|
876
|
+
let markPage = page - 1;
|
|
877
|
+
setPageNumHistory(markPage);
|
|
878
|
+
getHistoryMessage(page - 1, 5, '1', dataList);
|
|
879
|
+
return;
|
|
880
|
+
}
|
|
857
881
|
setPageCount(Math.ceil(total / maxPageSize));
|
|
858
882
|
let newHistoryMessageList = [];
|
|
859
883
|
setHistoryMessageList((historyMessageList)=>{
|
|
@@ -862,6 +886,9 @@ const CustomerService = (props)=>{
|
|
|
862
886
|
if (flag == 1) {
|
|
863
887
|
newHistoryMessageList = dataList;
|
|
864
888
|
}
|
|
889
|
+
if (flag == 5) {
|
|
890
|
+
newHistoryMessageList = raw_data.concat(dataList);
|
|
891
|
+
}
|
|
865
892
|
if (flag == 4) {
|
|
866
893
|
newHistoryMessageList = historyMessageList.concat(dataList); //下拉加载,向后追加内容
|
|
867
894
|
}
|
|
@@ -881,6 +908,7 @@ const CustomerService = (props)=>{
|
|
|
881
908
|
totalNumber = newHistoryMessageList.length;
|
|
882
909
|
return newHistoryMessageList;
|
|
883
910
|
});
|
|
911
|
+
// console.log(lastId,'lastIdlastId-------')
|
|
884
912
|
//如果在跟老师的聊天窗口,用于找到与老师的最新的聊天,并不在与老师对话的窗口中,并聊天窗口相同
|
|
885
913
|
try {
|
|
886
914
|
if (stepIds != undefined && stepIds != "" && (showType == 3 || showType == 4)) {
|
|
@@ -1199,13 +1227,12 @@ const CustomerService = (props)=>{
|
|
|
1199
1227
|
container.scrollTop = 60;
|
|
1200
1228
|
try {
|
|
1201
1229
|
setTimeout(()=>{
|
|
1202
|
-
|
|
1230
|
+
let top = showType == 1 || showType == 3 ? $("#li_flag").offset().top - 20 : $("#chat_content_modal #li_flag").offset().top - $("#chat_content_modal").offset().top + 24;
|
|
1231
|
+
// let top =
|
|
1203
1232
|
// showType == 1 || showType == 3
|
|
1204
|
-
// ? $("#li_flag").offset().top
|
|
1233
|
+
// ? $("#li_flag").offset().top
|
|
1205
1234
|
// : $("#chat_content_modal #li_flag").offset().top -
|
|
1206
|
-
// $("#chat_content_modal").offset().top
|
|
1207
|
-
// 24;
|
|
1208
|
-
let top = showType == 1 || showType == 3 ? $("#li_flag").offset().top : $("#chat_content_modal #li_flag").offset().top - $("#chat_content_modal").offset().top;
|
|
1235
|
+
// $("#chat_content_modal").offset().top;
|
|
1209
1236
|
// console.log(top2,top,444444444444)
|
|
1210
1237
|
$(`#${showType == 1 || showType == 3 ? "chat_content" : "chat_content_modal"}`).animate({
|
|
1211
1238
|
scrollTop: top
|
|
@@ -2114,15 +2141,19 @@ const CustomerService = (props)=>{
|
|
|
2114
2141
|
setButtomHei(45);
|
|
2115
2142
|
return;
|
|
2116
2143
|
}
|
|
2117
|
-
}
|
|
2144
|
+
}
|
|
2118
2145
|
//跟老师对话
|
|
2119
2146
|
let roomList = contactsList;
|
|
2120
2147
|
if (roomList.length > 0 && roomList[0].roomId != roomId) {
|
|
2121
2148
|
sendToTeacher(2);
|
|
2122
2149
|
} else {
|
|
2123
|
-
|
|
2150
|
+
clearTimeout(timer.current);
|
|
2124
2151
|
setQuestionsList([]);
|
|
2152
|
+
setAnswerMode(-1);
|
|
2125
2153
|
setTeacherList([]);
|
|
2154
|
+
setHistoryMessageList((historyMessageList)=>{
|
|
2155
|
+
return historyMessageList.filter((item)=>item.id != "-1");
|
|
2156
|
+
});
|
|
2126
2157
|
sendMessage("", 0);
|
|
2127
2158
|
}
|
|
2128
2159
|
setButtomHei(45);
|
|
@@ -2219,6 +2250,13 @@ const CustomerService = (props)=>{
|
|
|
2219
2250
|
if (roomList.length > 0 && roomList[0].roomId != roomId) {
|
|
2220
2251
|
sendToTeacher(2);
|
|
2221
2252
|
} else {
|
|
2253
|
+
clearTimeout(timer.current);
|
|
2254
|
+
setQuestionsList([]);
|
|
2255
|
+
setAnswerMode(-1);
|
|
2256
|
+
setTeacherList([]);
|
|
2257
|
+
setHistoryMessageList((historyMessageList)=>{
|
|
2258
|
+
return historyMessageList.filter((item)=>item.id != "-1");
|
|
2259
|
+
});
|
|
2222
2260
|
sendMessage("", 0);
|
|
2223
2261
|
}
|
|
2224
2262
|
onEvent(serverName + serverUrl(), "click_智能问答_ Enter", "提交");
|
|
@@ -2265,9 +2303,19 @@ const CustomerService = (props)=>{
|
|
|
2265
2303
|
bottom: `${buttomHei + 14}px`
|
|
2266
2304
|
},
|
|
2267
2305
|
children: teacherList.map((item)=>{
|
|
2268
|
-
let
|
|
2269
|
-
|
|
2270
|
-
|
|
2306
|
+
let reg = /[`~!@#$%^&*()_\-+=<>?:"{}|,.\/;'\\[\]·~!@#¥%……&*()——\-+={}|《》?:“”【】、;‘’,。、]/im;
|
|
2307
|
+
let span = '';
|
|
2308
|
+
//搜索内容是否有特殊字符
|
|
2309
|
+
if (reg.test(keyWord)) {
|
|
2310
|
+
span = item.name.replaceAll(keyWord, (e)=>{
|
|
2311
|
+
return `<span class=${styles.sign}>${e}</span>`;
|
|
2312
|
+
});
|
|
2313
|
+
} else {
|
|
2314
|
+
span = item.name.replaceAll(new RegExp(keyWord, "ig"), (i)=>{
|
|
2315
|
+
// console.log(i,'skdcnsdjk')
|
|
2316
|
+
return `<span class=${styles.sign}>${i}</span>`;
|
|
2317
|
+
});
|
|
2318
|
+
}
|
|
2271
2319
|
return /*#__PURE__*/ _jsx("p", {
|
|
2272
2320
|
className: styles.item,
|
|
2273
2321
|
children: /*#__PURE__*/ _jsx("span", {
|
|
@@ -2288,9 +2336,19 @@ const CustomerService = (props)=>{
|
|
|
2288
2336
|
bottom: `${buttomHei + 6}px`
|
|
2289
2337
|
},
|
|
2290
2338
|
children: questionsList.map((item)=>{
|
|
2291
|
-
let
|
|
2292
|
-
|
|
2293
|
-
|
|
2339
|
+
let reg = /[`~!@#$%^&*()_\-+=<>?:"{}|,.\/;'\\[\]·~!@#¥%……&*()——\-+={}|《》?:“”【】、;‘’,。、]/im;
|
|
2340
|
+
let span = '';
|
|
2341
|
+
//搜索内容是否有特殊字符
|
|
2342
|
+
if (reg.test(keyWord)) {
|
|
2343
|
+
span = item.question.replaceAll(keyWord, (e)=>{
|
|
2344
|
+
return `<span class=${styles.sign}>${e}</span>`;
|
|
2345
|
+
});
|
|
2346
|
+
} else {
|
|
2347
|
+
span = item.question.replaceAll(new RegExp(keyWord, "ig"), (i)=>{
|
|
2348
|
+
// console.log(i,'skdcnsdjk')
|
|
2349
|
+
return `<span class=${styles.sign}>${i}</span>`;
|
|
2350
|
+
});
|
|
2351
|
+
}
|
|
2294
2352
|
return /*#__PURE__*/ _jsx("p", {
|
|
2295
2353
|
className: styles.item,
|
|
2296
2354
|
children: /*#__PURE__*/ _jsx("span", {
|
|
@@ -2310,25 +2368,26 @@ const CustomerService = (props)=>{
|
|
|
2310
2368
|
};
|
|
2311
2369
|
//加载指定数据,点击历史记录
|
|
2312
2370
|
const loadSpecifiedData = (renewRoomId, page, id, receiver)=>{
|
|
2371
|
+
// let renewRoomId = '4a615d7126b343f78d10dcb06dbc29b0';
|
|
2372
|
+
// let page = 1;
|
|
2373
|
+
// let id = '0e459f0a3a62438698f170b42b94d150';
|
|
2374
|
+
// let receiver = mid;
|
|
2313
2375
|
if (page != 1) {
|
|
2314
2376
|
setPageNumHistory(page);
|
|
2315
2377
|
}
|
|
2316
|
-
setPageNum(page);
|
|
2317
2378
|
setLastId(id); //用于定位
|
|
2379
|
+
setPageNum(page);
|
|
2318
2380
|
//如果是当前聊天室
|
|
2319
2381
|
if (renewRoomId == roomId) {
|
|
2320
2382
|
getHistoryMessage(page, 1);
|
|
2321
2383
|
} else {
|
|
2322
2384
|
setRoomId(renewRoomId);
|
|
2323
|
-
// if (childRef.current) {
|
|
2324
2385
|
if (receiver != mid) {
|
|
2325
2386
|
createRooms(receiver);
|
|
2326
2387
|
}
|
|
2327
2388
|
setTimeout(()=>{
|
|
2328
|
-
// childRef.current.roomsListTimer();
|
|
2329
2389
|
roomsListTimer();
|
|
2330
2390
|
}, 500);
|
|
2331
|
-
// }
|
|
2332
2391
|
}
|
|
2333
2392
|
setShowContacts(true);
|
|
2334
2393
|
};
|
|
@@ -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
|
//获取当前时间
|