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.
@@ -160,7 +160,8 @@ const urlToBase64 = (url)=>{
160
160
  return new Promise((resolve)=>{
161
161
  const image = new Image();
162
162
  // 先设置图片跨域属性
163
- image.crossOrigin = 'Anonymous';
163
+ // image.crossOrigin = 'Anonymous'
164
+ image.setAttribute("crossOrigin", "Anonymous"); // 解决控制台跨域报错的问题
164
165
  // 再给image赋值src属性,先后顺序不能颠倒
165
166
  image.src = url;
166
167
  image.onload = function() {
@@ -523,7 +523,7 @@ const CustomerService = (props)=>{
523
523
  roomId: roomId,
524
524
  sender: "AI",
525
525
  recevier: mid,
526
- message: `Hi,我是智能学习助手,你遇到了什么问题?111`,
526
+ message: `Hi,我是智能学习助手,你遇到了什么问题?`,
527
527
  extraInfos: questionsList == null ? null : questionsList
528
528
  };
529
529
  if (pageNumHistory <= 1) {
@@ -551,7 +551,7 @@ const CustomerService = (props)=>{
551
551
  roomId: roomId,
552
552
  sender: "AI",
553
553
  recevier: mid,
554
- message: `Hi,我是智能学习助手,你遇到了什么问题?222哈哈`
554
+ message: `Hi,我是智能学习助手,你遇到了什么问题?`
555
555
  };
556
556
  if (pageNumHistory <= 1) {
557
557
  setHistoryMessageList((historyMessageList)=>{
@@ -743,12 +743,7 @@ const CustomerService = (props)=>{
743
743
  quotedMessage: citationContent.content || ""
744
744
  };
745
745
  if (citationContent.imageUrl) {
746
- // obj.image = citationContent.imageUrl;
747
- // obj.image = urlToBase64(citationContent.imageUrl);
748
- let base64 = await urlToBase64(citationContent.imageUrl);
749
- console.log('citationContent.imageUrl', citationContent.imageUrl);
750
- //imageUrl = citationContent.imageUrl;
751
- obj.image = base64;
746
+ obj.image = citationContent.imageUrl;
752
747
  }
753
748
  if (screenshotBese64) {
754
749
  obj.image = screenshotBese64;
@@ -874,9 +869,9 @@ const CustomerService = (props)=>{
874
869
  let imageUrl = '';
875
870
  if (citationContent.imageUrl) {
876
871
  let base64 = await urlToBase64(citationContent.imageUrl);
872
+ console.log('base64', base64);
877
873
  console.log('citationContent.imageUrl', citationContent.imageUrl);
878
- sendData.image = citationContent.imageUrl;
879
- //imageUrl = citationContent.imageUrl;
874
+ sendData.image = base64;
880
875
  imageUrl = base64;
881
876
  }
882
877
  if (screenshotBese64) {
@@ -164,7 +164,8 @@ var urlToBase64 = function(url) {
164
164
  return new Promise(function(resolve) {
165
165
  var image = new Image();
166
166
  // 先设置图片跨域属性
167
- image.crossOrigin = "Anonymous";
167
+ // image.crossOrigin = 'Anonymous'
168
+ image.setAttribute("crossOrigin", "Anonymous"); // 解决控制台跨域报错的问题
168
169
  // 再给image赋值src属性,先后顺序不能颠倒
169
170
  image.src = url;
170
171
  image.onload = function() {
@@ -534,7 +534,7 @@ var CustomerService = function(props) {
534
534
  roomId: roomId,
535
535
  sender: "AI",
536
536
  recevier: mid,
537
- message: "Hi,我是智能学习助手,你遇到了什么问题?111",
537
+ message: "Hi,我是智能学习助手,你遇到了什么问题?",
538
538
  extraInfos: questionsList == null ? null : questionsList
539
539
  };
540
540
  if (pageNumHistory <= 1) {
@@ -564,7 +564,7 @@ var CustomerService = function(props) {
564
564
  roomId: roomId,
565
565
  sender: "AI",
566
566
  recevier: mid,
567
- message: "Hi,我是智能学习助手,你遇到了什么问题?222哈哈"
567
+ message: "Hi,我是智能学习助手,你遇到了什么问题?"
568
568
  };
569
569
  if (pageNumHistory <= 1) {
570
570
  setHistoryMessageList(function(historyMessageList) {
@@ -732,117 +732,90 @@ var CustomerService = function(props) {
732
732
  //消息发送给老师type == 1,召唤老师时发送,type == 2,在老师聊天窗口聊天
733
733
  var sendToTeacher = function() {
734
734
  var _ref = _async_to_generator(function(type) {
735
- var message, obj, list, recevier, base64;
735
+ var message, obj, list, recevier;
736
736
  var _arguments = arguments;
737
737
  return _ts_generator(this, function(_state) {
738
- switch(_state.label){
739
- case 0:
740
- message = _arguments.length > 1 && _arguments[1] !== void 0 ? _arguments[1] : "";
741
- console.log("消息发送给老师111");
742
- obj = {};
743
- if (!(type == 1)) return [
744
- 3,
745
- 1
746
- ];
747
- obj = {
748
- roomId: roomId,
749
- sender: mid,
750
- recevier: chatWith.uid,
751
- message: problem.question
752
- };
753
- if (problem.url) {
754
- obj.image = problem.url;
755
- }
756
- setProblem({});
757
- return [
758
- 3,
759
- 4
760
- ];
761
- case 1:
762
- if (!(type == 2 || type == 3)) return [
763
- 3,
764
- 4
765
- ];
766
- list = contactsList.filter(function(item) {
767
- return item.roomId == roomId;
768
- });
769
- recevier = "";
770
- if (list.length > 0) {
771
- recevier = list[0].sender;
772
- }
773
- obj = {
774
- roomId: roomId,
775
- sender: mid,
776
- recevier: recevier,
777
- message: type == 2 ? keyWord : message,
778
- quotedMessage: citationContent.content || ""
779
- };
780
- if (!citationContent.imageUrl) return [
781
- 3,
782
- 3
783
- ];
784
- return [
785
- 4,
786
- urlToBase64(citationContent.imageUrl)
787
- ];
788
- case 2:
789
- base64 = _state.sent();
790
- console.log("citationContent.imageUrl", citationContent.imageUrl);
791
- //imageUrl = citationContent.imageUrl;
792
- obj.image = base64;
793
- _state.label = 3;
794
- case 3:
795
- if (screenshotBese64) {
796
- obj.image = screenshotBese64;
797
- setScreenshotBese64("");
798
- }
799
- _state.label = 4;
800
- case 4:
801
- http.post("".concat(urllocation, "/chat-service/public/v1.0/chat-with-user/messages"), obj).then(function(res) {
802
- if (res.data.id) {
803
- // console.log(pageNum, pageNumHistory, lastId, "dlskskdsd4444");
804
- if (pageNum == 1 || pageNumHistory == 1 || pageNumHistory == 0) {
805
- setHistoryMessageList(function(historyMessageList) {
806
- var newHistoryMessageList = historyMessageList.concat(_object_spread_props(_object_spread({}, obj), {
807
- id: res.data.id,
808
- upvoted: false,
809
- downvoted: false,
810
- createdAt: getDataTime(-1),
811
- extraInfo: obj.image ? JSON.stringify([
812
- {
813
- key: "imageUrl",
814
- value: obj.image
815
- }
816
- ]) : null
817
- }));
818
- return newHistoryMessageList;
819
- });
820
- // console.log(lastId,'消息发送给老师111');
821
- scrollToBottom();
822
- }
823
- //判断当前窗口是否是
824
- if (type == 1) {
825
- var roomList = [
738
+ message = _arguments.length > 1 && _arguments[1] !== void 0 ? _arguments[1] : "";
739
+ console.log("消息发送给老师111");
740
+ obj = {};
741
+ if (type == 1) {
742
+ obj = {
743
+ roomId: roomId,
744
+ sender: mid,
745
+ recevier: chatWith.uid,
746
+ message: problem.question
747
+ };
748
+ if (problem.url) {
749
+ obj.image = problem.url;
750
+ }
751
+ setProblem({});
752
+ } else if (type == 2 || type == 3) {
753
+ list = contactsList.filter(function(item) {
754
+ return item.roomId == roomId;
755
+ });
756
+ recevier = "";
757
+ if (list.length > 0) {
758
+ recevier = list[0].sender;
759
+ }
760
+ obj = {
761
+ roomId: roomId,
762
+ sender: mid,
763
+ recevier: recevier,
764
+ message: type == 2 ? keyWord : message,
765
+ quotedMessage: citationContent.content || ""
766
+ };
767
+ if (citationContent.imageUrl) {
768
+ obj.image = citationContent.imageUrl;
769
+ }
770
+ if (screenshotBese64) {
771
+ obj.image = screenshotBese64;
772
+ setScreenshotBese64("");
773
+ }
774
+ }
775
+ http.post("".concat(urllocation, "/chat-service/public/v1.0/chat-with-user/messages"), obj).then(function(res) {
776
+ if (res.data.id) {
777
+ // console.log(pageNum, pageNumHistory, lastId, "dlskskdsd4444");
778
+ if (pageNum == 1 || pageNumHistory == 1 || pageNumHistory == 0) {
779
+ setHistoryMessageList(function(historyMessageList) {
780
+ var newHistoryMessageList = historyMessageList.concat(_object_spread_props(_object_spread({}, obj), {
781
+ id: res.data.id,
782
+ upvoted: false,
783
+ downvoted: false,
784
+ createdAt: getDataTime(-1),
785
+ extraInfo: obj.image ? JSON.stringify([
826
786
  {
827
- roomId: roomId,
828
- id: res.data.id
787
+ key: "imageUrl",
788
+ value: obj.image
829
789
  }
830
- ];
831
- setChatObj(function(list) {
832
- var list2 = list.filter(function(item) {
833
- return item.id != roomList[0].id;
834
- });
835
- return list2.concat(roomList);
836
- });
790
+ ]) : null
791
+ }));
792
+ return newHistoryMessageList;
793
+ });
794
+ // console.log(lastId,'消息发送给老师111');
795
+ scrollToBottom();
796
+ }
797
+ //判断当前窗口是否是
798
+ if (type == 1) {
799
+ var roomList = [
800
+ {
801
+ roomId: roomId,
802
+ id: res.data.id
837
803
  }
838
- }
839
- }).catch(function(err) {
840
- console.log(err);
841
- });
842
- return [
843
- 2
844
- ];
845
- }
804
+ ];
805
+ setChatObj(function(list) {
806
+ var list2 = list.filter(function(item) {
807
+ return item.id != roomList[0].id;
808
+ });
809
+ return list2.concat(roomList);
810
+ });
811
+ }
812
+ }
813
+ }).catch(function(err) {
814
+ console.log(err);
815
+ });
816
+ return [
817
+ 2
818
+ ];
846
819
  });
847
820
  });
848
821
  return function sendToTeacher(type) {
@@ -958,9 +931,9 @@ var CustomerService = function(props) {
958
931
  ];
959
932
  case 2:
960
933
  base64 = _state.sent();
934
+ console.log("base64", base64);
961
935
  console.log("citationContent.imageUrl", citationContent.imageUrl);
962
- sendData1.image = citationContent.imageUrl;
963
- //imageUrl = citationContent.imageUrl;
936
+ sendData1.image = base64;
964
937
  imageUrl = base64;
965
938
  _state.label = 3;
966
939
  case 3:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bhd-components",
3
- "version": "0.9.13",
3
+ "version": "0.9.14",
4
4
  "description": "组件功能描述",
5
5
  "config": {
6
6
  "commitizen": {