bhd-components 0.9.13 → 0.9.14

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.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # bhd-components
2
2
 
3
- **当前版本:** 0.9.13
3
+ **当前版本:** 0.9.14
4
4
 
5
5
  ## Install
6
6
 
@@ -2669,7 +2669,8 @@ var urlToBase64 = function(url) {
2669
2669
  return new Promise(function(resolve) {
2670
2670
  var image = new Image();
2671
2671
  // 先设置图片跨域属性
2672
- image.crossOrigin = "Anonymous";
2672
+ // image.crossOrigin = 'Anonymous'
2673
+ image.setAttribute("crossOrigin", "Anonymous"); // 解决控制台跨域报错的问题
2673
2674
  // 再给image赋值src属性,先后顺序不能颠倒
2674
2675
  image.src = url;
2675
2676
  image.onload = function() {
@@ -8398,7 +8399,7 @@ var CustomerService = function(props) {
8398
8399
  roomId: roomId,
8399
8400
  sender: "AI",
8400
8401
  recevier: mid,
8401
- message: "Hi,我是智能学习助手,你遇到了什么问题?111",
8402
+ message: "Hi,我是智能学习助手,你遇到了什么问题?",
8402
8403
  extraInfos: questionsList == null ? null : questionsList
8403
8404
  };
8404
8405
  if (pageNumHistory <= 1) {
@@ -8428,7 +8429,7 @@ var CustomerService = function(props) {
8428
8429
  roomId: roomId,
8429
8430
  sender: "AI",
8430
8431
  recevier: mid,
8431
- message: "Hi,我是智能学习助手,你遇到了什么问题?222哈哈"
8432
+ message: "Hi,我是智能学习助手,你遇到了什么问题?"
8432
8433
  };
8433
8434
  if (pageNumHistory <= 1) {
8434
8435
  setHistoryMessageList(function(historyMessageList) {
@@ -8596,117 +8597,90 @@ var CustomerService = function(props) {
8596
8597
  //消息发送给老师type == 1,召唤老师时发送,type == 2,在老师聊天窗口聊天
8597
8598
  var sendToTeacher = function() {
8598
8599
  var _ref = _async_to_generator(function(type) {
8599
- var message, obj, list, recevier, base64;
8600
+ var message, obj, list, recevier;
8600
8601
  var _arguments = arguments;
8601
8602
  return __generator(this, function(_state) {
8602
- switch(_state.label){
8603
- case 0:
8604
- message = _arguments.length > 1 && _arguments[1] !== void 0 ? _arguments[1] : "";
8605
- console.log("消息发送给老师111");
8606
- obj = {};
8607
- if (!(type == 1)) return [
8608
- 3,
8609
- 1
8610
- ];
8611
- obj = {
8612
- roomId: roomId,
8613
- sender: mid,
8614
- recevier: chatWith.uid,
8615
- message: problem.question
8616
- };
8617
- if (problem.url) {
8618
- obj.image = problem.url;
8619
- }
8620
- setProblem({});
8621
- return [
8622
- 3,
8623
- 4
8624
- ];
8625
- case 1:
8626
- if (!(type == 2 || type == 3)) return [
8627
- 3,
8628
- 4
8629
- ];
8630
- list = contactsList.filter(function(item) {
8631
- return item.roomId == roomId;
8632
- });
8633
- recevier = "";
8634
- if (list.length > 0) {
8635
- recevier = list[0].sender;
8636
- }
8637
- obj = {
8638
- roomId: roomId,
8639
- sender: mid,
8640
- recevier: recevier,
8641
- message: type == 2 ? keyWord : message,
8642
- quotedMessage: citationContent.content || ""
8643
- };
8644
- if (!citationContent.imageUrl) return [
8645
- 3,
8646
- 3
8647
- ];
8648
- return [
8649
- 4,
8650
- urlToBase64(citationContent.imageUrl)
8651
- ];
8652
- case 2:
8653
- base64 = _state.sent();
8654
- console.log("citationContent.imageUrl", citationContent.imageUrl);
8655
- //imageUrl = citationContent.imageUrl;
8656
- obj.image = base64;
8657
- _state.label = 3;
8658
- case 3:
8659
- if (screenshotBese64) {
8660
- obj.image = screenshotBese64;
8661
- setScreenshotBese64("");
8662
- }
8663
- _state.label = 4;
8664
- case 4:
8665
- http.post("".concat(urllocation, "/chat-service/public/v1.0/chat-with-user/messages"), obj).then(function(res) {
8666
- if (res.data.id) {
8667
- // console.log(pageNum, pageNumHistory, lastId, "dlskskdsd4444");
8668
- if (pageNum == 1 || pageNumHistory == 1 || pageNumHistory == 0) {
8669
- setHistoryMessageList(function(historyMessageList) {
8670
- var newHistoryMessageList = historyMessageList.concat(_object_spread_props(_object_spread({}, obj), {
8671
- id: res.data.id,
8672
- upvoted: false,
8673
- downvoted: false,
8674
- createdAt: getDataTime(-1),
8675
- extraInfo: obj.image ? JSON.stringify([
8676
- {
8677
- key: "imageUrl",
8678
- value: obj.image
8679
- }
8680
- ]) : null
8681
- }));
8682
- return newHistoryMessageList;
8683
- });
8684
- // console.log(lastId,'消息发送给老师111');
8685
- scrollToBottom();
8686
- }
8687
- //判断当前窗口是否是
8688
- if (type == 1) {
8689
- var roomList = [
8603
+ message = _arguments.length > 1 && _arguments[1] !== void 0 ? _arguments[1] : "";
8604
+ console.log("消息发送给老师111");
8605
+ obj = {};
8606
+ if (type == 1) {
8607
+ obj = {
8608
+ roomId: roomId,
8609
+ sender: mid,
8610
+ recevier: chatWith.uid,
8611
+ message: problem.question
8612
+ };
8613
+ if (problem.url) {
8614
+ obj.image = problem.url;
8615
+ }
8616
+ setProblem({});
8617
+ } else if (type == 2 || type == 3) {
8618
+ list = contactsList.filter(function(item) {
8619
+ return item.roomId == roomId;
8620
+ });
8621
+ recevier = "";
8622
+ if (list.length > 0) {
8623
+ recevier = list[0].sender;
8624
+ }
8625
+ obj = {
8626
+ roomId: roomId,
8627
+ sender: mid,
8628
+ recevier: recevier,
8629
+ message: type == 2 ? keyWord : message,
8630
+ quotedMessage: citationContent.content || ""
8631
+ };
8632
+ if (citationContent.imageUrl) {
8633
+ obj.image = citationContent.imageUrl;
8634
+ }
8635
+ if (screenshotBese64) {
8636
+ obj.image = screenshotBese64;
8637
+ setScreenshotBese64("");
8638
+ }
8639
+ }
8640
+ http.post("".concat(urllocation, "/chat-service/public/v1.0/chat-with-user/messages"), obj).then(function(res) {
8641
+ if (res.data.id) {
8642
+ // console.log(pageNum, pageNumHistory, lastId, "dlskskdsd4444");
8643
+ if (pageNum == 1 || pageNumHistory == 1 || pageNumHistory == 0) {
8644
+ setHistoryMessageList(function(historyMessageList) {
8645
+ var newHistoryMessageList = historyMessageList.concat(_object_spread_props(_object_spread({}, obj), {
8646
+ id: res.data.id,
8647
+ upvoted: false,
8648
+ downvoted: false,
8649
+ createdAt: getDataTime(-1),
8650
+ extraInfo: obj.image ? JSON.stringify([
8690
8651
  {
8691
- roomId: roomId,
8692
- id: res.data.id
8652
+ key: "imageUrl",
8653
+ value: obj.image
8693
8654
  }
8694
- ];
8695
- setChatObj(function(list) {
8696
- var list2 = list.filter(function(item) {
8697
- return item.id != roomList[0].id;
8698
- });
8699
- return list2.concat(roomList);
8700
- });
8655
+ ]) : null
8656
+ }));
8657
+ return newHistoryMessageList;
8658
+ });
8659
+ // console.log(lastId,'消息发送给老师111');
8660
+ scrollToBottom();
8661
+ }
8662
+ //判断当前窗口是否是
8663
+ if (type == 1) {
8664
+ var roomList = [
8665
+ {
8666
+ roomId: roomId,
8667
+ id: res.data.id
8701
8668
  }
8702
- }
8703
- }).catch(function(err) {
8704
- console.log(err);
8705
- });
8706
- return [
8707
- 2
8708
- ];
8709
- }
8669
+ ];
8670
+ setChatObj(function(list) {
8671
+ var list2 = list.filter(function(item) {
8672
+ return item.id != roomList[0].id;
8673
+ });
8674
+ return list2.concat(roomList);
8675
+ });
8676
+ }
8677
+ }
8678
+ }).catch(function(err) {
8679
+ console.log(err);
8680
+ });
8681
+ return [
8682
+ 2
8683
+ ];
8710
8684
  });
8711
8685
  });
8712
8686
  return function sendToTeacher(type) {
@@ -8822,9 +8796,9 @@ var CustomerService = function(props) {
8822
8796
  ];
8823
8797
  case 2:
8824
8798
  base64 = _state.sent();
8799
+ console.log("base64", base64);
8825
8800
  console.log("citationContent.imageUrl", citationContent.imageUrl);
8826
- sendData1.image = citationContent.imageUrl;
8827
- //imageUrl = citationContent.imageUrl;
8801
+ sendData1.image = base64;
8828
8802
  imageUrl = base64;
8829
8803
  _state.label = 3;
8830
8804
  case 3: