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.
@@ -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 './12224038.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 './12224038.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';
@@ -2332,7 +2332,7 @@ function BhdAppLayout(props) {
2332
2332
  });
2333
2333
  }
2334
2334
 
2335
- var modules_63b47c51 = {"service_ChatWindow_Drawer":"index_module_service_ChatWindow_Drawer__9cd6a734","ChatWindow_Modal":"index_module_ChatWindow_Modal__9cd6a734","ChatWindow_Drawer":"index_module_ChatWindow_Drawer__9cd6a734","header_wrap":"index_module_header_wrap__9cd6a734","top":"index_module_top__9cd6a734","user":"index_module_user__9cd6a734","count":"index_module_count__9cd6a734","operate":"index_module_operate__9cd6a734","line":"index_module_line__9cd6a734","header_wrap_newlabo":"index_module_header_wrap_newlabo__9cd6a734","Drawer_main":"index_module_Drawer_main__9cd6a734","loading":"index_module_loading__9cd6a734","message_con":"index_module_message_con__9cd6a734","left":"index_module_left__9cd6a734","head_sculpture":"index_module_head_sculpture__9cd6a734","main_content":"index_module_main_content__9cd6a734","right":"index_module_right__9cd6a734","main":"index_module_main__9cd6a734","main_content_flag":"index_module_main_content_flag__9cd6a734","operate_modal":"index_module_operate_modal__9cd6a734","content":"index_module_content__9cd6a734","content_child":"index_module_content_child__9cd6a734","active":"index_module_active__9cd6a734","ask_question":"index_module_ask_question__9cd6a734","operate_modal_bottom":"index_module_operate_modal_bottom__9cd6a734","stop_generate":"index_module_stop_generate__9cd6a734","icon":"index_module_icon__9cd6a734","find_teacher":"index_module_find_teacher__9cd6a734","stop_findTeacher":"index_module_stop_findTeacher__9cd6a734","association_problem":"index_module_association_problem__9cd6a734","time":"index_module_time__9cd6a734","citation_content":"index_module_citation_content__9cd6a734","text_exceed":"index_module_text_exceed__9cd6a734","popover_content":"index_module_popover_content__9cd6a734","Drawer_main_newlabo":"index_module_Drawer_main_newlabo__9cd6a734","Drawer_main_newlabo_no_pic":"index_module_Drawer_main_newlabo_no_pic__9cd6a734","Drawer_buttom_Issues_List":"index_module_Drawer_buttom_Issues_List__9cd6a734","issues_list_teacherList":"index_module_issues_list_teacherList__9cd6a734","item":"index_module_item__9cd6a734","issues_list":"index_module_issues_list__9cd6a734","sign":"index_module_sign__9cd6a734","Drawer_buttom":"index_module_Drawer_buttom__9cd6a734","input_wrap":"index_module_input_wrap__9cd6a734","input":"index_module_input__9cd6a734","no_AI":"index_module_no_AI__9cd6a734","voice":"index_module_voice__9cd6a734","voice_btn":"index_module_voice_btn__9cd6a734","disabled":"index_module_disabled__9cd6a734","content_main":"index_module_content_main__9cd6a734","content_con":"index_module_content_con__9cd6a734","delete_quote":"index_module_delete_quote__9cd6a734","sending":"index_module_sending__9cd6a734","Drawer_buttom_Issues_List_newlabo":"index_module_Drawer_buttom_Issues_List_newlabo__9cd6a734","main_list":"index_module_main_list__9cd6a734","chat_content":"index_module_chat_content__9cd6a734","popover_main_content":"index_module_popover_main_content__9cd6a734","popover_main_content_name":"index_module_popover_main_content_name__9cd6a734","teacher_layout":"index_module_teacher_layout__9cd6a734","bottom":"index_module_bottom__9cd6a734","delete":"index_module_delete__9cd6a734","num":"index_module_num__9cd6a734","shrink":"index_module_shrink__9cd6a734","teacher_layout_newlabo":"index_module_teacher_layout_newlabo__9cd6a734","teacher_layout_modal":"index_module_teacher_layout_modal__9cd6a734","ai":"index_module_ai__9cd6a734","user_info":"index_module_user_info__9cd6a734","message":"index_module_message__9cd6a734","con":"index_module_con__9cd6a734","teacher_layout_modal_newlabo":"index_module_teacher_layout_modal_newlabo__9cd6a734","history_list":"index_module_history_list__9cd6a734","search_layout":"index_module_search_layout__9cd6a734","mymove":"index_module_mymove__9cd6a734","title":"index_module_title__9cd6a734","search_top":"index_module_search_top__9cd6a734","list_item":"index_module_list_item__9cd6a734","list_summary":"index_module_list_summary__9cd6a734","head_img":"index_module_head_img__9cd6a734","list_desc":"index_module_list_desc__9cd6a734","name":"index_module_name__9cd6a734","decs":"index_module_decs__9cd6a734","open":"index_module_open__9cd6a734","list_detail":"index_module_list_detail__9cd6a734","list":"index_module_list__9cd6a734","list_more":"index_module_list_more__9cd6a734","no_data":"index_module_no_data__9cd6a734","history_list_broadside":"index_module_history_list_broadside__9cd6a734"};
2335
+ var modules_63b47c51 = {"service_ChatWindow_Drawer":"index_module_service_ChatWindow_Drawer__1d39865c","ChatWindow_Modal":"index_module_ChatWindow_Modal__1d39865c","ChatWindow_Drawer":"index_module_ChatWindow_Drawer__1d39865c","header_wrap":"index_module_header_wrap__1d39865c","top":"index_module_top__1d39865c","user":"index_module_user__1d39865c","count":"index_module_count__1d39865c","operate":"index_module_operate__1d39865c","line":"index_module_line__1d39865c","header_wrap_newlabo":"index_module_header_wrap_newlabo__1d39865c","Drawer_main":"index_module_Drawer_main__1d39865c","loading":"index_module_loading__1d39865c","message_con":"index_module_message_con__1d39865c","left":"index_module_left__1d39865c","head_sculpture":"index_module_head_sculpture__1d39865c","main_content":"index_module_main_content__1d39865c","right":"index_module_right__1d39865c","main":"index_module_main__1d39865c","main_content_flag":"index_module_main_content_flag__1d39865c","operate_modal":"index_module_operate_modal__1d39865c","content":"index_module_content__1d39865c","content_child":"index_module_content_child__1d39865c","active":"index_module_active__1d39865c","ask_question":"index_module_ask_question__1d39865c","operate_modal_bottom":"index_module_operate_modal_bottom__1d39865c","stop_generate":"index_module_stop_generate__1d39865c","icon":"index_module_icon__1d39865c","find_teacher":"index_module_find_teacher__1d39865c","stop_findTeacher":"index_module_stop_findTeacher__1d39865c","association_problem":"index_module_association_problem__1d39865c","time":"index_module_time__1d39865c","citation_content":"index_module_citation_content__1d39865c","text_exceed":"index_module_text_exceed__1d39865c","popover_content":"index_module_popover_content__1d39865c","Drawer_main_newlabo":"index_module_Drawer_main_newlabo__1d39865c","Drawer_main_newlabo_no_pic":"index_module_Drawer_main_newlabo_no_pic__1d39865c","Drawer_buttom_Issues_List":"index_module_Drawer_buttom_Issues_List__1d39865c","issues_list_teacherList":"index_module_issues_list_teacherList__1d39865c","item":"index_module_item__1d39865c","issues_list":"index_module_issues_list__1d39865c","sign":"index_module_sign__1d39865c","Drawer_buttom":"index_module_Drawer_buttom__1d39865c","input_wrap":"index_module_input_wrap__1d39865c","input":"index_module_input__1d39865c","no_AI":"index_module_no_AI__1d39865c","voice":"index_module_voice__1d39865c","voice_btn":"index_module_voice_btn__1d39865c","disabled":"index_module_disabled__1d39865c","content_main":"index_module_content_main__1d39865c","content_con":"index_module_content_con__1d39865c","delete_quote":"index_module_delete_quote__1d39865c","sending":"index_module_sending__1d39865c","Drawer_buttom_Issues_List_newlabo":"index_module_Drawer_buttom_Issues_List_newlabo__1d39865c","main_list":"index_module_main_list__1d39865c","chat_content":"index_module_chat_content__1d39865c","popover_main_content":"index_module_popover_main_content__1d39865c","popover_main_content_name":"index_module_popover_main_content_name__1d39865c","teacher_layout":"index_module_teacher_layout__1d39865c","bottom":"index_module_bottom__1d39865c","delete":"index_module_delete__1d39865c","num":"index_module_num__1d39865c","shrink":"index_module_shrink__1d39865c","teacher_layout_newlabo":"index_module_teacher_layout_newlabo__1d39865c","teacher_layout_modal":"index_module_teacher_layout_modal__1d39865c","ai":"index_module_ai__1d39865c","user_info":"index_module_user_info__1d39865c","message":"index_module_message__1d39865c","con":"index_module_con__1d39865c","teacher_layout_modal_newlabo":"index_module_teacher_layout_modal_newlabo__1d39865c","history_list":"index_module_history_list__1d39865c","search_layout":"index_module_search_layout__1d39865c","mymove":"index_module_mymove__1d39865c","title":"index_module_title__1d39865c","search_top":"index_module_search_top__1d39865c","list_item":"index_module_list_item__1d39865c","list_summary":"index_module_list_summary__1d39865c","head_img":"index_module_head_img__1d39865c","list_desc":"index_module_list_desc__1d39865c","name":"index_module_name__1d39865c","decs":"index_module_decs__1d39865c","open":"index_module_open__1d39865c","list_detail":"index_module_list_detail__1d39865c","list":"index_module_list__1d39865c","list_more":"index_module_list_more__1d39865c","no_data":"index_module_no_data__1d39865c","history_list_broadside":"index_module_history_list_broadside__1d39865c"};
2336
2336
 
