bhd-components 0.6.9 → 0.7.2
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/{a1012a79.esm.es5.production.js → 03434506.esm.es5.production.js} +1 -1
- package/dist/{769f0c13.esm.es5.development.js → 86a6ab15.esm.es5.development.js} +76 -76
- package/dist/index.esm.es5.development.css +774 -752
- package/dist/index.esm.es5.development.js +349 -282
- package/dist/index.esm.es5.production.css +1 -1
- package/dist/index.esm.es5.production.js +1 -1
- package/es2017/customerService/common.module.less +1391 -0
- package/es2017/customerService/historyFun.js +2 -2
- package/es2017/customerService/index.js +330 -261
- package/es2017/customerService/index.module.less +25 -12
- package/es2017/customerService/index2.module.less +27 -9
- package/esm/customerService/common.module.less +1391 -0
- package/esm/customerService/historyFun.js +2 -2
- package/esm/customerService/index.js +344 -277
- package/esm/customerService/index.module.less +25 -12
- package/esm/customerService/index2.module.less +27 -9
- package/package.json +1 -1
|
@@ -51,9 +51,9 @@ const CustomerService = (props)=>{
|
|
|
51
51
|
const [answerMode, setAnswerMode] = useState(-1); //设置回答模式。1,召唤老师回答
|
|
52
52
|
const [teacherList, setTeacherList] = useState([]); //老师列表
|
|
53
53
|
const [problem, setProblem] = useState({}); //召唤老师回答的问题
|
|
54
|
-
// const [roomList,setRoomList] = useState([]);//聊天列表
|
|
55
54
|
const [contactsList, setContactsList] = useState([]); //老师列表
|
|
56
55
|
const [chatObj, setChatObj] = useState([]); //聊天记录id保存,用来在实验报告中记录
|
|
56
|
+
const [keyWordProblem, setKeyWordProblem] = useState(""); //历史记录搜索的内容
|
|
57
57
|
const timer = useRef(null); //文本框输入时
|
|
58
58
|
let receiveMessageTimer = useRef(null); //接收ai发回的消息
|
|
59
59
|
let voiceCountdownTimer = useRef(null); //语音录制倒计时
|
|
@@ -253,26 +253,48 @@ const CustomerService = (props)=>{
|
|
|
253
253
|
let questionsList = [];
|
|
254
254
|
let obj = {};
|
|
255
255
|
if (type == 1) {
|
|
256
|
-
questionsList = hotQuestionsList.map((item, index)=>{
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
});
|
|
268
|
-
questionsList = questionsList.filter((i)=>i != null);
|
|
256
|
+
// questionsList = hotQuestionsList.map((item, index) => {
|
|
257
|
+
// if (index < 3) {
|
|
258
|
+
// return {
|
|
259
|
+
// key: "messageSource",
|
|
260
|
+
// value: item.id,
|
|
261
|
+
// question: item.question,
|
|
262
|
+
// answer: item.answer,
|
|
263
|
+
// };
|
|
264
|
+
// } else {
|
|
265
|
+
// return null;
|
|
266
|
+
// }
|
|
267
|
+
// });
|
|
268
|
+
// questionsList = questionsList.filter((i) => i != null);
|
|
269
269
|
obj = {
|
|
270
270
|
roomId: roomId,
|
|
271
271
|
sender: "AI",
|
|
272
272
|
recevier: mid,
|
|
273
|
-
message: `Hi
|
|
274
|
-
extraInfos: questionsList
|
|
273
|
+
message: `Hi!我是有问必答的实训云智能客服,请问您遇到了什么问题?`
|
|
275
274
|
};
|
|
275
|
+
if (pageNumHistory <= 1) {
|
|
276
|
+
setHistoryMessageList((historyMessageList)=>{
|
|
277
|
+
let newHistoryMessageList = historyMessageList.concat(_object_spread_props(_object_spread({}, obj), {
|
|
278
|
+
id: new Date().getTime() + 'dede',
|
|
279
|
+
upvoted: false,
|
|
280
|
+
downvoted: false,
|
|
281
|
+
quotedMessage: "",
|
|
282
|
+
createdAt: getDataTime(-1),
|
|
283
|
+
// extraInfo: JSON.stringify(obj.extraInfos),
|
|
284
|
+
extraInfo: JSON.stringify([
|
|
285
|
+
{
|
|
286
|
+
key: "messageSource",
|
|
287
|
+
value: "knowledgebase"
|
|
288
|
+
}
|
|
289
|
+
])
|
|
290
|
+
}));
|
|
291
|
+
return newHistoryMessageList;
|
|
292
|
+
});
|
|
293
|
+
setTimeout(()=>{
|
|
294
|
+
scrollToBottom();
|
|
295
|
+
}, 100);
|
|
296
|
+
}
|
|
297
|
+
return;
|
|
276
298
|
} else if (type == 2) {
|
|
277
299
|
obj = {
|
|
278
300
|
roomId: roomId,
|
|
@@ -347,6 +369,23 @@ const CustomerService = (props)=>{
|
|
|
347
369
|
message: `猜你想问:`,
|
|
348
370
|
extraInfos: questionsList
|
|
349
371
|
};
|
|
372
|
+
if (pageNumHistory <= 1) {
|
|
373
|
+
setHistoryMessageList((historyMessageList)=>{
|
|
374
|
+
let newHistoryMessageList = historyMessageList.concat(_object_spread_props(_object_spread({}, obj), {
|
|
375
|
+
id: 'p' + new Date().getTime(),
|
|
376
|
+
upvoted: false,
|
|
377
|
+
downvoted: false,
|
|
378
|
+
quotedMessage: "",
|
|
379
|
+
createdAt: getDataTime(-1),
|
|
380
|
+
extraInfo: JSON.stringify(obj.extraInfos)
|
|
381
|
+
}));
|
|
382
|
+
return newHistoryMessageList;
|
|
383
|
+
});
|
|
384
|
+
setTimeout(()=>{
|
|
385
|
+
scrollToBottom();
|
|
386
|
+
}, 100);
|
|
387
|
+
}
|
|
388
|
+
return;
|
|
350
389
|
}
|
|
351
390
|
setKeyWord("");
|
|
352
391
|
setQuestionsList([]);
|
|
@@ -866,7 +905,6 @@ const CustomerService = (props)=>{
|
|
|
866
905
|
last_id = historyMessageList[0].id;
|
|
867
906
|
}
|
|
868
907
|
if (flag != 1 && last_id != "") {
|
|
869
|
-
console.log(last_id, 'dkfjvndfjvndfkvdflast_idlast_idlast_id');
|
|
870
908
|
setLastId(last_id);
|
|
871
909
|
}
|
|
872
910
|
//取消搜索页码标记
|
|
@@ -949,12 +987,17 @@ const CustomerService = (props)=>{
|
|
|
949
987
|
if (problem != undefined && problem.user != undefined && problem.question != undefined) {
|
|
950
988
|
sendToTeacher(1);
|
|
951
989
|
}
|
|
990
|
+
// if(flag == 1){
|
|
991
|
+
setTimeout(()=>{
|
|
992
|
+
setKeyWordProblem('');
|
|
993
|
+
}, 3100);
|
|
994
|
+
// }
|
|
952
995
|
} else {
|
|
953
996
|
setPageCount(0);
|
|
954
|
-
setGreetingMessage(true);
|
|
955
997
|
setBottomLoading(false);
|
|
956
998
|
setLoading(false);
|
|
957
999
|
setHistoryMessageList([]);
|
|
1000
|
+
setGreetingMessage(true);
|
|
958
1001
|
//召唤老师回答
|
|
959
1002
|
if (problem != undefined && problem.user != undefined && problem.question != undefined) {
|
|
960
1003
|
sendToTeacher(1);
|
|
@@ -1475,17 +1518,19 @@ const CustomerService = (props)=>{
|
|
|
1475
1518
|
// }
|
|
1476
1519
|
//渲染问答
|
|
1477
1520
|
const renderQuestion = ()=>{
|
|
1478
|
-
if (historyMessageList.length > 0) {
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1521
|
+
// if (historyMessageList.length > 0) {
|
|
1522
|
+
return /*#__PURE__*/ _jsx("ul", {
|
|
1523
|
+
className: styles.message_con,
|
|
1524
|
+
children: historyMessageList.map((item, i)=>{
|
|
1525
|
+
console.log(item, 444444888888);
|
|
1526
|
+
let timeObj = parseDate(item.createdAt);
|
|
1527
|
+
// console.log(item.message);
|
|
1528
|
+
let message = item.message;
|
|
1529
|
+
let li;
|
|
1530
|
+
// 是否需要显示日期
|
|
1531
|
+
let itemIndex = historyMessageList.findIndex((ite)=>ite.id === item.id);
|
|
1532
|
+
let time = "";
|
|
1533
|
+
if (historyMessageList.length > 1) {
|
|
1489
1534
|
if (itemIndex <= 0) {
|
|
1490
1535
|
//第一项
|
|
1491
1536
|
time = `${timeObj.year}-${timeObj.month}-${timeObj.day} ${timeObj.hours}:${timeObj.minutes}`;
|
|
@@ -1505,244 +1550,253 @@ const CustomerService = (props)=>{
|
|
|
1505
1550
|
}
|
|
1506
1551
|
}
|
|
1507
1552
|
}
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
});
|
|
1541
|
-
resettingBottomHei();
|
|
1542
|
-
onEvent(serverName + serverUrl(), "click_智能问答_引用", "提交");
|
|
1543
|
-
},
|
|
1544
|
-
children: /*#__PURE__*/ _jsx(CustomQuote, {})
|
|
1545
|
-
}),
|
|
1546
|
-
copyTextOBJ.length > 0 && copyTextOBJ.some((list)=>list == item.id) ? /*#__PURE__*/ _jsx("i", {
|
|
1547
|
-
className: `tongyong-xuanzhongdui`,
|
|
1548
|
-
children: /*#__PURE__*/ _jsx(CustomDuihao, {})
|
|
1549
|
-
}) : /*#__PURE__*/ _jsx("i", {
|
|
1550
|
-
className: "fuzhi21",
|
|
1551
|
-
onClick: ()=>{
|
|
1552
|
-
let bol = copyText(item.message);
|
|
1553
|
-
if (bol) {
|
|
1554
|
-
let obj = copyTextOBJ;
|
|
1555
|
-
obj = obj.filter((list)=>list != item.id);
|
|
1556
|
-
obj.push(item.id);
|
|
1557
|
-
setCopyTextObj(obj);
|
|
1558
|
-
}
|
|
1559
|
-
setTimeout(()=>{
|
|
1560
|
-
let obj = copyTextOBJ;
|
|
1561
|
-
obj = obj.filter((list)=>list != item.id);
|
|
1562
|
-
setCopyTextObj(obj);
|
|
1563
|
-
}, 3000);
|
|
1564
|
-
onEvent(serverName + serverUrl(), "click_智能问答_复制", "提交");
|
|
1565
|
-
},
|
|
1566
|
-
children: /*#__PURE__*/ _jsx(CustomCopy, {})
|
|
1567
|
-
})
|
|
1568
|
-
]
|
|
1569
|
-
})
|
|
1570
|
-
}),
|
|
1571
|
-
/*#__PURE__*/ _jsx("div", {
|
|
1572
|
-
className: styles.content,
|
|
1573
|
-
children: /*#__PURE__*/ _jsx("p", {
|
|
1574
|
-
dangerouslySetInnerHTML: {
|
|
1575
|
-
__html: remarkable.render(message)
|
|
1576
|
-
},
|
|
1577
|
-
className: styles.content_child
|
|
1578
|
-
})
|
|
1579
|
-
})
|
|
1580
|
-
]
|
|
1581
|
-
}),
|
|
1582
|
-
//引用消息
|
|
1583
|
-
item.quotedMessage && /*#__PURE__*/ _jsx("div", {
|
|
1584
|
-
className: styles.citation_content,
|
|
1585
|
-
children: getByteLen(item.quotedMessage) > 120 ? /*#__PURE__*/ _jsx(Tooltip, {
|
|
1586
|
-
overlayClassName: styles.popover_main_content,
|
|
1587
|
-
title: item.quotedMessage,
|
|
1588
|
-
placement: "leftTop",
|
|
1553
|
+
}
|
|
1554
|
+
let dataTime = time;
|
|
1555
|
+
if (lastId == item.id && keyWordProblem != '') {
|
|
1556
|
+
message = remarkable.render(message);
|
|
1557
|
+
message = message.replaceAll(keyWordProblem, (e)=>{
|
|
1558
|
+
return `<span class=${styles.sign}>${e}</span>`;
|
|
1559
|
+
});
|
|
1560
|
+
} else {
|
|
1561
|
+
message = remarkable.render(message);
|
|
1562
|
+
}
|
|
1563
|
+
if (item.sender == mid) {
|
|
1564
|
+
//只有引用和复制功能
|
|
1565
|
+
li = /*#__PURE__*/ _jsxs(_Fragment, {
|
|
1566
|
+
children: [
|
|
1567
|
+
dataTime ? /*#__PURE__*/ _jsx("li", {
|
|
1568
|
+
className: styles.time,
|
|
1569
|
+
children: dataTime
|
|
1570
|
+
}) : "",
|
|
1571
|
+
/*#__PURE__*/ _jsxs("li", {
|
|
1572
|
+
className: styles.left,
|
|
1573
|
+
id: lastId == item.id ? "li_flag" : "",
|
|
1574
|
+
children: [
|
|
1575
|
+
/*#__PURE__*/ _jsx("div", {
|
|
1576
|
+
className: styles.main,
|
|
1577
|
+
children: /*#__PURE__*/ _jsxs("div", {
|
|
1578
|
+
className: styles.main_content,
|
|
1579
|
+
children: [
|
|
1580
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
1581
|
+
className: styles.main_content_flag,
|
|
1582
|
+
children: [
|
|
1583
|
+
/*#__PURE__*/ _jsx("div", {
|
|
1584
|
+
className: styles.operate_modal,
|
|
1589
1585
|
children: /*#__PURE__*/ _jsxs("p", {
|
|
1590
|
-
className: styles.
|
|
1586
|
+
className: styles.operate,
|
|
1591
1587
|
children: [
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
})
|
|
1602
|
-
}),
|
|
1603
|
-
showType == 2 || showType == 4 ? /*#__PURE__*/ _jsx("div", {
|
|
1604
|
-
className: styles.head_sculpture,
|
|
1605
|
-
style: {
|
|
1606
|
-
marginLeft: "12px"
|
|
1607
|
-
},
|
|
1608
|
-
children: /*#__PURE__*/ _jsx("img", {
|
|
1609
|
-
src: userData.avatar
|
|
1610
|
-
})
|
|
1611
|
-
}) : ""
|
|
1612
|
-
]
|
|
1613
|
-
}, item.id)
|
|
1614
|
-
]
|
|
1615
|
-
});
|
|
1616
|
-
} else {
|
|
1617
|
-
//获取用户头像
|
|
1618
|
-
let headImg = "";
|
|
1619
|
-
let chatWindow = [];
|
|
1620
|
-
let isAiChatWindow;
|
|
1621
|
-
chatWindow = contactsList.filter((item)=>item.roomId == roomId);
|
|
1622
|
-
if (chatWindow.length > 0 && chatWindow[0].headImg != "") {
|
|
1623
|
-
headImg = chatWindow[0].headImg;
|
|
1624
|
-
}
|
|
1625
|
-
// console.log(chatWindow,'chatWindowchatWindow')
|
|
1626
|
-
//是否在智能客服窗口
|
|
1627
|
-
isAiChatWindow = chatWindow.length > 0 && chatWindow[0].sender != undefined && chatWindow[0].sender == "AI" ? true : false;
|
|
1628
|
-
let header = 2; //代表是ai头像
|
|
1629
|
-
if (isAiChatWindow && item.extraInfo != undefined && JSON.parse(item.extraInfo).length > 0 && JSON.parse(item.extraInfo)[0].key == "isVoteMessage") {
|
|
1630
|
-
//使用AI头像
|
|
1631
|
-
header = 1;
|
|
1632
|
-
}
|
|
1633
|
-
li = /*#__PURE__*/ _jsxs(_Fragment, {
|
|
1634
|
-
children: [
|
|
1635
|
-
dataTime ? /*#__PURE__*/ _jsx("li", {
|
|
1636
|
-
className: styles.time,
|
|
1637
|
-
children: dataTime
|
|
1638
|
-
}) : "",
|
|
1639
|
-
/*#__PURE__*/ _jsxs("li", {
|
|
1640
|
-
className: styles.right,
|
|
1641
|
-
id: lastId == item.id ? "li_flag" : "",
|
|
1642
|
-
children: [
|
|
1643
|
-
(showType == 2 || showType == 4) && /*#__PURE__*/ _jsx("div", {
|
|
1644
|
-
className: styles.head_sculpture,
|
|
1645
|
-
style: {
|
|
1646
|
-
marginRight: "12px"
|
|
1647
|
-
},
|
|
1648
|
-
children: isAiChatWindow ? item.extraInfo == null || header == 1 ? /*#__PURE__*/ _jsx(CustomAiIcon, {}) : /*#__PURE__*/ _jsx("img", {
|
|
1649
|
-
src: knowledge_icon
|
|
1650
|
-
}) : /*#__PURE__*/ _jsx("img", {
|
|
1651
|
-
src: headImg
|
|
1652
|
-
})
|
|
1653
|
-
}),
|
|
1654
|
-
/*#__PURE__*/ _jsx("div", {
|
|
1655
|
-
className: styles.main,
|
|
1656
|
-
children: /*#__PURE__*/ _jsxs("div", {
|
|
1657
|
-
className: styles.main_content,
|
|
1658
|
-
children: [
|
|
1659
|
-
/*#__PURE__*/ _jsxs("div", {
|
|
1660
|
-
className: styles.main_content_flag,
|
|
1661
|
-
children: [
|
|
1662
|
-
/*#__PURE__*/ _jsx("div", {
|
|
1663
|
-
className: styles.operate_modal,
|
|
1664
|
-
children: // 不是最后一行,
|
|
1665
|
-
historyMessageList.length - 1 != i && renderOperateBtn(item, isAiChatWindow, i)
|
|
1666
|
-
}),
|
|
1667
|
-
/*#__PURE__*/ _jsxs("div", {
|
|
1668
|
-
className: styles.content,
|
|
1669
|
-
children: [
|
|
1670
|
-
/*#__PURE__*/ _jsx("p", {
|
|
1671
|
-
dangerouslySetInnerHTML: {
|
|
1672
|
-
__html: remarkable.render(message)
|
|
1588
|
+
/*#__PURE__*/ _jsx("i", {
|
|
1589
|
+
className: "yinyong_quote1",
|
|
1590
|
+
onClick: ()=>{
|
|
1591
|
+
setCitationContent({
|
|
1592
|
+
content: item.message,
|
|
1593
|
+
id: item.id
|
|
1594
|
+
});
|
|
1595
|
+
resettingBottomHei();
|
|
1596
|
+
onEvent(serverName + serverUrl(), "click_智能问答_引用", "提交");
|
|
1673
1597
|
},
|
|
1674
|
-
|
|
1598
|
+
children: /*#__PURE__*/ _jsx(CustomQuote, {})
|
|
1675
1599
|
}),
|
|
1676
|
-
|
|
1677
|
-
className:
|
|
1678
|
-
children:
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
}
|
|
1689
|
-
|
|
1600
|
+
copyTextOBJ.length > 0 && copyTextOBJ.some((list)=>list == item.id) ? /*#__PURE__*/ _jsx("i", {
|
|
1601
|
+
className: `tongyong-xuanzhongdui`,
|
|
1602
|
+
children: /*#__PURE__*/ _jsx(CustomDuihao, {})
|
|
1603
|
+
}) : /*#__PURE__*/ _jsx("i", {
|
|
1604
|
+
className: "fuzhi21",
|
|
1605
|
+
onClick: ()=>{
|
|
1606
|
+
let bol = copyText(item.message);
|
|
1607
|
+
if (bol) {
|
|
1608
|
+
let obj = copyTextOBJ;
|
|
1609
|
+
obj = obj.filter((list)=>list != item.id);
|
|
1610
|
+
obj.push(item.id);
|
|
1611
|
+
setCopyTextObj(obj);
|
|
1612
|
+
}
|
|
1613
|
+
setTimeout(()=>{
|
|
1614
|
+
let obj = copyTextOBJ;
|
|
1615
|
+
obj = obj.filter((list)=>list != item.id);
|
|
1616
|
+
setCopyTextObj(obj);
|
|
1617
|
+
}, 3000);
|
|
1618
|
+
onEvent(serverName + serverUrl(), "click_智能问答_复制", "提交");
|
|
1619
|
+
},
|
|
1620
|
+
children: /*#__PURE__*/ _jsx(CustomCopy, {})
|
|
1690
1621
|
})
|
|
1691
1622
|
]
|
|
1692
1623
|
})
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
overlayClassName: styles.popover_main_content,
|
|
1700
|
-
title: item.quotedMessage,
|
|
1701
|
-
placement: "rightTop",
|
|
1702
|
-
children: /*#__PURE__*/ _jsxs("p", {
|
|
1703
|
-
className: styles.text_exceed,
|
|
1704
|
-
children: [
|
|
1705
|
-
item.quotedMessage,
|
|
1706
|
-
/*#__PURE__*/ _jsx(RightOutlined, {})
|
|
1707
|
-
]
|
|
1708
|
-
})
|
|
1709
|
-
}) : /*#__PURE__*/ _jsx("p", {
|
|
1710
|
-
children: item.quotedMessage
|
|
1711
|
-
})
|
|
1712
|
-
}),
|
|
1713
|
-
//findTeacher//是否在召唤老师过程中,是否是最后一条消息
|
|
1714
|
-
!item.findTeacher && historyMessageList.length - 1 == i && item.id != "123456" && renderLastOperateBtn(item, isAiChatWindow, i),
|
|
1715
|
-
//召唤老师回答按钮
|
|
1716
|
-
isAiChatWindow && item.findTeacher && userData.modules.some((item)=>item.short == "TeacherAnswer") ? /*#__PURE__*/ _jsx("div", {
|
|
1717
|
-
className: `${styles.operate_modal_bottom} `,
|
|
1718
|
-
children: /*#__PURE__*/ _jsx("p", {
|
|
1719
|
-
className: styles.stop_findTeacher,
|
|
1720
|
-
children: /*#__PURE__*/ _jsx("span", {
|
|
1721
|
-
onClick: ()=>{
|
|
1722
|
-
setAnswerMode(-1);
|
|
1723
|
-
setTeacherList([]);
|
|
1724
|
-
setHistoryMessageList((historyMessageList)=>{
|
|
1725
|
-
return historyMessageList.filter((item)=>item.id != "-1");
|
|
1726
|
-
});
|
|
1624
|
+
}),
|
|
1625
|
+
/*#__PURE__*/ _jsx("div", {
|
|
1626
|
+
className: styles.content,
|
|
1627
|
+
children: /*#__PURE__*/ _jsx("p", {
|
|
1628
|
+
dangerouslySetInnerHTML: {
|
|
1629
|
+
__html: message
|
|
1727
1630
|
},
|
|
1728
|
-
|
|
1631
|
+
className: styles.content_child
|
|
1729
1632
|
})
|
|
1730
1633
|
})
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1634
|
+
]
|
|
1635
|
+
}),
|
|
1636
|
+
//引用消息
|
|
1637
|
+
item.quotedMessage && /*#__PURE__*/ _jsx("div", {
|
|
1638
|
+
className: styles.citation_content,
|
|
1639
|
+
children: getByteLen(item.quotedMessage) > 120 ? /*#__PURE__*/ _jsx(Tooltip, {
|
|
1640
|
+
overlayClassName: styles.popover_main_content,
|
|
1641
|
+
title: item.quotedMessage,
|
|
1642
|
+
placement: "leftTop",
|
|
1643
|
+
children: /*#__PURE__*/ _jsxs("p", {
|
|
1644
|
+
className: styles.text_exceed,
|
|
1645
|
+
children: [
|
|
1646
|
+
item.quotedMessage,
|
|
1647
|
+
/*#__PURE__*/ _jsx(RightOutlined, {})
|
|
1648
|
+
]
|
|
1649
|
+
})
|
|
1650
|
+
}) : /*#__PURE__*/ _jsx("p", {
|
|
1651
|
+
children: item.quotedMessage
|
|
1652
|
+
})
|
|
1653
|
+
})
|
|
1654
|
+
]
|
|
1734
1655
|
})
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1656
|
+
}),
|
|
1657
|
+
showType == 2 || showType == 4 ? /*#__PURE__*/ _jsx("div", {
|
|
1658
|
+
className: styles.head_sculpture,
|
|
1659
|
+
style: {
|
|
1660
|
+
marginLeft: "12px"
|
|
1661
|
+
},
|
|
1662
|
+
children: /*#__PURE__*/ _jsx("img", {
|
|
1663
|
+
src: userData.avatar
|
|
1664
|
+
})
|
|
1665
|
+
}) : ""
|
|
1666
|
+
]
|
|
1667
|
+
}, item.id)
|
|
1668
|
+
]
|
|
1669
|
+
});
|
|
1670
|
+
} else {
|
|
1671
|
+
//获取用户头像
|
|
1672
|
+
let headImg = "";
|
|
1673
|
+
let chatWindow = [];
|
|
1674
|
+
let isAiChatWindow;
|
|
1675
|
+
chatWindow = contactsList.filter((item)=>item.roomId == roomId);
|
|
1676
|
+
if (chatWindow.length > 0 && chatWindow[0].headImg != "") {
|
|
1677
|
+
headImg = chatWindow[0].headImg;
|
|
1739
1678
|
}
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1679
|
+
// console.log(chatWindow,'chatWindowchatWindow')
|
|
1680
|
+
//是否在智能客服窗口
|
|
1681
|
+
isAiChatWindow = chatWindow.length > 0 && chatWindow[0].sender != undefined && chatWindow[0].sender == "AI" ? true : false;
|
|
1682
|
+
let header = 2; //代表是ai头像
|
|
1683
|
+
if (isAiChatWindow && item.extraInfo != undefined && JSON.parse(item.extraInfo).length > 0 && JSON.parse(item.extraInfo)[0].key == "isVoteMessage") {
|
|
1684
|
+
//使用AI头像
|
|
1685
|
+
header = 1;
|
|
1686
|
+
}
|
|
1687
|
+
li = /*#__PURE__*/ _jsxs(_Fragment, {
|
|
1688
|
+
children: [
|
|
1689
|
+
dataTime ? /*#__PURE__*/ _jsx("li", {
|
|
1690
|
+
className: styles.time,
|
|
1691
|
+
children: dataTime
|
|
1692
|
+
}) : "",
|
|
1693
|
+
/*#__PURE__*/ _jsxs("li", {
|
|
1694
|
+
className: styles.right,
|
|
1695
|
+
id: lastId == item.id ? "li_flag" : "",
|
|
1696
|
+
children: [
|
|
1697
|
+
(showType == 2 || showType == 4) && /*#__PURE__*/ _jsx("div", {
|
|
1698
|
+
className: styles.head_sculpture,
|
|
1699
|
+
style: {
|
|
1700
|
+
marginRight: "12px"
|
|
1701
|
+
},
|
|
1702
|
+
children: isAiChatWindow ? item.extraInfo == null || header == 1 ? /*#__PURE__*/ _jsx(CustomAiIcon, {}) : /*#__PURE__*/ _jsx("img", {
|
|
1703
|
+
src: knowledge_icon
|
|
1704
|
+
}) : /*#__PURE__*/ _jsx("img", {
|
|
1705
|
+
src: headImg
|
|
1706
|
+
})
|
|
1707
|
+
}),
|
|
1708
|
+
/*#__PURE__*/ _jsx("div", {
|
|
1709
|
+
className: styles.main,
|
|
1710
|
+
children: /*#__PURE__*/ _jsxs("div", {
|
|
1711
|
+
className: styles.main_content,
|
|
1712
|
+
children: [
|
|
1713
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
1714
|
+
className: styles.main_content_flag,
|
|
1715
|
+
children: [
|
|
1716
|
+
/*#__PURE__*/ _jsx("div", {
|
|
1717
|
+
className: styles.operate_modal,
|
|
1718
|
+
children: // 不是最后一行,
|
|
1719
|
+
historyMessageList.length - 1 != i && renderOperateBtn(item, isAiChatWindow, i)
|
|
1720
|
+
}),
|
|
1721
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
1722
|
+
className: styles.content,
|
|
1723
|
+
children: [
|
|
1724
|
+
/*#__PURE__*/ _jsx("p", {
|
|
1725
|
+
dangerouslySetInnerHTML: {
|
|
1726
|
+
__html: message
|
|
1727
|
+
},
|
|
1728
|
+
className: styles.content_child
|
|
1729
|
+
}),
|
|
1730
|
+
item.extraInfo != undefined && JSON.parse(item.extraInfo).length > 0 && JSON.parse(item.extraInfo)[0].key == "messageSource" && JSON.parse(item.extraInfo)[0].value != "knowledgebase" && /*#__PURE__*/ _jsx("ul", {
|
|
1731
|
+
className: styles.association_problem,
|
|
1732
|
+
children: JSON.parse(item.extraInfo).map((list, index)=>{
|
|
1733
|
+
return /*#__PURE__*/ _jsxs("li", {
|
|
1734
|
+
onClick: ()=>{
|
|
1735
|
+
sendMessage(list, 1);
|
|
1736
|
+
},
|
|
1737
|
+
children: [
|
|
1738
|
+
index + 1,
|
|
1739
|
+
".",
|
|
1740
|
+
list.question
|
|
1741
|
+
]
|
|
1742
|
+
}, i + "_" + index + "_" + list.value);
|
|
1743
|
+
})
|
|
1744
|
+
})
|
|
1745
|
+
]
|
|
1746
|
+
})
|
|
1747
|
+
]
|
|
1748
|
+
}),
|
|
1749
|
+
//引用消息
|
|
1750
|
+
item.quotedMessage && /*#__PURE__*/ _jsx("div", {
|
|
1751
|
+
className: styles.citation_content,
|
|
1752
|
+
children: getByteLen(item.quotedMessage) > 120 ? /*#__PURE__*/ _jsx(Tooltip, {
|
|
1753
|
+
overlayClassName: styles.popover_main_content,
|
|
1754
|
+
title: item.quotedMessage,
|
|
1755
|
+
placement: "rightTop",
|
|
1756
|
+
children: /*#__PURE__*/ _jsxs("p", {
|
|
1757
|
+
className: styles.text_exceed,
|
|
1758
|
+
children: [
|
|
1759
|
+
item.quotedMessage,
|
|
1760
|
+
/*#__PURE__*/ _jsx(RightOutlined, {})
|
|
1761
|
+
]
|
|
1762
|
+
})
|
|
1763
|
+
}) : /*#__PURE__*/ _jsx("p", {
|
|
1764
|
+
children: item.quotedMessage
|
|
1765
|
+
})
|
|
1766
|
+
}),
|
|
1767
|
+
//findTeacher//是否在召唤老师过程中,是否是最后一条消息
|
|
1768
|
+
!item.findTeacher && historyMessageList.length - 1 == i && item.id != "123456" && renderLastOperateBtn(item, isAiChatWindow, i),
|
|
1769
|
+
//召唤老师回答按钮
|
|
1770
|
+
isAiChatWindow && item.findTeacher && userData.modules.some((item)=>item.short == "TeacherAnswer") ? /*#__PURE__*/ _jsx("div", {
|
|
1771
|
+
className: `${styles.operate_modal_bottom} `,
|
|
1772
|
+
children: /*#__PURE__*/ _jsx("p", {
|
|
1773
|
+
className: styles.stop_findTeacher,
|
|
1774
|
+
children: /*#__PURE__*/ _jsx("span", {
|
|
1775
|
+
onClick: ()=>{
|
|
1776
|
+
setAnswerMode(-1);
|
|
1777
|
+
setTeacherList([]);
|
|
1778
|
+
setHistoryMessageList((historyMessageList)=>{
|
|
1779
|
+
return historyMessageList.filter((item)=>item.id != "-1");
|
|
1780
|
+
});
|
|
1781
|
+
},
|
|
1782
|
+
children: "停止召唤老师"
|
|
1783
|
+
})
|
|
1784
|
+
})
|
|
1785
|
+
}) : ""
|
|
1786
|
+
]
|
|
1787
|
+
})
|
|
1788
|
+
})
|
|
1789
|
+
]
|
|
1790
|
+
}, item.id)
|
|
1791
|
+
]
|
|
1792
|
+
});
|
|
1793
|
+
}
|
|
1794
|
+
return li;
|
|
1795
|
+
})
|
|
1796
|
+
});
|
|
1797
|
+
// } else {
|
|
1798
|
+
// return "";
|
|
1799
|
+
// }
|
|
1746
1800
|
};
|
|
1747
1801
|
//渲染相关操作按钮 header == 1 ai ,== 2 知识库
|
|
1748
1802
|
const renderOperateBtn = (item, isAiChatWindow, i)=>{
|
|
@@ -2398,11 +2452,14 @@ const CustomerService = (props)=>{
|
|
|
2398
2452
|
}
|
|
2399
2453
|
};
|
|
2400
2454
|
//加载指定数据,点击历史记录
|
|
2401
|
-
const loadSpecifiedData = (renewRoomId, page, id, receiver)=>{
|
|
2455
|
+
const loadSpecifiedData = (renewRoomId, page, id, receiver, keyWordProblem)=>{
|
|
2402
2456
|
// let renewRoomId = '4a615d7126b343f78d10dcb06dbc29b0';
|
|
2403
2457
|
// let page = 1;
|
|
2404
2458
|
// let id = '0e459f0a3a62438698f170b42b94d150';
|
|
2405
2459
|
// let receiver = mid;
|
|
2460
|
+
if (keyWordProblem != '') {
|
|
2461
|
+
setKeyWordProblem(keyWordProblem);
|
|
2462
|
+
}
|
|
2406
2463
|
if (page != 1) {
|
|
2407
2464
|
setPageNumHistory(page);
|
|
2408
2465
|
}
|
|
@@ -2466,6 +2523,9 @@ const CustomerService = (props)=>{
|
|
|
2466
2523
|
style: {
|
|
2467
2524
|
maxHeight: `calc(100vh-${buttomHei + 48}px)`
|
|
2468
2525
|
},
|
|
2526
|
+
onClick: ()=>{
|
|
2527
|
+
setKeyWordProblem('');
|
|
2528
|
+
},
|
|
2469
2529
|
children: [
|
|
2470
2530
|
loading ? /*#__PURE__*/ _jsx("div", {
|
|
2471
2531
|
className: styles.loading,
|
|
@@ -2474,7 +2534,7 @@ const CustomerService = (props)=>{
|
|
|
2474
2534
|
alt: ""
|
|
2475
2535
|
})
|
|
2476
2536
|
}) : "",
|
|
2477
|
-
renderQuestion(),
|
|
2537
|
+
keyWordProblem ? renderQuestion() : renderQuestion(),
|
|
2478
2538
|
bottomLoading ? /*#__PURE__*/ _jsx("div", {
|
|
2479
2539
|
className: styles.loading,
|
|
2480
2540
|
children: /*#__PURE__*/ _jsx("img", {
|
|
@@ -2530,6 +2590,9 @@ const CustomerService = (props)=>{
|
|
|
2530
2590
|
}),
|
|
2531
2591
|
/*#__PURE__*/ _jsxs("div", {
|
|
2532
2592
|
className: `${styles.Drawer_wrap_main}`,
|
|
2593
|
+
onClick: ()=>{
|
|
2594
|
+
setKeyWordProblem('');
|
|
2595
|
+
},
|
|
2533
2596
|
children: [
|
|
2534
2597
|
/*#__PURE__*/ _jsxs("div", {
|
|
2535
2598
|
className: `${styles.Drawer_main} ChatWindow_Modal_history_list`,
|
|
@@ -2562,7 +2625,7 @@ const CustomerService = (props)=>{
|
|
|
2562
2625
|
alt: ""
|
|
2563
2626
|
})
|
|
2564
2627
|
}) : "",
|
|
2565
|
-
renderQuestion()
|
|
2628
|
+
keyWordProblem ? renderQuestion() : renderQuestion()
|
|
2566
2629
|
]
|
|
2567
2630
|
})
|
|
2568
2631
|
]
|
|
@@ -2596,6 +2659,9 @@ const CustomerService = (props)=>{
|
|
|
2596
2659
|
showType == 3 ? /*#__PURE__*/ _jsxs("div", {
|
|
2597
2660
|
className: `${styles.ChatWindow_Drawer}`,
|
|
2598
2661
|
id: "",
|
|
2662
|
+
onClick: ()=>{
|
|
2663
|
+
setKeyWordProblem('');
|
|
2664
|
+
},
|
|
2599
2665
|
children: [
|
|
2600
2666
|
/*#__PURE__*/ _jsx("div", {
|
|
2601
2667
|
className: `${styles.header_wrap} ${styles.header_wrap_newlabo}`,
|
|
@@ -2656,7 +2722,7 @@ const CustomerService = (props)=>{
|
|
|
2656
2722
|
alt: ""
|
|
2657
2723
|
})
|
|
2658
2724
|
}) : "",
|
|
2659
|
-
renderQuestion()
|
|
2725
|
+
keyWordProblem ? renderQuestion() : renderQuestion()
|
|
2660
2726
|
]
|
|
2661
2727
|
}),
|
|
2662
2728
|
/*#__PURE__*/ _jsxs("div", {
|
|
@@ -2733,6 +2799,9 @@ const CustomerService = (props)=>{
|
|
|
2733
2799
|
style: {
|
|
2734
2800
|
maxHeight: `${window.innerHeight - 148 - buttomHei}px`
|
|
2735
2801
|
},
|
|
2802
|
+
onClick: ()=>{
|
|
2803
|
+
setKeyWordProblem('');
|
|
2804
|
+
},
|
|
2736
2805
|
children: [
|
|
2737
2806
|
/*#__PURE__*/ _jsx(ContactsList, {
|
|
2738
2807
|
type: 4,
|
|
@@ -2758,7 +2827,7 @@ const CustomerService = (props)=>{
|
|
|
2758
2827
|
alt: ""
|
|
2759
2828
|
})
|
|
2760
2829
|
}) : "",
|
|
2761
|
-
renderQuestion()
|
|
2830
|
+
keyWordProblem ? renderQuestion() : renderQuestion()
|
|
2762
2831
|
]
|
|
2763
2832
|
})
|
|
2764
2833
|
]
|
|
@@ -2850,7 +2919,7 @@ const CustomerService = (props)=>{
|
|
|
2850
2919
|
alt: ""
|
|
2851
2920
|
})
|
|
2852
2921
|
}) : "",
|
|
2853
|
-
renderQuestion()
|
|
2922
|
+
keyWordProblem ? renderQuestion() : renderQuestion()
|
|
2854
2923
|
]
|
|
2855
2924
|
}),
|
|
2856
2925
|
/*#__PURE__*/ _jsxs("div", {
|