bhd-components 0.8.0 → 0.8.1
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/dist/{de88944c.esm.es5.development.js → 3f8529e7.esm.es5.development.js} +1 -1
- package/dist/{2f338078.esm.es5.production.js → f460f54e.esm.es5.production.js} +1 -1
- package/dist/index.esm.es5.development.css +1007 -1011
- package/dist/index.esm.es5.development.js +40 -136
- package/dist/index.esm.es5.production.css +1 -1
- package/dist/index.esm.es5.production.js +1 -1
- package/dist/vendor.esm.es5.development.esm.es5.development.css +83 -84
- package/dist/vendor.esm.es5.production.esm.es5.production.css +8 -10
- package/es2017/customerService/historyFun.d.ts +1 -1
- package/es2017/customerService/historyFun.js +1 -2
- package/es2017/customerService/html2canvas.test.js +1233 -1234
- package/es2017/customerService/index.d.ts +1 -1
- package/es2017/customerService/index.js +30 -118
- package/es2017/customerService/index.module.less +4 -5
- package/es2017/customerService/index2.module.less +5 -6
- package/es2017/customerService/screenshotTool.js +9 -15
- package/esm/customerService/historyFun.d.ts +1 -1
- package/esm/customerService/historyFun.js +1 -2
- package/esm/customerService/html2canvas.test.js +34 -34
- package/esm/customerService/index.d.ts +1 -1
- package/esm/customerService/index.js +36 -125
- package/esm/customerService/index.module.less +4 -5
- package/esm/customerService/index2.module.less +5 -6
- package/esm/customerService/screenshotTool.js +8 -14
- package/package.json +1 -1
|
@@ -6,6 +6,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "@ice/jsx-runt
|
|
|
6
6
|
import React, { useEffect, useState, useRef } from "react";
|
|
7
7
|
import { Modal, Drawer, Input, Tooltip } from "antd";
|
|
8
8
|
import ViewImage from "../viewImage";
|
|
9
|
+
// import html2canvas from "html2canvas";
|
|
9
10
|
import cssStyle from "./index.module.less";
|
|
10
11
|
import cssStyleOnline from "./index2.module.less";
|
|
11
12
|
var styles = cssStyle;
|
|
@@ -21,7 +22,7 @@ import TeacherList from "./teacherList";
|
|
|
21
22
|
import { parseDate } from "../utils/Date";
|
|
22
23
|
import { Remarkable } from "remarkable";
|
|
23
24
|
import hljs from "highlight.js";
|
|
24
|
-
import "highlight.js/styles/
|
|
25
|
+
import "highlight.js/styles/default.css";
|
|
25
26
|
import { render } from "react-dom";
|
|
26
27
|
import Provider from "../provider";
|
|
27
28
|
var TextArea = Input.TextArea;
|
|
@@ -107,112 +108,6 @@ var CustomerService = function(props) {
|
|
|
107
108
|
initShowType
|
|
108
109
|
]);
|
|
109
110
|
useEffect(function() {
|
|
110
|
-
var handlerHtml2canvas = function handlerHtml2canvas() {
|
|
111
|
-
console.log("kkkkkkkkkkk");
|
|
112
|
-
try {
|
|
113
|
-
newShowType.current = true;
|
|
114
|
-
setImgBese64("");
|
|
115
|
-
var plugin = new screenShotPlugin({
|
|
116
|
-
clickCutFullScreen: true,
|
|
117
|
-
enableWebRtc: true,
|
|
118
|
-
loadCrossImg: true,
|
|
119
|
-
canvasWidth: window.innerWidth,
|
|
120
|
-
canvasHeight: window.innerHeight,
|
|
121
|
-
level: -1,
|
|
122
|
-
hiddenToolIco: true,
|
|
123
|
-
screenShotDom: document.body,
|
|
124
|
-
cropBoxInfo: {
|
|
125
|
-
x: 0,
|
|
126
|
-
y: 0,
|
|
127
|
-
w: window.innerWidth,
|
|
128
|
-
h: window.innerHeight
|
|
129
|
-
},
|
|
130
|
-
wrcReplyTime: 20,
|
|
131
|
-
wrcWindowMode: true,
|
|
132
|
-
hiddenScrollBar: {
|
|
133
|
-
state: true
|
|
134
|
-
},
|
|
135
|
-
completeCallback: function(param) {
|
|
136
|
-
var base64 = param.base64;
|
|
137
|
-
// console.log(
|
|
138
|
-
// "截图组件加载完毕调用此方法来完成框选区域的截图",
|
|
139
|
-
// base64
|
|
140
|
-
// );
|
|
141
|
-
setImgBese64(base64);
|
|
142
|
-
},
|
|
143
|
-
triggerCallback: function() {
|
|
144
|
-
// 截图组件加载完毕调用此方法来完成框选区域的截图
|
|
145
|
-
plugin.completeScreenshot();
|
|
146
|
-
},
|
|
147
|
-
cancelCallback: function(err) {
|
|
148
|
-
if (err.code === -1) {
|
|
149
|
-
console.log(err);
|
|
150
|
-
newShowType.current = false;
|
|
151
|
-
if (saveShowType != -1) {
|
|
152
|
-
setShowType(saveShowType);
|
|
153
|
-
} else {
|
|
154
|
-
setShowType(1);
|
|
155
|
-
}
|
|
156
|
-
setShowScreenshot(false);
|
|
157
|
-
onCancel();
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
});
|
|
161
|
-
// modernScreenshot
|
|
162
|
-
// .domToPng(document.querySelector("body"))
|
|
163
|
-
// .then((dataUrl:any) => {
|
|
164
|
-
// console.log(dataUrl);
|
|
165
|
-
// setImgBese64(dataUrl);
|
|
166
|
-
// });
|
|
167
|
-
// domtoimage
|
|
168
|
-
// .toPng(document.body)
|
|
169
|
-
// .then(function (dataUrl:any) {
|
|
170
|
-
// setImgBese64(dataUrl);
|
|
171
|
-
// })
|
|
172
|
-
// .catch(function (error:any) {
|
|
173
|
-
// console.error("oops, something went wrong!", error);
|
|
174
|
-
// });
|
|
175
|
-
// //排除
|
|
176
|
-
// new screenShotPlugin({
|
|
177
|
-
// enableWebRtc: true,
|
|
178
|
-
// canvasWidth:window.innerWidth,
|
|
179
|
-
// canvasHeight:window.innerHeight,
|
|
180
|
-
// level:9999999,
|
|
181
|
-
// completeCallback: function (info:any) {
|
|
182
|
-
// console.log(info);
|
|
183
|
-
// setImgBese64(info.base64);
|
|
184
|
-
// },
|
|
185
|
-
// closeCallback: function () {
|
|
186
|
-
// },
|
|
187
|
-
// });
|
|
188
|
-
// html2canvas(document.body,{//__docusaurus
|
|
189
|
-
// useCORS: true, // 支持跨域图片截图
|
|
190
|
-
// allowTaint: true, // 污染处理
|
|
191
|
-
// scale: 1 ,// 图片比例
|
|
192
|
-
// logging:false,
|
|
193
|
-
// // foreignObjectRendering:true,
|
|
194
|
-
// ignoreElements:(element: { compareDocumentPosition: (arg0: string) => number; })=>{
|
|
195
|
-
// if(element.compareDocumentPosition(screenshotAreaId)===2)return true
|
|
196
|
-
// return false
|
|
197
|
-
// },
|
|
198
|
-
// windowWidth:window.innerWidth,
|
|
199
|
-
// windowHeight:window.innerHeight
|
|
200
|
-
// })
|
|
201
|
-
// .then(function (canvas:any) {
|
|
202
|
-
// // document.body.appendChild(canvas);
|
|
203
|
-
// // console.log(canvas,99999);
|
|
204
|
-
// // var base64URL = canvas.toDataURL('image/jpeg')
|
|
205
|
-
// let base64URL = canvas.toDataURL("image/jpg", 1.0)
|
|
206
|
-
// // console.log(base64URL);
|
|
207
|
-
// setImgBese64(base64URL);
|
|
208
|
-
// // svgNodesToRemove.forEach(item=>{
|
|
209
|
-
// // item.remove()
|
|
210
|
-
// // })
|
|
211
|
-
// });
|
|
212
|
-
} catch (error) {
|
|
213
|
-
console.log(error);
|
|
214
|
-
}
|
|
215
|
-
};
|
|
216
111
|
var handleScroll = function handleScroll() {
|
|
217
112
|
var container = document.getElementById(showType == 1 || showType == 3 ? "chat_content" : "chat_content_modal");
|
|
218
113
|
var scrollTop = container.scrollTop;
|
|
@@ -261,9 +156,30 @@ var CustomerService = function(props) {
|
|
|
261
156
|
};
|
|
262
157
|
//|| showScreenshot
|
|
263
158
|
if (showType == 5 || showScreenshot) {
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
159
|
+
try {
|
|
160
|
+
newShowType.current = true;
|
|
161
|
+
setImgBese64("");
|
|
162
|
+
// let dom = document.getElementById(screenshotAreaId);
|
|
163
|
+
html2canvas(screenshotAreaId, {
|
|
164
|
+
useCORS: true,
|
|
165
|
+
// allowTaint: true, // 污染处理
|
|
166
|
+
scale: 1,
|
|
167
|
+
// logging:true,
|
|
168
|
+
ignoreElements: function(element) {
|
|
169
|
+
if (element.compareDocumentPosition(screenshotAreaId) === 2) return true;
|
|
170
|
+
return false;
|
|
171
|
+
}
|
|
172
|
+
}).then(function(canvas) {
|
|
173
|
+
// document.body.appendChild(canvas);
|
|
174
|
+
console.log(canvas, 99999);
|
|
175
|
+
// var base64URL = canvas.toDataURL('image/jpeg')
|
|
176
|
+
var base64URL = canvas.toDataURL("image/jpg", 1.0);
|
|
177
|
+
console.log(base64URL);
|
|
178
|
+
setImgBese64(base64URL);
|
|
179
|
+
});
|
|
180
|
+
} catch (error) {
|
|
181
|
+
console.log(error);
|
|
182
|
+
}
|
|
267
183
|
}
|
|
268
184
|
if (showType != 1 && !firstLoad && pageCount > 0) {
|
|
269
185
|
setFirstLoad(true);
|
|
@@ -278,7 +194,6 @@ var CustomerService = function(props) {
|
|
|
278
194
|
if (content) {
|
|
279
195
|
content.removeEventListener("scroll", handleScroll);
|
|
280
196
|
}
|
|
281
|
-
window.removeEventListener("resize", handlerHtml2canvas);
|
|
282
197
|
};
|
|
283
198
|
}, [
|
|
284
199
|
historyMessageList,
|
|
@@ -1807,18 +1722,11 @@ var CustomerService = function(props) {
|
|
|
1807
1722
|
/*#__PURE__*/ _jsxs("div", {
|
|
1808
1723
|
className: styles.operate,
|
|
1809
1724
|
children: [
|
|
1810
|
-
/*#__PURE__*/
|
|
1811
|
-
className: styles.popover_main,
|
|
1725
|
+
/*#__PURE__*/ _jsx("i", {
|
|
1812
1726
|
onClick: function() {
|
|
1813
1727
|
setShowHistory(true);
|
|
1814
1728
|
},
|
|
1815
|
-
children:
|
|
1816
|
-
/*#__PURE__*/ _jsx(CustomRecord, {}),
|
|
1817
|
-
/*#__PURE__*/ _jsx("span", {
|
|
1818
|
-
className: styles.popover,
|
|
1819
|
-
children: "历史记录"
|
|
1820
|
-
})
|
|
1821
|
-
]
|
|
1729
|
+
children: /*#__PURE__*/ _jsx(CustomRecord, {})
|
|
1822
1730
|
}),
|
|
1823
1731
|
/*#__PURE__*/ _jsx("span", {
|
|
1824
1732
|
className: styles.line
|
|
@@ -1838,14 +1746,20 @@ var CustomerService = function(props) {
|
|
|
1838
1746
|
})
|
|
1839
1747
|
]
|
|
1840
1748
|
}),
|
|
1841
|
-
/*#__PURE__*/
|
|
1749
|
+
/*#__PURE__*/ _jsxs("i", {
|
|
1842
1750
|
className: styles.popover_main,
|
|
1843
1751
|
onClick: function() {
|
|
1844
1752
|
onEvent(serverName + serverUrl(), "click_智能问答_退出全屏", "提交");
|
|
1845
1753
|
setShowType(3);
|
|
1846
1754
|
setFirstLoad(false); //重启滚动条在最上方
|
|
1847
1755
|
},
|
|
1848
|
-
children:
|
|
1756
|
+
children: [
|
|
1757
|
+
/*#__PURE__*/ _jsx(CloseOutlined, {}),
|
|
1758
|
+
/*#__PURE__*/ _jsx("span", {
|
|
1759
|
+
className: styles.popover,
|
|
1760
|
+
children: "退出全屏"
|
|
1761
|
+
})
|
|
1762
|
+
]
|
|
1849
1763
|
})
|
|
1850
1764
|
]
|
|
1851
1765
|
})
|
|
@@ -3536,9 +3450,6 @@ var CustomerService = function(props) {
|
|
|
3536
3450
|
}),
|
|
3537
3451
|
(showType == 4 || showType == 5) && /*#__PURE__*/ _jsxs("div", {
|
|
3538
3452
|
className: "".concat(styles.ChatWindow_Drawer),
|
|
3539
|
-
style: {
|
|
3540
|
-
display: "".concat(!showScreenshot ? "none" : "flex")
|
|
3541
|
-
},
|
|
3542
3453
|
id: "",
|
|
3543
3454
|
children: [
|
|
3544
3455
|
/*#__PURE__*/ _jsx("div", {
|
|
@@ -1177,8 +1177,8 @@
|
|
|
1177
1177
|
max-height: 36px;
|
|
1178
1178
|
word-break: break-all;
|
|
1179
1179
|
|
|
1180
|
-
|
|
1181
|
-
|
|
1180
|
+
display: flex;
|
|
1181
|
+
align-items: center;
|
|
1182
1182
|
img{
|
|
1183
1183
|
margin-right: 8px;
|
|
1184
1184
|
width: 60px;
|
|
@@ -1866,7 +1866,7 @@
|
|
|
1866
1866
|
width: 417px;
|
|
1867
1867
|
height: calc(100% - 48px);
|
|
1868
1868
|
right: 0;
|
|
1869
|
-
top:
|
|
1869
|
+
top: 48px;
|
|
1870
1870
|
border-radius: 0;
|
|
1871
1871
|
background: transparent;
|
|
1872
1872
|
overflow: visible;
|
|
@@ -1918,7 +1918,7 @@
|
|
|
1918
1918
|
background-color: transparent !important;
|
|
1919
1919
|
// background-color: burlywood;
|
|
1920
1920
|
.ReactCrop{
|
|
1921
|
-
|
|
1921
|
+
|
|
1922
1922
|
}
|
|
1923
1923
|
:global{
|
|
1924
1924
|
.ReactCrop__child-wrapper{
|
|
@@ -1935,7 +1935,6 @@
|
|
|
1935
1935
|
height: 100% !important;
|
|
1936
1936
|
top: 0 !important;
|
|
1937
1937
|
left: 0 !important;
|
|
1938
|
-
cursor: default !important;
|
|
1939
1938
|
}
|
|
1940
1939
|
|
|
1941
1940
|
}
|
|
@@ -1175,8 +1175,8 @@
|
|
|
1175
1175
|
max-height: 36px;
|
|
1176
1176
|
word-break: break-all;
|
|
1177
1177
|
|
|
1178
|
-
|
|
1179
|
-
|
|
1178
|
+
display: flex;
|
|
1179
|
+
align-items: center;
|
|
1180
1180
|
img{
|
|
1181
1181
|
margin-right: 8px;
|
|
1182
1182
|
width: 60px;
|
|
@@ -1860,7 +1860,7 @@
|
|
|
1860
1860
|
width: 417px;
|
|
1861
1861
|
height: calc(100% - 48px);
|
|
1862
1862
|
right: 0;
|
|
1863
|
-
top:
|
|
1863
|
+
top: 48px;
|
|
1864
1864
|
border-radius: 0;
|
|
1865
1865
|
background: transparent;
|
|
1866
1866
|
overflow: visible;
|
|
@@ -1904,7 +1904,7 @@
|
|
|
1904
1904
|
background-color: transparent !important;
|
|
1905
1905
|
// background-color: burlywood;
|
|
1906
1906
|
.ReactCrop{
|
|
1907
|
-
|
|
1907
|
+
|
|
1908
1908
|
}
|
|
1909
1909
|
:global{
|
|
1910
1910
|
.ReactCrop__child-wrapper{
|
|
@@ -1912,8 +1912,7 @@
|
|
|
1912
1912
|
width: 100% !important;
|
|
1913
1913
|
height: 100% !important;
|
|
1914
1914
|
top: 0 !important;
|
|
1915
|
-
left: 0 !important
|
|
1916
|
-
cursor: default !important;
|
|
1915
|
+
left: 0 !important
|
|
1917
1916
|
}
|
|
1918
1917
|
}
|
|
1919
1918
|
:global{
|
|
@@ -34,10 +34,10 @@ var ScreenshotTool = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
34
34
|
image.src = imgBese64; // 将'your_image_url'替换为你自己的图片URL
|
|
35
35
|
// 等待图片加载完成后再进行操作
|
|
36
36
|
image.onload = function() {
|
|
37
|
-
var x =
|
|
38
|
-
var y =
|
|
39
|
-
var width =
|
|
40
|
-
var height =
|
|
37
|
+
var x = completedCrop.x; // 起始点x坐标
|
|
38
|
+
var y = completedCrop.y; // 起始点y坐标
|
|
39
|
+
var width = completedCrop.width; // 需要裁剪的区域宽度
|
|
40
|
+
var height = completedCrop.height; // 需要裁剪的区域高度
|
|
41
41
|
// 设置canvas大小与裁剪区域相同
|
|
42
42
|
canvas.width = width;
|
|
43
43
|
canvas.height = height;
|
|
@@ -56,20 +56,18 @@ var ScreenshotTool = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
56
56
|
var _useState = _sliced_to_array(useState(), 2), crop = _useState[0], setCrop = _useState[1];
|
|
57
57
|
var _useState1 = _sliced_to_array(useState(), 2), completedCrop = _useState1[0], setCompletedCrop = _useState1[1];
|
|
58
58
|
var _useState2 = _sliced_to_array(useState(16 / 9), 2), aspect = _useState2[0], setAspect = _useState2[1];
|
|
59
|
-
var _useState3 = _sliced_to_array(useState(
|
|
60
|
-
var _useState4 = _sliced_to_array(useState(true), 2), isFirst = _useState4[0], setIsFirst = _useState4[1];
|
|
61
|
-
var _useState5 = _sliced_to_array(useState({
|
|
59
|
+
var _useState3 = _sliced_to_array(useState({
|
|
62
60
|
top: 0,
|
|
63
61
|
left: 0
|
|
64
|
-
}), 2), btnPosition =
|
|
65
|
-
var
|
|
62
|
+
}), 2), btnPosition = _useState3[0], setBtnPosition = _useState3[1];
|
|
63
|
+
var _useState4 = _sliced_to_array(useState(false), 2), showBtn = _useState4[0], setShowBtn = _useState4[1];
|
|
66
64
|
var savePosition = function(e) {
|
|
67
65
|
// console.log(e,'位置位置');
|
|
68
66
|
var x = e.x;
|
|
69
67
|
var y = e.y;
|
|
70
68
|
var h = e.height;
|
|
71
69
|
var w = e.width;
|
|
72
|
-
var top = y + h +
|
|
70
|
+
var top = y + h + 8;
|
|
73
71
|
var left = x + w - 88;
|
|
74
72
|
if (top + 42 > window.innerHeight) {
|
|
75
73
|
top = top - 50;
|
|
@@ -79,7 +77,6 @@ var ScreenshotTool = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
79
77
|
left: left
|
|
80
78
|
});
|
|
81
79
|
setShowBtn(true);
|
|
82
|
-
setIsFirst(false);
|
|
83
80
|
};
|
|
84
81
|
return /*#__PURE__*/ _jsxs("div", {
|
|
85
82
|
className: styles.screenshot_Modal,
|
|
@@ -105,9 +102,6 @@ var ScreenshotTool = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
105
102
|
minWidth: 100,
|
|
106
103
|
children: /*#__PURE__*/ _jsx("img", {
|
|
107
104
|
alt: "Crop me",
|
|
108
|
-
style: {
|
|
109
|
-
display: "none"
|
|
110
|
-
},
|
|
111
105
|
src: imgBese64,
|
|
112
106
|
onLoad: onImageLoad
|
|
113
107
|
})
|