bhd-components 0.5.7 → 0.5.8
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/5764783e.esm.es5.production.js +468 -0
- package/dist/{535fc6c5.esm.es5.development.js → f2b01b9c.esm.es5.development.js} +98068 -25721
- package/dist/index.esm.es5.development.css +8467 -0
- package/dist/index.esm.es5.development.js +5835 -0
- package/dist/index.esm.es5.production.css +1 -0
- package/dist/index.esm.es5.production.js +1 -0
- package/es2017/customerService/contactsList/index.d.ts +3 -2
- package/es2017/customerService/contactsList/index.js +93 -90
- package/es2017/customerService/contactsList/index.module.less +32 -13
- package/es2017/customerService/function.js +18 -13
- package/es2017/customerService/historyFun/index.d.ts +2 -1
- package/es2017/customerService/historyFun/index.js +121 -86
- package/es2017/customerService/historyFun/index.module.less +40 -6
- package/es2017/customerService/index.js +771 -577
- package/es2017/customerService/index.module.less +747 -684
- package/es2017/icons/components/custom-duihao.js +1 -1
- package/esm/customerService/contactsList/index.d.ts +3 -2
- package/esm/customerService/contactsList/index.js +104 -97
- package/esm/customerService/contactsList/index.module.less +32 -13
- package/esm/customerService/function.js +18 -13
- package/esm/customerService/historyFun/index.d.ts +2 -1
- package/esm/customerService/historyFun/index.js +127 -94
- package/esm/customerService/historyFun/index.module.less +40 -6
- package/esm/customerService/index.js +836 -619
- package/esm/customerService/index.module.less +747 -684
- package/esm/icons/components/custom-duihao.js +1 -1
- package/package.json +4 -3
- package/dist/1bddec89.esm.es5.production.js +0 -72
- package/dist/CustomerService.esm.es5.development.css +0 -2827
- package/dist/CustomerService.esm.es5.development.js +0 -3823
- package/dist/CustomerService.esm.es5.production.css +0 -1
- package/dist/CustomerService.esm.es5.production.js +0 -1
|
@@ -1,6 +1,9 @@
|
|
|
1
|
+
import { _ as _object_spread } from "@swc/helpers/_/_object_spread";
|
|
2
|
+
import { _ as _object_spread_props } from "@swc/helpers/_/_object_spread_props";
|
|
1
3
|
import { jsx as _jsx, jsxs as _jsxs } from "@ice/jsx-runtime/jsx-runtime";
|
|
2
|
-
import React, { useState, useRef } from "react";
|
|
4
|
+
import React, { useEffect, useState, useRef } from "react";
|
|
3
5
|
import styles from "./index.module.less";
|
|
6
|
+
import "highlight.js/styles/default.css";
|
|
4
7
|
import { Input } from "antd";
|
|
5
8
|
import { CustomClose } from "../../icons/index";
|
|
6
9
|
import { SearchOutlined } from "@ant-design/icons";
|
|
@@ -10,7 +13,30 @@ const HistoryFun = (props)=>{
|
|
|
10
13
|
const [keyWordProblem, setKeyWordProblem] = useState(""); //搜索内容
|
|
11
14
|
const [keyHistoryMessageList, setKeyHistoryMessageList] = useState([]); //搜索的历史记录
|
|
12
15
|
const [userNameObj, setUserNameObj] = useState([]); //根据用户id,存储一些用户名
|
|
16
|
+
const [showLoadingState, setShowLoadingState] = useState(1); //1,初始状态,2、无数据 ,3、不显示图片
|
|
17
|
+
const [load, setLoad] = useState(false);
|
|
13
18
|
const timer = useRef(null); //文本框输入时
|
|
19
|
+
const objName = useRef([]);
|
|
20
|
+
useEffect(()=>{
|
|
21
|
+
setKeyHistoryMessageList((list)=>{
|
|
22
|
+
console.log(objName, 4444455555);
|
|
23
|
+
let newList = list.map((item)=>{
|
|
24
|
+
let name = '';
|
|
25
|
+
let nameList = objName.current.filter((a)=>a.id == item.receiver);
|
|
26
|
+
if (nameList.length > 0) {
|
|
27
|
+
name = nameList[0].name;
|
|
28
|
+
}
|
|
29
|
+
console.log(name, 77777);
|
|
30
|
+
return _object_spread_props(_object_spread({}, item), {
|
|
31
|
+
name: name
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
console.log(newList, 4444444444);
|
|
35
|
+
return newList;
|
|
36
|
+
});
|
|
37
|
+
}, [
|
|
38
|
+
load
|
|
39
|
+
]);
|
|
14
40
|
//获取搜索中的历史消息记录
|
|
15
41
|
const getKeyHistoryMessage = (keyWordProblem)=>{
|
|
16
42
|
if (roomId == "") return;
|
|
@@ -29,9 +55,13 @@ const HistoryFun = (props)=>{
|
|
|
29
55
|
}).then((res)=>{
|
|
30
56
|
console.log(res.data, 3434378);
|
|
31
57
|
if (res.data.messages.length > 0) {
|
|
58
|
+
setShowLoadingState(3);
|
|
32
59
|
let dataList = res.data.messages;
|
|
33
60
|
setKeyHistoryMessageList(dataList);
|
|
34
61
|
getUserName(dataList);
|
|
62
|
+
} else {
|
|
63
|
+
// setKeyHistoryMessageList([]);
|
|
64
|
+
setShowLoadingState(2);
|
|
35
65
|
}
|
|
36
66
|
}).catch((res)=>{});
|
|
37
67
|
};
|
|
@@ -58,7 +88,7 @@ const HistoryFun = (props)=>{
|
|
|
58
88
|
return pageNumber;
|
|
59
89
|
};
|
|
60
90
|
//根据index,计算历史数据在第几页
|
|
61
|
-
const calculationData = (roomId, index, id)=>{
|
|
91
|
+
const calculationData = (roomId, index, id, sender)=>{
|
|
62
92
|
allData(roomId).then((res)=>{
|
|
63
93
|
// console.log(res.data.messages,'11111111')
|
|
64
94
|
if (res.data) {
|
|
@@ -72,8 +102,8 @@ const HistoryFun = (props)=>{
|
|
|
72
102
|
}
|
|
73
103
|
});
|
|
74
104
|
const pageNumber = findPageNumber(30, Math.ceil(total / 30), number);
|
|
75
|
-
console.log(
|
|
76
|
-
loadSpecifiedData(roomId, pageNumber, id);
|
|
105
|
+
console.log(roomId, pageNumber, id, "第几页第几页第几页第几页第几页第几页");
|
|
106
|
+
loadSpecifiedData(roomId, pageNumber, id, receiver);
|
|
77
107
|
onClose();
|
|
78
108
|
setKeyWordProblem("");
|
|
79
109
|
setKeyHistoryMessageList([]);
|
|
@@ -82,52 +112,27 @@ const HistoryFun = (props)=>{
|
|
|
82
112
|
};
|
|
83
113
|
const getUserName = (dataList)=>{
|
|
84
114
|
try {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
name: roomListName[0].name
|
|
99
|
-
});
|
|
100
|
-
});
|
|
101
|
-
} else {
|
|
102
|
-
//判断是否需要重新请求数据
|
|
103
|
-
let getData = false;
|
|
104
|
-
setUserNameObj((userNameObj)=>{
|
|
105
|
-
console.log(userNameObj, "userNameObjuserNameObj");
|
|
106
|
-
if (userNameObj.filter((e)=>e.id == id).length == 0) {
|
|
107
|
-
console.log("没有相同的id");
|
|
108
|
-
getData = true;
|
|
109
|
-
}
|
|
110
|
-
return userNameObj;
|
|
115
|
+
// let objName: { id: string; name: String; }[] = [];//[{id:'用户id',name:'用户名字‘}]
|
|
116
|
+
let obj = [];
|
|
117
|
+
//去重
|
|
118
|
+
let res = new Map();
|
|
119
|
+
let filterList = dataList.filter((a)=>!res.has(a.receiver) && res.set(a.receiver, 1));
|
|
120
|
+
filterList = filterList.filter((item)=>item.receiver != userData.mid && item.receiver != 'AI');
|
|
121
|
+
console.log(filterList, 'wefwekfjwef');
|
|
122
|
+
filterList.map((item)=>{
|
|
123
|
+
userName(item.receiver).then((res)=>{
|
|
124
|
+
if (res.data) {
|
|
125
|
+
obj.push({
|
|
126
|
+
id: item.receiver,
|
|
127
|
+
name: res.data.name
|
|
111
128
|
});
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
userName(id).then((res)=>{
|
|
117
|
-
if (res.data) {
|
|
118
|
-
setUserNameObj((userNameObj)=>{
|
|
119
|
-
let list = userNameObj;
|
|
120
|
-
return list.concat({
|
|
121
|
-
name: res.data.name,
|
|
122
|
-
id: id
|
|
123
|
-
});
|
|
124
|
-
});
|
|
125
|
-
console.log(7777777, res.data.name);
|
|
126
|
-
}
|
|
127
|
-
});
|
|
129
|
+
console.log(objName, 'kdfvdfdfvjkdfnv');
|
|
130
|
+
if (obj.length == filterList.length) {
|
|
131
|
+
objName.current = obj;
|
|
132
|
+
setLoad(true);
|
|
128
133
|
}
|
|
129
134
|
}
|
|
130
|
-
}
|
|
135
|
+
});
|
|
131
136
|
});
|
|
132
137
|
} catch (error) {}
|
|
133
138
|
};
|
|
@@ -175,6 +180,10 @@ const HistoryFun = (props)=>{
|
|
|
175
180
|
timer.current = setTimeout(()=>{
|
|
176
181
|
if (val != "") {
|
|
177
182
|
getKeyHistoryMessage(val);
|
|
183
|
+
} else {
|
|
184
|
+
setShowLoadingState(1);
|
|
185
|
+
setKeyHistoryMessageList([]);
|
|
186
|
+
setLoad(false);
|
|
178
187
|
}
|
|
179
188
|
}, 1000);
|
|
180
189
|
}
|
|
@@ -182,57 +191,83 @@ const HistoryFun = (props)=>{
|
|
|
182
191
|
/*#__PURE__*/ _jsx("i", {
|
|
183
192
|
className: "guanbi_Close",
|
|
184
193
|
onClick: ()=>{
|
|
194
|
+
setShowLoadingState(1);
|
|
185
195
|
setKeyWordProblem("");
|
|
186
196
|
setKeyHistoryMessageList([]);
|
|
197
|
+
setLoad(false);
|
|
187
198
|
},
|
|
188
199
|
children: /*#__PURE__*/ _jsx(CustomClose, {})
|
|
189
200
|
})
|
|
190
201
|
]
|
|
191
202
|
}),
|
|
192
|
-
/*#__PURE__*/
|
|
203
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
193
204
|
className: styles.main_list,
|
|
194
|
-
children:
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
});
|
|
198
|
-
{
|
|
199
|
-
console.log(userNameObj), 9999999;
|
|
200
|
-
}
|
|
201
|
-
let name = "";
|
|
202
|
-
if (item.sender == userData.mid) {
|
|
203
|
-
name = userData.real_name;
|
|
204
|
-
} else if (item.sender == 'AI') {
|
|
205
|
-
name = userNameObj.filter((e)=>e.id == item.recevier)[0].name;
|
|
206
|
-
} else {
|
|
207
|
-
name = userNameObj.filter((e)=>e.id == item.sender)[0].name;
|
|
208
|
-
}
|
|
209
|
-
return /*#__PURE__*/ _jsxs("div", {
|
|
210
|
-
className: styles.list,
|
|
211
|
-
onClick: ()=>{
|
|
212
|
-
calculationData(item.roomId, item.messageIdWithinRoom, item.id);
|
|
213
|
-
},
|
|
205
|
+
children: [
|
|
206
|
+
showLoadingState == 1 && /*#__PURE__*/ _jsxs("div", {
|
|
207
|
+
className: styles.no_data,
|
|
214
208
|
children: [
|
|
215
|
-
/*#__PURE__*/
|
|
216
|
-
|
|
217
|
-
children: [
|
|
218
|
-
/*#__PURE__*/ _jsx("p", {
|
|
219
|
-
children: name
|
|
220
|
-
}),
|
|
221
|
-
/*#__PURE__*/ _jsx("span", {
|
|
222
|
-
className: styles.time,
|
|
223
|
-
children: getDataTime(item.updatedAt)
|
|
224
|
-
})
|
|
225
|
-
]
|
|
209
|
+
/*#__PURE__*/ _jsx("img", {
|
|
210
|
+
src: "/new_yun/images/aiService/search_for_icon.png"
|
|
226
211
|
}),
|
|
227
|
-
/*#__PURE__*/ _jsx("
|
|
228
|
-
|
|
229
|
-
dangerouslySetInnerHTML: {
|
|
230
|
-
__html: span
|
|
231
|
-
}
|
|
212
|
+
/*#__PURE__*/ _jsx("p", {
|
|
213
|
+
children: "输入关键词,搜索聊天记录"
|
|
232
214
|
})
|
|
233
215
|
]
|
|
234
|
-
},
|
|
235
|
-
|
|
216
|
+
}),
|
|
217
|
+
showLoadingState == 2 && /*#__PURE__*/ _jsxs("div", {
|
|
218
|
+
className: styles.no_data,
|
|
219
|
+
children: [
|
|
220
|
+
/*#__PURE__*/ _jsx("img", {
|
|
221
|
+
src: "/new_yun/images/aiService/no_data.png"
|
|
222
|
+
}),
|
|
223
|
+
/*#__PURE__*/ _jsx("p", {
|
|
224
|
+
children: "暂无记录"
|
|
225
|
+
})
|
|
226
|
+
]
|
|
227
|
+
}),
|
|
228
|
+
keyHistoryMessageList.map((item, index)=>{
|
|
229
|
+
let span = item.message.replaceAll(keyWordProblem, ()=>{
|
|
230
|
+
return `<span class=${styles.sign}>${keyWordProblem}</span>`;
|
|
231
|
+
});
|
|
232
|
+
let name = "";
|
|
233
|
+
if (item.receiver == userData.mid) {
|
|
234
|
+
name = userData.real_name;
|
|
235
|
+
} else if (item.receiver == 'AI') {
|
|
236
|
+
name = "AI助手";
|
|
237
|
+
if (item.extraInfo != null) {
|
|
238
|
+
name = '智能客服';
|
|
239
|
+
}
|
|
240
|
+
} else {
|
|
241
|
+
name = item.name;
|
|
242
|
+
}
|
|
243
|
+
return /*#__PURE__*/ _jsxs("div", {
|
|
244
|
+
className: styles.list,
|
|
245
|
+
onClick: ()=>{
|
|
246
|
+
calculationData(item.roomId, item.messageIdWithinRoom, item.id, item.receiver);
|
|
247
|
+
},
|
|
248
|
+
children: [
|
|
249
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
250
|
+
className: styles.name,
|
|
251
|
+
children: [
|
|
252
|
+
/*#__PURE__*/ _jsx("p", {
|
|
253
|
+
children: name
|
|
254
|
+
}),
|
|
255
|
+
/*#__PURE__*/ _jsx("span", {
|
|
256
|
+
className: styles.time,
|
|
257
|
+
children: getDataTime(item.updatedAt)
|
|
258
|
+
})
|
|
259
|
+
]
|
|
260
|
+
}),
|
|
261
|
+
/*#__PURE__*/ _jsx("div", {
|
|
262
|
+
className: styles.con,
|
|
263
|
+
dangerouslySetInnerHTML: {
|
|
264
|
+
__html: span
|
|
265
|
+
}
|
|
266
|
+
})
|
|
267
|
+
]
|
|
268
|
+
}, item.id);
|
|
269
|
+
})
|
|
270
|
+
]
|
|
236
271
|
})
|
|
237
272
|
]
|
|
238
273
|
})
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
@import "../../theme/variable.less";
|
|
2
|
+
// @color-text-primary: @color-background-info-base;
|
|
3
|
+
|
|
2
4
|
//历史记录11
|
|
3
5
|
.history_list {
|
|
4
6
|
position: absolute;
|
|
@@ -7,6 +9,7 @@
|
|
|
7
9
|
width: 100%;
|
|
8
10
|
height: 100%;
|
|
9
11
|
overflow: hidden;
|
|
12
|
+
|
|
10
13
|
.search_layout {
|
|
11
14
|
background: #fff;
|
|
12
15
|
position: absolute;
|
|
@@ -15,13 +18,14 @@
|
|
|
15
18
|
border-radius: 16px 16px 0px 0px;
|
|
16
19
|
overflow: hidden;
|
|
17
20
|
animation: mymove 1s forwards;
|
|
21
|
+
box-shadow: 0px 4px 20px 0px rgba(0, 0, 0, 0.10);
|
|
18
22
|
|
|
19
23
|
.title {
|
|
20
24
|
border-bottom: 1px solid @color-border-Tr;
|
|
21
25
|
font-size: 16px;
|
|
22
26
|
font-weight: 600;
|
|
23
27
|
line-height: 150%;
|
|
24
|
-
padding: 16px;
|
|
28
|
+
padding: 16px 24px;
|
|
25
29
|
display: flex;
|
|
26
30
|
justify-content: space-between;
|
|
27
31
|
svg {
|
|
@@ -61,14 +65,14 @@
|
|
|
61
65
|
}
|
|
62
66
|
.guanbi_Close {
|
|
63
67
|
position: absolute;
|
|
64
|
-
top:
|
|
68
|
+
top: 3px;
|
|
65
69
|
right: 38px;
|
|
66
70
|
font-size: 16px;
|
|
67
71
|
z-index: 1;
|
|
68
72
|
color: rgba(0, 0, 0, 0.65);
|
|
69
73
|
cursor: pointer;
|
|
70
74
|
svg {
|
|
71
|
-
font-size:
|
|
75
|
+
font-size: 10px;
|
|
72
76
|
opacity: 0.65;
|
|
73
77
|
}
|
|
74
78
|
}
|
|
@@ -137,13 +141,32 @@
|
|
|
137
141
|
font-weight: 400;
|
|
138
142
|
line-height: 150%;
|
|
139
143
|
overflow: hidden;
|
|
140
|
-
white-space: nowrap;
|
|
141
144
|
text-overflow: ellipsis;
|
|
145
|
+
-webkit-box-orient: vertical;
|
|
146
|
+
-webkit-line-clamp: 2;
|
|
147
|
+
display: -webkit-box;
|
|
148
|
+
|
|
149
|
+
max-height: 40px;
|
|
150
|
+
word-break: break-all;
|
|
142
151
|
span {
|
|
143
152
|
color: @color-text-primary;
|
|
144
153
|
}
|
|
145
154
|
}
|
|
146
155
|
}
|
|
156
|
+
.no_data{
|
|
157
|
+
text-align: center;
|
|
158
|
+
margin-top: 130px;
|
|
159
|
+
img{
|
|
160
|
+
width: 160px;
|
|
161
|
+
}
|
|
162
|
+
p{
|
|
163
|
+
margin-top: 24px;
|
|
164
|
+
color: rgba(0, 0, 0, 0.45);
|
|
165
|
+
text-align: center;
|
|
166
|
+
font-size: 14px;
|
|
167
|
+
line-height: 100%; /* 14px */
|
|
168
|
+
}
|
|
169
|
+
}
|
|
147
170
|
}
|
|
148
171
|
}
|
|
149
172
|
@keyframes mymove {
|
|
@@ -173,17 +196,28 @@
|
|
|
173
196
|
//全屏下的历史记录
|
|
174
197
|
.history_list_broadside {
|
|
175
198
|
width: 417px;
|
|
176
|
-
height: calc(100% -
|
|
199
|
+
height: calc(100% - 48px);
|
|
177
200
|
right: 0;
|
|
178
201
|
top: 48px;
|
|
179
|
-
border-radius:
|
|
202
|
+
border-radius: 0;
|
|
180
203
|
background: transparent;
|
|
204
|
+
overflow: visible;
|
|
181
205
|
.search_layout {
|
|
182
206
|
height: 100%;
|
|
183
207
|
border-radius: 0;
|
|
208
|
+
box-shadow: 0px 4px 20px 0px rgba(0, 0, 0, 0.10);
|
|
209
|
+
.search_top{
|
|
210
|
+
margin: 16px;
|
|
211
|
+
}
|
|
212
|
+
.title{
|
|
213
|
+
padding: 16px;
|
|
214
|
+
}
|
|
184
215
|
.main_list {
|
|
185
216
|
height: calc(100% - 140px);
|
|
186
217
|
max-height: calc(100% - 140px);
|
|
218
|
+
.list{
|
|
219
|
+
margin: 8px 16px 17px;
|
|
220
|
+
}
|
|
187
221
|
}
|
|
188
222
|
}
|
|
189
223
|
}
|