bhd-components 0.7.14 → 0.7.16

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.
@@ -309,7 +309,7 @@ const CustomerService = (props)=>{
309
309
  };
310
310
  //发送欢迎语,视频页面
311
311
  const sendWelcomMessage = ()=>{
312
- if (config.type == 'video') {
312
+ if (config && config.type == 'video') {
313
313
  let params = config.params;
314
314
  let videoId = params.videoId;
315
315
  let watchTime = params.videoProgress;
@@ -333,42 +333,46 @@ const CustomerService = (props)=>{
333
333
  ],
334
334
  "maximum": 3
335
335
  }).then((res)=>{
336
- let data = res.data.questions;
337
- let questionsList = data.map((item, index)=>{
338
- if (index < 3) {
339
- return {
340
- key: "messageSource",
341
- value: item.id,
342
- question: item.question,
343
- answer: item.answer
344
- };
345
- } else {
346
- return null;
336
+ try {
337
+ let data = res.data.questions;
338
+ let questionsList = null;
339
+ if (data.length > 0) {
340
+ questionsList = data.map((item, index)=>{
341
+ return {
342
+ key: "messageSource",
343
+ value: item.id,
344
+ question: item.question,
345
+ answer: item.answer
346
+ };
347
+ });
347
348
  }
348
- });
349
- let obj = {
350
- roomId: roomId,
351
- sender: "AI",
352
- recevier: mid,
353
- message: `Hi,我是智能学习助手,你遇到了什么问题?`,
354
- extraInfos: questionsList.length > 0 ? questionsList : null
355
- };
356
- if (pageNumHistory <= 1) {
357
- setHistoryMessageList((historyMessageList)=>{
358
- let newHistoryMessageList = historyMessageList.filter((e)=>e.id != '123456_date');
359
- newHistoryMessageList.push(_object_spread_props(_object_spread({}, obj), {
360
- id: '123456_date',
361
- upvoted: false,
362
- downvoted: false,
363
- quotedMessage: "",
364
- createdAt: getDataTime(-1),
365
- extraInfo: JSON.stringify(obj.extraInfos)
366
- }));
367
- return newHistoryMessageList;
368
- });
369
- scrollToBottom();
370
- }
371
- return;
349
+ console.log('dflkvmdfklvdf欢迎语', data);
350
+ let obj = {
351
+ roomId: roomId,
352
+ sender: "AI",
353
+ recevier: mid,
354
+ message: `Hi,我是智能学习助手,你遇到了什么问题?`,
355
+ extraInfos: questionsList == null ? null : questionsList
356
+ };
357
+ if (pageNumHistory <= 1) {
358
+ console.log('欢迎语');
359
+ setHistoryMessageList((historyMessageList)=>{
360
+ let newHistoryMessageList = historyMessageList.filter((e)=>e.id != '123456_date');
361
+ newHistoryMessageList.push(_object_spread_props(_object_spread({}, obj), {
362
+ id: '123456_date',
363
+ upvoted: false,
364
+ downvoted: false,
365
+ quotedMessage: "",
366
+ createdAt: getDataTime(-1),
367
+ extraInfo: obj.extraInfos != null ? JSON.stringify(obj.extraInfos) : null
368
+ }));
369
+ console.log(newHistoryMessageList, 3333333333339999);
370
+ return newHistoryMessageList;
371
+ });
372
+ scrollToBottom();
373
+ }
374
+ return;
375
+ } catch (error) {}
372
376
  }).catch(()=>{});
373
377
  }
374
378
  } else {
@@ -406,6 +410,7 @@ const CustomerService = (props)=>{
406
410
  let questionsList = [];
407
411
  let obj = {};
408
412
  if (type == 1) {
413
+ console.log('dflkvmdfklvdf欢迎语');
409
414
  sendWelcomMessage();
410
415
  // console.log(hotQuestionsList,newHotQuestionsList.current,'33322221111');
411
416
  // if(newHotQuestionsList.current.length > 0){
@@ -2096,7 +2101,7 @@ const CustomerService = (props)=>{
2096
2101
  //是否在智能客服窗口
2097
2102
  isAiChatWindow = chatWindow.length > 0 && chatWindow[0].sender != undefined && chatWindow[0].sender == "AI" ? true : false;
2098
2103
  let header = 2; //代表是ai头像
2099
- if (isAiChatWindow && item.extraInfo != undefined && JSON.parse(item.extraInfo).length > 0 && JSON.parse(item.extraInfo)[0].key == "isVoteMessage") {
2104
+ if (isAiChatWindow && item.extraInfo && JSON.parse(item.extraInfo).length > 0 && JSON.parse(item.extraInfo)[0].key == "isVoteMessage") {
2100
2105
  //使用AI头像
2101
2106
  header = 1;
2102
2107
  }
@@ -2160,7 +2165,7 @@ const CustomerService = (props)=>{
2160
2165
  })
2161
2166
  ]
2162
2167
  }),
2163
- 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", {
2168
+ item.extraInfo && JSON.parse(item.extraInfo).length > 0 && JSON.parse(item.extraInfo)[0].key == "messageSource" && JSON.parse(item.extraInfo)[0].value != "knowledgebase" && /*#__PURE__*/ _jsxs("ul", {
2164
2169
  className: `${styles.association_problem} ${item.message == '抱歉,我暂时无法回答这样的问题。' ? styles.association_problem_flag : ''}`,
2165
2170
  children: [
2166
2171
  item.message == '抱歉,我暂时无法回答这样的问题。' && /*#__PURE__*/ _jsx("li", {
@@ -627,6 +627,44 @@
627
627
  }
628
628
 
629
629
 
630
+ .association_problem_flag{
631
+
632
+ li{
633
+ padding-left: 30px;
634
+ position: relative;
635
+ &::after{
636
+ content: '';
637
+ width: 6px;
638
+ height: 6px;
639
+ border-radius: 50%;
640
+ background-color: rgba(217, 217, 217, 1);
641
+ display: block;
642
+ position: absolute;
643
+ top: 26px;
644
+ left: 10px;
645
+ }
646
+ }
647
+
648
+ li:first-child{
649
+ padding-left:0;
650
+ &::after{
651
+ display: none;
652
+ }
653
+ }
654
+
655
+ .related_issues_flag{
656
+ span{
657
+ color: #000;
658
+ font-weight: 600;
659
+ border-bottom: 6px solid @color-background-primary-weak-hover;
660
+ display: inline-block;
661
+ height: 22px;
662
+ }
663
+
664
+ }
665
+ }
666
+
667
+
630
668
  .img_con{
631
669
  width: 100%;
632
670
  text-align: center;
@@ -754,33 +792,6 @@
754
792
  }
755
793
  }
756
794
 
757
- .association_problem_flag{
758
- padding-left: 30px;
759
-
760
- li{
761
- position: relative;
762
- &::after{
763
- content: '';
764
- width: 6px;
765
- height: 6px;
766
- border-radius: 50%;
767
- background-color: rgba(217, 217, 217, 1);
768
- display: block;
769
- position: absolute;
770
- top: 12px;
771
- left: 12px;
772
- }
773
- }
774
- .related_issues_flag{
775
- span{
776
- color: #000;
777
- font-weight: 600;
778
- border-bottom: 4px solid @color-background-primary-weak-hover;
779
- }
780
-
781
- }
782
- }
783
-
784
795
  .time {
785
796
  display: block;
786
797
  margin: 40px 0;
@@ -313,7 +313,7 @@ var CustomerService = function(props) {
313
313
  };
314
314
  //发送欢迎语,视频页面
315
315
  var sendWelcomMessage = function() {
316
- if (config.type == "video") {
316
+ if (config && config.type == "video") {
317
317
  var params = config.params;
318
318
  var videoId = params.videoId;
319
319
  var watchTime = params.videoProgress;
@@ -337,44 +337,48 @@ var CustomerService = function(props) {
337
337
  ],
338
338
  "maximum": 3
339
339
  }).then(function(res) {
340
- var data = res.data.questions;
341
- var questionsList = data.map(function(item, index) {
342
- if (index < 3) {
343
- return {
344
- key: "messageSource",
345
- value: item.id,
346
- question: item.question,
347
- answer: item.answer
348
- };
349
- } else {
350
- return null;
340
+ try {
341
+ var data = res.data.questions;
342
+ var questionsList = null;
343
+ if (data.length > 0) {
344
+ questionsList = data.map(function(item, index) {
345
+ return {
346
+ key: "messageSource",
347
+ value: item.id,
348
+ question: item.question,
349
+ answer: item.answer
350
+ };
351
+ });
351
352
  }
352
- });
353
- var obj = {
354
- roomId: roomId,
355
- sender: "AI",
356
- recevier: mid,
357
- message: "Hi,我是智能学习助手,你遇到了什么问题?",
358
- extraInfos: questionsList.length > 0 ? questionsList : null
359
- };
360
- if (pageNumHistory <= 1) {
361
- setHistoryMessageList(function(historyMessageList) {
362
- var newHistoryMessageList = historyMessageList.filter(function(e) {
363
- return e.id != "123456_date";
353
+ console.log("dflkvmdfklvdf欢迎语", data);
354
+ var obj = {
355
+ roomId: roomId,
356
+ sender: "AI",
357
+ recevier: mid,
358
+ message: "Hi,我是智能学习助手,你遇到了什么问题?",
359
+ extraInfos: questionsList == null ? null : questionsList
360
+ };
361
+ if (pageNumHistory <= 1) {
362
+ console.log("欢迎语");
363
+ setHistoryMessageList(function(historyMessageList) {
364
+ var newHistoryMessageList = historyMessageList.filter(function(e) {
365
+ return e.id != "123456_date";
366
+ });
367
+ newHistoryMessageList.push(_object_spread_props(_object_spread({}, obj), {
368
+ id: "123456_date",
369
+ upvoted: false,
370
+ downvoted: false,
371
+ quotedMessage: "",
372
+ createdAt: getDataTime(-1),
373
+ extraInfo: obj.extraInfos != null ? JSON.stringify(obj.extraInfos) : null
374
+ }));
375
+ console.log(newHistoryMessageList, 3333333333339999);
376
+ return newHistoryMessageList;
364
377
  });
365
- newHistoryMessageList.push(_object_spread_props(_object_spread({}, obj), {
366
- id: "123456_date",
367
- upvoted: false,
368
- downvoted: false,
369
- quotedMessage: "",
370
- createdAt: getDataTime(-1),
371
- extraInfo: JSON.stringify(obj.extraInfos)
372
- }));
373
- return newHistoryMessageList;
374
- });
375
- scrollToBottom();
376
- }
377
- return;
378
+ scrollToBottom();
379
+ }
380
+ return;
381
+ } catch (error) {}
378
382
  }).catch(function() {});
379
383
  }
380
384
  } else {
@@ -414,6 +418,7 @@ var CustomerService = function(props) {
414
418
  var questionsList = [];
415
419
  var obj = {};
416
420
  if (type == 1) {
421
+ console.log("dflkvmdfklvdf欢迎语");
417
422
  sendWelcomMessage();
418
423
  // console.log(hotQuestionsList,newHotQuestionsList.current,'33322221111');
419
424
  // if(newHotQuestionsList.current.length > 0){
@@ -2120,7 +2125,7 @@ var CustomerService = function(props) {
2120
2125
  //是否在智能客服窗口
2121
2126
  isAiChatWindow = chatWindow.length > 0 && chatWindow[0].sender != undefined && chatWindow[0].sender == "AI" ? true : false;
2122
2127
  var header = 2; //代表是ai头像
2123
- if (isAiChatWindow && item.extraInfo != undefined && JSON.parse(item.extraInfo).length > 0 && JSON.parse(item.extraInfo)[0].key == "isVoteMessage") {
2128
+ if (isAiChatWindow && item.extraInfo && JSON.parse(item.extraInfo).length > 0 && JSON.parse(item.extraInfo)[0].key == "isVoteMessage") {
2124
2129
  //使用AI头像
2125
2130
  header = 1;
2126
2131
  }
@@ -2184,7 +2189,7 @@ var CustomerService = function(props) {
2184
2189
  })
2185
2190
  ]
2186
2191
  }),
2187
- 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", {
2192
+ item.extraInfo && JSON.parse(item.extraInfo).length > 0 && JSON.parse(item.extraInfo)[0].key == "messageSource" && JSON.parse(item.extraInfo)[0].value != "knowledgebase" && /*#__PURE__*/ _jsxs("ul", {
2188
2193
  className: "".concat(styles.association_problem, " ").concat(item.message == "抱歉,我暂时无法回答这样的问题。" ? styles.association_problem_flag : ""),
2189
2194
  children: [
2190
2195
  item.message == "抱歉,我暂时无法回答这样的问题。" && /*#__PURE__*/ _jsx("li", {
@@ -627,6 +627,44 @@
627
627
  }
628
628
 
629
629
 
630
+ .association_problem_flag{
631
+
632
+ li{
633
+ padding-left: 30px;
634
+ position: relative;
635
+ &::after{
636
+ content: '';
637
+ width: 6px;
638
+ height: 6px;
639
+ border-radius: 50%;
640
+ background-color: rgba(217, 217, 217, 1);
641
+ display: block;
642
+ position: absolute;
643
+ top: 26px;
644
+ left: 10px;
645
+ }
646
+ }
647
+
648
+ li:first-child{
649
+ padding-left:0;
650
+ &::after{
651
+ display: none;
652
+ }
653
+ }
654
+
655
+ .related_issues_flag{
656
+ span{
657
+ color: #000;
658
+ font-weight: 600;
659
+ border-bottom: 6px solid @color-background-primary-weak-hover;
660
+ display: inline-block;
661
+ height: 22px;
662
+ }
663
+
664
+ }
665
+ }
666
+
667
+
630
668
  .img_con{
631
669
  width: 100%;
632
670
  text-align: center;
@@ -754,33 +792,6 @@
754
792
  }
755
793
  }
756
794
 
757
- .association_problem_flag{
758
- padding-left: 30px;
759
-
760
- li{
761
- position: relative;
762
- &::after{
763
- content: '';
764
- width: 6px;
765
- height: 6px;
766
- border-radius: 50%;
767
- background-color: rgba(217, 217, 217, 1);
768
- display: block;
769
- position: absolute;
770
- top: 12px;
771
- left: 12px;
772
- }
773
- }
774
- .related_issues_flag{
775
- span{
776
- color: #000;
777
- font-weight: 600;
778
- border-bottom: 4px solid @color-background-primary-weak-hover;
779
- }
780
-
781
- }
782
- }
783
-
784
795
  .time {
785
796
  display: block;
786
797
  margin: 40px 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bhd-components",
3
- "version": "0.7.14",
3
+ "version": "0.7.16",
4
4
  "description": "组件功能描述",
5
5
  "files": [
6
6
  "esm",