bhd-components 0.5.7 → 0.5.9

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.
Files changed (36) hide show
  1. package/dist/{535fc6c5.esm.es5.development.js → 4a44b71b.esm.es5.development.js} +98068 -25721
  2. package/dist/e7b4aef5.esm.es5.production.js +468 -0
  3. package/dist/index.esm.es5.development.css +8467 -0
  4. package/dist/index.esm.es5.development.js +5881 -0
  5. package/dist/index.esm.es5.production.css +1 -0
  6. package/dist/index.esm.es5.production.js +1 -0
  7. package/es2017/customerService/contactsList/index.d.ts +3 -2
  8. package/es2017/customerService/contactsList/index.js +93 -90
  9. package/es2017/customerService/contactsList/index.module.less +32 -13
  10. package/es2017/customerService/function.js +18 -13
  11. package/es2017/customerService/historyFun/index.d.ts +2 -1
  12. package/es2017/customerService/historyFun/index.js +121 -86
  13. package/es2017/customerService/historyFun/index.module.less +40 -6
  14. package/es2017/customerService/index.js +748 -567
  15. package/es2017/customerService/index.module.less +747 -684
  16. package/es2017/icons/components/custom-duihao.js +1 -1
  17. package/es2017/utils/Date.d.ts +9 -0
  18. package/es2017/utils/Date.js +18 -0
  19. package/esm/customerService/contactsList/index.d.ts +3 -2
  20. package/esm/customerService/contactsList/index.js +104 -97
  21. package/esm/customerService/contactsList/index.module.less +32 -13
  22. package/esm/customerService/function.js +18 -13
  23. package/esm/customerService/historyFun/index.d.ts +2 -1
  24. package/esm/customerService/historyFun/index.js +127 -94
  25. package/esm/customerService/historyFun/index.module.less +40 -6
  26. package/esm/customerService/index.js +813 -609
  27. package/esm/customerService/index.module.less +747 -684
  28. package/esm/icons/components/custom-duihao.js +1 -1
  29. package/esm/utils/Date.d.ts +9 -0
  30. package/esm/utils/Date.js +18 -0
  31. package/package.json +4 -3
  32. package/dist/1bddec89.esm.es5.production.js +0 -72
  33. package/dist/CustomerService.esm.es5.development.css +0 -2827
  34. package/dist/CustomerService.esm.es5.development.js +0 -3823
  35. package/dist/CustomerService.esm.es5.production.css +0 -1
  36. package/dist/CustomerService.esm.es5.production.js +0 -1
@@ -1,7 +1,10 @@
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 { _ as _sliced_to_array } from "@swc/helpers/_/_sliced_to_array";
2
4
  import { jsx as _jsx, jsxs as _jsxs } from "@ice/jsx-runtime/jsx-runtime";
3
- import React, { useState, useRef } from "react";
5
+ import React, { useEffect, useState, useRef } from "react";
4
6
  import styles from "./index.module.less";
7
+ import "highlight.js/styles/default.css";
5
8
  import { Input } from "antd";
6
9
  import { CustomClose } from "../../icons/index";
7
10
  import { SearchOutlined } from "@ant-design/icons";
@@ -11,7 +14,32 @@ var HistoryFun = function(props) {
11
14
  var _useState = _sliced_to_array(useState(""), 2), keyWordProblem = _useState[0], setKeyWordProblem = _useState[1]; //搜索内容
12
15
  var _useState1 = _sliced_to_array(useState([]), 2), keyHistoryMessageList = _useState1[0], setKeyHistoryMessageList = _useState1[1]; //搜索的历史记录
13
16
  var _useState2 = _sliced_to_array(useState([]), 2), userNameObj = _useState2[0], setUserNameObj = _useState2[1]; //根据用户id,存储一些用户名
17
+ var _useState3 = _sliced_to_array(useState(1), 2), showLoadingState = _useState3[0], setShowLoadingState = _useState3[1]; //1,初始状态,2、无数据 ,3、不显示图片
18
+ var _useState4 = _sliced_to_array(useState(false), 2), load = _useState4[0], setLoad = _useState4[1];
14
19
  var timer = useRef(null); //文本框输入时
20
+ var objName = useRef([]);
21
+ useEffect(function() {
22
+ setKeyHistoryMessageList(function(list) {
23
+ console.log(objName, 4444455555);
24
+ var newList = list.map(function(item) {
25
+ var name = "";
26
+ var nameList = objName.current.filter(function(a) {
27
+ return a.id == item.receiver;
28
+ });
29
+ if (nameList.length > 0) {
30
+ name = nameList[0].name;
31
+ }
32
+ console.log(name, 77777);
33
+ return _object_spread_props(_object_spread({}, item), {
34
+ name: name
35
+ });
36
+ });
37
+ console.log(newList, 4444444444);
38
+ return newList;
39
+ });
40
+ }, [
41
+ load
42
+ ]);
15
43
  //获取搜索中的历史消息记录
16
44
  var getKeyHistoryMessage = function(keyWordProblem) {
17
45
  if (roomId == "") return;
@@ -32,9 +60,13 @@ var HistoryFun = function(props) {
32
60
  }).then(function(res) {
33
61
  console.log(res.data, 3434378);
34
62
  if (res.data.messages.length > 0) {
63
+ setShowLoadingState(3);
35
64
  var dataList = res.data.messages;
36
65
  setKeyHistoryMessageList(dataList);
37
66
  getUserName(dataList);
67
+ } else {
68
+ // setKeyHistoryMessageList([]);
69
+ setShowLoadingState(2);
38
70
  }
39
71
  }).catch(function(res) {});
40
72
  };
