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.
@@ -120372,7 +120372,7 @@ function requireD () {
120372
120372
  + 'pragma private protected public pure ref return scope shared static struct '
120373
120373
  + 'super switch synchronized template this throw try typedef typeid typeof union '
120374
120374
  + 'unittest version void volatile while with __FILE__ __LINE__ __gshared|10 '
120375
- + '__thread __traits __DATE__ __EOF__ __TIME__ __TIMESTAMP__ __VENDOR__ "0.6.6"',
120375
+ + '__thread __traits __DATE__ __EOF__ __TIME__ __TIMESTAMP__ __VENDOR__ "0.6.7"',
120376
120376
  built_in:
120377
120377
  'bool cdouble cent cfloat char creal dchar delegate double dstring float function '
120378
120378
  + 'idouble ifloat ireal long real short string ubyte ucent uint ulong ushort wchar '
@@ -1,5 +1,5 @@
1
- import { z as zhCN, C as ConfigProvider, _ as _extends, a as _object_destructuring_empty, j as jsx, b as _object_spread_props, S as StyleProvider, t as transform, c as _object_spread, d as _sliced_to_array, T as Tooltip, e as Table$2, I as Icon, f as jsxs, m as message, E as ExclamationCircleFilled, P as Pagination, g as Select, h as CaretDownOutlined, M as Modal, i as _inherits, k as _create_super, l as _create_class, n as _class_call_check, o as _define_property, p as _assert_this_initialized, q as _async_to_generator, L as LeftOutlined, R as RightOutlined, r as MinusOutlined, s as PlusOutlined, u as __generator, v as Input, w as SearchOutlined, x as CloseOutlined, y as Remarkable, D as Drawer, H as HighlightJS } from './869a16fb.esm.es5.development.js';
2
- export { A as Affix, B as Alert, F as Anchor, aA as App, G as AutoComplete, J as Avatar, N as BackTop, O as Badge, Q as Breadcrumb, U as Button, V as Calendar, W as Card, X as Carousel, Y as Cascader, Z as Checkbox, $ as Col, a0 as Collapse, a1 as DatePicker, a2 as Descriptions, a3 as Divider, D as Drawer, a4 as Dropdown, a5 as Empty, K as FloatButton, a6 as Form, a7 as Grid, a8 as Image, v as Input, a9 as InputNumber, aa as Layout, ab as List, ac as Mentions, ad as Menu, M as Modal, af as Popconfirm, ag as Popover, ah as Progress, aH as QRCode, ai as Radio, aj as Rate, ak as Result, al as Row, am as Segmented, g as Select, an as Skeleton, ao as Slider, ap as Space, aq as Spin, ar as Statistic, as as Steps, at as Switch, au as Tabs, av as Tag, ax as TimePicker, ay as Timeline, T as Tooltip, az as Tour, aB as Transfer, aC as Tree, aD as TreeSelect, aE as Typography, aF as Upload, aG as Watermark, aJ as en_US, ae as notification, aw as theme, aI as version, z as zh_CN } from './869a16fb.esm.es5.development.js';
1
+ import { z as zhCN, C as ConfigProvider, _ as _extends, a as _object_destructuring_empty, j as jsx, b as _object_spread_props, S as StyleProvider, t as transform, c as _object_spread, d as _sliced_to_array, T as Tooltip, e as Table$2, I as Icon, f as jsxs, m as message, E as ExclamationCircleFilled, P as Pagination, g as Select, h as CaretDownOutlined, M as Modal, i as _inherits, k as _create_super, l as _create_class, n as _class_call_check, o as _define_property, p as _assert_this_initialized, q as _async_to_generator, L as LeftOutlined, R as RightOutlined, r as MinusOutlined, s as PlusOutlined, u as __generator, v as Input, w as SearchOutlined, x as CloseOutlined, y as Remarkable, D as Drawer, H as HighlightJS } from './4fa3313f.esm.es5.development.js';
2
+ export { A as Affix, B as Alert, F as Anchor, aA as App, G as AutoComplete, J as Avatar, N as BackTop, O as Badge, Q as Breadcrumb, U as Button, V as Calendar, W as Card, X as Carousel, Y as Cascader, Z as Checkbox, $ as Col, a0 as Collapse, a1 as DatePicker, a2 as Descriptions, a3 as Divider, D as Drawer, a4 as Dropdown, a5 as Empty, K as FloatButton, a6 as Form, a7 as Grid, a8 as Image, v as Input, a9 as InputNumber, aa as Layout, ab as List, ac as Mentions, ad as Menu, M as Modal, af as Popconfirm, ag as Popover, ah as Progress, aH as QRCode, ai as Radio, aj as Rate, ak as Result, al as Row, am as Segmented, g as Select, an as Skeleton, ao as Slider, ap as Space, aq as Spin, ar as Statistic, as as Steps, at as Switch, au as Tabs, av as Tag, ax as TimePicker, ay as Timeline, T as Tooltip, az as Tour, aB as Transfer, aC as Tree, aD as TreeSelect, aE as Typography, aF as Upload, aG as Watermark, aJ as en_US, ae as notification, aw as theme, aI as version, z as zh_CN } from './4fa3313f.esm.es5.development.js';
3
3
  import * as React from 'react';
4
4
  import { useState, useRef, useEffect, useLayoutEffect, forwardRef, useImperativeHandle } from 'react';
5
5
  import { Fragment } from 'react/jsx-runtime';
@@ -2370,19 +2370,26 @@ var serverUrl = function() {
2370
2370
  };
2371
2371
  //复制内容
2372
2372
  var copyText = function(text) {
2373
- // text是复制文本
2374
- // 创建input元素
2375
- var el = document.createElement("input");
2376
- // 给input元素赋值需要复制的文本
2377
- el.setAttribute("value", text);
2378
- // 将input元素插入页面
2379
- document.body.appendChild(el);
2380
- // 选中input元素的文本
2381
- el.select();
2382
- // 复制内容到剪贴板
2373
+ // // text是复制文本
2374
+ // // 创建input元素
2375
+ // const el = document.createElement("textarea");
2376
+ // // 给input元素赋值需要复制的文本
2377
+ // el.setAttribute("value", text);
2378
+ // // 将input元素插入页面
2379
+ // document.body.appendChild(el);
2380
+ // // 选中input元素的文本
2381
+ // el.select();
2382
+ // // 复制内容到剪贴板
2383
+ // document.execCommand("copy");
2384
+ // // 删除input元素
2385
+ // document.body.removeChild(el);
2386
+ // return true;
2387
+ var tempInput = document.createElement("textarea");
2388
+ document.body.appendChild(tempInput);
2389
+ tempInput.value = text;
2390
+ tempInput.select();
2383
2391
  document.execCommand("copy");
2384
- // 删除input元素
2385
- document.body.removeChild(el);
2392
+ document.body.removeChild(tempInput);
2386
2393
  return true;
2387
2394
  };
2388
2395
  //获取当前时间
@@ -2688,6 +2695,7 @@ var HistoryFun = function(props) {
2688
2695
  }),
