bhd-components 0.6.5 → 0.6.6
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/{d4259367.esm.es5.development.js → 869a16fb.esm.es5.development.js} +1402 -1140
- package/dist/{8bda9e2e.esm.es5.production.js → c220442c.esm.es5.production.js} +1 -1
- package/dist/index.esm.es5.development.css +864 -732
- package/dist/index.esm.es5.development.js +757 -671
- package/dist/index.esm.es5.production.css +1 -1
- package/dist/index.esm.es5.production.js +1 -1
- package/es2017/customerService/contactsList.d.ts +1 -1
- package/es2017/customerService/contactsList.js +11 -145
- package/es2017/customerService/function.js +1 -1
- package/es2017/customerService/historyFun.js +325 -154
- package/es2017/customerService/index.js +412 -341
- package/es2017/customerService/index.module.less +169 -65
- package/es2017/customerService/index2.module.less +170 -65
- package/es2017/icons/components/custom-expand.d.ts +4 -0
- package/es2017/icons/components/custom-expand.js +22 -0
- package/es2017/icons/components/index.d.ts +1 -0
- package/es2017/icons/components/index.js +1 -0
- package/esm/customerService/contactsList.d.ts +1 -1
- package/esm/customerService/contactsList.js +11 -158
- package/esm/customerService/function.js +1 -1
- package/esm/customerService/historyFun.js +329 -167
- package/esm/customerService/index.js +397 -348
- package/esm/customerService/index.module.less +169 -65
- package/esm/customerService/index2.module.less +170 -65
- package/esm/icons/components/custom-expand.d.ts +4 -0
- package/esm/icons/components/custom-expand.js +24 -0
- package/esm/icons/components/index.d.ts +1 -0
- package/esm/icons/components/index.js +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { _ as _object_spread } from "@swc/helpers/_/_object_spread";
|
|
2
|
+
import { _ as _object_spread_props } from "@swc/helpers/_/_object_spread_props";
|
|
3
|
+
import { jsx as _jsx } from "@ice/jsx-runtime/jsx-runtime";
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
import Icon from "@ant-design/icons";
|
|
6
|
+
const CustomExpandSvg = ()=>/*#__PURE__*/ _jsx("svg", {
|
|
7
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
8
|
+
width: "1em",
|
|
9
|
+
height: "1em",
|
|
10
|
+
viewBox: "0 0 24 25",
|
|
11
|
+
"shape-rendering": "geometricPrecision",
|
|
12
|
+
fill: "currentColor",
|
|
13
|
+
children: /*#__PURE__*/ _jsx("path", {
|
|
14
|
+
d: "M8.36358 5.86364C8.01211 6.21511 8.01211 6.78496 8.36358 7.13643L13.7272 12.5L8.36358 17.8636C8.01211 18.2151 8.01211 18.785 8.36358 19.1364C8.71505 19.4879 9.2849 19.4879 9.63637 19.1364L15.6364 13.1364C15.9878 12.785 15.9878 12.2151 15.6364 11.8636L9.63637 5.86364C9.2849 5.51217 8.71505 5.51217 8.36358 5.86364Z"
|
|
15
|
+
})
|
|
16
|
+
});
|
|
17
|
+
const CustomExpand = (props)=>{
|
|
18
|
+
return /*#__PURE__*/ _jsx(Icon, _object_spread_props(_object_spread({}, props), {
|
|
19
|
+
component: CustomExpandSvg
|
|
20
|
+
}));
|
|
21
|
+
};
|
|
22
|
+
export default CustomExpand;
|
|
@@ -17,3 +17,4 @@ export { default as CustomContacts } from "./custom-contacts";
|
|
|
17
17
|
export { default as CustomDuihao } from "./custom-duihao";
|
|
18
18
|
export { default as CustomRoundClose } from "./custom-round_close";
|
|
19
19
|
export { default as CustomAiIcon } from "./custom-ai_icon";
|
|
20
|
+
export { default as CustomExpand } from "./custom-expand";
|
|
@@ -17,3 +17,4 @@ export { default as CustomContacts } from "./custom-contacts";
|
|
|
17
17
|
export { default as CustomDuihao } from "./custom-duihao";
|
|
18
18
|
export { default as CustomRoundClose } from "./custom-round_close";
|
|
19
19
|
export { default as CustomAiIcon } from "./custom-ai_icon";
|
|
20
|
+
export { default as CustomExpand } from "./custom-expand";
|
|
@@ -7,7 +7,7 @@ interface data {
|
|
|
7
7
|
urllocation: String;
|
|
8
8
|
onClose: any;
|
|
9
9
|
switchChatRoom: any;
|
|
10
|
-
|
|
10
|
+
contactsList: any;
|
|
11
11
|
ref: any;
|
|
12
12
|
}
|
|
13
13
|
declare const ContactsList: import("react").ForwardRefExoticComponent<Omit<data, "ref"> & import("react").RefAttributes<unknown>>;
|
|
@@ -1,131 +1,24 @@
|
|
|
1
|
-
import { _ as _object_spread } from "@swc/helpers/_/_object_spread";
|
|
2
|
-
import { _ as _object_spread_props } from "@swc/helpers/_/_object_spread_props";
|
|
3
|
-
import { _ as _sliced_to_array } from "@swc/helpers/_/_sliced_to_array";
|
|
4
1
|
import { jsx as _jsx, jsxs as _jsxs } from "@ice/jsx-runtime/jsx-runtime";
|
|
5
|
-
import React, {
|
|
2
|
+
import React, { forwardRef } from "react";
|
|
6
3
|
import styles from "./index.module.less";
|
|
7
4
|
import { Tooltip } from "antd";
|
|
8
5
|
import { CustomAiIcon, CustomRetract } from "../icons/index";
|
|
9
6
|
import { CloseOutlined } from "@ant-design/icons";
|
|
10
7
|
import { getDataTime, getByteLen } from "./function"; //录音使用文件
|
|
11
8
|
var ContactsList = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
12
|
-
var type = props.type, roomId = props.roomId, userData = props.userData, http = props.http, urllocation = props.urllocation, onClose = props.onClose, switchChatRoom = props.switchChatRoom,
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
clearTimeout(timer.current);
|
|
20
|
-
};
|
|
21
|
-
}, []);
|
|
22
|
-
// //获取聊天室列表
|
|
23
|
-
// useEffect(() => {
|
|
24
|
-
// roomsListTimer();
|
|
25
|
-
// }, [contactsList]);
|
|
26
|
-
useImperativeHandle(ref, function() {
|
|
27
|
-
return {
|
|
28
|
-
roomsListTimer: function() {
|
|
29
|
-
return roomsListTimer();
|
|
30
|
-
}
|
|
31
|
-
};
|
|
32
|
-
});
|
|
33
|
-
var roomsListTimer = function() {
|
|
34
|
-
if (timer != null) clearTimeout(timer.current);
|
|
35
|
-
timer.current = setTimeout(function() {
|
|
36
|
-
return roomsListTimer();
|
|
37
|
-
}, 60000);
|
|
38
|
-
http.get("".concat(urllocation, "/chat-service/public/v1.0/rooms"), {
|
|
39
|
-
params: {
|
|
40
|
-
page: 1,
|
|
41
|
-
maxPageSize: 100002
|
|
42
|
-
},
|
|
43
|
-
headers: {
|
|
44
|
-
"x-module-id": userData.modules.find(function(ele) {
|
|
45
|
-
return ele.short == "IntelligentCustomerService";
|
|
46
|
-
}).id,
|
|
47
|
-
"x-auth-jwt": window.localStorage.getItem("usertoken") || ""
|
|
48
|
-
}
|
|
49
|
-
}).then(function(res) {
|
|
50
|
-
if (res.data) {
|
|
51
|
-
var list = res.data.contacts;
|
|
52
|
-
setContactsList(function(contactsList) {
|
|
53
|
-
list = list.map(function(item, index) {
|
|
54
|
-
var c_list = contactsList.filter(function(e) {
|
|
55
|
-
return e.sender == item.sender;
|
|
56
|
-
});
|
|
57
|
-
var obj = {};
|
|
58
|
-
if (c_list.length > 0) {
|
|
59
|
-
obj = c_list[0];
|
|
60
|
-
}
|
|
61
|
-
return _object_spread({}, obj, item);
|
|
62
|
-
});
|
|
63
|
-
return list;
|
|
64
|
-
});
|
|
65
|
-
getUserInfo(list);
|
|
66
|
-
saveContactsList(list);
|
|
67
|
-
}
|
|
68
|
-
});
|
|
69
|
-
};
|
|
9
|
+
var type = props.type, roomId = props.roomId, userData = props.userData, http = props.http, urllocation = props.urllocation, onClose = props.onClose, switchChatRoom = props.switchChatRoom, contactsList = props.contactsList;
|
|
10
|
+
// useImperativeHandle(ref, () => ({
|
|
11
|
+
// roomsListTimer: () => {
|
|
12
|
+
// return roomsListTimer();
|
|
13
|
+
// },
|
|
14
|
+
// roomsList:contactsList,
|
|
15
|
+
// }),[contactsList]);
|
|
70
16
|
//删除聊天室
|
|
71
17
|
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
|
-
});
|
|
84
18
|
http.delete("".concat(urllocation, "/chat-service/public/v1.0/rooms/").concat(roomId), {
|
|
85
|
-
headers: {
|
|
86
|
-
"x-module-id": userData.modules.find(function(ele) {
|
|
87
|
-
return ele.short == "IntelligentCustomerService";
|
|
88
|
-
}).id,
|
|
89
|
-
"x-auth-jwt": window.localStorage.getItem("usertoken") || ""
|
|
90
|
-
}
|
|
91
19
|
}).then(function(res) {
|
|
92
|
-
roomsListTimer();
|
|
93
|
-
|
|
94
|
-
};
|
|
95
|
-
//获取老师的信息等
|
|
96
|
-
var getUserInfo = function(list) {
|
|
97
|
-
list.map(function(item, i) {
|
|
98
|
-
if (!item.name && !item.headImg && item.sender != "AI") {
|
|
99
|
-
getUserName(item.sender).then(function(res) {
|
|
100
|
-
if (res.data) {
|
|
101
|
-
var _$list;
|
|
102
|
-
setContactsList(function(contactsList) {
|
|
103
|
-
_$list = contactsList.map(function(item, index) {
|
|
104
|
-
if (item.sender == res.data.uid) {
|
|
105
|
-
return _object_spread({}, item, res.data);
|
|
106
|
-
} else {
|
|
107
|
-
return item;
|
|
108
|
-
}
|
|
109
|
-
});
|
|
110
|
-
return _$list;
|
|
111
|
-
});
|
|
112
|
-
saveContactsList(_$list);
|
|
113
|
-
}
|
|
114
|
-
});
|
|
115
|
-
}
|
|
116
|
-
});
|
|
117
|
-
};
|
|
118
|
-
var getUserName = function(uid) {
|
|
119
|
-
return http.get("".concat(urllocation, "/chat-service/public/v1.0/userinfo"), {
|
|
120
|
-
params: {
|
|
121
|
-
uid: uid
|
|
122
|
-
},
|
|
123
|
-
headers: {
|
|
124
|
-
"x-module-id": userData.modules.find(function(ele) {
|
|
125
|
-
return ele.short == "TeacherAnswer";
|
|
126
|
-
}).id,
|
|
127
|
-
"x-auth-jwt": window.localStorage.getItem("usertoken") || ""
|
|
128
|
-
}
|
|
20
|
+
// roomsListTimer();
|
|
21
|
+
switchChatRoom(roomId, "1");
|
|
129
22
|
});
|
|
130
23
|
};
|
|
131
24
|
return type == 2 || type == 4 ? //联系人展开
|
|
@@ -137,8 +30,7 @@ var ContactsList = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
137
30
|
children: /*#__PURE__*/ _jsxs("div", {
|
|
138
31
|
className: "".concat(styles.ai, " ").concat(contactsList.length > 0 && contactsList[0].roomId != undefined && roomId != "" && contactsList[0].roomId == roomId || contactsList.length == 0 ? styles.active : ""),
|
|
139
32
|
onClick: function() {
|
|
140
|
-
switchChatRoom(contactsList[0].roomId, "");
|
|
141
|
-
// roomsListTimer();
|
|
33
|
+
return switchChatRoom(contactsList[0].roomId, "");
|
|
142
34
|
},
|
|
143
35
|
children: [
|
|
144
36
|
/*#__PURE__*/ _jsx(CustomAiIcon, {}),
|
|
@@ -182,25 +74,6 @@ var ContactsList = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
182
74
|
className: "".concat(styles.ai, " ").concat(item.roomId != undefined && roomId != "" && item.roomId == roomId ? styles.active : ""),
|
|
183
75
|
onClick: function() {
|
|
184
76
|
switchChatRoom(item.roomId, "");
|
|
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);
|
|
204
77
|
},
|
|
205
78
|
children: [
|
|
206
79
|
/*#__PURE__*/ _jsx("img", {
|
|
@@ -291,26 +164,6 @@ var ContactsList = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
291
164
|
className: "".concat(styles.ai, " ").concat(item.roomId != undefined && roomId != "" && item.roomId == roomId ? styles.active : ""),
|
|
292
165
|
onClick: function() {
|
|
293
166
|
switchChatRoom(item.roomId, "");
|
|
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);
|
|
314
167
|
},
|
|
315
168
|
children: [
|
|
316
169
|
/*#__PURE__*/ _jsx("img", {
|
|
@@ -68,7 +68,7 @@ var getDataTime = function(time) {
|
|
|
68
68
|
var hours = String(now.getHours()).padStart(2, "0");
|
|
69
69
|
var minutes = String(now.getMinutes()).padStart(2, "0");
|
|
70
70
|
var seconds = String(now.getSeconds()).padStart(2, "0");
|
|
71
|
-
var currentDateTime = "".concat(year, "-").concat(month, "-").concat(day, " ").concat(hours, ":").concat(minutes
|
|
71
|
+
var currentDateTime = "".concat(year, "-").concat(month, "-").concat(day, " ").concat(hours, ":").concat(minutes);
|
|
72
72
|
if (type == 1) {
|
|
73
73
|
return "".concat(year, "-").concat(month, "-").concat(day);
|
|
74
74
|
} else if (type == 2) {
|