bhd-components 0.7.17 → 0.7.19

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,6 +1,5 @@
1
1
  /// <reference types="react" />
2
2
  import "highlight.js/styles/default.css";
3
- import './html2canvas.test.js';
4
3
  interface Service {
5
4
  type: string;
6
5
  params: any;
@@ -23,7 +23,7 @@ import "highlight.js/styles/default.css";
23
23
  import { render } from "react-dom";
24
24
  import Provider from "../provider";
25
25
  const { TextArea } = Input;
26
- import "./html2canvas.test.js";
26
+ // import './html2canvas.test.js';
27
27
  import knowledge_icon from "./images/knowledge_icon.png";
28
28
  // import { useMediaRecorder } from "./useMediaRecorder"; //录音使用文件
29
29
  import { readMessage, getByteLen, serverUrl, copyText, getDataTime, getQuery, resetStyles, findParent, delegate } from "./function"; //一些方法
@@ -107,29 +107,23 @@ const CustomerService = (props)=>{
107
107
  if (showType == 5 || showScreenshot) {
108
108
  try {
109
109
  setImgBese64('');
110
- // html2canvas(document.getElementsByTagName('html')[0],{
111
- // // ignoreElements:(element)=>{
112
- // // if(element.compareDocumentPosition(dom)===2)return true
113
- // // return false
114
- // // }
115
- // }).then((canvas)=>{
116
- // console.log(canvas,22222);
117
- // setTimeout(()=>{
118
- let dom = document.getElementById(screenshotAreaId);
119
- html2canvas(dom, {
110
+ // let dom = document.getElementById(screenshotAreaId);
111
+ html2canvas(screenshotAreaId, {
120
112
  useCORS: true,
121
113
  // allowTaint: true, // 污染处理
122
- scale: 1
114
+ scale: 1,
115
+ // logging:true,
116
+ ignoreElements: (element)=>{
117
+ if (element.compareDocumentPosition(screenshotAreaId) === 2) return true;
118
+ return false;
119
+ }
123
120
  }).then(function(canvas) {
124
- // document.body.appendChild(canvas);
125
121
  // document.body.appendChild(canvas);
126
122
  console.log(canvas, 99999);
127
123
  // var base64URL = canvas.toDataURL('image/jpeg')
128
124
  let base64URL = canvas.toDataURL("image/jpg", 1.0);
129
125
  setImgBese64(base64URL);
130
126
  });
131
- // },100)
132
- // })
133
127
  } catch (error) {
134
128
  console.log(error);
135
129
  }
@@ -315,10 +309,10 @@ const CustomerService = (props)=>{
315
309
  let watchTime = params.videoProgress;
316
310
  let courseId = getQuery('yc_id');
317
311
  let sectionId = params.VideoBriefSummaryId;
318
- // let courseId="20899",
319
- // sectionId= "462347",
320
- // videoId= "29715",
321
- // watchTime= 677
312
+ // let courseId="31007",
313
+ // sectionId= "446168",
314
+ // videoId= "71399",
315
+ // watchTime= 527
322
316
  if (videoId && courseId && sectionId) {
323
317
  http.post(`${urllocation}/chat-service/public/v1.0/knowledge-base/questions:recommend`, {
324
318
  "recommendedQuestions": [],
@@ -345,6 +339,9 @@ const CustomerService = (props)=>{
345
339
  answer: item.answer
346
340
  };
347
341
  });
342
+ recommendeQuestionID.current = data.map((item)=>{
343
+ return item.id;
344
+ });
348
345
  }
349
346
  console.log('dflkvmdfklvdf欢迎语', data);
350
347
  let obj = {
@@ -632,7 +629,7 @@ const CustomerService = (props)=>{
632
629
  recevier: "AI",
633
630
  message: questions.question,
634
631
  quotedMessage: '',
635
- id: "654321",
632
+ id: 'p' + new Date().getTime(),
636
633
  upvoted: false,
637
634
  downvoted: false,
638
635
  createdAt: getDataTime(-1),
@@ -690,7 +687,7 @@ const CustomerService = (props)=>{
690
687
  recevier: "AI",
691
688
  message: keyWord,
692
689
  quotedMessage: citationContent.content,
693
- id: "654321",
690
+ id: 'p' + new Date().getTime(),
694
691
  upvoted: false,
695
692
  downvoted: false,
696
693
  createdAt: getDataTime(-1),
@@ -718,7 +715,7 @@ const CustomerService = (props)=>{
718
715
  if (pageNumHistory <= 1) {
719
716
  setHistoryMessageList((historyMessageList)=>{
720
717
  let newHistoryMessageList = historyMessageList.concat(_object_spread_props(_object_spread({}, obj), {
721
- id: null,
718
+ id: 'p' + new Date().getTime(),
722
719
  upvoted: false,
723
720
  downvoted: false,
724
721
  createdAt: getDataTime(-1),
@@ -777,9 +774,11 @@ const CustomerService = (props)=>{
777
774
  ctrl.current = new AbortController();
778
775
  clearTimeout(receiveMessageTimer.current);
779
776
  receiveMessageTimer.current = setTimeout(()=>{
780
- setHistoryMessageList((historyMessageList)=>{
781
- return historyMessageList.filter((item)=>item.id != "123456" && item.id != "654321");
782
- });
777
+ // setHistoryMessageList((historyMessageList) => {
778
+ // return historyMessageList.filter(
779
+ // (item) => item.id != "123456" && item.id != "654321"
780
+ // );
781
+ // });
783
782
  setFinished(true);
784
783
  ctrl.current.abort();
785
784
  setHistoryMessageList((historyMessageList)=>{
@@ -794,6 +793,7 @@ const CustomerService = (props)=>{
794
793
  });
795
794
  });
796
795
  }, 60 * 1000);
796
+ setFinished(false);
797
797
  if (config && config.type == 'video' && config.params) {
798
798
  let params = config.params;
799
799
  let videoId = params.videoId;
@@ -1419,10 +1419,10 @@ const CustomerService = (props)=>{
1419
1419
  let watchTime = params.videoProgress;
1420
1420
  let courseId = getQuery('yc_id');
1421
1421
  let sectionId = params.VideoBriefSummaryId;
1422
- // let courseId="20899",
1423
- // sectionId= "462347",
1424
- // videoId= "29715",
1425
- // watchTime= 677
1422
+ // let courseId="31007",
1423
+ // sectionId= "446168",
1424
+ // videoId= "71399",
1425
+ // watchTime= 527
1426
1426
  if (videoId && courseId && sectionId) {
1427
1427
  console.log(recommendeQuestionID.current, 'recommendeQuestionID.current');
1428
1428
  http.post(`${urllocation}/chat-service/public/v1.0/knowledge-base/questions:recommend`, {
@@ -1452,17 +1452,13 @@ const CustomerService = (props)=>{
1452
1452
  setHotQuestionsList(data);
1453
1453
  newHotQuestionsList.current = data;
1454
1454
  }
1455
- // let ids:any[] = [];
1456
- // data.map((str: { id: string; })=>{
1457
- // ids.push(str.id);
1458
- // })
1459
- // recommendeQuestionID.current = Array.from(new Set(recommendeQuestionID.current.concat(ids)));
1460
- resettingBottomHei();
1455
+ let ids = [];
1456
+ data.map((str)=>{
1457
+ ids.push(str.id);
1458
+ });
1459
+ recommendeQuestionID.current = Array.from(new Set(recommendeQuestionID.current.concat(ids)));
1461
1460
  scrollToBottom();
1462
- // console.log(data,99999);
1463
- // if(data.length < 4){
1464
- // getQuestiionsList('',4)
1465
- // }
1461
+ resettingBottomHei();
1466
1462
  }
1467
1463
  }).catch(()=>{});
1468
1464
  }
@@ -1593,7 +1589,7 @@ const CustomerService = (props)=>{
1593
1589
  }
1594
1590
  } else {
1595
1591
  if (document.getElementById("Drawer_buttom_modal")) {
1596
- let hei = document.getElementById("Drawer_buttom_modal").offsetHeight + document.getElementById("BottomAssociationProblem").offsetHeight;
1592
+ let hei = document.getElementById("Drawer_buttom_modal").offsetHeight + document.getElementById("BottomAssociationProblem_modal").offsetHeight;
1597
1593
  setButtomHei(hei);
1598
1594
  }
1599
1595
  }
@@ -2128,7 +2124,6 @@ const CustomerService = (props)=>{
2128
2124
  return /*#__PURE__*/ _jsx("li", {
2129
2125
  onClick: ()=>{
2130
2126
  sendMessage(list, 1);
2131
- recommendeQuestionID.current = recommendeQuestionID.current.concat(list.value);
2132
2127
  setBottomRecommendationQuestions([]);
2133
2128
  resettingBottomHei();
2134
2129
  },
@@ -2378,7 +2373,6 @@ const CustomerService = (props)=>{
2378
2373
  } else if (JSON.parse(previousLineData.extraInfo).length > 0 && JSON.parse(previousLineData.extraInfo)[0].key == "imageUrl") {
2379
2374
  showTeacherBtn = false;
2380
2375
  }
2381
- console.log(showTeacherBtn, 'dlvkdfl');
2382
2376
  /// style={{position:showStopBtn && isPosition.current ? 'sticky' : 'relative'}}
2383
2377
  return /*#__PURE__*/ _jsxs("div", {
2384
2378
  className: `${styles.operate_modal_bottom}`,
@@ -2657,7 +2651,7 @@ const CustomerService = (props)=>{
2657
2651
  onClick: ()=>{
2658
2652
  setHistoryMessageList((historyMessageList)=>{
2659
2653
  let newHistoryMessageList = historyMessageList.concat({
2660
- id: -1,
2654
+ id: 'p' + new Date().getTime(),
2661
2655
  roomId: roomId,
2662
2656
  sender: mid,
2663
2657
  recevier: 'AI',
@@ -2695,7 +2689,7 @@ const CustomerService = (props)=>{
2695
2689
  onClick: ()=>{
2696
2690
  setHistoryMessageList((historyMessageList)=>{
2697
2691
  let newHistoryMessageList = historyMessageList.concat({
2698
- id: -1,
2692
+ id: 'p' + new Date().getTime(),
2699
2693
  roomId: roomId,
2700
2694
  sender: mid,
2701
2695
  recevier: 'AI',
@@ -3009,23 +3003,51 @@ const CustomerService = (props)=>{
3009
3003
  };
3010
3004
  //视频页面底部推荐问题
3011
3005
  const renderBottomAssociationProblem = ()=>{
3012
- return /*#__PURE__*/ _jsx("div", {
3013
- className: styles.issues_list_flag,
3014
- id: "BottomAssociationProblem",
3015
- children: bottomRecommendationQuestions.map((item)=>{
3016
- return /*#__PURE__*/ _jsx("p", {
3017
- onClick: ()=>{
3018
- sendMessage(item, 1);
3019
- if (config && config.type == 'video') {
3020
- recommendeQuestionID.current = recommendeQuestionID.current.concat(item.id);
3021
- setBottomRecommendationQuestions([]);
3022
- resettingBottomHei();
3023
- }
3024
- },
3025
- children: item.question
3026
- }, item.id);
3027
- })
3028
- });
3006
+ if (showType == 1 || showType == 3) {
3007
+ return /*#__PURE__*/ _jsx("div", {
3008
+ className: styles.issues_list_flag,
3009
+ id: "BottomAssociationProblem",
3010
+ children: bottomRecommendationQuestions.map((item)=>{
3011
+ return /*#__PURE__*/ _jsxs(_Fragment, {
3012
+ children: [
3013
+ /*#__PURE__*/ _jsx("p", {
3014
+ onClick: ()=>{
3015
+ sendMessage(item, 1);
3016
+ if (config && config.type == 'video') {
3017
+ setBottomRecommendationQuestions([]);
3018
+ resettingBottomHei();
3019
+ }
3020
+ },
3021
+ children: item.question
3022
+ }, item.id),
3023
+ /*#__PURE__*/ _jsx("br", {})
3024
+ ]
3025
+ });
3026
+ })
3027
+ });
3028
+ } else {
3029
+ return /*#__PURE__*/ _jsx("div", {
3030
+ className: styles.issues_list_flag,
3031
+ id: "BottomAssociationProblem_modal",
3032
+ children: bottomRecommendationQuestions.map((item)=>{
3033
+ return /*#__PURE__*/ _jsxs(_Fragment, {
3034
+ children: [
3035
+ /*#__PURE__*/ _jsx("p", {
3036
+ onClick: ()=>{
3037
+ sendMessage(item, 1);
3038
+ if (config && config.type == 'video') {
3039
+ setBottomRecommendationQuestions([]);
3040
+ resettingBottomHei();
3041
+ }
3042
+ },
3043
+ children: item.question
3044
+ }, item.id),
3045
+ /*#__PURE__*/ _jsx("br", {})
3046
+ ]
3047
+ });
3048
+ })
3049
+ });
3050
+ }
3029
3051
  };
3030
3052
  //加载指定数据,点击历史记录
3031
3053
  const loadSpecifiedData = (renewRoomId, page, id, receiver, keyWordProblem)=>{
@@ -3123,7 +3145,7 @@ const CustomerService = (props)=>{
3123
3145
  className: styles.Drawer_buttom_Issues_List,
3124
3146
  children: [
3125
3147
  renderAssociationProblem(),
3126
- renderBottomAssociationProblem(),
3148
+ showType == 1 && renderBottomAssociationProblem(),
3127
3149
  /*#__PURE__*/ _jsx("div", {
3128
3150
  className: styles.Drawer_buttom,
3129
3151
  id: "Drawer_buttom",
@@ -3210,6 +3232,7 @@ const CustomerService = (props)=>{
3210
3232
  className: styles.Drawer_buttom_Issues_List,
3211
3233
  children: [
3212
3234
  renderAssociationProblem(),
3235
+ showType == 2 && renderBottomAssociationProblem(),
3213
3236
  /*#__PURE__*/ _jsx("div", {
3214
3237
  className: styles.Drawer_buttom,
3215
3238
  id: "Drawer_buttom_modal",
@@ -3305,6 +3328,7 @@ const CustomerService = (props)=>{
3305
3328
  className: `${styles.Drawer_buttom_Issues_List} ${styles.Drawer_buttom_Issues_List_newlabo}`,
3306
3329
  children: [
3307
3330
  renderAssociationProblem(),
3331
+ showType == 3 && renderBottomAssociationProblem(),
3308
3332
  /*#__PURE__*/ _jsx("div", {
3309
3333
  className: styles.Drawer_buttom,
3310
3334
  id: "Drawer_buttom",
@@ -3412,6 +3436,7 @@ const CustomerService = (props)=>{
3412
3436
  className: styles.Drawer_buttom_Issues_List,
3413
3437
  children: [
3414
3438
  renderAssociationProblem(),
3439
+ (showType == 4 || showType == 5) && renderBottomAssociationProblem(),
3415
3440
  /*#__PURE__*/ _jsx("div", {
3416
3441
  className: styles.Drawer_buttom,
3417
3442
  id: "Drawer_buttom_modal",
@@ -3502,6 +3527,7 @@ const CustomerService = (props)=>{
3502
3527
  className: `${styles.Drawer_buttom_Issues_List} ${styles.Drawer_buttom_Issues_List_newlabo}`,
3503
3528
  children: [
3504
3529
  renderAssociationProblem(),
3530
+ (showType == 4 || showType == 5) && renderBottomAssociationProblem(),
3505
3531
  /*#__PURE__*/ _jsx("div", {
3506
3532
  className: styles.Drawer_buttom,
3507
3533
  id: "Drawer_buttom",
@@ -398,7 +398,7 @@
398
398
  // 最后一行操作按钮
399
399
  .operate_modal_bottom{
400
400
  position: relative;
401
- top: 10px ;
401
+ top: 12px ;
402
402
  &::before{
403
403
  content: '';
404
404
  display: block;
@@ -406,7 +406,7 @@
406
406
  height: 1px;
407
407
  background-color: rgba(0, 0, 0, 0.06);
408
408
  position: absolute;
409
- bottom: 40px;
409
+ bottom: 42px;
410
410
  left: -16px;
411
411
  }
412
412
  &>p{
@@ -969,6 +969,8 @@
969
969
  border-radius: 38px;
970
970
  margin-bottom: 16px;
971
971
  line-height: 1.5;
972
+ display: inline-block;
973
+
972
974
  cursor: pointer;
973
975
  &:hover{
974
976
  background-color: @color-background-primary-weak;
@@ -395,7 +395,7 @@
395
395
  // 最后一行操作按钮
396
396
  .operate_modal_bottom{
397
397
  position: relative;
398
- top: 10px ;
398
+ top: 12px ;
399
399
  &::before{
400
400
  content: '';
401
401
  display: block;
@@ -403,7 +403,7 @@
403
403
  height: 1px;
404
404
  background-color: rgba(0, 0, 0, 0.06);
405
405
  position: absolute;
406
- bottom: 40px;
406
+ bottom: 42px;
407
407
  left: -16px;
408
408
  }
409
409
  &>p{
@@ -966,6 +966,8 @@
966
966
  border-radius: 38px;
967
967
  margin-bottom: 16px;
968
968
  line-height: 1.5;
969
+ display: inline-block;
970
+
969
971
  cursor: pointer;
970
972
  &:hover{
971
973
  background-color: @color-background-primary-weak;
@@ -1,6 +1,5 @@
1
1
  /// <reference types="react" />
2
2
  import "highlight.js/styles/default.css";
3
- import './html2canvas.test.js';
4
3
  interface Service {
5
4
  type: string;
6
5
  params: any;