2689
2696
  /*#__PURE__*/ jsx("span", {
2690
2697
  onClick: function() {
2698
+ loadSpecifiedData();
2691
2699
  onClose();
2692
2700
  },
2693
2701
  children: /*#__PURE__*/ jsx(CustomClose$1, {})
@@ -2759,13 +2767,18 @@ var HistoryFun = function(props) {
2759
2767
  var span = "";
2760
2768
  var time = "";
2761
2769
  if (item.count == 1) {
2762
- // span = item.message.replaceAll(keyWordProblem, () => {
2763
- // return `<span class=${styles.sign}>${keyWordProblem}</span>`;
2764
- // });
2765
- span = item.message.replaceAll(new RegExp(keyWordProblem, "ig"), function(i) {
2766
- // console.log(i,'skdcnsdjk')
2767
- return "<span class=".concat(modules_63b47c51.sign, ">").concat(i, "</span>");
2768
- });
2770
+ var reg = /[`~!@#$%^&*()_\-+=<>?:"{}|,.\/;'\\[\]·~!@#¥%……&*()——\-+={}|《》?:“”【】、;‘’,。、]/im;
2771
+ //搜索内容是否有特殊字符
2772
+ if (reg.test(keyWordProblem)) {
2773
+ span = item.message.replaceAll(keyWordProblem, function(e) {
2774
+ return "<span class=".concat(modules_63b47c51.sign, ">").concat(e, "</span>");
2775
+ });
2776
+ } else {
2777
+ span = item.message.replaceAll(new RegExp(keyWordProblem, "ig"), function(i) {
2778
+ // console.log(i,'skdcnsdjk')
2779
+ return "<span class=".concat(modules_63b47c51.sign, ">").concat(i, "</span>");
2780
+ });
2781
+ }
2769
2782
  var currentTime = getDataTime(-1, 1); //当前时间
2770
2783
  var createdAt = getDataTime(item.createdAt, 1);
2771
2784
  if (currentTime == createdAt) {
@@ -2847,16 +2860,19 @@ var HistoryFun = function(props) {
2847
2860
  } else {
2848
2861
  time = getDataTime(list.updatedAt);
2849
2862
  }
2850
- // let span = list.message.replace(
2851
- // /keyWordProblem/gi,
2852
- // () => {
2853
- // return `<span class=${styles.sign}>${keyWordProblem}</span>`;
2854
- // }
2855
- // );
2856
- var span = list.message.replaceAll(new RegExp(keyWordProblem, "ig"), function(i) {
2857
- // console.log(i,'skdcnsdjk')
2858
- return "<span class=".concat(modules_63b47c51.sign, ">").concat(i, "</span>");
2859
- });
2863
+ var reg = /[`~!@#$%^&*()_\-+=<>?:"{}|,.\/;'\\[\]·~!@#¥%……&*()——\-+={}|《》?:“”【】、;‘’,。、]/im;
2864
+ var span = "";
2865
+ //搜索内容是否有特殊字符
2866
+ if (reg.test(keyWordProblem)) {
2867
+ span = list.message.replaceAll(keyWordProblem, function(e) {
2868
+ return "<span class=".concat(modules_63b47c51.sign, ">").concat(e, "</span>");
2869
+ });
2870
+ } else {
2871
+ span = list.message.replaceAll(new RegExp(keyWordProblem, "ig"), function(i) {
2872
+ // console.log(i,'skdcnsdjk')
2873
+ return "<span class=".concat(modules_63b47c51.sign, ">").concat(i, "</span>");
2874
+ });
2875
+ }
2860
2876
  return /*#__PURE__*/ jsxs("div", {
2861
2877
  className: modules_63b47c51.list,
2862
2878
  onClick: function() {
@@ -3317,21 +3333,24 @@ var CustomerService = function(props) {
3317
3333
  var clientHeight = container.clientHeight;
3318
3334
  var scrollHeight = container.scrollHeight;
3319
3335
  // console.log(scrollTop,clientHeight,scrollHeight,'333dfkvmdfv')
3320
- if (clientHeight + scrollTop + 0.5 >= scrollHeight) {
3336
+ if (clientHeight + scrollTop + 0.5 >= scrollHeight && pageNumHistory > 1) {
3321
3337
  console.log("到底部了22222");
3322
- // console.log(11111111,pageNumHistory)
3323
- if (pageNumHistory > 1) {
3324
- // console.log(pageNumHistory,'pageNumpageNumpageNum')
3325
- var number = pageNumHistory - 1;
3326
- setPageNumHistory(number);
3327
- clearTimeout(listTimer.current);
3328
- setBottomLoading(true);
3329
- listTimer.current = setTimeout(function() {
3338
+ // if (pageNumHistory > 1) {
3339
+ // console.log(pageNumHistory,'pageNumpageNumpageNum')
3340
+ var number = pageNumHistory - 1;
3341
+ setPageNumHistory(number);
3342
+ clearTimeout(listTimer.current);
3343
+ listTimer.current = setTimeout(function() {
3344
+ if (number > 0) {
3345
+ setBottomLoading(true);
3330
3346
  getHistoryMessage(number, 4);
3331
- }, 1000);
3332
- } else {
3333
- setLastId("");
3334
- }
3347
+ } else {
3348
+ setPageNumHistory(0);
3349
+ }
3350
+ }, 100);
3351
+ // } else {
3352
+ // setLastId("");
3353
+ // }
3335
3354
  }
3336
3355
  if (scrollTop == 0 && pageCount > pageNum && pageCount > 0) {
3337
3356
  console.log("到顶了", pageNum);
@@ -3563,17 +3582,19 @@ var CustomerService = function(props) {
3563
3582
  setCitationContent({});
3564
3583
  http.post("".concat(urllocation, "/chat-service/public/v1.0/history-messages"), obj).then(function(res) {
3565
3584
  if (res.data.id) {
3566
- setHistoryMessageList(function(historyMessageList) {
3567
- var newHistoryMessageList = historyMessageList.concat(_object_spread_props(_object_spread({}, obj), {
3568
- id: res.data.id,
3569
- upvoted: false,
3570
- downvoted: false,
3571
- quotedMessage: "",
3572
- createdAt: getDataTime(-1),
3573
- extraInfo: JSON.stringify(obj.extraInfos)
3574
- }));
3575
- return newHistoryMessageList;
3576
- });
3585
+ if (pageNumHistory <= 1) {
3586
+ setHistoryMessageList(function(historyMessageList) {
3587
+ var newHistoryMessageList = historyMessageList.concat(_object_spread_props(_object_spread({}, obj), {
3588
+ id: res.data.id,
3589
+ upvoted: false,
3590
+ downvoted: false,
3591
+ quotedMessage: "",
3592
+ createdAt: getDataTime(-1),
3593
+ extraInfo: JSON.stringify(obj.extraInfos)
3594
+ }));
3595
+ return newHistoryMessageList;
3596
+ });
3597
+ }
3577
3598
  scrollToBottom();
3578
3599
  if (type == 4) {
3579
3600
  sendGreetingMessage(6);
@@ -3686,21 +3707,23 @@ var CustomerService = function(props) {
3686
3707
  } else if (userData.modules.some(function(item) {
3687
3708
  return item.short == "AIservice";
3688
3709
  })) {
3689
- setHistoryMessageList(function(historyMessageList) {
3690
- var newHistoryMessageList = historyMessageList.concat({
3691
- roomId: roomId,
3692
- sender: mid,
3693
- recevier: "AI",
3694
- message: keyWord,
3695
- quotedMessage: citationContent.content,
3696
- id: "654321",
3697
- upvoted: false,
3698
- downvoted: false,
3699
- createdAt: getDataTime(-1),
3700
- extraInfo: JSON.stringify([])
3710
+ if (pageNumHistory <= 1) {
3711
+ setHistoryMessageList(function(historyMessageList) {
3712
+ var newHistoryMessageList = historyMessageList.concat({
3713
+ roomId: roomId,
3714
+ sender: mid,
3715
+ recevier: "AI",
3716
+ message: keyWord,
3717
+ quotedMessage: citationContent.content,
3718
+ id: "654321",
3719
+ upvoted: false,
3720
+ downvoted: false,
3721
+ createdAt: getDataTime(-1),
3722
+ extraInfo: JSON.stringify([])
3723
+ });
3724
+ return newHistoryMessageList;
3701
3725
  });
3702
- return newHistoryMessageList;
3703
- });
3726
+ }
3704
3727
  setFinished(false);
3705
3728
  aiSendQuestions(3, {
3706
3729
  //相关数据
@@ -3718,32 +3741,36 @@ var CustomerService = function(props) {
3718
3741
  };
3719
3742
  //向知识库发送问题 或答案 type:1 发送问题 2 接受答案
3720
3743
  var sendingExistingIssues = function(type, obj, questions) {
3721
- setHistoryMessageList(function(historyMessageList) {
3722
- var newHistoryMessageList = historyMessageList.concat(_object_spread_props(_object_spread({}, obj), {
3723
- id: null,
3724
- upvoted: false,
3725
- downvoted: false,
3726
- createdAt: getDataTime(-1),
3727
- extraInfo: JSON.stringify(obj.extraInfos)
3728
- }));
3729
- return newHistoryMessageList;
3730
- });
3731
- scrollToBottom();
3744
+ if (pageNumHistory <= 1) {
3745
+ setHistoryMessageList(function(historyMessageList) {
3746
+ var newHistoryMessageList = historyMessageList.concat(_object_spread_props(_object_spread({}, obj), {
3747
+ id: null,
3748
+ upvoted: false,
3749
+ downvoted: false,
3750
+ createdAt: getDataTime(-1),
3751
+ extraInfo: JSON.stringify(obj.extraInfos)
3752
+ }));
3753
+ return newHistoryMessageList;
3754
+ });
3755
+ scrollToBottom();
3756
+ }
3732
3757
  http.post("".concat(urllocation, "/chat-service/public/v1.0/history-messages"), obj).then(function(res) {
3733
3758
  if (res.data.id) {
3734
- //更新聊天记录id
3735
- setHistoryMessageList(function(historyMessageList) {
3736
- var newHistoryMessageList = historyMessageList.map(function(item) {
3737
- if (item.id == null) {
3738
- return _object_spread_props(_object_spread({}, item), {
3739
- id: res.data.id
3740
- });
3741
- } else {
3742
- return item;
3743
- }
3759
+ if (pageNumHistory <= 1) {
3760
+ //更新聊天记录id
3761
+ setHistoryMessageList(function(historyMessageList) {
3762
+ var newHistoryMessageList = historyMessageList.map(function(item) {
3763
+ if (item.id == null) {
3764
+ return _object_spread_props(_object_spread({}, item), {
3765
+ id: res.data.id
3766
+ });
3767
+ } else {
3768
+ return item;
3769
+ }
3770
+ });
3771
+ return newHistoryMessageList;
3744
3772
  });
3745
- return newHistoryMessageList;
3746
- });
3773
+ }
3747
3774
  }
3748
3775
  if (type == 1) {
3749
3776
  //发送答案,调用自动回答
@@ -3808,39 +3835,42 @@ var CustomerService = function(props) {
3808
3835
  setTimeout(function() {
3809
3836
  setQuestionsList([]);
3810
3837
  }, 2000);
3838
+ // console.log(pageNumHistory,44444444444444);
3811
3839
  //占位信息
3812
- setHistoryMessageList(function(historyMessageList) {
3813
- if (type == 2) {
3814
- return historyMessageList.map(function(item) {
3815
- if (item.id == id) {
3816
- return {
3817
- roomId: roomId,
3818
- sender: "AI",
3819
- recevier: mid,
3820
- message: "正在输入...",
3821
- id: "123456",
3822
- createdAt: getDataTime(-1),
3823
- extraInfo: null
3824
- };
3825
- } else {
3826
- return item;
3827
- }
3828
- });
3829
- } else {
3830
- return historyMessageList.concat({
3831
- roomId: roomId,
3832
- sender: "AI",
3833
- recevier: mid,
3834
- message: "正在输入...",
3835
- id: "123456",
3836
- createdAt: getDataTime(-1),
3837
- extraInfo: null
3838
- });
3839
- }
3840
- });
3841
- setTimeout(function() {
3842
- scrollToBottom();
3843
- }, 10);
3840
+ if (pageNumHistory <= 1) {
3841
+ setHistoryMessageList(function(historyMessageList) {
3842
+ if (type == 2) {
3843
+ return historyMessageList.map(function(item) {
3844
+ if (item.id == id) {
3845
+ return {
3846
+ roomId: roomId,
3847
+ sender: "AI",
3848
+ recevier: mid,
3849
+ message: "正在输入...",
3850
+ id: "123456",
3851
+ createdAt: getDataTime(-1),
3852
+ extraInfo: null
3853
+ };
3854
+ } else {
3855
+ return item;
3856
+ }
3857
+ });
3858
+ } else {
3859
+ return historyMessageList.concat({
3860
+ roomId: roomId,
3861
+ sender: "AI",
3862
+ recevier: mid,
3863
+ message: "正在输入...",
3864
+ id: "123456",
3865
+ createdAt: getDataTime(-1),
3866
+ extraInfo: null
3867
+ });
3868
+ }
3869
+ });
3870
+ setTimeout(function() {
3871
+ scrollToBottom();
3872
+ }, 10);
3873
+ }
3844
3874
  //使用fetchEventSource接收数据
3845
3875
  fetchEventSource("".concat(urllocation, "/chat-service/public/v1.0/chat-with-ai/messages"), {
3846
3876
  method: "POST",
@@ -3959,7 +3989,9 @@ var CustomerService = function(props) {
3959
3989
  };
3960
3990
  //渲染AI回答
3961
3991
  var renderAiAnswer = function(msg, message_id, type) {
3992
+ // console.log(pageNumHistory,5555555);
3962
3993
  // console.log(aiSendQuestions().abort(),'slkdsdsdsd')
3994
+ if (pageNumHistory > 1) return;
3963
3995
  var obj = msg;
3964
3996
  var id = msg.messageId;
3965
3997
  setHistoryMessageList(function(historyMessageList) {
@@ -4059,7 +4091,7 @@ var CustomerService = function(props) {
4059
4091
  };
4060
4092
  //获取历史消息 flag:1,历史记录点击定位,2,代表是上拉加载,3,存在新的消息-->老师回答等,4,下拉加载,滚动到底部时,主要用于查看历史记录
4061
4093
  var getHistoryMessage = function(pageNum, flag) {
4062
- var id = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "1";
4094
+ var id = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "1", raw_data = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : [];
4063
4095
  clearTimeout(roomMessage.current);
4064
4096
  // console.log(pageNum,flag,'dkfjvndfjvndfkvdf')
4065
4097
  // flag == 1 时已经设置好了位置标记
@@ -4076,10 +4108,11 @@ var CustomerService = function(props) {
4076
4108
  }
4077
4109
  var rid = flag == 3 ? id : roomId;
4078
4110
  if (rid == "") return;
4111
+ var page = pageNum ? pageNum : 1;
4079
4112
  return http.get("".concat(urllocation, "/chat-service/public/v1.0/history-messages"), {
4080
4113
  params: {
4081
4114
  roomId: rid,
4082
- page: pageNum ? pageNum : 1,
4115
+ page: page,
4083
4116
  maxPageSize: 30,
4084
4117
  direction: "desc"
4085
4118
  }
@@ -4091,6 +4124,13 @@ var CustomerService = function(props) {
4091
4124
  var total = res.data.total;
4092
4125
  var maxPageSize = 30;
4093
4126
  var dataList = res.data.messages.reverse();
4127
+ //历史记录点击进来的,多加载一页,防止定位不准
4128
+ if (flag == 1 && page > 1) {
4129
+ var markPage = page - 1;
4130
+ setPageNumHistory(markPage);
4131
+ getHistoryMessage(page - 1, 5, "1", dataList);
4132
+ return;
4133
+ }
4094
4134
  setPageCount(Math.ceil(total / maxPageSize));
4095
4135
  var newHistoryMessageList = [];
4096
4136
  setHistoryMessageList(function(historyMessageList) {
@@ -4099,6 +4139,9 @@ var CustomerService = function(props) {
4099
4139
  if (flag == 1) {
4100
4140
  newHistoryMessageList = dataList;
4101
4141
  }
4142
+ if (flag == 5) {
4143
+ newHistoryMessageList = raw_data.concat(dataList);
4144
+ }
4102
4145
  if (flag == 4) {
4103
4146
  newHistoryMessageList = historyMessageList.concat(dataList); //下拉加载,向后追加内容
4104
4147
  }
@@ -4120,6 +4163,7 @@ var CustomerService = function(props) {
4120
4163
  totalNumber = newHistoryMessageList.length;
4121
4164
  return newHistoryMessageList;
4122
4165
  });
4166
+ // console.log(lastId,'lastIdlastId-------')
4123
4167
  //如果在跟老师的聊天窗口,用于找到与老师的最新的聊天,并不在与老师对话的窗口中,并聊天窗口相同
4124
4168
  try {
4125
4169
  if (stepIds != undefined && stepIds != "" && (showType == 3 || showType == 4)) {
@@ -4452,13 +4496,12 @@ var CustomerService = function(props) {
4452
4496
  container.scrollTop = 60;
4453
4497
  try {
4454
4498
  setTimeout(function() {
4455
- // let top2 =
4499
+ var top = showType == 1 || showType == 3 ? $("#li_flag").offset().top - 20 : $("#chat_content_modal #li_flag").offset().top - $("#chat_content_modal").offset().top + 24;
4500
+ // let top =
4456
4501
  // showType == 1 || showType == 3
4457
- // ? $("#li_flag").offset().top - 20
4502
+ // ? $("#li_flag").offset().top
4458
4503
  // : $("#chat_content_modal #li_flag").offset().top -
4459
- // $("#chat_content_modal").offset().top +
4460
- // 24;
4461
- var top = showType == 1 || showType == 3 ? $("#li_flag").offset().top : $("#chat_content_modal #li_flag").offset().top - $("#chat_content_modal").offset().top;
4504
+ // $("#chat_content_modal").offset().top;
4462
4505
  // console.log(top2,top,444444444444)
4463
4506
  $("#".concat(showType == 1 || showType == 3 ? "chat_content" : "chat_content_modal")).animate({
4464
4507
  scrollTop: top
@@ -5413,9 +5456,15 @@ var CustomerService = function(props) {
5413
5456
  if (roomList.length > 0 && roomList[0].roomId != roomId) {
5414
5457
  sendToTeacher(2);
5415
5458
  } else {
5416
- setAnswerMode(-1);
5459
+ clearTimeout(timer.current);
5417
5460
  setQuestionsList([]);
5461
+ setAnswerMode(-1);
5418
5462
  setTeacherList([]);
5463
+ setHistoryMessageList(function(historyMessageList) {
5464
+ return historyMessageList.filter(function(item) {
5465
+ return item.id != "-1";
5466
+ });
5467
+ });
5419
5468
  sendMessage("", 0);
5420
5469
  }
5421
5470
  setButtomHei(45);
@@ -5516,6 +5565,15 @@ var CustomerService = function(props) {
5516
5565
  if (roomList.length > 0 && roomList[0].roomId != roomId) {
5517
5566
  sendToTeacher(2);
5518
5567
  } else {
5568
+ clearTimeout(timer.current);
5569
+ setQuestionsList([]);
5570
+ setAnswerMode(-1);
5571
+ setTeacherList([]);
5572
+ setHistoryMessageList(function(historyMessageList) {
5573
+ return historyMessageList.filter(function(item) {
5574
+ return item.id != "-1";
5575
+ });
5576
+ });
5519
5577
  sendMessage("", 0);
5520
5578
  }
5521
5579
  onEvent(serverName + serverUrl(), "click_智能问答_ Enter", "提交");
@@ -5564,9 +5622,19 @@ var CustomerService = function(props) {
5564
5622
  bottom: "".concat(buttomHei + 14, "px")
5565
5623
  },
5566
5624
  children: teacherList.map(function(item) {
5567
- var span = item.name.replaceAll(new RegExp(keyWord, "ig"), function(i) {
5568
- return "<span class=".concat(styles.sign, ">").concat(i, "</span>");
5569
- });
5625
+ var reg = /[`~!@#$%^&*()_\-+=<>?:"{}|,.\/;'\\[\]·~!@#¥%……&*()——\-+={}|《》?:“”【】、;‘’,。、]/im;
5626
+ var span = "";
5627
+ //搜索内容是否有特殊字符
5628
+ if (reg.test(keyWord)) {
5629
+ span = item.name.replaceAll(keyWord, function(e) {
5630
+ return "<span class=".concat(styles.sign, ">").concat(e, "</span>");
5631
+ });
5632
+ } else {
5633
+ span = item.name.replaceAll(new RegExp(keyWord, "ig"), function(i) {
5634
+ // console.log(i,'skdcnsdjk')
5635
+ return "<span class=".concat(styles.sign, ">").concat(i, "</span>");
5636
+ });
5637
+ }
5570
5638
  return /*#__PURE__*/ jsx("p", {
5571
5639
  className: styles.item,
5572
5640
  children: /*#__PURE__*/ jsx("span", {
@@ -5587,9 +5655,19 @@ var CustomerService = function(props) {
5587
5655
  bottom: "".concat(buttomHei + 6, "px")
5588
5656
  },
5589
5657
  children: questionsList.map(function(item) {
5590
- var span = item.question.replaceAll(new RegExp(keyWord, "ig"), function(i) {
5591
- return "<span class=".concat(styles.sign, ">").concat(i, "</span>");
5592
- });
5658
+ var reg = /[`~!@#$%^&*()_\-+=<>?:"{}|,.\/;'\\[\]·~!@#¥%……&*()——\-+={}|《》?:“”【】、;‘’,。、]/im;
5659
+ var span = "";
5660
+ //搜索内容是否有特殊字符
5661
+ if (reg.test(keyWord)) {
5662
+ span = item.question.replaceAll(keyWord, function(e) {
5663
+ return "<span class=".concat(styles.sign, ">").concat(e, "</span>");
5664
+ });
5665
+ } else {
5666
+ span = item.question.replaceAll(new RegExp(keyWord, "ig"), function(i) {
5667
+ // console.log(i,'skdcnsdjk')
5668
+ return "<span class=".concat(styles.sign, ">").concat(i, "</span>");
5669
+ });
5670
+ }
5593
5671
  return /*#__PURE__*/ jsx("p", {
5594
5672
  className: styles.item,
5595
5673
  children: /*#__PURE__*/ jsx("span", {
@@ -5609,25 +5687,26 @@ var CustomerService = function(props) {
5609
5687
  };
5610
5688
  //加载指定数据,点击历史记录
5611
5689
  var loadSpecifiedData = function(renewRoomId, page, id, receiver) {
5690
+ // let renewRoomId = '4a615d7126b343f78d10dcb06dbc29b0';
5691
+ // let page = 1;
5692
+ // let id = '0e459f0a3a62438698f170b42b94d150';
5693
+ // let receiver = mid;
5612
5694
  if (page != 1) {
5613
5695
  setPageNumHistory(page);
5614
5696
  }
5615
- setPageNum(page);
5616
5697
  setLastId(id); //用于定位
5698
+ setPageNum(page);
5617
5699
  //如果是当前聊天室
5618
5700
  if (renewRoomId == roomId) {
5619
5701
  getHistoryMessage(page, 1);
5620
5702
  } else {
5621
5703
  setRoomId(renewRoomId);
5622
- // if (childRef.current) {
5623
5704
  if (receiver != mid) {
5624
5705
  createRooms(receiver);
5625
5706
  }
5626
5707
  setTimeout(function() {
5627
- // childRef.current.roomsListTimer();
5628
5708
  roomsListTimer();
5629
5709
  }, 500);
5630
- // }
5631
5710
  }
5632
5711
  setShowContacts(true);
5633
5712
  };