bhd-components 0.7.11 → 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; })=>{
@@ -1907,7 +1924,7 @@ const CustomerService = (props)=>{
1907
1924
  className: styles.content_child
1908
1925
  }),
1909
1926
  item.extraInfo && JSON.parse(item.extraInfo).length > 0 && JSON.parse(item.extraInfo)[0].key == "imageUrl" && /*#__PURE__*/ _jsxs("p", {
1910
- className: styles.img_con,
1927
+ className: `${styles.img_con} ${showType == 2 || showType == 4 ? styles.img_con2 : ''}`,
1911
1928
  children: [
1912
1929
  /*#__PURE__*/ _jsx("img", {
1913
1930
  src: JSON.parse(item.extraInfo)[0].value
@@ -2022,7 +2039,7 @@ const CustomerService = (props)=>{
2022
2039
  className: styles.content_child
2023
2040
  }),
2024
2041
  item.extraInfo && JSON.parse(item.extraInfo).length > 0 && JSON.parse(item.extraInfo)[0].key == "imageUrl" && /*#__PURE__*/ _jsxs("p", {
2025
- className: styles.img_con,
2042
+ className: `${styles.img_con} ${showType == 2 || showType == 4 ? styles.img_con2 : ''}`,
2026
2043
  children: [
2027
2044
  /*#__PURE__*/ _jsx("img", {
2028
2045
  src: JSON.parse(item.extraInfo)[0].value
@@ -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,
@@ -2131,11 +2148,21 @@ const CustomerService = (props)=>{
2131
2148
  return "";
2132
2149
  }
2133
2150
  // console.log(historyMessageList,i,'sdcsd;sldcscsdsd')
2151
+ //根据上一行数据,判断是否显示招唤老师按钮
2152
+ let showTeacherBtn = true;
2153
+ let previousLineData = historyMessageList[i - 1];
2154
+ if (!previousLineData) {
2155
+ showTeacherBtn = true;
2156
+ } else if (!previousLineData.extraInfo) {
2157
+ showTeacherBtn = true;
2158
+ } else if (JSON.parse(previousLineData.extraInfo).length > 0 && JSON.parse(previousLineData.extraInfo)[0].key == "imageUrl") {
2159
+ showTeacherBtn = false;
2160
+ }
2134
2161
  return /*#__PURE__*/ _jsxs("p", {
2135
2162
  className: styles.operate,
2136
2163
  children: [
2137
2164
  // 不在智能客服窗口,并已经点击了召唤老师,并有召唤老师权限
2138
- isAiChatWindow && answerMode != 1 && userData.modules.some((item)=>item.short == "TeacherAnswer") && historyMessageList[i - 1] && historyMessageList[i - 1].extraInfo && JSON.parse(historyMessageList[i - 1].extraInfo).length > 0 && JSON.parse(historyMessageList[i - 1].extraInfo)[0].key != "imageUrl" && /*#__PURE__*/ _jsx("span", {
2165
+ isAiChatWindow && answerMode != 1 && userData.modules.some((item)=>item.short == "TeacherAnswer") && showTeacherBtn && /*#__PURE__*/ _jsx("span", {
2139
2166
  className: styles.ask_question,
2140
2167
  onClick: ()=>{
2141
2168
  setAnswerMode(1);
@@ -2278,9 +2305,20 @@ const CustomerService = (props)=>{
2278
2305
  }
2279
2306
  //3、是否显示召唤老师回答按钮
2280
2307
  let findTeacherBtn = false;
2281
- if (!showStopBtn && isAiChatWindow && (extraInfo != undefined && JSON.parse(extraInfo).length > 0 && JSON.parse(extraInfo)[0].key == "questionId" || extraInfo == null) && historyMessageList[i - 1] && historyMessageList[i - 1].extraInfo && JSON.parse(historyMessageList[i - 1].extraInfo).length > 0 && JSON.parse(historyMessageList[i - 1].extraInfo)[0].key != "imageUrl") {
2308
+ if (!showStopBtn && isAiChatWindow && (extraInfo != undefined && JSON.parse(extraInfo).length > 0 && JSON.parse(extraInfo)[0].key == "questionId" || extraInfo == null)) {
2282
2309
  findTeacherBtn = true;
2283
2310
  }
2311
+ //根据上一行数据,判断是否显示招唤老师按钮
2312
+ let showTeacherBtn = true;
2313
+ let previousLineData = historyMessageList[i - 1];
2314
+ if (!previousLineData) {
2315
+ showTeacherBtn = true;
2316
+ } else if (!previousLineData.extraInfo) {
2317
+ showTeacherBtn = true;
2318
+ } else if (JSON.parse(previousLineData.extraInfo).length > 0 && JSON.parse(previousLineData.extraInfo)[0].key == "imageUrl") {
2319
+ showTeacherBtn = false;
2320
+ }
2321
+ console.log(showTeacherBtn, 'dlvkdfl');
2284
2322
  /// style={{position:showStopBtn && isPosition.current ? 'sticky' : 'relative'}}
2285
2323
  return /*#__PURE__*/ _jsxs("div", {
2286
2324
  className: `${styles.operate_modal_bottom}`,
@@ -2326,7 +2364,7 @@ const CustomerService = (props)=>{
2326
2364
  ]
2327
2365
  }),
2328
2366
  //在ai窗口并ai已经生成完答案
2329
- findTeacherBtn && userData.modules.some((item)=>item.short == "TeacherAnswer") && /*#__PURE__*/ _jsx("span", {
2367
+ findTeacherBtn && userData.modules.some((item)=>item.short == "TeacherAnswer") && showTeacherBtn && /*#__PURE__*/ _jsx("span", {
2330
2368
  className: styles.find_teacher,
2331
2369
  onClick: ()=>{
2332
2370
  setAnswerMode(1);
@@ -2664,6 +2702,8 @@ const CustomerService = (props)=>{
2664
2702
  }
2665
2703
  }, 1000);
2666
2704
  }
2705
+ setBottomRecommendationQuestions([]);
2706
+ resettingBottomHei();
2667
2707
  },
2668
2708
  onPressEnter: (e)=>{
2669
2709
  // console.log('发送内容22222',props)
@@ -2674,6 +2714,8 @@ const CustomerService = (props)=>{
2674
2714
  clearTimeout(timer.current);
2675
2715
  setKeyWord("");
2676
2716
  setCitationContent({});
2717
+ setBottomRecommendationQuestions([]);
2718
+ resettingBottomHei();
2677
2719
  //查找是否是召唤老师回答并有相应的老师名称
2678
2720
  if (answerMode == 1 && teacherList.length > 0) {
2679
2721
  let list = teacherList.filter((v)=>v.name == keyWord.trim());
@@ -2892,7 +2934,7 @@ const CustomerService = (props)=>{
2892
2934
  className: styles.item,
2893
2935
  children: /*#__PURE__*/ _jsx("span", {
2894
2936
  onClick: ()=>{
2895
- sendMessage(item, 2);
2937
+ sendMessage(item, 2, 'AssociativeProblem');
2896
2938
  setKeyWord("");
2897
2939
  onEvent(serverName + serverUrl(), "click_智能问答_ 发送", "提交");
2898
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;
@@ -638,8 +676,11 @@
638
676
  overflow: hidden;
639
677
  display: inline-flex;
640
678
  margin-top: 12px;
679
+ width: 240px;
680
+ max-height: 134px;
641
681
  img{
642
- width: 100%;
682
+ width: 240px;
683
+ height: fit-content;
643
684
  }
644
685
  .mask_zoom{
645
686
  position: absolute;
@@ -666,6 +707,14 @@
666
707
  }
667
708
  }
668
709
  }
710
+ .img_con2{
711
+ width: 300px;
712
+ max-height: 168px;
713
+ img{
714
+ width: 300px;
715
+ height: fit-content;
716
+ }
717
+ }
669
718
 
670
719
  .copyCode{
671
720
  display: flex;
@@ -746,33 +795,6 @@
746
795
  }
747
796
  }
748
797
 
749
- .association_problem_flag{
750
- padding-left: 30px;
751
-
752
- li{
753
- position: relative;
754
- &::after{
755
- content: '';
756
- width: 6px;
757
- height: 6px;
758
- border-radius: 50%;
759
- background-color: rgba(217, 217, 217, 1);
760
- display: block;
761
- position: absolute;
762
- top: 12px;
763
- left: 12px;
764
- }
765
- }
766
- .related_issues_flag{
767
- span{
768
- color: #000;
769
- font-weight: 600;
770
- border-bottom: 4px solid @color-background-primary-weak-hover;
771
- }
772
-
773
- }
774
- }
775
-
776
798
  .time {
777
799
  display: block;
778
800
  margin: 40px 0;
@@ -635,8 +635,11 @@
635
635
  overflow: hidden;
636
636
  display: inline-flex;
637
637
  margin-top: 12px;
638
+ width: 240px;
639
+ max-height: 134px;
638
640
  img{
639
- width: 100%;
641
+ width: 240px;
642
+ height: fit-content;
640
643
  }
641
644
  .mask_zoom{
642
645
  position: absolute;
@@ -663,6 +666,14 @@
663
666
  }
664
667
  }
665
668
  }
669
+ .img_con2{
670
+ width: 300px;
671
+ max-height: 168px;
672
+ img{
673
+ width: 300px;
674
+ height: fit-content;
675
+ }
676
+ }
666
677
 
667
678
  .copyCode{
668
679
  display: flex;
@@ -932,8 +943,8 @@
932
943
  }
933
944
  }
934
945
  .issues_list_flag {
935
- position: absolute;
936
- bottom: 60px;
946
+ // position: absolute;
947
+ // bottom: 60px;
937
948
  margin: 0 16px;
938
949
  // padding-bottom: 4px;
939
950
  line-height: 1;
@@ -943,6 +954,7 @@
943
954
  background-color: #fff;
944
955
  border-radius: 38px;
945
956
  margin-bottom: 16px;
957
+ line-height: 1.5;
946
958
  cursor: pointer;
947
959
  &:hover{
948
960
  background-color: @color-background-primary-weak;
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "@ice/jsx-runtime/jsx-runtime";
2
- import React, { useState, useRef, forwardRef } from "react";
2
+ import React, { useState, forwardRef } from "react";
3
3
  import ReactCrop, { centerCrop, makeAspectCrop } from "react-image-crop";
4
4
  import { CloseOutlined } from "@ant-design/icons";
5
5
  import { CustomDuihao } from "../icons/index";
@@ -9,7 +9,6 @@ const ScreenshotTool = /*#__PURE__*/ forwardRef((props)=>{
9
9
  let { imgBese64 , saveScreenshotBese64 , cancelScreenshot } = props;
10
10
  const [crop, setCrop] = useState();
11
11
  const [completedCrop, setCompletedCrop] = useState();
12
- const imgRef = useRef(null);
13
12
  const [aspect, setAspect] = useState(16 / 9);
14
13
  const [btnPosition, setBtnPosition] = useState({
15
14
  top: 0,
@@ -85,20 +84,22 @@ const ScreenshotTool = /*#__PURE__*/ forwardRef((props)=>{
85
84
  className: styles.ReactCrop,
86
85
  crop: crop,
87
86
  onChange: (_, percentCrop)=>{
87
+ if (percentCrop.height === 0 && percentCrop.width === 0) {
88
+ return;
89
+ }
88
90
  setShowBtn(false);
89
91
  setCrop(percentCrop);
90
92
  },
91
93
  onComplete: (c)=>{
94
+ if (c.height === 0 && c.width === 0) {
95
+ return;
96
+ }
92
97
  setCompletedCrop(c);
93
98
  savePosition(c);
94
- // console.log(c,'剪裁222');
95
99
  },
96
- // aspect={aspect}
97
- // minWidth={400}
98
100
  minHeight: 100,
99
101
  minWidth: 100,
100
102
  children: /*#__PURE__*/ _jsx("img", {
101
- // ref={imgRef}
102
103
  alt: "Crop me",
103
104
  src: imgBese64,
104
105
  onLoad: onImageLoad
@@ -113,7 +114,12 @@ const ScreenshotTool = /*#__PURE__*/ forwardRef((props)=>{
113
114
  children: [
114
115
  /*#__PURE__*/ _jsx("span", {
115
116
  onClick: cancelScreenshot,
116
- children: /*#__PURE__*/ _jsx(CloseOutlined, {})
117
+ children: /*#__PURE__*/ _jsx(CloseOutlined, {
118
+ style: {
119
+ position: 'relative',
120
+ top: '1px'
121
+ }
122
+ })
117
123
  }),
118
124
  /*#__PURE__*/ _jsx("span", {
119
125
  onClick: saveImage,