bhd-components 0.9.12 → 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 +536 -427
- package/dist/index.esm.es5.production.js +1 -1
- package/dist/vendor.esm.es5.development.js +2 -2
- package/dist/vendor.esm.es5.production.js +2 -2
- package/es2017/customerService/function.js +2 -1
- package/es2017/customerService/historyFun.js +168 -159
- package/es2017/customerService/index.js +61 -31
- package/esm/customerService/function.js +2 -1
- package/esm/customerService/historyFun.js +174 -165
- package/esm/customerService/index.js +341 -266
- package/package.json +1 -1
|
@@ -6,18 +6,19 @@ import React, { useEffect, useState, useRef } from "react";
|
|
|
6
6
|
import styles from "./index.module.less";
|
|
7
7
|
//import "highlight.js/styles/default.css";
|
|
8
8
|
import "highlight.js/styles/github.css";
|
|
9
|
-
import { Input } from "antd";
|
|
9
|
+
import { Input, Spin } from "antd";
|
|
10
10
|
import { CustomClose, CustomExpand, CustomAiIcon } from "../icons";
|
|
11
11
|
import { SearchOutlined } from "@ant-design/icons";
|
|
12
12
|
import { formatDate } from "./function"; //录音使用文件
|
|
13
13
|
var HistoryFun = function(props) {
|
|
14
14
|
var type = props.type, roomId = props.roomId, userData = props.userData, http = props.http, urllocation = props.urllocation, onClose = props.onClose, loadSpecifiedData = props.loadSpecifiedData;
|
|
15
|
-
var _useState = _sliced_to_array(useState(
|
|
16
|
-
var _useState1 = _sliced_to_array(useState(
|
|
17
|
-
var _useState2 = _sliced_to_array(useState(1), 2),
|
|
18
|
-
var _useState3 = _sliced_to_array(useState(
|
|
19
|
-
var _useState4 = _sliced_to_array(useState(
|
|
20
|
-
var _useState5 = _sliced_to_array(useState(
|
|
15
|
+
var _useState = _sliced_to_array(useState(false), 2), loading = _useState[0], setLoading = _useState[1];
|
|
16
|
+
var _useState1 = _sliced_to_array(useState(""), 2), keyWordProblem = _useState1[0], setKeyWordProblem = _useState1[1]; //搜索内容
|
|
17
|
+
var _useState2 = _sliced_to_array(useState(1), 2), showLoadingState = _useState2[0], setShowLoadingState = _useState2[1]; //1,初始状态,2、无数据 ,3、不显示图片
|
|
18
|
+
var _useState3 = _sliced_to_array(useState(1), 2), pageNum = _useState3[0], setPageNum = _useState3[1];
|
|
19
|
+
var _useState4 = _sliced_to_array(useState(0), 2), pageCount = _useState4[0], setPageCount = _useState4[1];
|
|
20
|
+
var _useState5 = _sliced_to_array(useState(10), 2), maxPageSize = _useState5[0], setMaxPageSize = _useState5[1];
|
|
21
|
+
var _useState6 = _sliced_to_array(useState([]), 2), totalData = _useState6[0], setTotalData = _useState6[1]; //总数据
|
|
21
22
|
var timer = useRef(null); //文本框输入时
|
|
22
23
|
useEffect(function() {
|
|
23
24
|
var handleScroll = function handleScroll() {
|
|
@@ -50,6 +51,7 @@ var HistoryFun = function(props) {
|
|
|
50
51
|
pageNum
|
|
51
52
|
]);
|
|
52
53
|
var getList = function(val, pageNum) {
|
|
54
|
+
setLoading(true);
|
|
53
55
|
return http.get("".concat(urllocation, "/chat-service/public/v1.0/history-messages-total"), {
|
|
54
56
|
params: {
|
|
55
57
|
message: val,
|
|
@@ -57,6 +59,7 @@ var HistoryFun = function(props) {
|
|
|
57
59
|
maxPageSize: maxPageSize
|
|
58
60
|
}
|
|
59
61
|
}).then(function(res) {
|
|
62
|
+
setLoading(false);
|
|
60
63
|
var data = res.data;
|
|
61
64
|
if (data.total > 0) {
|
|
62
65
|
setShowLoadingState(3);
|
|
@@ -71,7 +74,9 @@ var HistoryFun = function(props) {
|
|
|
71
74
|
} else {
|
|
72
75
|
setShowLoadingState(2);
|
|
73
76
|
}
|
|
74
|
-
}).catch(function(res) {
|
|
77
|
+
}).catch(function(res) {
|
|
78
|
+
setLoading(false);
|
|
79
|
+
});
|
|
75
80
|
};
|
|
76
81
|
//获取全部数据
|
|
77
82
|
var allData = function(roomId) {
|
|
@@ -322,181 +327,185 @@ var HistoryFun = function(props) {
|
|
|
322
327
|
})
|
|
323
328
|
]
|
|
324
329
|
}),
|
|
325
|
-
/*#__PURE__*/
|
|
330
|
+
/*#__PURE__*/ _jsx("div", {
|
|
326
331
|
className: styles.main_list,
|
|
327
332
|
id: "history_list",
|
|
328
|
-
children:
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
var
|
|
358
|
-
var
|
|
359
|
-
if (
|
|
360
|
-
message = message
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
}
|
|
333
|
+
children: /*#__PURE__*/ _jsxs(Spin, {
|
|
334
|
+
spinning: loading,
|
|
335
|
+
tip: "加载中...",
|
|
336
|
+
children: [
|
|
337
|
+
showLoadingState == 1 && /*#__PURE__*/ _jsxs("div", {
|
|
338
|
+
className: styles.no_data,
|
|
339
|
+
children: [
|
|
340
|
+
/*#__PURE__*/ _jsx("img", {
|
|
341
|
+
src: "/new_yun/images/aiService/search_for_icon.png"
|
|
342
|
+
}),
|
|
343
|
+
/*#__PURE__*/ _jsx("p", {
|
|
344
|
+
children: "输入关键词,搜索聊天记录"
|
|
345
|
+
})
|
|
346
|
+
]
|
|
347
|
+
}),
|
|
348
|
+
showLoadingState == 2 && /*#__PURE__*/ _jsxs("div", {
|
|
349
|
+
className: styles.no_data,
|
|
350
|
+
children: [
|
|
351
|
+
/*#__PURE__*/ _jsx("img", {
|
|
352
|
+
src: "/new_yun/images/aiService/no_data.png"
|
|
353
|
+
}),
|
|
354
|
+
/*#__PURE__*/ _jsx("p", {
|
|
355
|
+
children: "暂无记录"
|
|
356
|
+
})
|
|
357
|
+
]
|
|
358
|
+
}),
|
|
359
|
+
/*#__PURE__*/ _jsx("div", {
|
|
360
|
+
className: styles.list_item,
|
|
361
|
+
children: totalData.map(function(item) {
|
|
362
|
+
var span = "";
|
|
363
|
+
var time = "";
|
|
364
|
+
if (item.count == 1) {
|
|
365
|
+
var message = item.message;
|
|
366
|
+
var position_i = message.indexOf(keyWordProblem);
|
|
367
|
+
if (position_i > 30) {
|
|
368
|
+
message = message.substring(position_i - 15);
|
|
369
|
+
}
|
|
370
|
+
var reg = /[`~!@#$%^&*()_\-+=<>?:"{}|,.\/;'\\[\]·~!@#¥%……&*()——\-+={}|《》?:“”【】、;‘’,。、]/im;
|
|
371
|
+
//搜索内容是否有特殊字符
|
|
372
|
+
if (reg.test(keyWordProblem)) {
|
|
373
|
+
span = message.replaceAll(keyWordProblem, function(e) {
|
|
374
|
+
return "<span class=".concat(styles.sign, ">").concat(e, "</span>");
|
|
375
|
+
});
|
|
376
|
+
} else {
|
|
377
|
+
span = message.replaceAll(new RegExp(keyWordProblem, "ig"), function(i) {
|
|
378
|
+
return "<span class=".concat(styles.sign, ">").concat(i, "</span>");
|
|
379
|
+
});
|
|
380
|
+
}
|
|
381
|
+
time = formatDate(item.createdAt);
|
|
372
382
|
}
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
if (item.count == 1) {
|
|
382
|
-
calculationData(item.roomId, item.id, item.member);
|
|
383
|
-
} else {
|
|
384
|
-
showDetails(item.roomId, item.show);
|
|
385
|
-
}
|
|
386
|
-
},
|
|
387
|
-
children: [
|
|
388
|
-
/*#__PURE__*/ _jsx("div", {
|
|
389
|
-
className: styles.head_img,
|
|
390
|
-
children: item.member == "AI" ? /*#__PURE__*/ _jsx(CustomAiIcon, {}) : /*#__PURE__*/ _jsx("img", {
|
|
391
|
-
src: item.headImg
|
|
392
|
-
})
|
|
393
|
-
}),
|
|
394
|
-
/*#__PURE__*/ _jsxs("div", {
|
|
395
|
-
className: styles.list_desc,
|
|
396
|
-
children: [
|
|
397
|
-
/*#__PURE__*/ _jsxs("p", {
|
|
398
|
-
className: styles.name,
|
|
399
|
-
children: [
|
|
400
|
-
item.member == "AI" ? "AI助手" : item.name,
|
|
401
|
-
item.count == 1 ? /*#__PURE__*/ _jsx("span", {
|
|
402
|
-
className: styles.time,
|
|
403
|
-
children: time
|
|
404
|
-
}) : ""
|
|
405
|
-
]
|
|
406
|
-
}),
|
|
407
|
-
item.count == 1 ? /*#__PURE__*/ _jsx("p", {
|
|
408
|
-
className: styles.decs,
|
|
409
|
-
style: {
|
|
410
|
-
width: "calc(100% - 36px)"
|
|
411
|
-
},
|
|
412
|
-
dangerouslySetInnerHTML: {
|
|
413
|
-
__html: span
|
|
414
|
-
}
|
|
415
|
-
}) : /*#__PURE__*/ _jsx("p", {
|
|
416
|
-
className: styles.decs,
|
|
417
|
-
children: "".concat(item.count, "条相关聊天记录")
|
|
418
|
-
})
|
|
419
|
-
]
|
|
420
|
-
}),
|
|
421
|
-
item.count != 1 ? /*#__PURE__*/ _jsx("div", {
|
|
422
|
-
className: "".concat(styles.open, " ").concat(item.show ? styles.active : ""),
|
|
423
|
-
children: /*#__PURE__*/ _jsx(CustomExpand, {})
|
|
424
|
-
}) : ""
|
|
425
|
-
]
|
|
426
|
-
}),
|
|
427
|
-
/*#__PURE__*/ _jsxs("div", {
|
|
428
|
-
className: styles.list_detail,
|
|
429
|
-
children: [
|
|
430
|
-
item.show && item.detailsList && item.detailsList.map(function(list) {
|
|
431
|
-
// console.log(list,item,'dklfvmdflkvmdfklv')
|
|
432
|
-
var name = "";
|
|
433
|
-
if (list.sender == "AI") {
|
|
434
|
-
name = "AI助手";
|
|
435
|
-
} else if (list.sender == item.member) {
|
|
436
|
-
name = item.name;
|
|
383
|
+
return /*#__PURE__*/ _jsxs(_Fragment, {
|
|
384
|
+
children: [
|
|
385
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
386
|
+
className: "".concat(styles.list_summary, " ").concat(item.show ? styles.list_summary_active : ""),
|
|
387
|
+
id: item.roomId,
|
|
388
|
+
onClick: function() {
|
|
389
|
+
if (item.count == 1) {
|
|
390
|
+
calculationData(item.roomId, item.id, item.member);
|
|
437
391
|
} else {
|
|
438
|
-
|
|
439
|
-
}
|
|
440
|
-
var time = formatDate(list.updatedAt);
|
|
441
|
-
var reg = /[`~!@#$%^&*()_\-+=<>?:"{}|,.\/;'\\[\]·~!@#¥%……&*()——\-+={}|《》?:“”【】、;‘’,。、]/im;
|
|
442
|
-
var span = "";
|
|
443
|
-
var message = list.message;
|
|
444
|
-
var position_i = message.indexOf(keyWordProblem);
|
|
445
|
-
if (position_i > 30) {
|
|
446
|
-
message = message.substring(position_i - 15);
|
|
392
|
+
showDetails(item.roomId, item.show);
|
|
447
393
|
}
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
})
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
}
|
|
459
|
-
return /*#__PURE__*/ _jsxs("div", {
|
|
460
|
-
className: styles.list,
|
|
461
|
-
onClick: function() {
|
|
462
|
-
calculationData(item.roomId, list.id, list.receiver);
|
|
463
|
-
},
|
|
394
|
+
},
|
|
395
|
+
children: [
|
|
396
|
+
/*#__PURE__*/ _jsx("div", {
|
|
397
|
+
className: styles.head_img,
|
|
398
|
+
children: item.member == "AI" ? /*#__PURE__*/ _jsx(CustomAiIcon, {}) : /*#__PURE__*/ _jsx("img", {
|
|
399
|
+
src: item.headImg
|
|
400
|
+
})
|
|
401
|
+
}),
|
|
402
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
403
|
+
className: styles.list_desc,
|
|
464
404
|
children: [
|
|
465
|
-
/*#__PURE__*/ _jsxs("
|
|
405
|
+
/*#__PURE__*/ _jsxs("p", {
|
|
466
406
|
className: styles.name,
|
|
467
407
|
children: [
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
}),
|
|
471
|
-
/*#__PURE__*/ _jsx("span", {
|
|
408
|
+
item.member == "AI" ? "AI助手" : item.name,
|
|
409
|
+
item.count == 1 ? /*#__PURE__*/ _jsx("span", {
|
|
472
410
|
className: styles.time,
|
|
473
411
|
children: time
|
|
474
|
-
})
|
|
412
|
+
}) : ""
|
|
475
413
|
]
|
|
476
414
|
}),
|
|
477
|
-
/*#__PURE__*/ _jsx("
|
|
478
|
-
className: styles.
|
|
415
|
+
item.count == 1 ? /*#__PURE__*/ _jsx("p", {
|
|
416
|
+
className: styles.decs,
|
|
417
|
+
style: {
|
|
418
|
+
width: "calc(100% - 36px)"
|
|
419
|
+
},
|
|
479
420
|
dangerouslySetInnerHTML: {
|
|
480
421
|
__html: span
|
|
481
422
|
}
|
|
423
|
+
}) : /*#__PURE__*/ _jsx("p", {
|
|
424
|
+
className: styles.decs,
|
|
425
|
+
children: "".concat(item.count, "条相关聊天记录")
|
|
482
426
|
})
|
|
483
427
|
]
|
|
484
|
-
},
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
428
|
+
}),
|
|
429
|
+
item.count != 1 ? /*#__PURE__*/ _jsx("div", {
|
|
430
|
+
className: "".concat(styles.open, " ").concat(item.show ? styles.active : ""),
|
|
431
|
+
children: /*#__PURE__*/ _jsx(CustomExpand, {})
|
|
432
|
+
}) : ""
|
|
433
|
+
]
|
|
434
|
+
}),
|
|
435
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
436
|
+
className: styles.list_detail,
|
|
437
|
+
children: [
|
|
438
|
+
item.show && item.detailsList && item.detailsList.map(function(list) {
|
|
439
|
+
// console.log(list,item,'dklfvmdflkvmdfklv')
|
|
440
|
+
var name = "";
|
|
441
|
+
if (list.sender == "AI") {
|
|
442
|
+
name = "AI助手";
|
|
443
|
+
} else if (list.sender == item.member) {
|
|
444
|
+
name = item.name;
|
|
445
|
+
} else {
|
|
446
|
+
name = userData.real_name;
|
|
447
|
+
}
|
|
448
|
+
var time = formatDate(list.updatedAt);
|
|
449
|
+
var reg = /[`~!@#$%^&*()_\-+=<>?:"{}|,.\/;'\\[\]·~!@#¥%……&*()——\-+={}|《》?:“”【】、;‘’,。、]/im;
|
|
450
|
+
var span = "";
|
|
451
|
+
var message = list.message;
|
|
452
|
+
var position_i = message.indexOf(keyWordProblem);
|
|
453
|
+
if (position_i > 30) {
|
|
454
|
+
message = message.substring(position_i - 15);
|
|
455
|
+
}
|
|
456
|
+
//搜索内容是否有特殊字符
|
|
457
|
+
if (reg.test(keyWordProblem)) {
|
|
458
|
+
span = message.replaceAll(keyWordProblem, function(e) {
|
|
459
|
+
return "<span class=".concat(styles.sign, ">").concat(e, "</span>");
|
|
460
|
+
});
|
|
461
|
+
} else {
|
|
462
|
+
span = message.replaceAll(new RegExp(keyWordProblem, "ig"), function(i) {
|
|
463
|
+
// console.log(i,'skdcnsdjk')
|
|
464
|
+
return "<span class=".concat(styles.sign, ">").concat(i, "</span>");
|
|
465
|
+
});
|
|
466
|
+
}
|
|
467
|
+
return /*#__PURE__*/ _jsxs("div", {
|
|
468
|
+
className: styles.list,
|
|
469
|
+
onClick: function() {
|
|
470
|
+
calculationData(item.roomId, list.id, list.receiver);
|
|
471
|
+
},
|
|
472
|
+
children: [
|
|
473
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
474
|
+
className: styles.name,
|
|
475
|
+
children: [
|
|
476
|
+
/*#__PURE__*/ _jsx("p", {
|
|
477
|
+
children: name
|
|
478
|
+
}),
|
|
479
|
+
/*#__PURE__*/ _jsx("span", {
|
|
480
|
+
className: styles.time,
|
|
481
|
+
children: time
|
|
482
|
+
})
|
|
483
|
+
]
|
|
484
|
+
}),
|
|
485
|
+
/*#__PURE__*/ _jsx("div", {
|
|
486
|
+
className: styles.con,
|
|
487
|
+
dangerouslySetInnerHTML: {
|
|
488
|
+
__html: span
|
|
489
|
+
}
|
|
490
|
+
})
|
|
491
|
+
]
|
|
492
|
+
}, list.id);
|
|
493
|
+
}),
|
|
494
|
+
item.show && item.pageCount > 1 && item.pageCount > item.pageNum && /*#__PURE__*/ _jsx("div", {
|
|
495
|
+
className: "".concat(styles.list, " ").concat(styles.list_more),
|
|
496
|
+
onClick: function() {
|
|
497
|
+
loadMore(item.pageNum + 1, item.roomId);
|
|
498
|
+
},
|
|
499
|
+
children: "点击加载更多"
|
|
500
|
+
})
|
|
501
|
+
]
|
|
502
|
+
})
|
|
503
|
+
]
|
|
504
|
+
});
|
|
505
|
+
})
|
|
497
506
|
})
|
|
498
|
-
|
|
499
|
-
|
|
507
|
+
]
|
|
508
|
+
})
|
|
500
509
|
})
|
|
501
510
|
]
|
|
502
511
|
})
|