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.
@@ -110,7 +110,7 @@ const HistoryFun = (props)=>{
110
110
  pageNumber = 1;
111
111
  }
112
112
  console.log(roomId, pageNumber, id, receiver, "第几页第几页第几页第几页第几页第几页");
113
- loadSpecifiedData(roomId, pageNumber, id, receiver);
113
+ loadSpecifiedData(roomId, pageNumber, id, receiver, keyWordProblem);
114
114
  onClose();
115
115
  setKeyWordProblem("");
116
116
  setTotalData([]);
@@ -373,7 +373,7 @@ const HistoryFun = (props)=>{
373
373
  return /*#__PURE__*/ _jsxs(_Fragment, {
374
374
  children: [
375
375
  /*#__PURE__*/ _jsxs("div", {
376
- className: styles.list_summary,
376
+ className: `${styles.list_summary} ${item.show ? styles.list_summary_active : ""}`,
377
377
  id: item.roomId,
378
378
  onClick: ()=>{
379
379
  if (item.count == 1) {
@@ -54,6 +54,7 @@ const CustomerService = (props)=>{
54
54
  // const [roomList,setRoomList] = useState([]);//聊天列表
55
55
  const [contactsList, setContactsList] = useState([]); //老师列表
56
56
  const [chatObj, setChatObj] = useState([]); //聊天记录id保存,用来在实验报告中记录
57
+ const [keyWordProblem, setKeyWordProblem] = useState(""); //历史记录搜索的内容
57
58
  const timer = useRef(null); //文本框输入时
58
59
  let receiveMessageTimer = useRef(null); //接收ai发回的消息
59
60
  let voiceCountdownTimer = useRef(null); //语音录制倒计时
@@ -253,26 +254,48 @@ const CustomerService = (props)=>{
253
254
  let questionsList = [];
254
255
  let obj = {};
255
256
  if (type == 1) {
256
- questionsList = hotQuestionsList.map((item, index)=>{
257
- if (index < 3) {
258
- return {
259
- key: "messageSource",
260
- value: item.id,
261
- question: item.question,
262
- answer: item.answer
263
- };
264
- } else {
265
- return null;
266
- }
267
- });
268
- questionsList = questionsList.filter((i)=>i != null);
257
+ // questionsList = hotQuestionsList.map((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((i) => i != null);
269
270
  obj = {
270
271
  roomId: roomId,
271
272
  sender: "AI",
272
273
  recevier: mid,
273
- message: `Hi!我是有问必答的实训云智能客服,请问您遇到了什么问题?`,
274
- extraInfos: questionsList
274
+ message: `Hi!我是有问必答的实训云智能客服,请问您遇到了什么问题?`
275
275
  };
276
+ if (pageNumHistory <= 1) {
277
+ setHistoryMessageList((historyMessageList)=>{
278
+ let newHistoryMessageList = historyMessageList.concat(_object_spread_props(_object_spread({}, obj), {
279
+ id: 'p' + new Date().getTime(),
280
+ upvoted: false,
281
+ downvoted: false,
282
+ quotedMessage: "",
283
+ createdAt: getDataTime(-1),
284
+ // extraInfo: JSON.stringify(obj.extraInfos),
285
+ extraInfo: JSON.stringify([
286
+ {
287
+ key: "messageSource",
288
+ value: "knowledgebase"
289
+ }
290
+ ])
291
+ }));
292
+ return newHistoryMessageList;
293
+ });
294
+ setTimeout(()=>{
295
+ scrollToBottom();
296
+ }, 100);
297
+ }
298
+ return;
276
299
  } else if (type == 2) {
277
300
  obj = {
278
301
  roomId: roomId,
@@ -347,6 +370,24 @@ const CustomerService = (props)=>{
347
370
  message: `猜你想问:`,
348
371
  extraInfos: questionsList
349
372
  };
373
+ if (pageNumHistory <= 1) {
374
+ setHistoryMessageList((historyMessageList)=>{
375
+ let newHistoryMessageList = historyMessageList.concat(_object_spread_props(_object_spread({}, obj), {
376
+ id: 'p' + new Date().getTime(),
377
+ upvoted: false,
378
+ downvoted: false,
379
+ quotedMessage: "",
380
+ createdAt: getDataTime(-1),
381
+ extraInfo: JSON.stringify(obj.extraInfos)
382
+ }));
383
+ return newHistoryMessageList;
384
+ });
385
+ setTimeout(()=>{
386
+ scrollToBottom();
387
+ }, 100);
388
+ }
389
+ console.log('不记录1111111');
390
+ return;
350
391
  }
351
392
  setKeyWord("");
352
393
  setQuestionsList([]);
@@ -866,7 +907,6 @@ const CustomerService = (props)=>{
866
907
  last_id = historyMessageList[0].id;
867
908
  }
868
909
  if (flag != 1 && last_id != "") {
869
- console.log(last_id, 'dkfjvndfjvndfkvdflast_idlast_idlast_id');
870
910
  setLastId(last_id);
871
911
  }
872
912
  //取消搜索页码标记
@@ -949,6 +989,11 @@ const CustomerService = (props)=>{
949
989
  if (problem != undefined && problem.user != undefined && problem.question != undefined) {
950
990
  sendToTeacher(1);
951
991
  }
992
+ // if(flag == 1){
993
+ setTimeout(()=>{
994
+ setKeyWordProblem('');
995
+ }, 3100);
996
+ // }
952
997
  } else {
953
998
  setPageCount(0);
954
999
  setGreetingMessage(true);
@@ -1506,6 +1551,16 @@ const CustomerService = (props)=>{
1506
1551
  }
1507
1552
  }
1508
1553
  let dataTime = time;
1554
+ if (lastId == item.id && keyWordProblem != '') {
1555
+ message = remarkable.render(message);
1556
+ console.log(message, 444444);
1557
+ message = message.replaceAll(keyWordProblem, (e)=>{
1558
+ return `<span class=${styles.sign}>${e}</span>`;
1559
+ });
1560
+ console.log(message, 55555);
1561
+ } else {
1562
+ message = remarkable.render(message);
1563
+ }
1509
1564
  if (item.sender == mid) {
1510
1565
  //只有引用和复制功能
1511
1566
  li = /*#__PURE__*/ _jsxs(_Fragment, {
@@ -1572,7 +1627,7 @@ const CustomerService = (props)=>{
1572
1627
  className: styles.content,
1573
1628
  children: /*#__PURE__*/ _jsx("p", {
1574
1629
  dangerouslySetInnerHTML: {
1575
- __html: remarkable.render(message)
1630
+ __html: message
1576
1631
  },
1577
1632
  className: styles.content_child
1578
1633
  })
@@ -1669,7 +1724,7 @@ const CustomerService = (props)=>{
1669
1724
  children: [
1670
1725
  /*#__PURE__*/ _jsx("p", {
1671
1726
  dangerouslySetInnerHTML: {
1672
- __html: remarkable.render(message)
1727
+ __html: message
1673
1728
  },
1674
1729
  className: styles.content_child
1675
1730
  }),
@@ -2398,11 +2453,14 @@ const CustomerService = (props)=>{
2398
2453
  }
2399
2454
  };
2400
2455
  //加载指定数据,点击历史记录
2401
- const loadSpecifiedData = (renewRoomId, page, id, receiver)=>{
2456
+ const loadSpecifiedData = (renewRoomId, page, id, receiver, keyWordProblem)=>{
2402
2457
  // let renewRoomId = '4a615d7126b343f78d10dcb06dbc29b0';
2403
2458
  // let page = 1;
2404
2459
  // let id = '0e459f0a3a62438698f170b42b94d150';
2405
2460
  // let receiver = mid;
2461
+ if (keyWordProblem != '') {
2462
+ setKeyWordProblem(keyWordProblem);
2463
+ }
2406
2464
  if (page != 1) {
2407
2465
  setPageNumHistory(page);
2408
2466
  }
@@ -2466,6 +2524,9 @@ const CustomerService = (props)=>{
2466
2524
  style: {
2467
2525
  maxHeight: `calc(100vh-${buttomHei + 48}px)`
2468
2526
  },
2527
+ onClick: ()=>{
2528
+ setKeyWordProblem('');
2529
+ },
2469
2530
  children: [
2470
2531
  loading ? /*#__PURE__*/ _jsx("div", {
2471
2532
  className: styles.loading,
@@ -2474,7 +2535,7 @@ const CustomerService = (props)=>{
2474
2535
  alt: ""
2475
2536
  })
2476
2537
  }) : "",
2477
- renderQuestion(),
2538
+ keyWordProblem ? renderQuestion() : renderQuestion(),
2478
2539
  bottomLoading ? /*#__PURE__*/ _jsx("div", {
2479
2540
  className: styles.loading,
2480
2541
  children: /*#__PURE__*/ _jsx("img", {
@@ -2530,6 +2591,9 @@ const CustomerService = (props)=>{
2530
2591
  }),
2531
2592
  /*#__PURE__*/ _jsxs("div", {
2532
2593
  className: `${styles.Drawer_wrap_main}`,
2594
+ onClick: ()=>{
2595
+ setKeyWordProblem('');
2596
+ },
2533
2597
  children: [
2534
2598
  /*#__PURE__*/ _jsxs("div", {
2535
2599
  className: `${styles.Drawer_main} ChatWindow_Modal_history_list`,
@@ -2562,7 +2626,7 @@ const CustomerService = (props)=>{
2562
2626
  alt: ""
2563
2627
  })
2564
2628
  }) : "",
2565
- renderQuestion()
2629
+ keyWordProblem ? renderQuestion() : renderQuestion()
2566
2630
  ]
2567
2631
  })
2568
2632
  ]
@@ -2596,6 +2660,9 @@ const CustomerService = (props)=>{
2596
2660
  showType == 3 ? /*#__PURE__*/ _jsxs("div", {
2597
2661
  className: `${styles.ChatWindow_Drawer}`,
2598
2662
  id: "",
2663
+ onClick: ()=>{
2664
+ setKeyWordProblem('');
2665
+ },
2599
2666
  children: [
2600
2667
  /*#__PURE__*/ _jsx("div", {
2601
2668
  className: `${styles.header_wrap} ${styles.header_wrap_newlabo}`,
@@ -2656,7 +2723,7 @@ const CustomerService = (props)=>{
2656
2723
  alt: ""
2657
2724
  })
2658
2725
  }) : "",
2659
- renderQuestion()
2726
+ keyWordProblem ? renderQuestion() : renderQuestion()
2660
2727
  ]
2661
2728
  }),
2662
2729
  /*#__PURE__*/ _jsxs("div", {
@@ -2733,6 +2800,9 @@ const CustomerService = (props)=>{
2733
2800
  style: {
2734
2801
  maxHeight: `${window.innerHeight - 148 - buttomHei}px`
2735
2802
  },
2803
+ onClick: ()=>{
2804
+ setKeyWordProblem('');
2805
+ },
2736
2806
  children: [
2737
2807
  /*#__PURE__*/ _jsx(ContactsList, {
2738
2808
  type: 4,
@@ -2758,7 +2828,7 @@ const CustomerService = (props)=>{
2758
2828
  alt: ""
2759
2829
  })
2760
2830
  }) : "",
2761
- renderQuestion()
2831
+ keyWordProblem ? renderQuestion() : renderQuestion()
2762
2832
  ]
2763
2833
  })
2764
2834
  ]
@@ -2850,7 +2920,7 @@ const CustomerService = (props)=>{
2850
2920
  alt: ""
2851
2921
  })
2852
2922
  }) : "",
2853
- renderQuestion()
2923
+ keyWordProblem ? renderQuestion() : renderQuestion()
2854
2924
  ]
2855
2925
  }),
2856
2926
  /*#__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
  }