bhd-components 0.7.12 → 0.7.13

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.
@@ -78,6 +78,7 @@ const CustomerService = (props)=>{
78
78
  let isPosition = useRef(true);
79
79
  let recommendeQuestionID = useRef([]); //推荐问题id
80
80
  let videoHotQuestionsList = useRef([]); //视频热门问题
81
+ let newHotQuestionsList = useRef([]); //视频热门问题
81
82
  const mid = props.userData.mid;
82
83
  const remarkable = new Remarkable({
83
84
  highlight: function(str, lang) {
@@ -311,19 +312,34 @@ const CustomerService = (props)=>{
311
312
  let questionsList = [];
312
313
  let obj = {};
313
314
  if (type == 1) {
314
- console.log(hotQuestionsList, '33322221111');
315
- questionsList = hotQuestionsList.map((item, index)=>{
316
- if (index < 3) {
317
- return {
318
- key: "messageSource",
319
- value: item.id,
320
- question: item.question,
321
- answer: item.answer
322
- };
323
- } else {
324
- return null;
325
- }
326
- });
315
+ console.log(hotQuestionsList, newHotQuestionsList.current, '33322221111');
316
+ if (newHotQuestionsList.current.length > 0) {
317
+ questionsList = newHotQuestionsList.current.map((item, index)=>{
318
+ if (index < 3) {
319
+ return {
320
+ key: "messageSource",
321
+ value: item.id,
322
+ question: item.question,
323
+ answer: item.answer
324
+ };
325
+ } else {
326
+ return null;
327
+ }
328
+ });
329
+ } else {
330
+ questionsList = hotQuestionsList.map((item, index)=>{
331
+ if (index < 3) {
332
+ return {
333
+ key: "messageSource",
334
+ value: item.id,
335
+ question: item.question,
336
+ answer: item.answer
337
+ };
338
+ } else {
339
+ return null;
340
+ }
341
+ });
342
+ }
327
343
  questionsList = questionsList.filter((i)=>i != null);
328
344
  obj = {
329
345
  roomId: roomId,
@@ -526,8 +542,8 @@ const CustomerService = (props)=>{
526
542
  });
527
543
  };
528
544
  //发送知识库问题 item,flag == 1 是获取问候信息的答案,flag == 2 是普通消息,flag == 3 是针对视频页面点击底部推荐问题
529
- const sendMessage = (item, flag)=>{
530
- // console.log(item,flag,888888888);
545
+ const sendMessage = (item, flag, type = '')=>{
546
+ console.log(item, flag, 888888888);
531
547
  let questions = [];
532
548
  if (item && flag) {
533
549
  questions = [
@@ -587,7 +603,7 @@ const CustomerService = (props)=>{
587
603
  key: "questionId",
588
604
  value: flag == 1 ? questions.value : questions.id,
589
605
  answer: questions.answer
590
- });
606
+ }, type);
591
607
  setKeyWord("");
592
608
  setQuestionsList([]);
593
609
  setCitationContent({});
@@ -637,7 +653,7 @@ const CustomerService = (props)=>{
637
653
  }
638
654
  };
639
655
  //向知识库发送问题 或答案 type:1 发送问题 2 接受答案
640
- const sendingExistingIssues = (type, obj, questions)=>{
656
+ const sendingExistingIssues = (type, obj, questions, problemType)=>{
641
657
  if (pageNumHistory <= 1) {
642
658
  setHistoryMessageList((historyMessageList)=>{
643
659
  let newHistoryMessageList = historyMessageList.concat(_object_spread_props(_object_spread({}, obj), {
@@ -688,10 +704,10 @@ const CustomerService = (props)=>{
688
704
  }
689
705
  ]
690
706
  };
691
- sendingExistingIssues(2, dataObj, "");
707
+ sendingExistingIssues(2, dataObj, "", problemType);
692
708
  testLabQuestion(obj.message, questions.answer, "");
693
709
  }
694
- if (type == 2 && config && config.type == 'video') {
710
+ if (type == 2 && config && config.type == 'video' && problemType != 'AssociativeProblem') {
695
711
  //先请求问题列表
696
712
  videoPageQuestiionsList(2);
697
713
  }
@@ -739,6 +755,7 @@ const CustomerService = (props)=>{
739
755
  obj.regenerate = false;
740
756
  }
741
757
  let data = JSON.stringify(obj);
758
+ let flagKeyWord = keyWord;
742
759
  setKeyWord("");
743
760
  setQuestionsList([]);
744
761
  setTimeout(()=>{
@@ -881,7 +898,9 @@ const CustomerService = (props)=>{
881
898
  }
882
899
  if (msg.finished) {
883
900
  setFinished(true); //发送结束
884
- videoPageQuestiionsList(2);
901
+ if (!flagKeyWord) {
902
+ videoPageQuestiionsList(2);
903
+ }
885
904
  // isPosition.current = true;
886
905
  setTimeout(()=>{
887
906
  isPosition.current = true;
@@ -1338,15 +1357,12 @@ const CustomerService = (props)=>{
1338
1357
  const videoPageQuestiionsList = (flag = 1)=>{
1339
1358
  console.log(flag, props, 3333333);
1340
1359
  if (config && config.type == 'video' && config.params) {
1341
- let params = config.params;
1342
- let videoId = params.videoId;
1343
- let watchTime = params.videoProgress;
1344
- let courseId = getQuery('yc_id');
1345
- let sectionId = params.VideoBriefSummaryId;
1346
- // let courseId="20899",
1347
- // sectionId= "462347",
1348
- // videoId= "29707",
1349
- // watchTime= 262
1360
+ // let params = config.params;
1361
+ // let videoId = params.videoId;
1362
+ // let watchTime = params.videoProgress;
1363
+ // let courseId = getQuery('yc_id');
1364
+ // let sectionId = params.VideoBriefSummaryId;
1365
+ let courseId = "20899", sectionId = "462347", videoId = "29715", watchTime = 677;
1350
1366
  if (videoId && courseId && sectionId) {
1351
1367
  console.log(recommendeQuestionID.current, 'recommendeQuestionID.current');
1352
1368
  http.post(`${urllocation}/chat-service/public/v1.0/knowledge-base/questions:recommend`, {
@@ -1374,6 +1390,7 @@ const CustomerService = (props)=>{
1374
1390
  setBottomRecommendationQuestions(data);
1375
1391
  } else {
1376
1392
  setHotQuestionsList(data);
1393
+ newHotQuestionsList.current = data;
1377
1394
  }
1378
1395
  // let ids:any[] = [];
1379
1396
  // data.map((str: { id: string; })=>{
@@ -2039,7 +2056,7 @@ const CustomerService = (props)=>{
2039
2056
  ]
2040
2057
  }),
2041
2058
  item.extraInfo != undefined && JSON.parse(item.extraInfo).length > 0 && JSON.parse(item.extraInfo)[0].key == "messageSource" && JSON.parse(item.extraInfo)[0].value != "knowledgebase" && /*#__PURE__*/ _jsxs("ul", {
2042
- className: `${styles.association_problem} ${item.message == '抱歉,我暂时无法回答这样的问题。' ? 'association_problem_flag' : ''}`,
2059
+ className: `${styles.association_problem} ${item.message == '抱歉,我暂时无法回答这样的问题。' ? styles.association_problem_flag : ''}`,
2043
2060
  children: [
2044
2061
  item.message == '抱歉,我暂时无法回答这样的问题。' && /*#__PURE__*/ _jsx("li", {
2045
2062
  className: styles.related_issues_flag,
@@ -2301,6 +2318,7 @@ const CustomerService = (props)=>{
2301
2318
  } else if (JSON.parse(previousLineData.extraInfo).length > 0 && JSON.parse(previousLineData.extraInfo)[0].key == "imageUrl") {
2302
2319
  showTeacherBtn = false;
2303
2320
  }
2321
+ console.log(showTeacherBtn, 'dlvkdfl');
2304
2322
  /// style={{position:showStopBtn && isPosition.current ? 'sticky' : 'relative'}}
2305
2323
  return /*#__PURE__*/ _jsxs("div", {
2306
2324
  className: `${styles.operate_modal_bottom}`,
@@ -2684,6 +2702,8 @@ const CustomerService = (props)=>{
2684
2702
  }
2685
2703
  }, 1000);
2686
2704
  }
2705
+ setBottomRecommendationQuestions([]);
2706
+ resettingBottomHei();
2687
2707
  },
2688
2708
  onPressEnter: (e)=>{
2689
2709
  // console.log('发送内容22222',props)
@@ -2694,6 +2714,8 @@ const CustomerService = (props)=>{
2694
2714
  clearTimeout(timer.current);
2695
2715
  setKeyWord("");
2696
2716
  setCitationContent({});
2717
+ setBottomRecommendationQuestions([]);
2718
+ resettingBottomHei();
2697
2719
  //查找是否是召唤老师回答并有相应的老师名称
2698
2720
  if (answerMode == 1 && teacherList.length > 0) {
2699
2721
  let list = teacherList.filter((v)=>v.name == keyWord.trim());
@@ -2912,7 +2934,7 @@ const CustomerService = (props)=>{
2912
2934
  className: styles.item,
2913
2935
  children: /*#__PURE__*/ _jsx("span", {
2914
2936
  onClick: ()=>{
2915
- sendMessage(item, 2);
2937
+ sendMessage(item, 2, 'AssociativeProblem');
2916
2938
  setKeyWord("");
2917
2939
  onEvent(serverName + serverUrl(), "click_智能问答_ 发送", "提交");
2918
2940
  },
@@ -630,6 +630,44 @@
630
630
  }
631
631
 
632
632
 
633
+ .association_problem_flag{
634
+
635
+ li{
636
+ padding-left: 30px;
637
+ position: relative;
638
+ &::after{
639
+ content: '';
640
+ width: 6px;
641
+ height: 6px;
642
+ border-radius: 50%;
643
+ background-color: rgba(217, 217, 217, 1);
644
+ display: block;
645
+ position: absolute;
646
+ top: 26px;
647
+ left: 10px;
648
+ }
649
+ }
650
+
651
+ li:first-child{
652
+ padding-left:0;
653
+ &::after{
654
+ display: none;
655
+ }
656
+ }
657
+
658
+ .related_issues_flag{
659
+ span{
660
+ color: #000;
661
+ font-weight: 600;
662
+ border-bottom: 6px solid @color-background-primary-weak-hover;
663
+ display: inline-block;
664
+ height: 22px;
665
+ }
666
+
667
+ }
668
+ }
669
+
670
+
633
671
  .img_con{
634
672
  width: 100%;
635
673
  text-align: center;
@@ -757,33 +795,6 @@
757
795
  }
758
796
  }
759
797
 
760
- .association_problem_flag{
761
- padding-left: 30px;
762
-
763
- li{
764
- position: relative;
765
- &::after{
766
- content: '';
767
- width: 6px;
768
- height: 6px;
769
- border-radius: 50%;
770
- background-color: rgba(217, 217, 217, 1);
771
- display: block;
772
- position: absolute;
773
- top: 12px;
774
- left: 12px;
775
- }
776
- }
777
- .related_issues_flag{
778
- span{
779
- color: #000;
780
- font-weight: 600;
781
- border-bottom: 4px solid @color-background-primary-weak-hover;
782
- }
783
-
784
- }
785
- }
786
-
787
798
  .time {
788
799
  display: block;
789
800
  margin: 40px 0;
@@ -80,6 +80,7 @@ var CustomerService = function(props) {
80
80
  var isPosition = useRef(true);
81
81
  var recommendeQuestionID = useRef([]); //推荐问题id
82
82
  var videoHotQuestionsList = useRef([]); //视频热门问题
83
+ var newHotQuestionsList = useRef([]); //视频热门问题
83
84
  var mid = props.userData.mid;
84
85
  var remarkable = new Remarkable({
85
86
  highlight: function highlight(str, lang) {
@@ -315,19 +316,34 @@ var CustomerService = function(props) {
315
316
  var questionsList = [];
316
317
  var obj = {};
317
318
  if (type == 1) {
318
- console.log(hotQuestionsList, "33322221111");
319
- questionsList = hotQuestionsList.map(function(item, index) {
320
- if (index < 3) {
321
- return {
322
- key: "messageSource",
323
- value: item.id,
324
- question: item.question,
325
- answer: item.answer
326
- };
327
- } else {
328
- return null;
329
- }
330
- });
319
+ console.log(hotQuestionsList, newHotQuestionsList.current, "33322221111");
320
+ if (newHotQuestionsList.current.length > 0) {
321
+ questionsList = newHotQuestionsList.current.map(function(item, index) {
322
+ if (index < 3) {
323
+ return {
324
+ key: "messageSource",
325
+ value: item.id,
326
+ question: item.question,
327
+ answer: item.answer
328
+ };
329
+ } else {
330
+ return null;
331
+ }
332
+ });
333
+ } else {
334
+ questionsList = hotQuestionsList.map(function(item, index) {
335
+ if (index < 3) {
336
+ return {
337
+ key: "messageSource",
338
+ value: item.id,
339
+ question: item.question,
340
+ answer: item.answer
341
+ };
342
+ } else {
343
+ return null;
344
+ }
345
+ });
346
+ }
331
347
  questionsList = questionsList.filter(function(i) {
332
348
  return i != null;
333
349
  });
@@ -539,7 +555,8 @@ var CustomerService = function(props) {
539
555
  };
540
556
  //发送知识库问题 item,flag == 1 是获取问候信息的答案,flag == 2 是普通消息,flag == 3 是针对视频页面点击底部推荐问题
541
557
  var sendMessage = function(item, flag) {
542
- // console.log(item,flag,888888888);
558
+ var type = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "";
559
+ console.log(item, flag, 888888888);
543
560
  var questions = [];
544
561
  if (item && flag) {
545
562
  questions = [
@@ -601,7 +618,7 @@ var CustomerService = function(props) {
601
618
  key: "questionId",
602
619
  value: flag == 1 ? questions.value : questions.id,
603
620
  answer: questions.answer
604
- });
621
+ }, type);
605
622
  setKeyWord("");
606
623
  setQuestionsList([]);
607
624
  setCitationContent({});
@@ -653,7 +670,7 @@ var CustomerService = function(props) {
653
670
  }
654
671
  };
655
672
  //向知识库发送问题 或答案 type:1 发送问题 2 接受答案
656
- var sendingExistingIssues = function(type, obj, questions) {
673
+ var sendingExistingIssues = function(type, obj, questions, problemType) {
657
674
  if (pageNumHistory <= 1) {
658
675
  setHistoryMessageList(function(historyMessageList) {
659
676
  var newHistoryMessageList = historyMessageList.concat(_object_spread_props(_object_spread({}, obj), {
@@ -704,10 +721,10 @@ var CustomerService = function(props) {
704
721
  }
705
722
  ]
706
723
  };
707
- sendingExistingIssues(2, dataObj, "");
724
+ sendingExistingIssues(2, dataObj, "", problemType);
708
725
  testLabQuestion(obj.message, questions.answer, "");
709
726
  }
710
- if (type == 2 && config && config.type == "video") {
727
+ if (type == 2 && config && config.type == "video" && problemType != "AssociativeProblem") {
711
728
  //先请求问题列表
712
729
  videoPageQuestiionsList(2);
713
730
  }
@@ -757,6 +774,7 @@ var CustomerService = function(props) {
757
774
  obj.regenerate = false;
758
775
  }
759
776
  var data = JSON.stringify(obj);
777
+ var flagKeyWord = keyWord;
760
778
  setKeyWord("");
761
779
  setQuestionsList([]);
762
780
  setTimeout(function() {
@@ -905,7 +923,9 @@ var CustomerService = function(props) {
905
923
  }
906
924
  if (msg.finished) {
907
925
  setFinished(true); //发送结束
908
- videoPageQuestiionsList(2);
926
+ if (!flagKeyWord) {
927
+ videoPageQuestiionsList(2);
928
+ }
909
929
  // isPosition.current = true;
910
930
  setTimeout(function() {
911
931
  isPosition.current = true;
@@ -1370,15 +1390,12 @@ var CustomerService = function(props) {
1370
1390
  var flag = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 1;
1371
1391
  console.log(flag, props, 3333333);
1372
1392
  if (config && config.type == "video" && config.params) {
1373
- var params = config.params;
1374
- var videoId = params.videoId;
1375
- var watchTime = params.videoProgress;
1376
- var courseId = getQuery("yc_id");
1377
- var sectionId = params.VideoBriefSummaryId;
1378
- // let courseId="20899",
1379
- // sectionId= "462347",
1380
- // videoId= "29707",
1381
- // watchTime= 262
1393
+ // let params = config.params;
1394
+ // let videoId = params.videoId;
1395
+ // let watchTime = params.videoProgress;
1396
+ // let courseId = getQuery('yc_id');
1397
+ // let sectionId = params.VideoBriefSummaryId;
1398
+ var courseId = "20899", sectionId = "462347", videoId = "29715", watchTime = 677;
1382
1399
  if (videoId && courseId && sectionId) {
1383
1400
  console.log(recommendeQuestionID.current, "recommendeQuestionID.current");
1384
1401
  http.post("".concat(urllocation, "/chat-service/public/v1.0/knowledge-base/questions:recommend"), {
@@ -1406,6 +1423,7 @@ var CustomerService = function(props) {
1406
1423
  setBottomRecommendationQuestions(data);
1407
1424
  } else {
1408
1425
  setHotQuestionsList(data);
1426
+ newHotQuestionsList.current = data;
1409
1427
  }
1410
1428
  // let ids:any[] = [];
1411
1429
  // data.map((str: { id: string; })=>{
@@ -2062,7 +2080,7 @@ var CustomerService = function(props) {
2062
2080
  ]
2063
2081
  }),
2064
2082
  item.extraInfo != undefined && JSON.parse(item.extraInfo).length > 0 && JSON.parse(item.extraInfo)[0].key == "messageSource" && JSON.parse(item.extraInfo)[0].value != "knowledgebase" && /*#__PURE__*/ _jsxs("ul", {
2065
- className: "".concat(styles.association_problem, " ").concat(item.message == "抱歉,我暂时无法回答这样的问题。" ? "association_problem_flag" : ""),
2083
+ className: "".concat(styles.association_problem, " ").concat(item.message == "抱歉,我暂时无法回答这样的问题。" ? styles.association_problem_flag : ""),
2066
2084
  children: [
2067
2085
  item.message == "抱歉,我暂时无法回答这样的问题。" && /*#__PURE__*/ _jsx("li", {
2068
2086
  className: styles.related_issues_flag,
@@ -2336,6 +2354,7 @@ var CustomerService = function(props) {
2336
2354
  } else if (JSON.parse(previousLineData.extraInfo).length > 0 && JSON.parse(previousLineData.extraInfo)[0].key == "imageUrl") {
2337
2355
  showTeacherBtn = false;
2338
2356
  }
2357
+ console.log(showTeacherBtn, "dlvkdfl");
2339
2358
  /// style={{position:showStopBtn && isPosition.current ? 'sticky' : 'relative'}}
2340
2359
  return /*#__PURE__*/ _jsxs("div", {
2341
2360
  className: "".concat(styles.operate_modal_bottom),
@@ -2733,6 +2752,8 @@ var CustomerService = function(props) {
2733
2752
  }
2734
2753
  }, 1000);
2735
2754
  }
2755
+ setBottomRecommendationQuestions([]);
2756
+ resettingBottomHei();
2736
2757
  },
2737
2758
  onPressEnter: function(e) {
2738
2759
  // console.log('发送内容22222',props)
@@ -2743,6 +2764,8 @@ var CustomerService = function(props) {
2743
2764
  clearTimeout(timer.current);
2744
2765
  setKeyWord("");
2745
2766
  setCitationContent({});
2767
+ setBottomRecommendationQuestions([]);
2768
+ resettingBottomHei();
2746
2769
  //查找是否是召唤老师回答并有相应的老师名称
2747
2770
  if (answerMode == 1 && teacherList.length > 0) {
2748
2771
  var list = teacherList.filter(function(v) {
@@ -2973,7 +2996,7 @@ var CustomerService = function(props) {
2973
2996
  className: styles.item,
2974
2997
  children: /*#__PURE__*/ _jsx("span", {
2975
2998
  onClick: function() {
2976
- sendMessage(item, 2);
2999
+ sendMessage(item, 2, "AssociativeProblem");
2977
3000
  setKeyWord("");
2978
3001
  onEvent(serverName + serverUrl(), "click_智能问答_ 发送", "提交");
2979
3002
  },
@@ -630,6 +630,44 @@
630
630
  }
631
631
 
632
632
 
633
+ .association_problem_flag{
634
+
635
+ li{
636
+ padding-left: 30px;
637
+ position: relative;
638
+ &::after{
639
+ content: '';
640
+ width: 6px;
641
+ height: 6px;
642
+ border-radius: 50%;
643
+ background-color: rgba(217, 217, 217, 1);
644
+ display: block;
645
+ position: absolute;
646
+ top: 26px;
647
+ left: 10px;
648
+ }
649
+ }
650
+
651
+ li:first-child{
652
+ padding-left:0;
653
+ &::after{
654
+ display: none;
655
+ }
656
+ }
657
+
658
+ .related_issues_flag{
659
+ span{
660
+ color: #000;
661
+ font-weight: 600;
662
+ border-bottom: 6px solid @color-background-primary-weak-hover;
663
+ display: inline-block;
664
+ height: 22px;
665
+ }
666
+
667
+ }
668
+ }
669
+
670
+
633
671
  .img_con{
634
672
  width: 100%;
635
673
  text-align: center;
@@ -757,33 +795,6 @@
757
795
  }
758
796
  }
759
797
 
760
- .association_problem_flag{
761
- padding-left: 30px;
762
-
763
- li{
764
- position: relative;
765
- &::after{
766
- content: '';
767
- width: 6px;
768
- height: 6px;
769
- border-radius: 50%;
770
- background-color: rgba(217, 217, 217, 1);
771
- display: block;
772
- position: absolute;
773
- top: 12px;
774
- left: 12px;
775
- }
776
- }
777
- .related_issues_flag{
778
- span{
779
- color: #000;
780
- font-weight: 600;
781
- border-bottom: 4px solid @color-background-primary-weak-hover;
782
- }
783
-
784
- }
785
- }
786
-
787
798
  .time {
788
799
  display: block;
789
800
  margin: 40px 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bhd-components",
3
- "version": "0.7.12",
3
+ "version": "0.7.13",
4
4
  "description": "组件功能描述",
5
5
  "files": [
6
6
  "esm",