2337
2337
  //消息已读
2338
2338
  var readMessage = function(roomId, urllocation, userData, http) {
@@ -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,34 +3333,32 @@ 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) {
3321
- 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() {
3336
+ if (clientHeight + scrollTop + 0.5 >= scrollHeight && pageNumHistory > 1) {
3337
+ // if (pageNumHistory > 1) {
3338
+ // console.log(pageNumHistory,'pageNumpageNumpageNum')
3339
+ var number = pageNumHistory - 1;
3340
+ setPageNumHistory(number);
3341
+ clearTimeout(listTimer.current);
3342
+ listTimer.current = setTimeout(function() {
3343
+ if (number > 0) {
3344
+ setBottomLoading(true);
3330
3345
  getHistoryMessage(number, 4);
3331
- }, 1000);
3332
- } else {
3333
- setLastId("");
3334
- }
3346
+ setLastId("");
3347
+ } else {
3348
+ setPageNumHistory(0);
3349
+ }
3350
+ }, 1000);
3351
+ // } else {
3352
+ // }
3335
3353
  }
3336
3354
  if (scrollTop == 0 && pageCount > pageNum && pageCount > 0) {
3337
3355
  console.log("到顶了", pageNum);
3338
- // if(pageNum == 1){
3339
- // setFirstpage(true);//代表是否存在第一页
3340
- // }
3341
3356
  setLoading(true);
3342
3357
  var number1 = pageNum + 1;
3343
3358
  setPageNum(function(pageNum) {
3344
3359
  return pageNum + 1;
3345
3360
  });
3346
3361
  listTimer.current = setTimeout(function() {
3347
- console.log("下拉加载下一页", number1);
3348
3362
  getHistoryMessage(number1, 2);
3349
3363
  }, 1000);
3350
3364
  }
