bhd-components 0.6.9 → 0.7.1

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.
@@ -111,7 +111,7 @@ var HistoryFun = function(props) {
111
111
  pageNumber = 1;
112
112
  }
113
113
  console.log(roomId, pageNumber, id, receiver, "第几页第几页第几页第几页第几页第几页");
114
- loadSpecifiedData(roomId, pageNumber, id, receiver);
114
+ loadSpecifiedData(roomId, pageNumber, id, receiver, keyWordProblem);
115
115
  onClose();
116
116
  setKeyWordProblem("");
117
117
  setTotalData([]);
@@ -378,7 +378,7 @@ var HistoryFun = function(props) {
378
378
  return /*#__PURE__*/ _jsxs(_Fragment, {
379
379
  children: [
380
380
  /*#__PURE__*/ _jsxs("div", {
381
- className: styles.list_summary,
381
+ className: "".concat(styles.list_summary, " ").concat(item.show ? styles.list_summary_active : ""),
382
382
  id: item.roomId,
383
383
  onClick: function() {
384
384
  if (item.count == 1) {
@@ -55,6 +55,7 @@ var CustomerService = function(props) {
55
55
  // const [roomList,setRoomList] = useState([]);//聊天列表
56
56
  var _useState25 = _sliced_to_array(useState([]), 2), contactsList = _useState25[0], setContactsList = _useState25[1]; //老师列表
57
57
  var _useState26 = _sliced_to_array(useState([]), 2), chatObj = _useState26[0], setChatObj = _useState26[1]; //聊天记录id保存,用来在实验报告中记录
58
+ var _useState27 = _sliced_to_array(useState(""), 2), keyWordProblem = _useState27[0], setKeyWordProblem = _useState27[1]; //历史记录搜索的内容
58
59
  var timer = useRef(null); //文本框输入时
59
60
  var receiveMessageTimer = useRef(null); //接收ai发回的消息
60
61
  var voiceCountdownTimer = useRef(null); //语音录制倒计时
@@ -254,28 +255,48 @@ var CustomerService = function(props) {
254
255
  var questionsList = [];
255
256
  var obj = {};
256
257
  if (type == 1) {
257
- questionsList = hotQuestionsList.map(function(item, index) {
258
- if (index < 3) {
259
- return {
260
- key: "messageSource",
261
- value: item.id,
262
- question: item.question,
263
- answer: item.answer
264
- };
265
- } else {
266
- return null;
267
- }
268
- });
269
- questionsList = questionsList.filter(function(i) {
270
- return i != null;
271
- });
258
+ // questionsList = hotQuestionsList.map((item, index) => {
259
+ // if (index < 3) {
260
+ // return {
261
+ // key: "messageSource",
262
+ // value: item.id,
263
+ // question: item.question,
264
+ // answer: item.answer,
265
+ // };
266
+ // } else {
267
+ // return null;
268
+ // }
269
+ // });
270
+ // questionsList = questionsList.filter((i) => i != null);
272
271
  obj = {
273
272
  roomId: roomId,
274
273
  sender: "AI",
275
274
  recevier: mid,
276
- message: "Hi!我是有问必答的实训云智能客服,请问您遇到了什么问题?",
277
- extraInfos: questionsList
275
+ message: "Hi!我是有问必答的实训云智能客服,请问您遇到了什么问题?"
278
276
  };
277
+ if (pageNumHistory <= 1) {
278
+ setHistoryMessageList(function(historyMessageList) {
279
+ var newHistoryMessageList = historyMessageList.concat(_object_spread_props(_object_spread({}, obj), {
280
+ id: "p" + new Date().getTime(),
281
+ upvoted: false,
282
+ downvoted: false,
283
+ quotedMessage: "",
284
+ createdAt: getDataTime(-1),
285
+ // extraInfo: JSON.stringify(obj.extraInfos),
286
+ extraInfo: JSON.stringify([
287
+ {
288
+ key: "messageSource",
289
+ value: "knowledgebase"
290
+ }
291
+ ])
292
+ }));
293
+ return newHistoryMessageList;
294
+ });
295
+ setTimeout(function() {
296
+ scrollToBottom();
297
+ }, 100);
298
+ }
299
+ return;
279
300
  } else if (type == 2) {
280
301
  obj = {
281
302
  roomId: roomId,
@@ -350,6 +371,24 @@ var CustomerService = function(props) {
350
371
  message: "猜你想问:",
351
372
  extraInfos: questionsList
352
373
  };
374
+ if (pageNumHistory <= 1) {
375
+ setHistoryMessageList(function(historyMessageList) {
376
+ var newHistoryMessageList = historyMessageList.concat(_object_spread_props(_object_spread({}, obj), {
377
+ id: "p" + new Date().getTime(),
378
+ upvoted: false,
379
+ downvoted: false,
380
+ quotedMessage: "",
381
+ createdAt: getDataTime(-1),
382
+ extraInfo: JSON.stringify(obj.extraInfos)
383
+ }));
384
+ return newHistoryMessageList;
385
+ });
386
+ setTimeout(function() {
387
+ scrollToBottom();
388
+ }, 100);
389
+ }
390
+ console.log("不记录1111111");
391
+ return;
353
392
  }
354
393
  setKeyWord("");
355
394
  setQuestionsList([]);
@@ -888,7 +927,6 @@ var CustomerService = function(props) {
888
927
  last_id = historyMessageList[0].id;
889
928
  }
890
929
  if (flag != 1 && last_id != "") {
891
- console.log(last_id, "dkfjvndfjvndfkvdflast_idlast_idlast_id");
892
930
  setLastId(last_id);
893
931
  }
894
932
  //取消搜索页码标记
@@ -973,6 +1011,11 @@ var CustomerService = function(props) {
973
1011
  if (problem != undefined && problem.user != undefined && problem.question != undefined) {
974
1012
  sendToTeacher(1);
975
1013
  }
1014
+ // if(flag == 1){
1015
+ setTimeout(function() {
1016
+ setKeyWordProblem("");
1017
+ }, 3100);
1018
+ // }
976
1019
  } else {
977
1020
  setPageCount(0);
978
1021
  setGreetingMessage(true);
@@ -1550,6 +1593,16 @@ var CustomerService = function(props) {
1550
1593
  }
1551
1594
  }
1552
1595
  var dataTime = time;
1596
+ if (lastId == item.id && keyWordProblem != "") {
1597
+ message = remarkable.render(message);
1598
+ console.log(message, 444444);
1599
+ message = message.replaceAll(keyWordProblem, function(e) {
1600
+ return "<span class=".concat(styles.sign, ">").concat(e, "</span>");
1601
+ });
1602
+ console.log(message, 55555);
1603
+ } else {
1604
+ message = remarkable.render(message);
1605
+ }
1553
1606
  if (item.sender == mid) {
1554
1607
  //只有引用和复制功能
1555
1608
  li = /*#__PURE__*/ _jsxs(_Fragment, {
@@ -1622,7 +1675,7 @@ var CustomerService = function(props) {
1622
1675
  className: styles.content,
1623
1676
  children: /*#__PURE__*/ _jsx("p", {
1624
1677
  dangerouslySetInnerHTML: {
1625
- __html: remarkable.render(message)
1678
+ __html: message
1626
1679
  },
1627
1680
  className: styles.content_child
1628
1681
  })
@@ -1721,7 +1774,7 @@ var CustomerService = function(props) {
1721
1774
  children: [
1722
1775
  /*#__PURE__*/ _jsx("p", {
1723
1776
  dangerouslySetInnerHTML: {
1724
- __html: remarkable.render(message)
1777
+ __html: message
1725
1778
  },
1726
1779
  className: styles.content_child
1727
1780
  }),
@@ -2488,11 +2541,14 @@ var CustomerService = function(props) {
2488
2541
  }
2489
2542
  };
2490
2543
  //加载指定数据,点击历史记录
2491
- var loadSpecifiedData = function(renewRoomId, page, id, receiver) {
2544
+ var loadSpecifiedData = function(renewRoomId, page, id, receiver, keyWordProblem) {
2492
2545
  // let renewRoomId = '4a615d7126b343f78d10dcb06dbc29b0';
2493
2546
  // let page = 1;
2494
2547
  // let id = '0e459f0a3a62438698f170b42b94d150';
2495
2548
  // let receiver = mid;
2549
+ if (keyWordProblem != "") {
2550
+ setKeyWordProblem(keyWordProblem);
2551
+ }
2496
2552
  if (page != 1) {
2497
2553
  setPageNumHistory(page);
2498
2554
  }
@@ -2556,6 +2612,9 @@ var CustomerService = function(props) {
2556
2612
  style: {
2557
2613
  maxHeight: "calc(100vh-".concat(buttomHei + 48, "px)")
2558
2614
  },
2615
+ onClick: function() {
2616
+ setKeyWordProblem("");
2617
+ },
2559
2618
  children: [
2560
2619
  loading ? /*#__PURE__*/ _jsx("div", {
2561
2620
  className: styles.loading,
@@ -2564,7 +2623,7 @@ var CustomerService = function(props) {
2564
2623
  alt: ""
2565
2624
  })
2566
2625
  }) : "",
2567
- renderQuestion(),
2626
+ keyWordProblem ? renderQuestion() : renderQuestion(),
2568
2627
  bottomLoading ? /*#__PURE__*/ _jsx("div", {
2569
2628
  className: styles.loading,
2570
2629
  children: /*#__PURE__*/ _jsx("img", {
@@ -2620,6 +2679,9 @@ var CustomerService = function(props) {
2620
2679
  }),
2621
2680
  /*#__PURE__*/ _jsxs("div", {
2622
2681
  className: "".concat(styles.Drawer_wrap_main),
2682
+ onClick: function() {
2683
+ setKeyWordProblem("");
2684
+ },
2623
2685
  children: [
2624
2686
  /*#__PURE__*/ _jsxs("div", {
2625
2687
  className: "".concat(styles.Drawer_main, " ChatWindow_Modal_history_list"),
@@ -2652,7 +2714,7 @@ var CustomerService = function(props) {
2652
2714
  alt: ""
2653
2715
  })
2654
2716
  }) : "",
2655
- renderQuestion()
2717
+ keyWordProblem ? renderQuestion() : renderQuestion()
2656
2718
  ]
2657
2719
  })
2658
2720
  ]
@@ -2686,6 +2748,9 @@ var CustomerService = function(props) {
2686
2748
  showType == 3 ? /*#__PURE__*/ _jsxs("div", {
2687
2749
  className: "".concat(styles.ChatWindow_Drawer),
2688
2750
  id: "",
2751
+ onClick: function() {
2752
+ setKeyWordProblem("");
2753
+ },
2689
2754
  children: [
2690
2755
  /*#__PURE__*/ _jsx("div", {
2691
2756
  className: "".concat(styles.header_wrap, " ").concat(styles.header_wrap_newlabo),
@@ -2746,7 +2811,7 @@ var CustomerService = function(props) {
2746
2811
  alt: ""
2747
2812
  })
2748
2813
  }) : "",
2749
- renderQuestion()
2814
+ keyWordProblem ? renderQuestion() : renderQuestion()
2750
2815
  ]
2751
2816
  }),
2752
2817
  /*#__PURE__*/ _jsxs("div", {
@@ -2823,6 +2888,9 @@ var CustomerService = function(props) {
2823
2888
  style: {
2824
2889
  maxHeight: "".concat(window.innerHeight - 148 - buttomHei, "px")
2825
2890
  },
2891
+ onClick: function() {
2892
+ setKeyWordProblem("");
2893
+ },
2826
2894
  children: [
2827
2895
  /*#__PURE__*/ _jsx(ContactsList, {
2828
2896
  type: 4,
@@ -2848,7 +2916,7 @@ var CustomerService = function(props) {
2848
2916
  alt: ""
2849
2917
  })
2850
2918
  }) : "",
2851
- renderQuestion()
2919
+ keyWordProblem ? renderQuestion() : renderQuestion()
2852
2920
  ]
2853
2921
  })
2854
2922
  ]
@@ -2940,7 +3008,7 @@ var CustomerService = function(props) {
2940
3008
  alt: ""
2941
3009
  })
2942
3010
  }) : "",
2943
- renderQuestion()
3011
+ keyWordProblem ? renderQuestion() : renderQuestion()
2944
3012
  ]
2945
3013
  }),
2946
3014
  /*#__PURE__*/ _jsxs("div", {
@@ -1,7 +1,6 @@
1
1
  @import "../theme/variable.less";
2
- // @color-data-visualization-01: @color-background-info-base;
3
- // @color-text-primary: @color-background-info-base;
4
- // @color-background-primary-weak-hover:@color-background-info-weak;
2
+
3
+ // @import "../common.module.less"
5
4
 
6
5
  .service_ChatWindow_Drawer,
7
6
  .ChatWindow_Modal {
@@ -187,6 +186,7 @@
187
186
  .main_content_flag{
188
187
  width: 100%;
189
188
  }
189
+
190
190
  .main_content_flag:hover{
191
191
  .operate_modal {
192
192
  // display: block;
@@ -245,6 +245,10 @@
245
245
  margin: 4px 0;
246
246
  }
247
247
  }
248
+ .sign{
249
+ background-color: #1890ff;
250
+ color: #fff;
251
+ }
248
252
  }
249
253
  .operate_modal {
250
254
  // display: none;
@@ -1189,6 +1193,10 @@
1189
1193
  display: flex;
1190
1194
  align-items: center;
1191
1195
  border-bottom: 1px solid @color-border-secondary;
1196
+ cursor: pointer;
1197
+ &:hover{
1198
+ background-color: #EBEBEB;
1199
+ }
1192
1200
  .head_img{
1193
1201
  width: 36px;
1194
1202
  height: 36px;
@@ -1244,6 +1252,12 @@
1244
1252
  }
1245
1253
  }
1246
1254
  }
1255
+ .list_summary_active{
1256
+ background-color: @color-background-primary-weak;
1257
+ &:hover{
1258
+ background-color: @color-background-primary-weak;
1259
+ }
1260
+ }
1247
1261
 
1248
1262
  //详情
1249
1263
  .list_detail{
@@ -1274,11 +1288,10 @@
1274
1288
  display: flex;
1275
1289
  justify-content: space-between;
1276
1290
  align-items: center;
1277
- margin-bottom: 9px;
1291
+ margin-bottom: 4px;
1278
1292
  p {
1279
- color: @color-text-Tr;
1280
- font-size: 16px;
1281
- font-weight: 600;
1293
+ color: @color-text-Secondary-Tr;
1294
+ font-size: 14px;
1282
1295
  line-height: 1.5;
1283
1296
  }
1284
1297
  .time {
@@ -1293,12 +1306,12 @@
1293
1306
  line-height: 150%;
1294
1307
  overflow: hidden;
1295
1308
  text-overflow: ellipsis;
1296
- -webkit-box-orient: vertical;
1297
- -webkit-line-clamp: 2;
1298
- display: -webkit-box;
1309
+ // -webkit-box-orient: vertical;
1310
+ // -webkit-line-clamp: 2;
1311
+ // display: -webkit-box;
1299
1312
 
1300
- max-height: 40px;
1301
- word-break: break-all;
1313
+ max-height: 21px;
1314
+ white-space: nowrap;
1302
1315
  span {
1303
1316
  color: @color-text-primary;
1304
1317
  }