bhd-components 0.6.1 → 0.6.3
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/{ab2a98d6.esm.es5.development.js → a0cd97b9.esm.es5.development.js} +1 -1
- package/dist/{b8edd934.esm.es5.production.js → e88a10a0.esm.es5.production.js} +1 -1
- package/dist/index.esm.es5.development.css +1711 -827
- package/dist/index.esm.es5.development.js +515 -384
- package/dist/index.esm.es5.production.css +1 -1
- package/dist/index.esm.es5.production.js +1 -1
- package/es2017/bhdSelect/index.d.ts +3 -0
- package/es2017/bhdSelect/index.js +18 -13
- package/es2017/bhdSelect/index.module.less +4 -1
- package/es2017/customerService/{contactsList/index.js → contactsList.js} +92 -77
- package/es2017/customerService/function.d.ts +1 -1
- package/es2017/customerService/function.js +10 -2
- package/es2017/customerService/{historyFun/index.d.ts → historyFun.d.ts} +0 -1
- package/es2017/customerService/{historyFun/index.js → historyFun.js} +62 -16
- package/es2017/customerService/index.d.ts +3 -3
- package/es2017/customerService/index.js +144 -81
- package/es2017/customerService/index.module.less +496 -5
- package/es2017/customerService/index2.module.less +1282 -0
- package/es2017/typings.d.ts +12 -0
- package/esm/bhdSelect/index.d.ts +3 -0
- package/esm/bhdSelect/index.js +18 -13
- package/esm/bhdSelect/index.module.less +4 -1
- package/esm/customerService/{contactsList/index.js → contactsList.js} +83 -66
- package/esm/customerService/function.d.ts +1 -1
- package/esm/customerService/function.js +10 -1
- package/esm/customerService/{historyFun/index.d.ts → historyFun.d.ts} +0 -1
- package/esm/customerService/{historyFun/index.js → historyFun.js} +64 -17
- package/esm/customerService/index.d.ts +3 -3
- package/esm/customerService/index.js +176 -111
- package/esm/customerService/index.module.less +496 -5
- package/esm/customerService/index2.module.less +1282 -0
- package/esm/typings.d.ts +12 -0
- package/package.json +1 -1
- package/es2017/customerService/contactsList/index.module.less +0 -206
- package/es2017/customerService/historyFun/index.module.less +0 -223
- package/esm/customerService/contactsList/index.module.less +0 -206
- package/esm/customerService/historyFun/index.module.less +0 -223
- /package/es2017/customerService/{contactsList/index.d.ts → contactsList.d.ts} +0 -0
- /package/esm/customerService/{contactsList/index.d.ts → contactsList.d.ts} +0 -0
package/es2017/typings.d.ts
CHANGED
package/esm/bhdSelect/index.d.ts
CHANGED
package/esm/bhdSelect/index.js
CHANGED
|
@@ -29,7 +29,7 @@ var BhdSelect = function(props) {
|
|
|
29
29
|
var _useState1 = _sliced_to_array(useState(0), 2), optionHei = _useState1[0], setOptionHei = _useState1[1]; //option的宽度
|
|
30
30
|
var _useState2 = _sliced_to_array(useState(""), 2), filterValue = _useState2[0], setFilterValue = _useState2[1]; //下拉搜索的内容
|
|
31
31
|
var _useState3 = _sliced_to_array(useState([]), 2), filterChildren = _useState3[0], setfilterChildren = _useState3[1];
|
|
32
|
-
|
|
32
|
+
var _useState4 = _sliced_to_array(useState(0), 2), selectWidth = _useState4[0], setSelectWidth = _useState4[1]; //下拉框的宽度
|
|
33
33
|
var renderSuffixIcon = function() {
|
|
34
34
|
switch(arrowType){
|
|
35
35
|
case "table":
|
|
@@ -201,11 +201,11 @@ var BhdSelect = function(props) {
|
|
|
201
201
|
};
|
|
202
202
|
useEffect(function() {
|
|
203
203
|
// console.log(34343434,props);
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
//
|
|
208
|
-
|
|
204
|
+
if (props.popupMatchSelectWidth) {
|
|
205
|
+
setSelectWidth(props.popupMatchSelectWidth);
|
|
206
|
+
} else {
|
|
207
|
+
// console.log(bhdSelectRef.current.getBoundingClientRect(),555555555);
|
|
208
|
+
}
|
|
209
209
|
filterOption();
|
|
210
210
|
window.addEventListener("resize", initHeight);
|
|
211
211
|
return function() {
|
|
@@ -221,7 +221,11 @@ var BhdSelect = function(props) {
|
|
|
221
221
|
var config = _object_spread_props(_object_spread({}, props), {
|
|
222
222
|
listHeight: optionHei,
|
|
223
223
|
popupClassName: "".concat(styles.bhdSelect_option, " ").concat(popupClassName || "", " "),
|
|
224
|
-
suffixIcon: suffixIcon ? suffixIcon : renderSuffixIcon()
|
|
224
|
+
suffixIcon: suffixIcon ? suffixIcon : renderSuffixIcon(),
|
|
225
|
+
popupMatchSelectWidth: selectWidth,
|
|
226
|
+
dropdownStyle: _object_spread_props(_object_spread({}, props.dropdownStyle), {
|
|
227
|
+
width: selectWidth
|
|
228
|
+
})
|
|
225
229
|
});
|
|
226
230
|
delete config.mask;
|
|
227
231
|
delete config.className;
|
|
@@ -266,12 +270,13 @@ var BhdSelect = function(props) {
|
|
|
266
270
|
}
|
|
267
271
|
//表格中使用下拉列表,定义下拉列表宽度
|
|
268
272
|
// console.log(props.dropdownStyle,'sdsddfdfdf');
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
273
|
+
if (props.dropdownStyle != undefined && props.dropdownStyle.width != undefined) {
|
|
274
|
+
setSelectWidth(props.dropdownStyle.width);
|
|
275
|
+
} else if ((props.dropdownStyle == undefined || props.dropdownStyle.width == undefined) && useType === "table") {
|
|
276
|
+
try {
|
|
277
|
+
setSelectWidth(bhdSelectRef.current.parentNode.getBoundingClientRect().width + 14);
|
|
278
|
+
} catch (error) {}
|
|
279
|
+
}
|
|
275
280
|
props.onMouseEnter && props.onMouseEnter(e);
|
|
276
281
|
},
|
|
277
282
|
children: filterChildren
|
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
import { _ as _object_spread } from "@swc/helpers/_/_object_spread";
|
|
2
|
+
import { _ as _object_spread_props } from "@swc/helpers/_/_object_spread_props";
|
|
2
3
|
import { _ as _sliced_to_array } from "@swc/helpers/_/_sliced_to_array";
|
|
3
4
|
import { jsx as _jsx, jsxs as _jsxs } from "@ice/jsx-runtime/jsx-runtime";
|
|
4
5
|
import React, { useEffect, useState, useRef, useImperativeHandle, forwardRef } from "react";
|
|
5
6
|
import styles from "./index.module.less";
|
|
6
|
-
import {
|
|
7
|
+
import { Tooltip } from "antd";
|
|
8
|
+
import { CustomAiIcon, CustomRetract } from "../icons/index";
|
|
7
9
|
import { CloseOutlined } from "@ant-design/icons";
|
|
8
|
-
import { getDataTime } from "
|
|
10
|
+
import { getDataTime, getByteLen } from "./function"; //录音使用文件
|
|
9
11
|
var ContactsList = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
10
12
|
var type = props.type, roomId = props.roomId, userData = props.userData, http = props.http, urllocation = props.urllocation, onClose = props.onClose, switchChatRoom = props.switchChatRoom, saveContactsList = props.saveContactsList;
|
|
11
13
|
var _useState = _sliced_to_array(useState([]), 2), contactsList = _useState[0], setContactsList = _useState[1]; //老师列表
|
|
12
|
-
var _useState1 = _sliced_to_array(useState(""), 2), newRoomId = _useState1[0], setNewRoomId = _useState1[1];
|
|
13
|
-
var _useState2 = _sliced_to_array(useState(true), 2), firstLoading = _useState2[0], setFirstLoading = _useState2[1];
|
|
14
|
-
// const [type,setType] = useState(0);
|
|
15
14
|
var timer = useRef(null); //文本框输入时
|
|
16
15
|
//获取聊天室列表
|
|
17
16
|
useEffect(function() {
|
|
18
17
|
roomsListTimer();
|
|
19
|
-
if (roomId != "") {
|
|
20
|
-
setNewRoomId(roomId);
|
|
21
|
-
}
|
|
22
18
|
return function() {
|
|
23
19
|
clearTimeout(timer.current);
|
|
24
20
|
};
|
|
25
21
|
}, []);
|
|
22
|
+
// //获取聊天室列表
|
|
23
|
+
// useEffect(() => {
|
|
24
|
+
// roomsListTimer();
|
|
25
|
+
// }, [contactsList]);
|
|
26
26
|
useImperativeHandle(ref, function() {
|
|
27
27
|
return {
|
|
28
28
|
roomsListTimer: function() {
|
|
@@ -30,11 +30,6 @@ var ContactsList = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
30
30
|
}
|
|
31
31
|
};
|
|
32
32
|
});
|
|
33
|
-
// useEffect(()=>{
|
|
34
|
-
// //重新调用接口
|
|
35
|
-
// console.log(44444444,contactsList)
|
|
36
|
-
// roomsListTimer();
|
|
37
|
-
// },[type])
|
|
38
33
|
var roomsListTimer = function() {
|
|
39
34
|
if (timer != null) clearTimeout(timer.current);
|
|
40
35
|
timer.current = setTimeout(function() {
|
|
@@ -54,7 +49,6 @@ var ContactsList = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
54
49
|
}).then(function(res) {
|
|
55
50
|
if (res.data) {
|
|
56
51
|
var list = res.data.contacts;
|
|
57
|
-
// let newMessage = false;
|
|
58
52
|
setContactsList(function(contactsList) {
|
|
59
53
|
list = list.map(function(item, index) {
|
|
60
54
|
var c_list = contactsList.filter(function(e) {
|
|
@@ -69,42 +63,24 @@ var ContactsList = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
69
63
|
return list;
|
|
70
64
|
});
|
|
71
65
|
getUserInfo(list);
|
|
72
|
-
// if(firstLoading){
|
|
73
|
-
// setFirstLoading(false);
|
|
74
|
-
// let isRoom = false;
|
|
75
|
-
// for (let index = 0; index < list.length; index++) {
|
|
76
|
-
// let count = list[index].unreadCount;
|
|
77
|
-
// if(count > 0 && list[index].roomId == roomId){
|
|
78
|
-
// isRoom = true;
|
|
79
|
-
// //在当前窗口
|
|
80
|
-
// return null;
|
|
81
|
-
// }else if(count > 0){
|
|
82
|
-
// isRoom = true;
|
|
83
|
-
// switchChatRoom(list[index].roomId, "");
|
|
84
|
-
// setContactsList((contactsList)=>{
|
|
85
|
-
// let new_list = contactsList;
|
|
86
|
-
// new_list = new_list.map((item)=>{
|
|
87
|
-
// if(item.roomId == list[index].roomId){
|
|
88
|
-
// return {
|
|
89
|
-
// ...item,
|
|
90
|
-
// unreadCount:0,
|
|
91
|
-
// }
|
|
92
|
-
// }else{
|
|
93
|
-
// return item;
|
|
94
|
-
// }
|
|
95
|
-
// })
|
|
96
|
-
// return new_list;
|
|
97
|
-
// })
|
|
98
|
-
// return null;
|
|
99
|
-
// }
|
|
100
|
-
// }
|
|
101
|
-
// }
|
|
102
66
|
saveContactsList(list);
|
|
103
67
|
}
|
|
104
68
|
});
|
|
105
69
|
};
|
|
106
70
|
//删除聊天室
|
|
107
71
|
var deleteRoom = function(roomId) {
|
|
72
|
+
var contactsList;
|
|
73
|
+
setContactsList(function(list) {
|
|
74
|
+
contactsList = list.filter(function(e) {
|
|
75
|
+
return e.roomId != roomId;
|
|
76
|
+
});
|
|
77
|
+
//切换到AI聊天窗口
|
|
78
|
+
if (roomId == props.roomId) {
|
|
79
|
+
switchChatRoom(contactsList[0].roomId, "");
|
|
80
|
+
}
|
|
81
|
+
saveContactsList(contactsList);
|
|
82
|
+
return contactsList;
|
|
83
|
+
});
|
|
108
84
|
http.delete("".concat(urllocation, "/chat-service/public/v1.0/rooms/").concat(roomId), {
|
|
109
85
|
headers: {
|
|
110
86
|
"x-module-id": userData.modules.find(function(ele) {
|
|
@@ -114,16 +90,6 @@ var ContactsList = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
114
90
|
}
|
|
115
91
|
}).then(function(res) {
|
|
116
92
|
roomsListTimer();
|
|
117
|
-
// let contactsList;
|
|
118
|
-
// setContactsList((list)=>{
|
|
119
|
-
// contactsList = list.filter(e=>e.roomId != roomId);
|
|
120
|
-
// //切换到AI聊天窗口
|
|
121
|
-
// if(roomId == props.roomId){
|
|
122
|
-
// switchChatRoom(contactsList[0].roomId, "");
|
|
123
|
-
// }
|
|
124
|
-
// return contactsList;
|
|
125
|
-
// })
|
|
126
|
-
// saveContactsList(contactsList);
|
|
127
93
|
});
|
|
128
94
|
};
|
|
129
95
|
//获取老师的信息等
|
|
@@ -164,16 +130,15 @@ var ContactsList = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
164
130
|
};
|
|
165
131
|
return type == 2 || type == 4 ? //联系人展开
|
|
166
132
|
/*#__PURE__*/ _jsxs("div", {
|
|
167
|
-
className: styles.teacher_layout_modal,
|
|
133
|
+
className: "".concat(styles.teacher_layout_modal, " ").concat(type == 4 ? styles.teacher_layout_modal_newlabo : ""),
|
|
168
134
|
children: [
|
|
169
135
|
/*#__PURE__*/ _jsx("div", {
|
|
170
136
|
className: styles.top,
|
|
171
137
|
children: /*#__PURE__*/ _jsxs("div", {
|
|
172
138
|
className: "".concat(styles.ai, " ").concat(contactsList.length > 0 && contactsList[0].roomId != undefined && roomId != "" && contactsList[0].roomId == roomId || contactsList.length == 0 ? styles.active : ""),
|
|
173
139
|
onClick: function() {
|
|
174
|
-
setNewRoomId(contactsList[0].roomId);
|
|
175
140
|
switchChatRoom(contactsList[0].roomId, "");
|
|
176
|
-
|
|
141
|
+
// roomsListTimer();
|
|
177
142
|
},
|
|
178
143
|
children: [
|
|
179
144
|
/*#__PURE__*/ _jsx(CustomAiIcon, {}),
|
|
@@ -186,7 +151,7 @@ var ContactsList = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
186
151
|
"AI助手",
|
|
187
152
|
/*#__PURE__*/ _jsx("span", {
|
|
188
153
|
className: styles.time,
|
|
189
|
-
children: contactsList.length > 0 && getDataTime(contactsList[0].createdAt)
|
|
154
|
+
children: contactsList.length > 0 && contactsList[0].createdAt != undefined && getDataTime(contactsList[0].createdAt)
|
|
190
155
|
})
|
|
191
156
|
]
|
|
192
157
|
}),
|
|
@@ -205,12 +170,37 @@ var ContactsList = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
205
170
|
className: styles.bottom,
|
|
206
171
|
children: contactsList.map(function(item, index) {
|
|
207
172
|
if (index != 0) {
|
|
173
|
+
var time = "";
|
|
174
|
+
var currentTime = getDataTime(-1, 1); //当前时间
|
|
175
|
+
var updatedAt = getDataTime(item.createdAt, 1);
|
|
176
|
+
if (currentTime == updatedAt) {
|
|
177
|
+
time = getDataTime(item.createdAt, 2);
|
|
178
|
+
} else {
|
|
179
|
+
time = getDataTime(item.createdAt);
|
|
180
|
+
}
|
|
208
181
|
return /*#__PURE__*/ _jsxs("div", {
|
|
209
182
|
className: "".concat(styles.ai, " ").concat(item.roomId != undefined && roomId != "" && item.roomId == roomId ? styles.active : ""),
|
|
210
183
|
onClick: function() {
|
|
211
|
-
setNewRoomId(item.roomId);
|
|
212
184
|
switchChatRoom(item.roomId, "");
|
|
213
|
-
roomsListTimer();
|
|
185
|
+
// roomsListTimer();
|
|
186
|
+
var newList = [];
|
|
187
|
+
setContactsList(function(list) {
|
|
188
|
+
newList = list;
|
|
189
|
+
newList = newList.map(function(v) {
|
|
190
|
+
if (v.roomId == item.roomId) {
|
|
191
|
+
return _object_spread_props(_object_spread({}, v), {
|
|
192
|
+
unreadCount: 0
|
|
193
|
+
});
|
|
194
|
+
} else {
|
|
195
|
+
return v;
|
|
196
|
+
}
|
|
197
|
+
});
|
|
198
|
+
return newList;
|
|
199
|
+
});
|
|
200
|
+
// console.log(newList,9999999999)
|
|
201
|
+
setTimeout(function() {
|
|
202
|
+
saveContactsList(newList);
|
|
203
|
+
}, 100);
|
|
214
204
|
},
|
|
215
205
|
children: [
|
|
216
206
|
/*#__PURE__*/ _jsx("img", {
|
|
@@ -222,7 +212,12 @@ var ContactsList = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
222
212
|
/*#__PURE__*/ _jsxs("p", {
|
|
223
213
|
className: styles.message,
|
|
224
214
|
children: [
|
|
225
|
-
item.name,
|
|
215
|
+
item.name != undefined && getByteLen(item.name) >= 20 ? /*#__PURE__*/ _jsx(Tooltip, {
|
|
216
|
+
overlayClassName: "".concat(styles.popover_main_content_name),
|
|
217
|
+
title: item.name,
|
|
218
|
+
placement: "top",
|
|
219
|
+
children: item.name
|
|
220
|
+
}) : item.name,
|
|
226
221
|
item.unreadCount != undefined && item.unreadCount > 0 && !(item.roomId != undefined && roomId != "" && item.roomId == roomId) && /*#__PURE__*/ _jsx("span", {
|
|
227
222
|
className: styles.num,
|
|
228
223
|
children: item.unreadCount > 99 ? "99+" : item.unreadCount
|
|
@@ -274,9 +269,8 @@ var ContactsList = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
274
269
|
/*#__PURE__*/ _jsxs("div", {
|
|
275
270
|
className: "".concat(styles.ai, " ").concat(contactsList.length > 0 && contactsList[0].roomId != undefined && roomId != "" && contactsList[0].roomId == roomId || contactsList.length == 0 ? styles.active : ""),
|
|
276
271
|
onClick: function() {
|
|
277
|
-
setNewRoomId(contactsList[0].roomId);
|
|
278
272
|
switchChatRoom(contactsList[0].roomId, "");
|
|
279
|
-
|
|
273
|
+
// roomsListTimer();
|
|
280
274
|
},
|
|
281
275
|
children: [
|
|
282
276
|
/*#__PURE__*/ _jsx(CustomAiIcon, {}),
|
|
@@ -296,16 +290,39 @@ var ContactsList = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
296
290
|
return /*#__PURE__*/ _jsxs("div", {
|
|
297
291
|
className: "".concat(styles.ai, " ").concat(item.roomId != undefined && roomId != "" && item.roomId == roomId ? styles.active : ""),
|
|
298
292
|
onClick: function() {
|
|
299
|
-
setNewRoomId(item.roomId);
|
|
300
293
|
switchChatRoom(item.roomId, "");
|
|
301
|
-
roomsListTimer();
|
|
294
|
+
// roomsListTimer();
|
|
295
|
+
//消息更改为已读
|
|
296
|
+
var newList = [];
|
|
297
|
+
setContactsList(function(list) {
|
|
298
|
+
newList = list;
|
|
299
|
+
newList = newList.map(function(v) {
|
|
300
|
+
if (v.roomId == item.roomId) {
|
|
301
|
+
return _object_spread_props(_object_spread({}, v), {
|
|
302
|
+
unreadCount: 0
|
|
303
|
+
});
|
|
304
|
+
} else {
|
|
305
|
+
return v;
|
|
306
|
+
}
|
|
307
|
+
});
|
|
308
|
+
return newList;
|
|
309
|
+
});
|
|
310
|
+
// console.log(newList,9999999999)
|
|
311
|
+
setTimeout(function() {
|
|
312
|
+
saveContactsList(newList);
|
|
313
|
+
}, 100);
|
|
302
314
|
},
|
|
303
315
|
children: [
|
|
304
316
|
/*#__PURE__*/ _jsx("img", {
|
|
305
317
|
src: item.headImg
|
|
306
318
|
}),
|
|
307
319
|
/*#__PURE__*/ _jsx("p", {
|
|
308
|
-
children: item.name
|
|
320
|
+
children: item.name != undefined && getByteLen(item.name) >= 10 ? /*#__PURE__*/ _jsx(Tooltip, {
|
|
321
|
+
overlayClassName: styles.popover_main_content_name,
|
|
322
|
+
title: item.name,
|
|
323
|
+
placement: "top",
|
|
324
|
+
children: item.name
|
|
325
|
+
}) : item.name
|
|
309
326
|
}),
|
|
310
327
|
item.unreadCount != undefined && item.unreadCount > 0 && !(item.roomId != undefined && roomId != "" && item.roomId == roomId) && /*#__PURE__*/ _jsx("span", {
|
|
311
328
|
className: styles.num,
|
|
@@ -13,5 +13,5 @@ declare const readMessage: (roomId: number | string, urllocation: any, userData:
|
|
|
13
13
|
declare const getByteLen: (val: string) => number;
|
|
14
14
|
declare const serverUrl: () => string;
|
|
15
15
|
declare const copyText: (text: string) => boolean;
|
|
16
|
-
declare const getDataTime: (time: string | number | Date) => string;
|
|
16
|
+
declare const getDataTime: (time: string | number | Date, type?: number) => string;
|
|
17
17
|
export { readMessage, getByteLen, serverUrl, copyText, getDataTime };
|
|
@@ -51,6 +51,9 @@ var copyText = function(text) {
|
|
|
51
51
|
};
|
|
52
52
|
//获取当前时间
|
|
53
53
|
var getDataTime = function(time) {
|
|
54
|
+
var type = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : -1;
|
|
55
|
+
//type = 1 ,获取当前年月日
|
|
56
|
+
//type = 2 ,只显示十 分
|
|
54
57
|
try {
|
|
55
58
|
var now;
|
|
56
59
|
if (time != undefined && time != -1) {
|
|
@@ -66,7 +69,13 @@ var getDataTime = function(time) {
|
|
|
66
69
|
var minutes = String(now.getMinutes()).padStart(2, "0");
|
|
67
70
|
var seconds = String(now.getSeconds()).padStart(2, "0");
|
|
68
71
|
var currentDateTime = "".concat(year, "-").concat(month, "-").concat(day, " ").concat(hours, ":").concat(minutes, ":").concat(seconds);
|
|
69
|
-
|
|
72
|
+
if (type == 1) {
|
|
73
|
+
return "".concat(year, "-").concat(month, "-").concat(day);
|
|
74
|
+
} else if (type == 2) {
|
|
75
|
+
return "".concat(hours, ":").concat(minutes);
|
|
76
|
+
} else {
|
|
77
|
+
return currentDateTime;
|
|
78
|
+
}
|
|
70
79
|
} catch (error) {
|
|
71
80
|
return "";
|
|
72
81
|
}
|
|
@@ -6,21 +6,49 @@ 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 { Input } from "antd";
|
|
9
|
-
import { CustomClose } from "
|
|
9
|
+
import { CustomClose } from "../icons/index";
|
|
10
10
|
import { SearchOutlined } from "@ant-design/icons";
|
|
11
|
-
import { getDataTime } from "
|
|
11
|
+
import { getDataTime } from "./function"; //录音使用文件
|
|
12
12
|
var HistoryFun = function(props) {
|
|
13
|
-
var type = props.type, roomId = props.roomId, userData = props.userData, http = props.http, urllocation = props.urllocation, onClose = props.onClose, loadSpecifiedData = props.loadSpecifiedData
|
|
13
|
+
var type = props.type, roomId = props.roomId, userData = props.userData, http = props.http, urllocation = props.urllocation, onClose = props.onClose, loadSpecifiedData = props.loadSpecifiedData;
|
|
14
14
|
var _useState = _sliced_to_array(useState(""), 2), keyWordProblem = _useState[0], setKeyWordProblem = _useState[1]; //搜索内容
|
|
15
15
|
var _useState1 = _sliced_to_array(useState([]), 2), keyHistoryMessageList = _useState1[0], setKeyHistoryMessageList = _useState1[1]; //搜索的历史记录
|
|
16
|
-
var _useState2 = _sliced_to_array(useState(
|
|
17
|
-
var _useState3 = _sliced_to_array(useState(1), 2),
|
|
18
|
-
var _useState4 = _sliced_to_array(useState(
|
|
16
|
+
var _useState2 = _sliced_to_array(useState(1), 2), showLoadingState = _useState2[0], setShowLoadingState = _useState2[1]; //1,初始状态,2、无数据 ,3、不显示图片
|
|
17
|
+
var _useState3 = _sliced_to_array(useState(1), 2), pageNum = _useState3[0], setPageNum = _useState3[1];
|
|
18
|
+
var _useState4 = _sliced_to_array(useState(0), 2), pageCount = _useState4[0], setPageCount = _useState4[1];
|
|
19
|
+
var _useState5 = _sliced_to_array(useState(false), 2), load = _useState5[0], setLoad = _useState5[1];
|
|
19
20
|
var timer = useRef(null); //文本框输入时
|
|
20
21
|
var objName = useRef([]);
|
|
22
|
+
// useEffect(() => {
|
|
23
|
+
// function handleScroll() {
|
|
24
|
+
// const container = document.getElementById('history_list');
|
|
25
|
+
// const scrollTop = container.scrollTop;
|
|
26
|
+
// const clientHeight = container.clientHeight;
|
|
27
|
+
// const scrollHeight = container.scrollHeight;
|
|
28
|
+
// // console.log(scrollTop,clientHeight,scrollHeight,'333dfkvmdfv')
|
|
29
|
+
// // if((clientHeight + scrollTop + 10) >= scrollHeight && pageCount > pageNum && pageCount > 0){
|
|
30
|
+
// // // console.log(11111111,pageNumHistory)
|
|
31
|
+
// // let number = pageNum + 1;
|
|
32
|
+
// // console.log('到底部了22222',number)
|
|
33
|
+
// // setPageNum((pageNum) => {
|
|
34
|
+
// // return pageNum + 1;
|
|
35
|
+
// // });
|
|
36
|
+
// // getKeyHistoryMessage(keyWordProblem,number);
|
|
37
|
+
// // }
|
|
38
|
+
// }
|
|
39
|
+
// const content = document.getElementById('history_list');
|
|
40
|
+
// if (content) {
|
|
41
|
+
// content.addEventListener("scroll", handleScroll);
|
|
42
|
+
// }
|
|
43
|
+
// return () => {
|
|
44
|
+
// const content = document.getElementById('history_list');
|
|
45
|
+
// if (content) {
|
|
46
|
+
// content.removeEventListener("scroll", handleScroll);
|
|
47
|
+
// }
|
|
48
|
+
// };
|
|
49
|
+
// }, [keyHistoryMessageList]);
|
|
21
50
|
useEffect(function() {
|
|
22
51
|
setKeyHistoryMessageList(function(list) {
|
|
23
|
-
console.log(objName, 4444455555);
|
|
24
52
|
var newList = list.map(function(item) {
|
|
25
53
|
var name = "";
|
|
26
54
|
var nameList = objName.current.filter(function(a) {
|
|
@@ -29,12 +57,10 @@ var HistoryFun = function(props) {
|
|
|
29
57
|
if (nameList.length > 0) {
|
|
30
58
|
name = nameList[0].name;
|
|
31
59
|
}
|
|
32
|
-
console.log(name, 77777);
|
|
33
60
|
return _object_spread_props(_object_spread({}, item), {
|
|
34
61
|
name: name
|
|
35
62
|
});
|
|
36
63
|
});
|
|
37
|
-
console.log(newList, 4444444444);
|
|
38
64
|
return newList;
|
|
39
65
|
});
|
|
40
66
|
}, [
|
|
@@ -42,13 +68,16 @@ var HistoryFun = function(props) {
|
|
|
42
68
|
]);
|
|
43
69
|
//获取搜索中的历史消息记录
|
|
44
70
|
var getKeyHistoryMessage = function(keyWordProblem) {
|
|
71
|
+
var page = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 1;
|
|
45
72
|
if (roomId == "") return;
|
|
73
|
+
setLoad(false);
|
|
74
|
+
setKeyHistoryMessageList([]);
|
|
46
75
|
return http.get("".concat(urllocation, "/chat-service/public/v1.0/history-messages"), {
|
|
47
76
|
params: {
|
|
48
77
|
roomId: "",
|
|
49
78
|
message: keyWordProblem,
|
|
50
|
-
page:
|
|
51
|
-
maxPageSize:
|
|
79
|
+
page: page,
|
|
80
|
+
maxPageSize: 1000,
|
|
52
81
|
direction: "desc"
|
|
53
82
|
},
|
|
54
83
|
headers: {
|
|
@@ -58,11 +87,16 @@ var HistoryFun = function(props) {
|
|
|
58
87
|
"x-auth-jwt": window.localStorage.getItem("usertoken") || ""
|
|
59
88
|
}
|
|
60
89
|
}).then(function(res) {
|
|
61
|
-
console.log(res.data, 3434378);
|
|
62
90
|
if (res.data.messages.length > 0) {
|
|
91
|
+
var total = res.data.total;
|
|
92
|
+
var maxPageSize = 20;
|
|
93
|
+
setPageCount(Math.ceil(total / maxPageSize));
|
|
63
94
|
setShowLoadingState(3);
|
|
64
95
|
var dataList = res.data.messages;
|
|
65
|
-
setKeyHistoryMessageList(
|
|
96
|
+
setKeyHistoryMessageList(function(list) {
|
|
97
|
+
var newList = list.concat(dataList);
|
|
98
|
+
return newList;
|
|
99
|
+
});
|
|
66
100
|
getUserName(dataList);
|
|
67
101
|
} else {
|
|
68
102
|
// setKeyHistoryMessageList([]);
|
|
@@ -95,7 +129,7 @@ var HistoryFun = function(props) {
|
|
|
95
129
|
return pageNumber;
|
|
96
130
|
};
|
|
97
131
|
//根据index,计算历史数据在第几页
|
|
98
|
-
var calculationData = function(roomId,
|
|
132
|
+
var calculationData = function(roomId, id, receiver) {
|
|
99
133
|
allData(roomId).then(function(res) {
|
|
100
134
|
// console.log(res.data.messages,'11111111')
|
|
101
135
|
if (res.data) {
|
|
@@ -109,7 +143,10 @@ var HistoryFun = function(props) {
|
|
|
109
143
|
}
|
|
110
144
|
});
|
|
111
145
|
var pageNumber = findPageNumber(30, Math.ceil(total / 30), number);
|
|
112
|
-
console.log(
|
|
146
|
+
// console.log(
|
|
147
|
+
// roomId, pageNumber, id,
|
|
148
|
+
// "第几页第几页第几页第几页第几页第几页"
|
|
149
|
+
// );
|
|
113
150
|
loadSpecifiedData(roomId, pageNumber, id, receiver);
|
|
114
151
|
onClose();
|
|
115
152
|
setKeyWordProblem("");
|
|
@@ -215,6 +252,7 @@ var HistoryFun = function(props) {
|
|
|
215
252
|
}),
|
|
216
253
|
/*#__PURE__*/ _jsxs("div", {
|
|
217
254
|
className: styles.main_list,
|
|
255
|
+
id: "history_list",
|
|
218
256
|
children: [
|
|
219
257
|
showLoadingState == 1 && /*#__PURE__*/ _jsxs("div", {
|
|
220
258
|
className: styles.no_data,
|
|
@@ -253,10 +291,19 @@ var HistoryFun = function(props) {
|
|
|
253
291
|
} else {
|
|
254
292
|
name = item.name;
|
|
255
293
|
}
|
|
294
|
+
var time = "";
|
|
295
|
+
var currentTime = getDataTime(-1, 1); //当前时间
|
|
296
|
+
var updatedAt = getDataTime(item.updatedAt, 1);
|
|
297
|
+
if (currentTime == updatedAt) {
|
|
298
|
+
time = getDataTime(item.updatedAt, 2);
|
|
299
|
+
} else {
|
|
300
|
+
time = getDataTime(item.updatedAt);
|
|
301
|
+
}
|
|
256
302
|
return /*#__PURE__*/ _jsxs("div", {
|
|
257
303
|
className: styles.list,
|
|
258
304
|
onClick: function() {
|
|
259
|
-
|
|
305
|
+
var id = item.receiver; // == userData.mid ? item.sender : item.receiver
|
|
306
|
+
calculationData(item.roomId, item.id, id);
|
|
260
307
|
},
|
|
261
308
|
children: [
|
|
262
309
|
/*#__PURE__*/ _jsxs("div", {
|
|
@@ -267,7 +314,7 @@ var HistoryFun = function(props) {
|
|
|
267
314
|
}),
|
|
268
315
|
/*#__PURE__*/ _jsx("span", {
|
|
269
316
|
className: styles.time,
|
|
270
|
-
children:
|
|
317
|
+
children: time
|
|
271
318
|
})
|
|
272
319
|
]
|
|
273
320
|
}),
|
|
@@ -7,9 +7,9 @@ interface Service {
|
|
|
7
7
|
onCancel?: () => {};
|
|
8
8
|
serverName?: string;
|
|
9
9
|
fetchEventSource?: any;
|
|
10
|
-
initShowType?:
|
|
11
|
-
stepIds
|
|
12
|
-
stepId
|
|
10
|
+
initShowType?: number;
|
|
11
|
+
stepIds?: string;
|
|
12
|
+
stepId?: string | number;
|
|
13
13
|
onEvent: (a: string, b: string, c: string) => {};
|
|
14
14
|
}
|
|
15
15
|
declare const CustomerService: (props: Service) => JSX.Element;
|