bhd-components 0.7.11 → 0.7.13
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/{901ed6b6.esm.es5.production.js → 1c455680.esm.es5.production.js} +1 -1
- package/dist/{facd5ad8.esm.es5.development.js → 75d9e8b4.esm.es5.development.js} +1 -1
- package/dist/index.esm.es5.development.css +2064 -1992
- package/dist/index.esm.es5.development.js +93 -44
- package/dist/index.esm.es5.production.css +1 -1
- package/dist/index.esm.es5.production.js +1 -1
- package/es2017/customerService/index.js +78 -36
- package/es2017/customerService/index.module.less +50 -28
- package/es2017/customerService/index2.module.less +15 -3
- package/es2017/customerService/screenshotTool.js +13 -7
- package/esm/customerService/index.js +78 -35
- package/esm/customerService/index.module.less +50 -28
- package/esm/customerService/index2.module.less +15 -3
- package/esm/customerService/screenshotTool.js +13 -7
- package/package.json +1 -1
|
@@ -80,6 +80,7 @@ var CustomerService = function(props) {
|
|
|
80
80
|
var isPosition = useRef(true);
|
|
81
81
|
var recommendeQuestionID = useRef([]); //推荐问题id
|
|
82
82
|
var videoHotQuestionsList = useRef([]); //视频热门问题
|
|
83
|
+
var newHotQuestionsList = useRef([]); //视频热门问题
|
|
83
84
|
var mid = props.userData.mid;
|
|
84
85
|
var remarkable = new Remarkable({
|
|
85
86
|
highlight: function highlight(str, lang) {
|
|
@@ -315,19 +316,34 @@ var CustomerService = function(props) {
|
|
|
315
316
|
var questionsList = [];
|
|
316
317
|
var obj = {};
|
|
317
318
|
if (type == 1) {
|
|
318
|
-
console.log(hotQuestionsList, "33322221111");
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
319
|
+
console.log(hotQuestionsList, newHotQuestionsList.current, "33322221111");
|
|
320
|
+
if (newHotQuestionsList.current.length > 0) {
|
|
321
|
+
questionsList = newHotQuestionsList.current.map(function(item, index) {
|
|
322
|
+
if (index < 3) {
|
|
323
|
+
return {
|
|
324
|
+
key: "messageSource",
|
|
325
|
+
value: item.id,
|
|
326
|
+
question: item.question,
|
|
327
|
+
answer: item.answer
|
|
328
|
+
};
|
|
329
|
+
} else {
|
|
330
|
+
return null;
|
|
331
|
+
}
|
|
332
|
+
});
|
|
333
|
+
} else {
|
|
334
|
+
questionsList = hotQuestionsList.map(function(item, index) {
|
|
335
|
+
if (index < 3) {
|
|
336
|
+
return {
|
|
337
|
+
key: "messageSource",
|
|
338
|
+
value: item.id,
|
|
339
|
+
question: item.question,
|
|
340
|
+
answer: item.answer
|
|
341
|
+
};
|
|
342
|
+
} else {
|
|
343
|
+
return null;
|
|
344
|
+
}
|
|
345
|
+
});
|
|
346
|
+
}
|
|
331
347
|
questionsList = questionsList.filter(function(i) {
|
|
332
348
|
return i != null;
|
|
333
349
|
});
|
|
@@ -539,7 +555,8 @@ var CustomerService = function(props) {
|
|
|
539
555
|
};
|
|
540
556
|
//发送知识库问题 item,flag == 1 是获取问候信息的答案,flag == 2 是普通消息,flag == 3 是针对视频页面点击底部推荐问题
|
|
541
557
|
var sendMessage = function(item, flag) {
|
|
542
|
-
|
|
558
|
+
var type = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "";
|
|
559
|
+
console.log(item, flag, 888888888);
|
|
543
560
|
var questions = [];
|
|
544
561
|
if (item && flag) {
|
|
545
562
|
questions = [
|
|
@@ -601,7 +618,7 @@ var CustomerService = function(props) {
|
|
|
601
618
|
key: "questionId",
|
|
602
619
|
value: flag == 1 ? questions.value : questions.id,
|
|
603
620
|
answer: questions.answer
|
|
604
|
-
});
|
|
621
|
+
}, type);
|
|
605
622
|
setKeyWord("");
|
|
606
623
|
setQuestionsList([]);
|
|
607
624
|
setCitationContent({});
|
|
@@ -653,7 +670,7 @@ var CustomerService = function(props) {
|
|
|
653
670
|
}
|
|
654
671
|
};
|
|
655
672
|
//向知识库发送问题 或答案 type:1 发送问题 2 接受答案
|
|
656
|
-
var sendingExistingIssues = function(type, obj, questions) {
|
|
673
|
+
var sendingExistingIssues = function(type, obj, questions, problemType) {
|
|
657
674
|
if (pageNumHistory <= 1) {
|
|
658
675
|
setHistoryMessageList(function(historyMessageList) {
|
|
659
676
|
var newHistoryMessageList = historyMessageList.concat(_object_spread_props(_object_spread({}, obj), {
|
|
@@ -704,10 +721,10 @@ var CustomerService = function(props) {
|
|
|
704
721
|
}
|
|
705
722
|
]
|
|
706
723
|
};
|
|
707
|
-
sendingExistingIssues(2, dataObj, "");
|
|
724
|
+
sendingExistingIssues(2, dataObj, "", problemType);
|
|
708
725
|
testLabQuestion(obj.message, questions.answer, "");
|
|
709
726
|
}
|
|
710
|
-
if (type == 2 && config && config.type == "video") {
|
|
727
|
+
if (type == 2 && config && config.type == "video" && problemType != "AssociativeProblem") {
|
|
711
728
|
//先请求问题列表
|
|
712
729
|
videoPageQuestiionsList(2);
|
|
713
730
|
}
|
|
@@ -757,6 +774,7 @@ var CustomerService = function(props) {
|
|
|
757
774
|
obj.regenerate = false;
|
|
758
775
|
}
|
|
759
776
|
var data = JSON.stringify(obj);
|
|
777
|
+
var flagKeyWord = keyWord;
|
|
760
778
|
setKeyWord("");
|
|
761
779
|
setQuestionsList([]);
|
|
762
780
|
setTimeout(function() {
|
|
@@ -905,7 +923,9 @@ var CustomerService = function(props) {
|
|
|
905
923
|
}
|
|
906
924
|
if (msg.finished) {
|
|
907
925
|
setFinished(true); //发送结束
|
|
908
|
-
|
|
926
|
+
if (!flagKeyWord) {
|
|
927
|
+
videoPageQuestiionsList(2);
|
|
928
|
+
}
|
|
909
929
|
// isPosition.current = true;
|
|
910
930
|
setTimeout(function() {
|
|
911
931
|
isPosition.current = true;
|
|
@@ -1370,15 +1390,12 @@ var CustomerService = function(props) {
|
|
|
1370
1390
|
var flag = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 1;
|
|
1371
1391
|
console.log(flag, props, 3333333);
|
|
1372
1392
|
if (config && config.type == "video" && config.params) {
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
// sectionId= "462347",
|
|
1380
|
-
// videoId= "29707",
|
|
1381
|
-
// watchTime= 262
|
|
1393
|
+
// let params = config.params;
|
|
1394
|
+
// let videoId = params.videoId;
|
|
1395
|
+
// let watchTime = params.videoProgress;
|
|
1396
|
+
// let courseId = getQuery('yc_id');
|
|
1397
|
+
// let sectionId = params.VideoBriefSummaryId;
|
|
1398
|
+
var courseId = "20899", sectionId = "462347", videoId = "29715", watchTime = 677;
|
|
1382
1399
|
if (videoId && courseId && sectionId) {
|
|
1383
1400
|
console.log(recommendeQuestionID.current, "recommendeQuestionID.current");
|
|
1384
1401
|
http.post("".concat(urllocation, "/chat-service/public/v1.0/knowledge-base/questions:recommend"), {
|
|
@@ -1406,6 +1423,7 @@ var CustomerService = function(props) {
|
|
|
1406
1423
|
setBottomRecommendationQuestions(data);
|
|
1407
1424
|
} else {
|
|
1408
1425
|
setHotQuestionsList(data);
|
|
1426
|
+
newHotQuestionsList.current = data;
|
|
1409
1427
|
}
|
|
1410
1428
|
// let ids:any[] = [];
|
|
1411
1429
|
// data.map((str: { id: string; })=>{
|
|
@@ -1928,7 +1946,7 @@ var CustomerService = function(props) {
|
|
|
1928
1946
|
className: styles.content_child
|
|
1929
1947
|
}),
|
|
1930
1948
|
item.extraInfo && JSON.parse(item.extraInfo).length > 0 && JSON.parse(item.extraInfo)[0].key == "imageUrl" && /*#__PURE__*/ _jsxs("p", {
|
|
1931
|
-
className: styles.img_con,
|
|
1949
|
+
className: "".concat(styles.img_con, " ").concat(showType == 2 || showType == 4 ? styles.img_con2 : ""),
|
|
1932
1950
|
children: [
|
|
1933
1951
|
/*#__PURE__*/ _jsx("img", {
|
|
1934
1952
|
src: JSON.parse(item.extraInfo)[0].value
|
|
@@ -2045,7 +2063,7 @@ var CustomerService = function(props) {
|
|
|
2045
2063
|
className: styles.content_child
|
|
2046
2064
|
}),
|
|
2047
2065
|
item.extraInfo && JSON.parse(item.extraInfo).length > 0 && JSON.parse(item.extraInfo)[0].key == "imageUrl" && /*#__PURE__*/ _jsxs("p", {
|
|
2048
|
-
className: styles.img_con,
|
|
2066
|
+
className: "".concat(styles.img_con, " ").concat(showType == 2 || showType == 4 ? styles.img_con2 : ""),
|
|
2049
2067
|
children: [
|
|
2050
2068
|
/*#__PURE__*/ _jsx("img", {
|
|
2051
2069
|
src: JSON.parse(item.extraInfo)[0].value
|
|
@@ -2062,7 +2080,7 @@ var CustomerService = function(props) {
|
|
|
2062
2080
|
]
|
|
2063
2081
|
}),
|
|
2064
2082
|
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", {
|
|
2065
|
-
className: "".concat(styles.association_problem, " ").concat(item.message == "抱歉,我暂时无法回答这样的问题。" ?
|
|
2083
|
+
className: "".concat(styles.association_problem, " ").concat(item.message == "抱歉,我暂时无法回答这样的问题。" ? styles.association_problem_flag : ""),
|
|
2066
2084
|
children: [
|
|
2067
2085
|
item.message == "抱歉,我暂时无法回答这样的问题。" && /*#__PURE__*/ _jsx("li", {
|
|
2068
2086
|
className: styles.related_issues_flag,
|
|
@@ -2158,13 +2176,23 @@ var CustomerService = function(props) {
|
|
|
2158
2176
|
return "";
|
|
2159
2177
|
}
|
|
2160
2178
|
// console.log(historyMessageList,i,'sdcsd;sldcscsdsd')
|
|
2179
|
+
//根据上一行数据,判断是否显示招唤老师按钮
|
|
2180
|
+
var showTeacherBtn = true;
|
|
2181
|
+
var previousLineData = historyMessageList[i - 1];
|
|
2182
|
+
if (!previousLineData) {
|
|
2183
|
+
showTeacherBtn = true;
|
|
2184
|
+
} else if (!previousLineData.extraInfo) {
|
|
2185
|
+
showTeacherBtn = true;
|
|
2186
|
+
} else if (JSON.parse(previousLineData.extraInfo).length > 0 && JSON.parse(previousLineData.extraInfo)[0].key == "imageUrl") {
|
|
2187
|
+
showTeacherBtn = false;
|
|
2188
|
+
}
|
|
2161
2189
|
return /*#__PURE__*/ _jsxs("p", {
|
|
2162
2190
|
className: styles.operate,
|
|
2163
2191
|
children: [
|
|
2164
2192
|
// 不在智能客服窗口,并已经点击了召唤老师,并有召唤老师权限
|
|
2165
2193
|
isAiChatWindow && answerMode != 1 && userData.modules.some(function(item) {
|
|
2166
2194
|
return item.short == "TeacherAnswer";
|
|
2167
|
-
}) &&
|
|
2195
|
+
}) && showTeacherBtn && /*#__PURE__*/ _jsx("span", {
|
|
2168
2196
|
className: styles.ask_question,
|
|
2169
2197
|
onClick: function() {
|
|
2170
2198
|
setAnswerMode(1);
|
|
@@ -2313,9 +2341,20 @@ var CustomerService = function(props) {
|
|
|
2313
2341
|
}
|
|
2314
2342
|
//3、是否显示召唤老师回答按钮
|
|
2315
2343
|
var findTeacherBtn = false;
|
|
2316
|
-
if (!showStopBtn && isAiChatWindow && (extraInfo != undefined && JSON.parse(extraInfo).length > 0 && JSON.parse(extraInfo)[0].key == "questionId" || extraInfo == null)
|
|
2344
|
+
if (!showStopBtn && isAiChatWindow && (extraInfo != undefined && JSON.parse(extraInfo).length > 0 && JSON.parse(extraInfo)[0].key == "questionId" || extraInfo == null)) {
|
|
2317
2345
|
findTeacherBtn = true;
|
|
2318
2346
|
}
|
|
2347
|
+
//根据上一行数据,判断是否显示招唤老师按钮
|
|
2348
|
+
var showTeacherBtn = true;
|
|
2349
|
+
var previousLineData = historyMessageList[i - 1];
|
|
2350
|
+
if (!previousLineData) {
|
|
2351
|
+
showTeacherBtn = true;
|
|
2352
|
+
} else if (!previousLineData.extraInfo) {
|
|
2353
|
+
showTeacherBtn = true;
|
|
2354
|
+
} else if (JSON.parse(previousLineData.extraInfo).length > 0 && JSON.parse(previousLineData.extraInfo)[0].key == "imageUrl") {
|
|
2355
|
+
showTeacherBtn = false;
|
|
2356
|
+
}
|
|
2357
|
+
console.log(showTeacherBtn, "dlvkdfl");
|
|
2319
2358
|
/// style={{position:showStopBtn && isPosition.current ? 'sticky' : 'relative'}}
|
|
2320
2359
|
return /*#__PURE__*/ _jsxs("div", {
|
|
2321
2360
|
className: "".concat(styles.operate_modal_bottom),
|
|
@@ -2367,7 +2406,7 @@ var CustomerService = function(props) {
|
|
|
2367
2406
|
//在ai窗口并ai已经生成完答案
|
|
2368
2407
|
findTeacherBtn && userData.modules.some(function(item) {
|
|
2369
2408
|
return item.short == "TeacherAnswer";
|
|
2370
|
-
}) && /*#__PURE__*/ _jsx("span", {
|
|
2409
|
+
}) && showTeacherBtn && /*#__PURE__*/ _jsx("span", {
|
|
2371
2410
|
className: styles.find_teacher,
|
|
2372
2411
|
onClick: function() {
|
|
2373
2412
|
setAnswerMode(1);
|
|
@@ -2713,6 +2752,8 @@ var CustomerService = function(props) {
|
|
|
2713
2752
|
}
|
|
2714
2753
|
}, 1000);
|
|
2715
2754
|
}
|
|
2755
|
+
setBottomRecommendationQuestions([]);
|
|
2756
|
+
resettingBottomHei();
|
|
2716
2757
|
},
|
|
2717
2758
|
onPressEnter: function(e) {
|
|
2718
2759
|
// console.log('发送内容22222',props)
|
|
@@ -2723,6 +2764,8 @@ var CustomerService = function(props) {
|
|
|
2723
2764
|
clearTimeout(timer.current);
|
|
2724
2765
|
setKeyWord("");
|
|
2725
2766
|
setCitationContent({});
|
|
2767
|
+
setBottomRecommendationQuestions([]);
|
|
2768
|
+
resettingBottomHei();
|
|
2726
2769
|
//查找是否是召唤老师回答并有相应的老师名称
|
|
2727
2770
|
if (answerMode == 1 && teacherList.length > 0) {
|
|
2728
2771
|
var list = teacherList.filter(function(v) {
|
|
@@ -2953,7 +2996,7 @@ var CustomerService = function(props) {
|
|
|
2953
2996
|
className: styles.item,
|
|
2954
2997
|
children: /*#__PURE__*/ _jsx("span", {
|
|
2955
2998
|
onClick: function() {
|
|
2956
|
-
sendMessage(item, 2);
|
|
2999
|
+
sendMessage(item, 2, "AssociativeProblem");
|
|
2957
3000
|
setKeyWord("");
|
|
2958
3001
|
onEvent(serverName + serverUrl(), "click_智能问答_ 发送", "提交");
|
|
2959
3002
|
},
|
|
@@ -630,6 +630,44 @@
|
|
|
630
630
|
}
|
|
631
631
|
|
|
632
632
|
|
|
633
|
+
.association_problem_flag{
|
|
634
|
+
|
|
635
|
+
li{
|
|
636
|
+
padding-left: 30px;
|
|
637
|
+
position: relative;
|
|
638
|
+
&::after{
|
|
639
|
+
content: '';
|
|
640
|
+
width: 6px;
|
|
641
|
+
height: 6px;
|
|
642
|
+
border-radius: 50%;
|
|
643
|
+
background-color: rgba(217, 217, 217, 1);
|
|
644
|
+
display: block;
|
|
645
|
+
position: absolute;
|
|
646
|
+
top: 26px;
|
|
647
|
+
left: 10px;
|
|
648
|
+
}
|
|
649
|
+
}
|
|
650
|
+
|
|
651
|
+
li:first-child{
|
|
652
|
+
padding-left:0;
|
|
653
|
+
&::after{
|
|
654
|
+
display: none;
|
|
655
|
+
}
|
|
656
|
+
}
|
|
657
|
+
|
|
658
|
+
.related_issues_flag{
|
|
659
|
+
span{
|
|
660
|
+
color: #000;
|
|
661
|
+
font-weight: 600;
|
|
662
|
+
border-bottom: 6px solid @color-background-primary-weak-hover;
|
|
663
|
+
display: inline-block;
|
|
664
|
+
height: 22px;
|
|
665
|
+
}
|
|
666
|
+
|
|
667
|
+
}
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
|
|
633
671
|
.img_con{
|
|
634
672
|
width: 100%;
|
|
635
673
|
text-align: center;
|
|
@@ -638,8 +676,11 @@
|
|
|
638
676
|
overflow: hidden;
|
|
639
677
|
display: inline-flex;
|
|
640
678
|
margin-top: 12px;
|
|
679
|
+
width: 240px;
|
|
680
|
+
max-height: 134px;
|
|
641
681
|
img{
|
|
642
|
-
width:
|
|
682
|
+
width: 240px;
|
|
683
|
+
height: fit-content;
|
|
643
684
|
}
|
|
644
685
|
.mask_zoom{
|
|
645
686
|
position: absolute;
|
|
@@ -666,6 +707,14 @@
|
|
|
666
707
|
}
|
|
667
708
|
}
|
|
668
709
|
}
|
|
710
|
+
.img_con2{
|
|
711
|
+
width: 300px;
|
|
712
|
+
max-height: 168px;
|
|
713
|
+
img{
|
|
714
|
+
width: 300px;
|
|
715
|
+
height: fit-content;
|
|
716
|
+
}
|
|
717
|
+
}
|
|
669
718
|
|
|
670
719
|
.copyCode{
|
|
671
720
|
display: flex;
|
|
@@ -746,33 +795,6 @@
|
|
|
746
795
|
}
|
|
747
796
|
}
|
|
748
797
|
|
|
749
|
-
.association_problem_flag{
|
|
750
|
-
padding-left: 30px;
|
|
751
|
-
|
|
752
|
-
li{
|
|
753
|
-
position: relative;
|
|
754
|
-
&::after{
|
|
755
|
-
content: '';
|
|
756
|
-
width: 6px;
|
|
757
|
-
height: 6px;
|
|
758
|
-
border-radius: 50%;
|
|
759
|
-
background-color: rgba(217, 217, 217, 1);
|
|
760
|
-
display: block;
|
|
761
|
-
position: absolute;
|
|
762
|
-
top: 12px;
|
|
763
|
-
left: 12px;
|
|
764
|
-
}
|
|
765
|
-
}
|
|
766
|
-
.related_issues_flag{
|
|
767
|
-
span{
|
|
768
|
-
color: #000;
|
|
769
|
-
font-weight: 600;
|
|
770
|
-
border-bottom: 4px solid @color-background-primary-weak-hover;
|
|
771
|
-
}
|
|
772
|
-
|
|
773
|
-
}
|
|
774
|
-
}
|
|
775
|
-
|
|
776
798
|
.time {
|
|
777
799
|
display: block;
|
|
778
800
|
margin: 40px 0;
|
|
@@ -635,8 +635,11 @@
|
|
|
635
635
|
overflow: hidden;
|
|
636
636
|
display: inline-flex;
|
|
637
637
|
margin-top: 12px;
|
|
638
|
+
width: 240px;
|
|
639
|
+
max-height: 134px;
|
|
638
640
|
img{
|
|
639
|
-
width:
|
|
641
|
+
width: 240px;
|
|
642
|
+
height: fit-content;
|
|
640
643
|
}
|
|
641
644
|
.mask_zoom{
|
|
642
645
|
position: absolute;
|
|
@@ -663,6 +666,14 @@
|
|
|
663
666
|
}
|
|
664
667
|
}
|
|
665
668
|
}
|
|
669
|
+
.img_con2{
|
|
670
|
+
width: 300px;
|
|
671
|
+
max-height: 168px;
|
|
672
|
+
img{
|
|
673
|
+
width: 300px;
|
|
674
|
+
height: fit-content;
|
|
675
|
+
}
|
|
676
|
+
}
|
|
666
677
|
|
|
667
678
|
.copyCode{
|
|
668
679
|
display: flex;
|
|
@@ -932,8 +943,8 @@
|
|
|
932
943
|
}
|
|
933
944
|
}
|
|
934
945
|
.issues_list_flag {
|
|
935
|
-
position: absolute;
|
|
936
|
-
bottom: 60px;
|
|
946
|
+
// position: absolute;
|
|
947
|
+
// bottom: 60px;
|
|
937
948
|
margin: 0 16px;
|
|
938
949
|
// padding-bottom: 4px;
|
|
939
950
|
line-height: 1;
|
|
@@ -943,6 +954,7 @@
|
|
|
943
954
|
background-color: #fff;
|
|
944
955
|
border-radius: 38px;
|
|
945
956
|
margin-bottom: 16px;
|
|
957
|
+
line-height: 1.5;
|
|
946
958
|
cursor: pointer;
|
|
947
959
|
&:hover{
|
|
948
960
|
background-color: @color-background-primary-weak;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { _ as _sliced_to_array } from "@swc/helpers/_/_sliced_to_array";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "@ice/jsx-runtime/jsx-runtime";
|
|
3
|
-
import React, { useState,
|
|
3
|
+
import React, { useState, forwardRef } from "react";
|
|
4
4
|
import ReactCrop, { centerCrop, makeAspectCrop } from "react-image-crop";
|
|
5
5
|
import { CloseOutlined } from "@ant-design/icons";
|
|
6
6
|
import { CustomDuihao } from "../icons/index";
|
|
@@ -55,7 +55,6 @@ var ScreenshotTool = /*#__PURE__*/ forwardRef(function(props) {
|
|
|
55
55
|
var imgBese64 = props.imgBese64, saveScreenshotBese64 = props.saveScreenshotBese64, cancelScreenshot = props.cancelScreenshot;
|
|
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
|
-
var imgRef = useRef(null);
|
|
59
58
|
var _useState2 = _sliced_to_array(useState(16 / 9), 2), aspect = _useState2[0], setAspect = _useState2[1];
|
|
60
59
|
var _useState3 = _sliced_to_array(useState({
|
|
61
60
|
top: 0,
|
|
@@ -86,20 +85,22 @@ var ScreenshotTool = /*#__PURE__*/ forwardRef(function(props) {
|
|
|
86
85
|
className: styles.ReactCrop,
|
|
87
86
|
crop: crop,
|
|
88
87
|
onChange: function(_, percentCrop) {
|
|
88
|
+
if (percentCrop.height === 0 && percentCrop.width === 0) {
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
89
91
|
setShowBtn(false);
|
|
90
92
|
setCrop(percentCrop);
|
|
91
93
|
},
|
|
92
94
|
onComplete: function(c) {
|
|
95
|
+
if (c.height === 0 && c.width === 0) {
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
93
98
|
setCompletedCrop(c);
|
|
94
99
|
savePosition(c);
|
|
95
|
-
// console.log(c,'剪裁222');
|
|
96
100
|
},
|
|
97
|
-
// aspect={aspect}
|
|
98
|
-
// minWidth={400}
|
|
99
101
|
minHeight: 100,
|
|
100
102
|
minWidth: 100,
|
|
101
103
|
children: /*#__PURE__*/ _jsx("img", {
|
|
102
|
-
// ref={imgRef}
|
|
103
104
|
alt: "Crop me",
|
|
104
105
|
src: imgBese64,
|
|
105
106
|
onLoad: onImageLoad
|
|
@@ -114,7 +115,12 @@ var ScreenshotTool = /*#__PURE__*/ forwardRef(function(props) {
|
|
|
114
115
|
children: [
|
|
115
116
|
/*#__PURE__*/ _jsx("span", {
|
|
116
117
|
onClick: cancelScreenshot,
|
|
117
|
-
children: /*#__PURE__*/ _jsx(CloseOutlined, {
|
|
118
|
+
children: /*#__PURE__*/ _jsx(CloseOutlined, {
|
|
119
|
+
style: {
|
|
120
|
+
position: "relative",
|
|
121
|
+
top: "1px"
|
|
122
|
+
}
|
|
123
|
+
})
|
|
118
124
|
}),
|
|
119
125
|
/*#__PURE__*/ _jsx("span", {
|
|
120
126
|
onClick: saveImage,
|