@@ -63,7 +95,7 @@ var HistoryFun = function(props) {
63
95
  return pageNumber;
64
96
  };
65
97
  //根据index,计算历史数据在第几页
66
- var calculationData = function(roomId, index, id) {
98
+ var calculationData = function(roomId, index, id, sender) {
67
99
  allData(roomId).then(function(res) {
68
100
  // console.log(res.data.messages,'11111111')
69
101
  if (res.data) {
@@ -77,8 +109,8 @@ var HistoryFun = function(props) {
77
109
  }
78
110
  });
79
111
  var pageNumber = findPageNumber(30, Math.ceil(total / 30), number);
80
- console.log(number, pageNumber, "第几页第几页第几页第几页第几页第几页");
81
- loadSpecifiedData(roomId, pageNumber, id);
112
+ console.log(roomId, pageNumber, id, "第几页第几页第几页第几页第几页第几页");
113
+ loadSpecifiedData(roomId, pageNumber, id, receiver);
82
114
  onClose();
83
115
  setKeyWordProblem("");
84
116
  setKeyHistoryMessageList([]);
@@ -87,56 +119,31 @@ var HistoryFun = function(props) {
87
119
  };
88
120
  var getUserName = function(dataList) {
89
121
  try {
90
- dataList.map(function(item) {
91
- var id = item.sender;
92
- //判断 不是当前登录用户
93
- if (id != userData.mid) {
94
- var roomListName = roomList.filter(function(item) {
95
- return item.sender == id;
96
- });
97
- console.log(roomListName, 1111111);
98
- //判断如果是当前聊天列表中的用户
99
- if (roomListName.length > 0 && !roomListName[0].name) {
100
- console.log(roomListName[0], "2222222222");
101
- setUserNameObj(function(userNameObj) {
102
- var list = userNameObj;
103
- return list.concat({
104
- id: id,
105
- name: roomListName[0].name
106
- });
107
- });
108
- } else {
109
- //判断是否需要重新请求数据
110
- var getData = false;
111
- setUserNameObj(function(userNameObj) {
112
- console.log(userNameObj, "userNameObjuserNameObj");
113
- if (userNameObj.filter(function(e) {
114
- return e.id == id;
115
- }).length == 0) {
116
- console.log("没有相同的id");
117
- getData = true;
118
- }
119
- return userNameObj;
122
+ // let objName: { id: string; name: String; }[] = [];//[{id:'用户id',name:'用户名字‘}]
123
+ var obj = [];
124
+ //去重
125
+ var res = new Map();
126
+ var filterList = dataList.filter(function(a) {
127
+ return !res.has(a.receiver) && res.set(a.receiver, 1);
128
+ });
129
+ filterList = filterList.filter(function(item) {
130
+ return item.receiver != userData.mid && item.receiver != "AI";
131
+ });
132
+ console.log(filterList, "wefwekfjwef");
133
+ filterList.map(function(item) {
134
+ userName(item.receiver).then(function(res) {
135
+ if (res.data) {
136
+ obj.push({
137
+ id: item.receiver,
138
+ name: res.data.name
120
139
  });
121
- if (getData) {
122
- if (id == "AI") {
123
- id == item.recevier;
124
- }
125
- userName(id).then(function(res) {
126
- if (res.data) {
127
- setUserNameObj(function(userNameObj) {
128
- var list = userNameObj;
129
- return list.concat({
130
- name: res.data.name,
131
- id: id
132
- });
133
- });
134
- console.log(7777777, res.data.name);
135
- }
136
- });
140
+ console.log(objName, "kdfvdfdfvjkdfnv");
141
+ if (obj.length == filterList.length) {
142
+ objName.current = obj;
143
+ setLoad(true);
137
144
  }
138
145
  }
139
- }
146
+ });
140
147
  });
141
148
  } catch (error) {}
142
149
  };
@@ -186,6 +193,10 @@ var HistoryFun = function(props) {
186
193
  timer.current = setTimeout(function() {
187
194
  if (val != "") {
188
195
  getKeyHistoryMessage(val);
196
+ } else {
197
+ setShowLoadingState(1);
198
+ setKeyHistoryMessageList([]);
199
+ setLoad(false);
189
200
  }
190
201
  }, 1000);
191
202
  }
@@ -193,61 +204,83 @@ var HistoryFun = function(props) {
193
204
  /*#__PURE__*/ _jsx("i", {
194
205
  className: "guanbi_Close",
195
206
  onClick: function() {
207
+ setShowLoadingState(1);
196
208
  setKeyWordProblem("");
197
209
  setKeyHistoryMessageList([]);
210
+ setLoad(false);
198
211
  },
199
212
  children: /*#__PURE__*/ _jsx(CustomClose, {})
200
213
  })
201
214
  ]
202
215
  }),
203
- /*#__PURE__*/ _jsx("div", {
216
+ /*#__PURE__*/ _jsxs("div", {
204
217
  className: styles.main_list,
205
- children: keyHistoryMessageList.map(function(item, index) {
206
- var span = item.message.replaceAll(keyWordProblem, function() {
207
- return "<span class=".concat(styles.sign, ">").concat(keyWordProblem, "</span>");
208
- });
209
- {
210
- console.log(userNameObj), 9999999;
211
- }
212
- var name = "";
213
- if (item.sender == userData.mid) {
214
- name = userData.real_name;
215
- } else if (item.sender == "AI") {
216
- name = userNameObj.filter(function(e) {
217
- return e.id == item.recevier;
218
- })[0].name;
219
- } else {
220
- name = userNameObj.filter(function(e) {
221
- return e.id == item.sender;
222
- })[0].name;
223
- }
224
- return /*#__PURE__*/ _jsxs("div", {
225
- className: styles.list,
226
- onClick: function() {
227
- calculationData(item.roomId, item.messageIdWithinRoom, item.id);
228
- },
218
+ children: [
219
+ showLoadingState == 1 && /*#__PURE__*/ _jsxs("div", {
220
+ className: styles.no_data,
229
221
  children: [
230
- /*#__PURE__*/ _jsxs("div", {
231
- className: styles.name,
232
- children: [
233
- /*#__PURE__*/ _jsx("p", {
234
- children: name
235
- }),
236
- /*#__PURE__*/ _jsx("span", {
237
- className: styles.time,
238
- children: getDataTime(item.updatedAt)
239
- })
240
- ]
222
+ /*#__PURE__*/ _jsx("img", {
223
+ src: "/new_yun/images/aiService/search_for_icon.png"
241
224
  }),
242
- /*#__PURE__*/ _jsx("div", {
243
- className: styles.con,
244
- dangerouslySetInnerHTML: {
245
- __html: span
246
- }
225
+ /*#__PURE__*/ _jsx("p", {
226
+ children: "输入关键词,搜索聊天记录"
247
227
  })
248
228
  ]
249
- }, item.id);
250
- })
229
+ }),
230
+ showLoadingState == 2 && /*#__PURE__*/ _jsxs("div", {
231
+ className: styles.no_data,
232
+ children: [
233
+ /*#__PURE__*/ _jsx("img", {
234
+ src: "/new_yun/images/aiService/no_data.png"
235
+ }),
236
+ /*#__PURE__*/ _jsx("p", {
237
+ children: "暂无记录"
238
+ })
239
+ ]
240
+ }),
241
+ keyHistoryMessageList.map(function(item, index) {
242
+ var span = item.message.replaceAll(keyWordProblem, function() {
243
+ return "<span class=".concat(styles.sign, ">").concat(keyWordProblem, "</span>");
244
+ });
245
+ var name = "";
246
+ if (item.receiver == userData.mid) {
247
+ name = userData.real_name;
248
+ } else if (item.receiver == "AI") {
249
+ name = "AI助手";
250
+ if (item.extraInfo != null) {
251
+ name = "智能客服";
252
+ }
253
+ } else {
254
+ name = item.name;
255
+ }
256
+ return /*#__PURE__*/ _jsxs("div", {
257
+ className: styles.list,
258
+ onClick: function() {
259
+ calculationData(item.roomId, item.messageIdWithinRoom, item.id, item.receiver);
260
+ },
261
+ children: [
262
+ /*#__PURE__*/ _jsxs("div", {
263
+ className: styles.name,
264
+ children: [
265
+ /*#__PURE__*/ _jsx("p", {
266
+ children: name
267
+ }),
268
+ /*#__PURE__*/ _jsx("span", {
269
+ className: styles.time,
270
+ children: getDataTime(item.updatedAt)
271
+ })
272
+ ]
273
+ }),
274
+ /*#__PURE__*/ _jsx("div", {
275
+ className: styles.con,
276
+ dangerouslySetInnerHTML: {
277
+ __html: span
278
+ }
279
+ })
280
+ ]
281
+ }, item.id);
282
+ })
283
+ ]
251
284
  })
252
285
  ]
253
286
  })
@@ -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: 2px;
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: 12px;
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% - 50px);
199
+ height: calc(100% - 48px);
177
200
  right: 0;
178
201
  top: 48px;
179
- border-radius: 0px 8px 8px 0px;
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
  }