bhd-components 0.7.17 → 0.7.18

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.
@@ -25,7 +25,7 @@ import "highlight.js/styles/default.css";
25
25
  import { render } from "react-dom";
26
26
  import Provider from "../provider";
27
27
  var TextArea = Input.TextArea;
28
- import "./html2canvas.test.js";
28
+ // import './html2canvas.test.js';
29
29
  import knowledge_icon from "./images/knowledge_icon.png";
30
30
  // import { useMediaRecorder } from "./useMediaRecorder"; //录音使用文件
31
31
  import { readMessage, getByteLen, serverUrl, copyText, getDataTime, getQuery, resetStyles, findParent, delegate } from "./function"; //一些方法
@@ -155,29 +155,23 @@ var CustomerService = function(props) {
155
155
  if (showType == 5 || showScreenshot) {
156
156
  try {
157
157
  setImgBese64("");
158
- // html2canvas(document.getElementsByTagName('html')[0],{
159
- // // ignoreElements:(element)=>{
160
- // // if(element.compareDocumentPosition(dom)===2)return true
161
- // // return false
162
- // // }
163
- // }).then((canvas)=>{
164
- // console.log(canvas,22222);
165
- // setTimeout(()=>{
166
- var dom = document.getElementById(screenshotAreaId);
167
- html2canvas(dom, {
158
+ // let dom = document.getElementById(screenshotAreaId);
159
+ html2canvas(screenshotAreaId, {
168
160
  useCORS: true,
169
161
  // allowTaint: true, // 污染处理
170
- scale: 1
162
+ scale: 1,
163
+ // logging:true,
164
+ ignoreElements: function(element) {
165
+ if (element.compareDocumentPosition(screenshotAreaId) === 2) return true;
166
+ return false;
167
+ }
171
168
  }).then(function(canvas) {
172
- // document.body.appendChild(canvas);
173
169
  // document.body.appendChild(canvas);
174
170
  console.log(canvas, 99999);
175
171
  // var base64URL = canvas.toDataURL('image/jpeg')
176
172
  var base64URL = canvas.toDataURL("image/jpg", 1.0);
177
173
  setImgBese64(base64URL);
178
174
  });
179
- // },100)
180
- // })
181
175
  } catch (error) {
182
176
  console.log(error);
183
177
  }
@@ -319,10 +313,10 @@ var CustomerService = function(props) {
319
313
  var watchTime = params.videoProgress;
320
314
  var courseId = getQuery("yc_id");
321
315
  var sectionId = params.VideoBriefSummaryId;
322
- // let courseId="20899",
323
- // sectionId= "462347",
324
- // videoId= "29715",
325
- // watchTime= 677
316
+ // let courseId="31007",
317
+ // sectionId= "446168",
318
+ // videoId= "71399",
319
+ // watchTime= 527
326
320
  if (videoId && courseId && sectionId) {
327
321
  http.post("".concat(urllocation, "/chat-service/public/v1.0/knowledge-base/questions:recommend"), {
328
322
  "recommendedQuestions": [],
@@ -349,6 +343,9 @@ var CustomerService = function(props) {
349
343
  answer: item.answer
350
344
  };
351
345
  });
346
+ recommendeQuestionID.current = data.map(function(item) {
347
+ return item.id;
348
+ });
352
349
  }
353
350
  console.log("dflkvmdfklvdf欢迎语", data);
354
351
  var obj = {
@@ -647,7 +644,7 @@ var CustomerService = function(props) {
647
644
  recevier: "AI",
648
645
  message: questions.question,
649
646
  quotedMessage: "",
650
- id: "654321",
647
+ id: "p" + new Date().getTime(),
651
648
  upvoted: false,
652
649
  downvoted: false,
653
650
  createdAt: getDataTime(-1),
@@ -707,7 +704,7 @@ var CustomerService = function(props) {
707
704
  recevier: "AI",
708
705
  message: keyWord,
709
706
  quotedMessage: citationContent.content,
710
- id: "654321",
707
+ id: "p" + new Date().getTime(),
711
708
  upvoted: false,
712
709
  downvoted: false,
713
710
  createdAt: getDataTime(-1),
@@ -735,7 +732,7 @@ var CustomerService = function(props) {
735
732
  if (pageNumHistory <= 1) {
736
733
  setHistoryMessageList(function(historyMessageList) {
737
734
  var newHistoryMessageList = historyMessageList.concat(_object_spread_props(_object_spread({}, obj), {
738
- id: null,
735
+ id: "p" + new Date().getTime(),
739
736
  upvoted: false,
740
737
  downvoted: false,
741
738
  createdAt: getDataTime(-1),
@@ -794,11 +791,11 @@ var CustomerService = function(props) {
794
791
  ctrl.current = new AbortController();
795
792
  clearTimeout(receiveMessageTimer.current);
796
793
  receiveMessageTimer.current = setTimeout(function() {
797
- setHistoryMessageList(function(historyMessageList) {
798
- return historyMessageList.filter(function(item) {
799
- return item.id != "123456" && item.id != "654321";
800
- });
801
- });
794
+ // setHistoryMessageList((historyMessageList) => {
795
+ // return historyMessageList.filter(
796
+ // (item) => item.id != "123456" && item.id != "654321"
797
+ // );
798
+ // });
802
799
  setFinished(true);
803
800
  ctrl.current.abort();
804
801
  setHistoryMessageList(function(historyMessageList) {
@@ -813,6 +810,7 @@ var CustomerService = function(props) {
813
810
  });
814
811
  });
815
812
  }, 60 * 1000);
813
+ setFinished(false);
816
814
  if (config && config.type == "video" && config.params) {
817
815
  var params = config.params;
818
816
  var videoId = params.videoId;
@@ -1452,10 +1450,10 @@ var CustomerService = function(props) {
1452
1450
  var watchTime = params.videoProgress;
1453
1451
  var courseId = getQuery("yc_id");
1454
1452
  var sectionId = params.VideoBriefSummaryId;
1455
- // let courseId="20899",
1456
- // sectionId= "462347",
1457
- // videoId= "29715",
1458
- // watchTime= 677
1453
+ // let courseId="31007",
1454
+ // sectionId= "446168",
1455
+ // videoId= "71399",
1456
+ // watchTime= 527
1459
1457
  if (videoId && courseId && sectionId) {
1460
1458
  console.log(recommendeQuestionID.current, "recommendeQuestionID.current");
1461
1459
  http.post("".concat(urllocation, "/chat-service/public/v1.0/knowledge-base/questions:recommend"), {
@@ -1485,17 +1483,13 @@ var CustomerService = function(props) {
1485
1483
  setHotQuestionsList(data);
1486
1484
  newHotQuestionsList.current = data;
1487
1485
  }
1488
- // let ids:any[] = [];
1489
- // data.map((str: { id: string; })=>{
1490
- // ids.push(str.id);
1491
- // })
1492
- // recommendeQuestionID.current = Array.from(new Set(recommendeQuestionID.current.concat(ids)));
1493
- resettingBottomHei();
1486
+ var ids = [];
1487
+ data.map(function(str) {
1488
+ ids.push(str.id);
1489
+ });
1490
+ recommendeQuestionID.current = Array.from(new Set(recommendeQuestionID.current.concat(ids)));
1494
1491
  scrollToBottom();
1495
- // console.log(data,99999);
1496
- // if(data.length < 4){
1497
- // getQuestiionsList('',4)
1498
- // }
1492
+ resettingBottomHei();
1499
1493
  }
1500
1494
  }).catch(function() {});
1501
1495
  }
@@ -1634,7 +1628,7 @@ var CustomerService = function(props) {
1634
1628
  }
1635
1629
  } else {
1636
1630
  if (document.getElementById("Drawer_buttom_modal")) {
1637
- var hei1 = document.getElementById("Drawer_buttom_modal").offsetHeight + document.getElementById("BottomAssociationProblem").offsetHeight;
1631
+ var hei1 = document.getElementById("Drawer_buttom_modal").offsetHeight + document.getElementById("BottomAssociationProblem_modal").offsetHeight;
1638
1632
  setButtomHei(hei1);
1639
1633
  }
1640
1634
  }
@@ -2152,7 +2146,6 @@ var CustomerService = function(props) {
2152
2146
  return /*#__PURE__*/ _jsx("li", {
2153
2147
  onClick: function() {
2154
2148
  sendMessage(list, 1);
2155
- recommendeQuestionID.current = recommendeQuestionID.current.concat(list.value);
2156
2149
  setBottomRecommendationQuestions([]);
2157
2150
  resettingBottomHei();
2158
2151
  },
@@ -2414,7 +2407,6 @@ var CustomerService = function(props) {
2414
2407
  } else if (JSON.parse(previousLineData.extraInfo).length > 0 && JSON.parse(previousLineData.extraInfo)[0].key == "imageUrl") {
2415
2408
  showTeacherBtn = false;
2416
2409
  }
2417
- console.log(showTeacherBtn, "dlvkdfl");
2418
2410
  /// style={{position:showStopBtn && isPosition.current ? 'sticky' : 'relative'}}
2419
2411
  return /*#__PURE__*/ _jsxs("div", {
2420
2412
  className: "".concat(styles.operate_modal_bottom),
@@ -2707,7 +2699,7 @@ var CustomerService = function(props) {
2707
2699
  onClick: function() {
2708
2700
  setHistoryMessageList(function(historyMessageList) {
2709
2701
  var newHistoryMessageList = historyMessageList.concat({
2710
- id: -1,
2702
+ id: "p" + new Date().getTime(),
2711
2703
  roomId: roomId,
2712
2704
  sender: mid,
2713
2705
  recevier: "AI",
@@ -2745,7 +2737,7 @@ var CustomerService = function(props) {
2745
2737
  onClick: function() {
2746
2738
  setHistoryMessageList(function(historyMessageList) {
2747
2739
  var newHistoryMessageList = historyMessageList.concat({
2748
- id: -1,
2740
+ id: "p" + new Date().getTime(),
2749
2741
  roomId: roomId,
2750
2742
  sender: mid,
2751
2743
  recevier: "AI",
@@ -3071,23 +3063,51 @@ var CustomerService = function(props) {
3071
3063
  };
3072
3064
  //视频页面底部推荐问题
3073
3065
  var renderBottomAssociationProblem = function() {
3074
- return /*#__PURE__*/ _jsx("div", {
3075
- className: styles.issues_list_flag,
3076
- id: "BottomAssociationProblem",
3077
- children: bottomRecommendationQuestions.map(function(item) {
3078
- return /*#__PURE__*/ _jsx("p", {
3079
- onClick: function() {
3080
- sendMessage(item, 1);
3081
- if (config && config.type == "video") {
3082
- recommendeQuestionID.current = recommendeQuestionID.current.concat(item.id);
3083
- setBottomRecommendationQuestions([]);
3084
- resettingBottomHei();
3085
- }
3086
- },
3087
- children: item.question
3088
- }, item.id);
3089
- })
3090
- });
3066
+ if (showType == 1 || showType == 3) {
3067
+ return /*#__PURE__*/ _jsx("div", {
3068
+ className: styles.issues_list_flag,
3069
+ id: "BottomAssociationProblem",
3070
+ children: bottomRecommendationQuestions.map(function(item) {
3071
+ return /*#__PURE__*/ _jsxs(_Fragment, {
3072
+ children: [
3073
+ /*#__PURE__*/ _jsx("p", {
3074
+ onClick: function() {
3075
+ sendMessage(item, 1);
3076
+ if (config && config.type == "video") {
3077
+ setBottomRecommendationQuestions([]);
3078
+ resettingBottomHei();
3079
+ }
3080
+ },
3081
+ children: item.question
3082
+ }, item.id),
3083
+ /*#__PURE__*/ _jsx("br", {})
3084
+ ]
3085
+ });
3086
+ })
3087
+ });
3088
+ } else {
3089
+ return /*#__PURE__*/ _jsx("div", {
3090
+ className: styles.issues_list_flag,
3091
+ id: "BottomAssociationProblem_modal",
3092
+ children: bottomRecommendationQuestions.map(function(item) {
3093
+ return /*#__PURE__*/ _jsxs(_Fragment, {
3094
+ children: [
3095
+ /*#__PURE__*/ _jsx("p", {
3096
+ onClick: function() {
3097
+ sendMessage(item, 1);
3098
+ if (config && config.type == "video") {
3099
+ setBottomRecommendationQuestions([]);
3100
+ resettingBottomHei();
3101
+ }
3102
+ },
3103
+ children: item.question
3104
+ }, item.id),
3105
+ /*#__PURE__*/ _jsx("br", {})
3106
+ ]
3107
+ });
3108
+ })
3109
+ });
3110
+ }
3091
3111
  };
3092
3112
  //加载指定数据,点击历史记录
3093
3113
  var loadSpecifiedData = function(renewRoomId, page, id, receiver, keyWordProblem) {
@@ -3185,7 +3205,7 @@ var CustomerService = function(props) {
3185
3205
  className: styles.Drawer_buttom_Issues_List,
3186
3206
  children: [
3187
3207
  renderAssociationProblem(),
3188
- renderBottomAssociationProblem(),
3208
+ showType == 1 && renderBottomAssociationProblem(),
3189
3209
  /*#__PURE__*/ _jsx("div", {
3190
3210
  className: styles.Drawer_buttom,
3191
3211
  id: "Drawer_buttom",
@@ -3272,6 +3292,7 @@ var CustomerService = function(props) {
3272
3292
  className: styles.Drawer_buttom_Issues_List,
3273
3293
  children: [
3274
3294
  renderAssociationProblem(),
3295
+ showType == 2 && renderBottomAssociationProblem(),
3275
3296
  /*#__PURE__*/ _jsx("div", {
3276
3297
  className: styles.Drawer_buttom,
3277
3298
  id: "Drawer_buttom_modal",
@@ -3367,6 +3388,7 @@ var CustomerService = function(props) {
3367
3388
  className: "".concat(styles.Drawer_buttom_Issues_List, " ").concat(styles.Drawer_buttom_Issues_List_newlabo),
3368
3389
  children: [
3369
3390
  renderAssociationProblem(),
3391
+ showType == 3 && renderBottomAssociationProblem(),
3370
3392
  /*#__PURE__*/ _jsx("div", {
3371
3393
  className: styles.Drawer_buttom,
3372
3394
  id: "Drawer_buttom",
@@ -3474,6 +3496,7 @@ var CustomerService = function(props) {
3474
3496
  className: styles.Drawer_buttom_Issues_List,
3475
3497
  children: [
3476
3498
  renderAssociationProblem(),
3499
+ (showType == 4 || showType == 5) && renderBottomAssociationProblem(),
3477
3500
  /*#__PURE__*/ _jsx("div", {
3478
3501
  className: styles.Drawer_buttom,
3479
3502
  id: "Drawer_buttom_modal",
@@ -3564,6 +3587,7 @@ var CustomerService = function(props) {
3564
3587
  className: "".concat(styles.Drawer_buttom_Issues_List, " ").concat(styles.Drawer_buttom_Issues_List_newlabo),
3565
3588
  children: [
3566
3589
  renderAssociationProblem(),
3590
+ (showType == 4 || showType == 5) && renderBottomAssociationProblem(),
3567
3591
  /*#__PURE__*/ _jsx("div", {
3568
3592
  className: styles.Drawer_buttom,
3569
3593
  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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bhd-components",
3
- "version": "0.7.17",
3
+ "version": "0.7.18",
4
4
  "description": "组件功能描述",
5
5
  "files": [
6
6
  "esm",