@@ -3563,17 +3577,19 @@ var CustomerService = function(props) {
3563
3577
  setCitationContent({});
3564
3578
  http.post("".concat(urllocation, "/chat-service/public/v1.0/history-messages"), obj).then(function(res) {
3565
3579
  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
- });
3580
+ if (pageNumHistory <= 1) {
3581
+ setHistoryMessageList(function(historyMessageList) {
3582
+ var newHistoryMessageList = historyMessageList.concat(_object_spread_props(_object_spread({}, obj), {
3583
+ id: res.data.id,
3584
+ upvoted: false,
3585
+ downvoted: false,
3586
+ quotedMessage: "",
3587
+ createdAt: getDataTime(-1),
3588
+ extraInfo: JSON.stringify(obj.extraInfos)
3589
+ }));
3590
+ return newHistoryMessageList;
3591
+ });
3592
+ }
3577
3593
  scrollToBottom();
3578
3594
  if (type == 4) {
3579
3595
  sendGreetingMessage(6);
@@ -3686,21 +3702,23 @@ var CustomerService = function(props) {
3686
3702
  } else if (userData.modules.some(function(item) {
3687
3703
  return item.short == "AIservice";
3688
3704
  })) {
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([])
3705
+ if (pageNumHistory <= 1) {
3706
+ setHistoryMessageList(function(historyMessageList) {
3707
+ var newHistoryMessageList = historyMessageList.concat({
3708
+ roomId: roomId,
3709
+ sender: mid,
3710
+ recevier: "AI",
3711
+ message: keyWord,
3712
+ quotedMessage: citationContent.content,
3713
+ id: "654321",
3714
+ upvoted: false,
3715
+ downvoted: false,
3716
+ createdAt: getDataTime(-1),
3717
+ extraInfo: JSON.stringify([])
3718
+ });
3719
+ return newHistoryMessageList;
3701
3720
  });
3702
- return newHistoryMessageList;
3703
- });
3721
+ }
3704
3722
  setFinished(false);
3705
3723
  aiSendQuestions(3, {
3706
3724
  //相关数据
@@ -3718,32 +3736,36 @@ var CustomerService = function(props) {
3718
3736
  };
3719
3737
  //向知识库发送问题 或答案 type:1 发送问题 2 接受答案
3720
3738
  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();
3739
+ if (pageNumHistory <= 1) {
3740
+ setHistoryMessageList(function(historyMessageList) {
3741
+ var newHistoryMessageList = historyMessageList.concat(_object_spread_props(_object_spread({}, obj), {
3742
+ id: null,
3743
+ upvoted: false,
3744
+ downvoted: false,
3745
+ createdAt: getDataTime(-1),
3746
+ extraInfo: JSON.stringify(obj.extraInfos)
3747
+ }));
3748
+ return newHistoryMessageList;
3749
+ });
3750
+ scrollToBottom();
3751
+ }
3732
3752
  http.post("".concat(urllocation, "/chat-service/public/v1.0/history-messages"), obj).then(function(res) {
3733
3753
  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
- }
3754
+ if (pageNumHistory <= 1) {
3755
+ //更新聊天记录id
3756
+ setHistoryMessageList(function(historyMessageList) {
3757
+ var newHistoryMessageList = historyMessageList.map(function(item) {
3758
+ if (item.id == null) {
3759
+ return _object_spread_props(_object_spread({}, item), {
3760
+ id: res.data.id
3761
+ });
3762
+ } else {
3763
+ return item;
3764
+ }
3765
+ });
3766
+ return newHistoryMessageList;
3744
3767
  });
3745
- return newHistoryMessageList;
3746
- });
3768
+ }
3747
3769
  }
3748
3770
  if (type == 1) {
3749
3771
  //发送答案,调用自动回答
@@ -3808,39 +3830,42 @@ var CustomerService = function(props) {
3808
3830
  setTimeout(function() {
3809
3831
  setQuestionsList([]);
3810
3832
  }, 2000);
3833
+ // console.log(pageNumHistory,44444444444444);
3811
3834
  //占位信息
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);
3835
+ if (pageNumHistory <= 1) {
3836
+ setHistoryMessageList(function(historyMessageList) {
3837
+ if (type == 2) {
3838
+ return historyMessageList.map(function(item) {
3839
+ if (item.id == id) {
3840
+ return {
3841
+ roomId: roomId,
3842
+ sender: "AI",
3843
+ recevier: mid,
3844
+ message: "正在输入...",
3845
+ id: "123456",
3846
+ createdAt: getDataTime(-1),
3847
+ extraInfo: null
3848
+ };
3849
+ } else {
3850
+ return item;
3851
+ }
3852
+ });
3853
+ } else {
3854
+ return historyMessageList.concat({
3855
+ roomId: roomId,
3856
+ sender: "AI",
3857
+ recevier: mid,
3858
+ message: "正在输入...",
3859
+ id: "123456",
3860
+ createdAt: getDataTime(-1),
3861
+ extraInfo: null
3862
+ });
3863
+ }
3864
+ });
3865
+ setTimeout(function() {
3866
+ scrollToBottom();
3867
+ }, 10);
3868
+ }
3844
3869
  //使用fetchEventSource接收数据
3845
3870
  fetchEventSource("".concat(urllocation, "/chat-service/public/v1.0/chat-with-ai/messages"), {
3846
3871
  method: "POST",
@@ -3959,7 +3984,9 @@ var CustomerService = function(props) {
3959
3984
  };
3960
3985
  //渲染AI回答
3961
3986
  var renderAiAnswer = function(msg, message_id, type) {
3987
+ // console.log(pageNumHistory,5555555);
3962
3988
  // console.log(aiSendQuestions().abort(),'slkdsdsdsd')
3989
+ if (pageNumHistory > 1) return;
3963
3990
  var obj = msg;
3964
3991
  var id = msg.messageId;
3965
3992
  setHistoryMessageList(function(historyMessageList) {
@@ -4011,9 +4038,9 @@ var CustomerService = function(props) {
4011
4038
  return newHistoryMessageList2;
4012
4039
  }
4013
4040
  });
4014
- // setTimeout(() => {
4015
- scrollToBottom();
4016
- // }, 10);
4041
+ setTimeout(function() {
4042
+ scrollToBottom();
4043
+ }, 10);
4017
4044
  };
4018
4045
  //问题记录到实验报告中
4019
4046
  var testLabQuestion = function(title, content, teachId) {
@@ -4059,7 +4086,7 @@ var CustomerService = function(props) {
4059
4086
  };
4060
4087
  //获取历史消息 flag:1,历史记录点击定位,2,代表是上拉加载,3,存在新的消息-->老师回答等,4,下拉加载,滚动到底部时,主要用于查看历史记录
4061
4088
  var getHistoryMessage = function(pageNum, flag) {
4062
- var id = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "1";
4089
+ var id = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "1", raw_data = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : [];
4063
4090
  clearTimeout(roomMessage.current);
4064
4091
  // console.log(pageNum,flag,'dkfjvndfjvndfkvdf')
4065
4092
  // flag == 1 时已经设置好了位置标记
@@ -4076,10 +4103,11 @@ var CustomerService = function(props) {
4076
4103
  }
4077
4104
  var rid = flag == 3 ? id : roomId;
4078
4105
  if (rid == "") return;
4106
+ var page = pageNum ? pageNum : 1;
4079
4107
  return http.get("".concat(urllocation, "/chat-service/public/v1.0/history-messages"), {
4080
4108
  params: {
4081
4109
  roomId: rid,
4082
- page: pageNum ? pageNum : 1,
4110
+ page: page,
4083
4111
  maxPageSize: 30,
4084
4112
  direction: "desc"
4085
4113
  }
@@ -4091,6 +4119,13 @@ var CustomerService = function(props) {
4091
4119
  var total = res.data.total;
4092
4120
  var maxPageSize = 30;
4093
4121
  var dataList = res.data.messages.reverse();
4122
+ //历史记录点击进来的,多加载一页,防止定位不准
4123
+ if (flag == 1 && page > 1) {
4124
+ var markPage = page - 1;
4125
+ setPageNumHistory(markPage);
4126
+ getHistoryMessage(page - 1, 5, "1", dataList);
4127
+ return;
4128
+ }
4094
4129
  setPageCount(Math.ceil(total / maxPageSize));
4095
4130
  var newHistoryMessageList = [];
4096
4131
  setHistoryMessageList(function(historyMessageList) {
@@ -4099,6 +4134,9 @@ var CustomerService = function(props) {
4099
4134
  if (flag == 1) {
4100
4135
  newHistoryMessageList = dataList;
4101
4136
  }
4137
+ if (flag == 5) {
4138
+ newHistoryMessageList = raw_data.concat(dataList);
4139
+ }
4102
4140
  if (flag == 4) {
4103
4141
  newHistoryMessageList = historyMessageList.concat(dataList); //下拉加载,向后追加内容
4104
4142
  }
@@ -4120,6 +4158,7 @@ var CustomerService = function(props) {
4120
4158
  totalNumber = newHistoryMessageList.length;
4121
4159
  return newHistoryMessageList;
4122
4160
  });
4161
+ // console.log(lastId,'lastIdlastId-------')
4123
4162
  //如果在跟老师的聊天窗口,用于找到与老师的最新的聊天,并不在与老师对话的窗口中,并聊天窗口相同
4124
4163
  try {
4125
4164
  if (stepIds != undefined && stepIds != "" && (showType == 3 || showType == 4)) {
@@ -4201,6 +4240,7 @@ var CustomerService = function(props) {
4201
4240
  if (!lastId && originList != newList) {
4202
4241
  setTimeout(function() {
4203
4242
  scrollToBottom();
4243
+ readMessage(roomId, urllocation, userData, http);
4204
4244
  }, 100);
4205
4245
  }
4206
4246
  }
@@ -4452,13 +4492,12 @@ var CustomerService = function(props) {
4452
4492
  container.scrollTop = 60;
4453
4493
  try {
4454
4494
  setTimeout(function() {
4455
- // let top2 =
4495
+ var top = showType == 1 || showType == 3 ? $("#li_flag").offset().top - 20 : $("#chat_content_modal #li_flag").offset().top - $("#chat_content_modal").offset().top + 24;
4496
+ // let top =
4456
4497
  // showType == 1 || showType == 3
4457
- // ? $("#li_flag").offset().top - 20
4498
+ // ? $("#li_flag").offset().top
4458
4499
  // : $("#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;
4500
+ // $("#chat_content_modal").offset().top;
4462
4501
  // console.log(top2,top,444444444444)
4463
4502
  $("#".concat(showType == 1 || showType == 3 ? "chat_content" : "chat_content_modal")).animate({
4464
4503
  scrollTop: top
@@ -5339,7 +5378,7 @@ var CustomerService = function(props) {
5339
5378
  var placeholder = "";
5340
5379
  var disabled = false;
5341
5380
  if (voiceRecordingStatus == 2) {
5342
- placeholder = "语音录制中,请说话...";
5381
+ placeholder = "正在录制语音,再次点击麦克风结束录制。";
5343
5382
  } else if (voiceRecordingStatus == 1) {
5344
5383
  placeholder = "正在语音识别文字,请稍后...";
5345
5384
  } else if (!finished) {
@@ -5413,9 +5452,15 @@ var CustomerService = function(props) {
5413
5452
  if (roomList.length > 0 && roomList[0].roomId != roomId) {
5414
5453
  sendToTeacher(2);
5415
5454
  } else {
5416
- setAnswerMode(-1);
5455
+ clearTimeout(timer.current);
5417
5456
  setQuestionsList([]);
5457
+ setAnswerMode(-1);
5418
5458
  setTeacherList([]);
5459
+ setHistoryMessageList(function(historyMessageList) {
5460
+ return historyMessageList.filter(function(item) {
5461
+ return item.id != "-1";
5462
+ });
5463
+ });
5419
5464
  sendMessage("", 0);
5420
5465
  }
5421
5466
  setButtomHei(45);
@@ -5516,6 +5561,15 @@ var CustomerService = function(props) {
5516
5561
  if (roomList.length > 0 && roomList[0].roomId != roomId) {
5517
5562
  sendToTeacher(2);
5518
5563
  } else {
5564
+ clearTimeout(timer.current);
5565
+ setQuestionsList([]);
5566
+ setAnswerMode(-1);
5567
+ setTeacherList([]);
5568
+ setHistoryMessageList(function(historyMessageList) {
5569
+ return historyMessageList.filter(function(item) {
5570
+ return item.id != "-1";
5571
+ });
5572
+ });
5519
5573
  sendMessage("", 0);
5520
5574
  }
5521
5575
  onEvent(serverName + serverUrl(), "click_智能问答_ Enter", "提交");
@@ -5564,9 +5618,19 @@ var CustomerService = function(props) {
5564
5618
  bottom: "".concat(buttomHei + 14, "px")
5565
5619
  },
5566
5620
  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
- });
5621
+ var reg = /[`~!@#$%^&*()_\-+=<>?:"{}|,.\/;'\\[\]·~!@#¥%……&*()——\-+={}|《》?:“”【】、;‘’,。、]/im;
5622
+ var span = "";
5623
+ //搜索内容是否有特殊字符
5624
+ if (reg.test(keyWord)) {
5625
+ span = item.name.replaceAll(keyWord, function(e) {
5626
+ return "<span class=".concat(styles.sign, ">").concat(e, "</span>");
5627
+ });
5628
+ } else {
5629
+ span = item.name.replaceAll(new RegExp(keyWord, "ig"), function(i) {
5630
+ // console.log(i,'skdcnsdjk')
5631
+ return "<span class=".concat(styles.sign, ">").concat(i, "</span>");
5632
+ });
5633
+ }
5570
5634
  return /*#__PURE__*/ jsx("p", {
5571
5635
  className: styles.item,
5572
5636
  children: /*#__PURE__*/ jsx("span", {
@@ -5587,9 +5651,19 @@ var CustomerService = function(props) {
5587
5651
  bottom: "".concat(buttomHei + 6, "px")
5588
5652
  },
5589
5653
  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
- });
5654
+ var reg = /[`~!@#$%^&*()_\-+=<>?:"{}|,.\/;'\\[\]·~!@#¥%……&*()——\-+={}|《》?:“”【】、;‘’,。、]/im;
5655
+ var span = "";
5656
+ //搜索内容是否有特殊字符
5657
+ if (reg.test(keyWord)) {
5658
+ span = item.question.replaceAll(keyWord, function(e) {
5659
+ return "<span class=".concat(styles.sign, ">").concat(e, "</span>");
5660
+ });
5661
+ } else {
5662
+ span = item.question.replaceAll(new RegExp(keyWord, "ig"), function(i) {
5663
+ // console.log(i,'skdcnsdjk')
5664
+ return "<span class=".concat(styles.sign, ">").concat(i, "</span>");
5665
+ });
5666
+ }
5593
5667
  return /*#__PURE__*/ jsx("p", {
5594
5668
  className: styles.item,
5595
5669
  children: /*#__PURE__*/ jsx("span", {
@@ -5609,25 +5683,26 @@ var CustomerService = function(props) {
5609
5683
  };
5610
5684
  //加载指定数据,点击历史记录
5611
5685
  var loadSpecifiedData = function(renewRoomId, page, id, receiver) {
5686
+ // let renewRoomId = '4a615d7126b343f78d10dcb06dbc29b0';
5687
+ // let page = 1;
5688
+ // let id = '0e459f0a3a62438698f170b42b94d150';
5689
+ // let receiver = mid;
5612
5690
  if (page != 1) {
5613
5691
  setPageNumHistory(page);
5614
5692
  }
5615
- setPageNum(page);
5616
5693
  setLastId(id); //用于定位
5694
+ setPageNum(page);
5617
5695
  //如果是当前聊天室
5618
5696
  if (renewRoomId == roomId) {
5619
5697
  getHistoryMessage(page, 1);
5620
5698
  } else {
5621
5699
  setRoomId(renewRoomId);
5622
- // if (childRef.current) {
5623
5700
  if (receiver != mid) {
5624
5701
  createRooms(receiver);
5625
5702
  }
5626
5703
  setTimeout(function() {
5627
- // childRef.current.roomsListTimer();
5628
5704
  roomsListTimer();
5629
5705
  }, 500);
5630
- // }
5631
5706
  }
5632
5707
  setShowContacts(true);
5633
5708
  };