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.
@@ -183,12 +183,10 @@
183
183
  width: 100%;
184
184
  .main {
185
185
  max-width: 80%;
186
- // .content:hover ~ .main_content{
187
- // .operate_modal {
188
- // // display: block;
189
- // visibility: visible;
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
- // &:hover {
201
- // .operate_modal {
202
- // // display: block;
203
- // visibility: visible;
204
- // }
205
- // }
206
-
198
+
207
199
  .content {
208
- // &:hover {
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
- var el = document.createElement("input");
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
- // 删除input元素
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
- // span = item.message.replaceAll(keyWordProblem, () => {
355
- // return `<span class=${styles.sign}>${keyWordProblem}</span>`;
356
- // });
357
- span = item.message.replaceAll(new RegExp(keyWordProblem, "ig"), function(i) {
358
- // console.log(i,'skdcnsdjk')
359
- return "<span class=".concat(styles.sign, ">").concat(i, "</span>");
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
- // let span = list.message.replace(
443
- // /keyWordProblem/gi,
444
- // () => {
445
- // return `<span class=${styles.sign}>${keyWordProblem}</span>`;
446
- // }
447
- // );
448
- var span = list.message.replaceAll(new RegExp(keyWordProblem, "ig"), function(i) {
449
- // console.log(i,'skdcnsdjk')
450
- return "<span class=".concat(styles.sign, ">").concat(i, "</span>");
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
- console.log("到底部了22222");
99
- // console.log(11111111,pageNumHistory)
100
- if (pageNumHistory > 1) {
101
- // console.log(pageNumHistory,'pageNumpageNumpageNum')
102
- var number = pageNumHistory - 1;
103
- setPageNumHistory(number);
104
- clearTimeout(listTimer.current);
105
- setBottomLoading(true);
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
- }, 1000);
109
- } else {
110
- setLastId("");
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
- setHistoryMessageList(function(historyMessageList) {
350
- var newHistoryMessageList = historyMessageList.concat(_object_spread_props(_object_spread({}, obj), {
351
- id: res.data.id,
352
- upvoted: false,
353
- downvoted: false,
354
- quotedMessage: "",
355
- createdAt: getDataTime(-1),
356
- extraInfo: JSON.stringify(obj.extraInfos)
357
- }));
358
- return newHistoryMessageList;
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
- setHistoryMessageList(function(historyMessageList) {
473
- var newHistoryMessageList = historyMessageList.concat({
474
- roomId: roomId,
475
- sender: mid,
476
- recevier: "AI",
477
- message: keyWord,
478
- quotedMessage: citationContent.content,
479
- id: "654321",
480
- upvoted: false,
481
- downvoted: false,
482
- createdAt: getDataTime(-1),
483
- extraInfo: JSON.stringify([])
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
- return newHistoryMessageList;
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
- setHistoryMessageList(function(historyMessageList) {
505
- var newHistoryMessageList = historyMessageList.concat(_object_spread_props(_object_spread({}, obj), {
506
- id: null,
507
- upvoted: false,
508
- downvoted: false,
509
- createdAt: getDataTime(-1),
510
- extraInfo: JSON.stringify(obj.extraInfos)
511
- }));
512
- return newHistoryMessageList;
513
- });
514
- scrollToBottom();
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
- //更新聊天记录id
518
- setHistoryMessageList(function(historyMessageList) {
519
- var newHistoryMessageList = historyMessageList.map(function(item) {
520
- if (item.id == null) {
521
- return _object_spread_props(_object_spread({}, item), {
522
- id: res.data.id
523
- });
524
- } else {
525
- return item;
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
- return newHistoryMessageList;
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
- setHistoryMessageList(function(historyMessageList) {
596
- if (type == 2) {
597
- return historyMessageList.map(function(item) {
598
- if (item.id == id) {
599
- return {
600
- roomId: roomId,
601
- sender: "AI",
602
- recevier: mid,
603
- message: "正在输入...",
604
- id: "123456",
605
- createdAt: getDataTime(-1),
606
- extraInfo: null
607
- };
608
- } else {
609
- return item;
610
- }
611
- });
612
- } else {
613
- return historyMessageList.concat({
614
- roomId: roomId,
615
- sender: "AI",
616
- recevier: mid,
617
- message: "正在输入...",
618
- id: "123456",
619
- createdAt: getDataTime(-1),
620
- extraInfo: null
621
- });
622
- }
623
- });
624
- setTimeout(function() {
625
- scrollToBottom();
626
- }, 10);
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
- // setTimeout(() => {
800
- scrollToBottom();
801
- // }, 10);
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: pageNum ? pageNum : 1,
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
- // let top2 =
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 - 20
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
- } else {}
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
- setAnswerMode(-1);
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 span = item.name.replaceAll(new RegExp(keyWord, "ig"), function(i) {
2355
- return "<span class=".concat(styles.sign, ">").concat(i, "</span>");
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 span = item.question.replaceAll(new RegExp(keyWord, "ig"), function(i) {
2378
- return "<span class=".concat(styles.sign, ">").concat(i, "</span>");
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
  };