bhd-components 0.6.2 → 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.
Files changed (39) hide show
  1. package/dist/{9eaa797e.esm.es5.development.js → a0cd97b9.esm.es5.development.js} +1 -1
  2. package/dist/{587f2764.esm.es5.production.js → e88a10a0.esm.es5.production.js} +1 -1
  3. package/dist/index.esm.es5.development.css +1711 -827
  4. package/dist/index.esm.es5.development.js +511 -383
  5. package/dist/index.esm.es5.production.css +1 -1
  6. package/dist/index.esm.es5.production.js +1 -1
  7. package/es2017/bhdSelect/index.d.ts +3 -0
  8. package/es2017/bhdSelect/index.js +18 -13
  9. package/es2017/bhdSelect/index.module.less +4 -1
  10. package/es2017/customerService/{contactsList/index.js → contactsList.js} +92 -76
  11. package/es2017/customerService/function.d.ts +1 -1
  12. package/es2017/customerService/function.js +10 -2
  13. package/es2017/customerService/{historyFun/index.d.ts → historyFun.d.ts} +0 -1
  14. package/es2017/customerService/{historyFun/index.js → historyFun.js} +62 -16
  15. package/es2017/customerService/index.d.ts +3 -3
  16. package/es2017/customerService/index.js +143 -82
  17. package/es2017/customerService/index.module.less +496 -6
  18. package/es2017/customerService/index2.module.less +1282 -0
  19. package/es2017/typings.d.ts +12 -0
  20. package/esm/bhdSelect/index.d.ts +3 -0
  21. package/esm/bhdSelect/index.js +18 -13
  22. package/esm/bhdSelect/index.module.less +4 -1
  23. package/esm/customerService/{contactsList/index.js → contactsList.js} +83 -65
  24. package/esm/customerService/function.d.ts +1 -1
  25. package/esm/customerService/function.js +10 -1
  26. package/esm/customerService/{historyFun/index.d.ts → historyFun.d.ts} +0 -1
  27. package/esm/customerService/{historyFun/index.js → historyFun.js} +63 -16
  28. package/esm/customerService/index.d.ts +3 -3
  29. package/esm/customerService/index.js +173 -112
  30. package/esm/customerService/index.module.less +496 -6
  31. package/esm/customerService/index2.module.less +1282 -0
  32. package/esm/typings.d.ts +12 -0
  33. package/package.json +1 -1
  34. package/es2017/customerService/contactsList/index.module.less +0 -208
  35. package/es2017/customerService/historyFun/index.module.less +0 -223
  36. package/esm/customerService/contactsList/index.module.less +0 -208
  37. package/esm/customerService/historyFun/index.module.less +0 -223
  38. /package/es2017/customerService/{contactsList/index.d.ts → contactsList.d.ts} +0 -0
  39. /package/esm/customerService/{contactsList/index.d.ts → contactsList.d.ts} +0 -0
@@ -1 +1,13 @@
1
1
  /// <reference types="@ice/pkg/types" />
2
+
3
+
4
+
5
+ declare let __ISONLINE__: boolean
6
+ declare module 'remarkable';
7
+ declare let $:any
8
+
9
+ declare global {
10
+ interface window {
11
+ appendDom: ()=>void
12
+ }
13
+ }
@@ -22,6 +22,9 @@ interface BhdSelectProps extends SelectProps {
22
22
  useType?: string;
23
23
  listHeight?: number;
24
24
  popupMatchSelectWidth?: number;
25
+ dropdownStyle?: {
26
+ width: number;
27
+ };
25
28
  }
26
29
  declare const BhdSelect: {
27
30
  (props: BhdSelectProps): React.JSX.Element;
@@ -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
- // const [selectWidth,setSelectWidth] = useState(0);//下拉框的宽度
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
- // if(props.popupMatchSelectWidth){
205
- // setSelectWidth(props.popupMatchSelectWidth);
206
- // }else{
207
- // // console.log(bhdSelectRef.current.getBoundingClientRect(),555555555);
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
- // if(props.dropdownStyle != undefined && props.dropdownStyle.width != undefined){
270
- // setSelectWidth(props.dropdownStyle.width)
271
- // }else if( (props.dropdownStyle == undefined || props.dropdownStyle.width == undefined) && useType === 'table'){
272
- // console.log(bhdSelectRef.current.parentNode.getBoundingClientRect().width-4,33333);
273
- // setSelectWidth(bhdSelectRef.current.parentNode.getBoundingClientRect().width-4)
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
@@ -105,10 +105,13 @@
105
105
  width: 14px;
106
106
  .bhd-btn {
107
107
  border: none;
108
- height: 10px;
108
+ height: 16px;
109
109
  line-height: 16px;
110
110
  width: 14px;
111
111
  }
112
+ .bhd-btn-default{
113
+ box-shadow: none !important;
114
+ }
112
115
  }
