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 +1 -1
- package/dist/index.esm.es5.development.js +85 -111
- package/dist/index.esm.es5.production.js +1 -1
- package/dist/vendor.esm.es5.development.js +1 -1
- package/dist/vendor.esm.es5.production.js +1 -1
- package/es2017/customerService/function.js +2 -1
- package/es2017/customerService/index.js +5 -10
- package/esm/customerService/function.js +2 -1
- package/esm/customerService/index.js +83 -110
- package/package.json +1 -1
|
@@ -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
|
|
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
|
|
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
|
-
|
|
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 =
|
|
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 =
|
|
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,我是智能学习助手,你遇到了什么问题?
|
|
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,我是智能学习助手,你遇到了什么问题?
|
|
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
|
|
735
|
+
var message, obj, list, recevier;
|
|
736
736
|
var _arguments = arguments;
|
|
737
737
|
return _ts_generator(this, function(_state) {
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
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
|
-
|
|
828
|
-
|
|
787
|
+
key: "imageUrl",
|
|
788
|
+
value: obj.image
|
|
829
789
|
}
|
|
830
|
-
]
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
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
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
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 =
|
|
963
|
-
//imageUrl = citationContent.imageUrl;
|
|
936
|
+
sendData1.image = base64;
|
|
964
937
|
imageUrl = base64;
|
|
965
938
|
_state.label = 3;
|
|
966
939
|
case 3:
|