bhd-components 0.6.4 → 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/README.md +1 -1
- package/dist/{9674e68c.esm.es5.development.js → 869a16fb.esm.es5.development.js} +1402 -1140
- package/dist/{a57a24b2.esm.es5.production.js → c220442c.esm.es5.production.js} +1 -1
- package/dist/index.esm.es5.development.css +888 -753
- package/dist/index.esm.es5.development.js +786 -686
- 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 +30 -14
- package/es2017/bhdSelect/index.module.less +4 -5
- 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/bhdSelect/index.d.ts +3 -0
- package/esm/bhdSelect/index.js +30 -14
- package/esm/bhdSelect/index.module.less +4 -5
- 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";
|
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;
|
|
@@ -265,13 +269,25 @@ var BhdSelect = function(props) {
|
|
|
265
269
|
}
|
|
266
270
|
}
|
|
267
271
|
//表格中使用下拉列表,定义下拉列表宽度
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
272
|
+
//表格中使用下拉列表,定义下拉列表宽度
|
|
273
|
+
if (props.dropdownStyle != undefined && props.dropdownStyle.width != undefined) {
|
|
274
|
+
setSelectWidth(props.dropdownStyle.width);
|
|
275
|
+
} else if (useType === "table") {
|
|
276
|
+
try {
|
|
277
|
+
var width = bhdSelectRef.current.parentNode.getBoundingClientRect().width + 14;
|
|
278
|
+
var minWidth = props.popupMatchSelectWidth;
|
|
279
|
+
//设置了最小宽度
|
|
280
|
+
if (minWidth != undefined && minWidth >= width) {
|
|
281
|
+
setSelectWidth(minWidth);
|
|
282
|
+
} else if (minWidth != undefined && minWidth < width) {
|
|
283
|
+
setSelectWidth(width);
|
|
284
|
+
} else if (minWidth == undefined && width < 60) {
|
|
285
|
+
setSelectWidth(60);
|
|
286
|
+
} else {
|
|
287
|
+
setSelectWidth(width);
|
|
288
|
+
}
|
|
289
|
+
} catch (error) {}
|
|
290
|
+
}
|
|
275
291
|
props.onMouseEnter && props.onMouseEnter(e);
|
|
276
292
|
},
|
|
277
293
|
children: filterChildren
|
|
@@ -105,14 +105,13 @@
|
|
|
105
105
|
width: 14px;
|
|
106
106
|
.bhd-btn {
|
|
107
107
|
border: none;
|
|
108
|
-
|
|
109
|
-
height: 10px;
|
|
108
|
+
height: 16px;
|
|
110
109
|
line-height: 16px;
|
|
111
110
|
width: 14px;
|
|
112
111
|
}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
112
|
+
.bhd-btn-default{
|
|
113
|
+
box-shadow: none !important;
|
|
114
|
+
}
|
|
116
115
|
}
|
|
117
116
|
|
|
118
117
|
}
|
|
@@ -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) {
|