113
116
 
114
117
  }
@@ -1,27 +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 { CustomAiIcon, CustomRetract } from "../../icons/index";
7
+ import { Tooltip } from "antd";
8
+ import { CustomAiIcon, CustomRetract } from "../icons/index";
7
9
  import { CloseOutlined } from "@ant-design/icons";
8
- import { getDataTime } from "../function"; //录音使用文件
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
- // const [type,setType] = useState(0);
14
14
  var timer = useRef(null); //文本框输入时
15
15
  //获取聊天室列表
16
16
  useEffect(function() {
17
17
  roomsListTimer();
18
- if (roomId != "") {
19
- setNewRoomId(roomId);
20
- }
21
18
  return function() {
22
19
  clearTimeout(timer.current);
23
20
  };
24
21
  }, []);
22
+ // //获取聊天室列表
23
+ // useEffect(() => {
24
+ // roomsListTimer();
25
+ // }, [contactsList]);
25
26
  useImperativeHandle(ref, function() {
26
27
  return {
27
28
  roomsListTimer: function() {
@@ -29,11 +30,6 @@ var ContactsList = /*#__PURE__*/ forwardRef(function(props, ref) {
29
30
  }
30
31
  };
31
32
  });
32
- // useEffect(()=>{
33
- // //重新调用接口
34
- // console.log(44444444,contactsList)
35
- // roomsListTimer();
36
- // },[type])
37
33
  var roomsListTimer = function() {
38
34
  if (timer != null) clearTimeout(timer.current);
39
35
  timer.current = setTimeout(function() {
@@ -53,7 +49,6 @@ var ContactsList = /*#__PURE__*/ forwardRef(function(props, ref) {
53
49
  }).then(function(res) {
54
50
  if (res.data) {
55
51
  var list = res.data.contacts;
56
- // let newMessage = false;
57
52
  setContactsList(function(contactsList) {
58
53
  list = list.map(function(item, index) {
59
54
  var c_list = contactsList.filter(function(e) {
@@ -68,42 +63,24 @@ var ContactsList = /*#__PURE__*/ forwardRef(function(props, ref) {
68
63
  return list;
69
64
  });
70
65
  getUserInfo(list);
71
- // if(firstLoading){
72
- // setFirstLoading(false);
73
- // let isRoom = false;
74
- // for (let index = 0; index < list.length; index++) {
75
- // let count = list[index].unreadCount;
76
- // if(count > 0 && list[index].roomId == roomId){
77
- // isRoom = true;
78
- // //在当前窗口
79
- // return null;
80
- // }else if(count > 0){
81
- // isRoom = true;
82
- // switchChatRoom(list[index].roomId, "");
83
- // setContactsList((contactsList)=>{
84
- // let new_list = contactsList;
85
- // new_list = new_list.map((item)=>{
86
- // if(item.roomId == list[index].roomId){
87
- // return {
88
- // ...item,
89
- // unreadCount:0,
90
- // }
91
- // }else{
92
- // return item;
93
- // }
94
- // })
95
- // return new_list;
96
- // })
97
- // return null;
98
- // }
99
- // }
100
- // }
101
66
  saveContactsList(list);
102
67
  }
103
68
  });
104
69
  };
105
70
  //删除聊天室
106
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
+ });
107
84
  http.delete("".concat(urllocation, "/chat-service/public/v1.0/rooms/").concat(roomId), {
108
85
  headers: {
109
86
  "x-module-id": userData.modules.find(function(ele) {
@@ -113,16 +90,6 @@ var ContactsList = /*#__PURE__*/ forwardRef(function(props, ref) {
113
90
  }
114
91
  }).then(function(res) {
115
92
  roomsListTimer();
116
- // let contactsList;
117
- // setContactsList((list)=>{
118
- // contactsList = list.filter(e=>e.roomId != roomId);
119
- // //切换到AI聊天窗口
120
- // if(roomId == props.roomId){
121
- // switchChatRoom(contactsList[0].roomId, "");
122
- // }
123
- // return contactsList;
124
- // })
125
- // saveContactsList(contactsList);
126
93
  });
127
94
  };
128
95
  //获取老师的信息等
@@ -163,16 +130,15 @@ var ContactsList = /*#__PURE__*/ forwardRef(function(props, ref) {
163
130
  };
164
131
  return type == 2 || type == 4 ? //联系人展开
165
132
  /*#__PURE__*/ _jsxs("div", {
166
- className: styles.teacher_layout_modal,
133
+ className: "".concat(styles.teacher_layout_modal, " ").concat(type == 4 ? styles.teacher_layout_modal_newlabo : ""),
167
134
  children: [
168
135
  /*#__PURE__*/ _jsx("div", {
169
136
  className: styles.top,
170
137
  children: /*#__PURE__*/ _jsxs("div", {
171
138
  className: "".concat(styles.ai, " ").concat(contactsList.length > 0 && contactsList[0].roomId != undefined && roomId != "" && contactsList[0].roomId == roomId || contactsList.length == 0 ? styles.active : ""),
172
139
  onClick: function() {
173
- setNewRoomId(contactsList[0].roomId);
174
140
  switchChatRoom(contactsList[0].roomId, "");
175
- roomsListTimer();
141
+ // roomsListTimer();
176
142
  },
177
143
  children: [
178
144
  /*#__PURE__*/ _jsx(CustomAiIcon, {}),
@@ -185,7 +151,7 @@ var ContactsList = /*#__PURE__*/ forwardRef(function(props, ref) {
185
151
  "AI助手",
186
152
  /*#__PURE__*/ _jsx("span", {
187
153
  className: styles.time,
188
- children: contactsList.length > 0 && getDataTime(contactsList[0].createdAt)
154
+ children: contactsList.length > 0 && contactsList[0].createdAt != undefined && getDataTime(contactsList[0].createdAt)
189
155
  })
190
156
  ]
191
157
  }),
@@ -204,12 +170,37 @@ var ContactsList = /*#__PURE__*/ forwardRef(function(props, ref) {
204
170
  className: styles.bottom,
205
171
  children: contactsList.map(function(item, index) {
206
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
+ }
207
181
  return /*#__PURE__*/ _jsxs("div", {
208
182
  className: "".concat(styles.ai, " ").concat(item.roomId != undefined && roomId != "" && item.roomId == roomId ? styles.active : ""),
209
183
  onClick: function() {
210
- setNewRoomId(item.roomId);
211
184
  switchChatRoom(item.roomId, "");
212
- 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);
213
204
  },
214
205
  children: [
215
206
  /*#__PURE__*/ _jsx("img", {
@@ -221,7 +212,12 @@ var ContactsList = /*#__PURE__*/ forwardRef(function(props, ref) {
221
212
  /*#__PURE__*/ _jsxs("p", {
222
213
  className: styles.message,
223
214
  children: [
224
- 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,
225
221
  item.unreadCount != undefined && item.unreadCount > 0 && !(item.roomId != undefined && roomId != "" && item.roomId == roomId) && /*#__PURE__*/ _jsx("span", {
226
222
  className: styles.num,
227
223
  children: item.unreadCount > 99 ? "99+" : item.unreadCount
@@ -273,9 +269,8 @@ var ContactsList = /*#__PURE__*/ forwardRef(function(props, ref) {
273
269
  /*#__PURE__*/ _jsxs("div", {
274
270
  className: "".concat(styles.ai, " ").concat(contactsList.length > 0 && contactsList[0].roomId != undefined && roomId != "" && contactsList[0].roomId == roomId || contactsList.length == 0 ? styles.active : ""),
275
271
  onClick: function() {
276
- setNewRoomId(contactsList[0].roomId);
277
272
  switchChatRoom(contactsList[0].roomId, "");
278
- roomsListTimer();
273
+ // roomsListTimer();
279
274
  },
280
275
  children: [
281
276
  /*#__PURE__*/ _jsx(CustomAiIcon, {}),
@@ -295,16 +290,39 @@ var ContactsList = /*#__PURE__*/ forwardRef(function(props, ref) {
295
290
  return /*#__PURE__*/ _jsxs("div", {
296
291
  className: "".concat(styles.ai, " ").concat(item.roomId != undefined && roomId != "" && item.roomId == roomId ? styles.active : ""),
297
292
  onClick: function() {
298
- setNewRoomId(item.roomId);
299
293
  switchChatRoom(item.roomId, "");
300
- 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);
301
314
  },
302
315
  children: [
303
316
  /*#__PURE__*/ _jsx("img", {
304
317
  src: item.headImg
305
318
  }),
306
319
  /*#__PURE__*/ _jsx("p", {
307
- 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
308
326
  }),
309
327
  item.unreadCount != undefined && item.unreadCount > 0 && !(item.roomId != undefined && roomId != "" && item.roomId == roomId) && /*#__PURE__*/ _jsx("span", {
310
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
- return currentDateTime;
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
  }
@@ -8,7 +8,6 @@ interface data {
8
8
  urllocation: String;
9
9
  onClose: any;
10
10
  loadSpecifiedData: any;
11
- roomList: any;
12
11
  }
13
12
  declare const HistoryFun: (props: data) => JSX.Element;
14
13
  export default HistoryFun;
@@ -6,20 +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 "../../icons/index";
9
+ import { CustomClose } from "../icons/index";
10
10
  import { SearchOutlined } from "@ant-design/icons";
11
- import { getDataTime } from "../function"; //录音使用文件
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, roomList = props.roomList;
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
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(false), 2), load = _useState3[0], setLoad = _useState3[1];
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];
18
20
  var timer = useRef(null); //文本框输入时
19
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]);
20
50
  useEffect(function() {
21
51
  setKeyHistoryMessageList(function(list) {
22
- console.log(objName, 4444455555);
23
52
  var newList = list.map(function(item) {
24
53
  var name = "";
25
54
  var nameList = objName.current.filter(function(a) {
@@ -28,12 +57,10 @@ var HistoryFun = function(props) {
28
57
  if (nameList.length > 0) {
29
58
  name = nameList[0].name;
30
59
  }
31
- console.log(name, 77777);
32
60
  return _object_spread_props(_object_spread({}, item), {
33
61
  name: name
34
62
  });
35
63
  });
36
- console.log(newList, 4444444444);
37
64
  return newList;
38
65
  });
39
66
  }, [
@@ -41,13 +68,16 @@ var HistoryFun = function(props) {
41
68
  ]);
42
69
  //获取搜索中的历史消息记录
43
70
  var getKeyHistoryMessage = function(keyWordProblem) {
71
+ var page = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 1;
44
72
  if (roomId == "") return;
73
+ setLoad(false);
74
+ setKeyHistoryMessageList([]);
45
75
  return http.get("".concat(urllocation, "/chat-service/public/v1.0/history-messages"), {
46
76
  params: {
47
77
  roomId: "",
48
78
  message: keyWordProblem,
49
- page: 1,
50
- maxPageSize: 300,
79
+ page: page,
80
+ maxPageSize: 1000,
51
81
  direction: "desc"
52
82
  },
53
83
  headers: {
@@ -57,11 +87,16 @@ var HistoryFun = function(props) {
57
87
  "x-auth-jwt": window.localStorage.getItem("usertoken") || ""
58
88
  }
59
89
  }).then(function(res) {
60
- console.log(res.data, 3434378);
61
90
  if (res.data.messages.length > 0) {
91
+ var total = res.data.total;
92
+ var maxPageSize = 20;
93
+ setPageCount(Math.ceil(total / maxPageSize));
62
94
  setShowLoadingState(3);
63
95
  var dataList = res.data.messages;
64
- setKeyHistoryMessageList(dataList);
96
+ setKeyHistoryMessageList(function(list) {
97
+ var newList = list.concat(dataList);
98
+ return newList;
99
+ });
65
100
  getUserName(dataList);
66
101
  } else {
67
102
  // setKeyHistoryMessageList([]);
@@ -94,7 +129,7 @@ var HistoryFun = function(props) {
94
129
  return pageNumber;
95
130
  };
96
131
  //根据index,计算历史数据在第几页
97
- var calculationData = function(roomId, index, id, receiver) {
132
+ var calculationData = function(roomId, id, receiver) {
98
133
  allData(roomId).then(function(res) {
99
134
  // console.log(res.data.messages,'11111111')
100
135
  if (res.data) {
@@ -108,7 +143,10 @@ var HistoryFun = function(props) {
108
143
  }
109
144
  });
110
145
  var pageNumber = findPageNumber(30, Math.ceil(total / 30), number);
111
- console.log(roomId, pageNumber, id, "第几页第几页第几页第几页第几页第几页");
146
+ // console.log(
147
+ // roomId, pageNumber, id,
148
+ // "第几页第几页第几页第几页第几页第几页"
149
+ // );
112
150
  loadSpecifiedData(roomId, pageNumber, id, receiver);
113
151
  onClose();
114
152
  setKeyWordProblem("");
@@ -214,6 +252,7 @@ var HistoryFun = function(props) {
214
252
  }),
215
253
  /*#__PURE__*/ _jsxs("div", {
216
254
  className: styles.main_list,
255
+ id: "history_list",
217
256
  children: [
218
257
  showLoadingState == 1 && /*#__PURE__*/ _jsxs("div", {
219
258
  className: styles.no_data,
@@ -252,11 +291,19 @@ var HistoryFun = function(props) {
252
291
  } else {
253
292
  name = item.name;
254
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
+ }
255
302
  return /*#__PURE__*/ _jsxs("div", {
256
303
  className: styles.list,
257
304
  onClick: function() {
258
- var id = item.receiver == userData.mid ? item.sender : item.receiver;
259
- calculationData(item.roomId, item.messageIdWithinRoom, id, item.receiver);
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: getDataTime(item.updatedAt)
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?: string | number;
11
- stepIds: string;
12
- stepId: string | number;
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;