bhd-components 0.5.5 → 0.5.7

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 (117) hide show
  1. package/dist/1bddec89.esm.es5.production.js +72 -0
  2. package/dist/535fc6c5.esm.es5.development.js +95493 -0
  3. package/dist/CustomerService.esm.es5.development.css +2827 -0
  4. package/dist/CustomerService.esm.es5.development.js +3823 -0
  5. package/dist/CustomerService.esm.es5.production.css +1 -0
  6. package/dist/CustomerService.esm.es5.production.js +1 -0
  7. package/dist/vendor.esm.es5.development.esm.es5.development.css +117 -0
  8. package/dist/vendor.esm.es5.production.esm.es5.production.css +9 -0
  9. package/es2017/customerService/contactsList/index.d.ts +13 -0
  10. package/es2017/customerService/contactsList/index.js +313 -0
  11. package/es2017/customerService/contactsList/index.module.less +187 -0
  12. package/es2017/customerService/function.d.ts +17 -0
  13. package/es2017/customerService/function.js +67 -0
  14. package/es2017/customerService/historyFun/index.d.ts +13 -0
  15. package/es2017/customerService/historyFun/index.js +241 -0
  16. package/es2017/customerService/historyFun/index.module.less +189 -0
  17. package/es2017/customerService/images/knowledge_icon.png +0 -0
  18. package/es2017/customerService/images/voice_btn.gif +0 -0
  19. package/es2017/customerService/index.d.ts +16 -0
  20. package/es2017/customerService/index.js +2493 -0
  21. package/es2017/customerService/index.module.less +727 -0
  22. package/es2017/customerService/useMediaRecorder.d.ts +9 -0
  23. package/es2017/customerService/useMediaRecorder.js +78 -0
  24. package/es2017/customerService/voice_btn.gif +0 -0
  25. package/es2017/icons/components/custom-ai_icon.d.ts +4 -0
  26. package/es2017/icons/components/custom-ai_icon.js +58 -0
  27. package/es2017/icons/components/custom-contacts.d.ts +4 -0
  28. package/es2017/icons/components/custom-contacts.js +29 -0
  29. package/es2017/icons/components/custom-copy.d.ts +4 -0
  30. package/es2017/icons/components/custom-copy.js +36 -0
  31. package/es2017/icons/components/custom-dislike.d.ts +4 -0
  32. package/es2017/icons/components/custom-dislike.js +22 -0
  33. package/es2017/icons/components/custom-duihao.d.ts +4 -0
  34. package/es2017/icons/components/custom-duihao.js +22 -0
  35. package/es2017/icons/components/custom-exit_full_screen.d.ts +4 -0
  36. package/es2017/icons/components/custom-exit_full_screen.js +26 -0
  37. package/es2017/icons/components/custom-full_screen.d.ts +4 -0
  38. package/es2017/icons/components/custom-full_screen.js +22 -0
  39. package/es2017/icons/components/custom-like.d.ts +4 -0
  40. package/es2017/icons/components/custom-like.js +22 -0
  41. package/es2017/icons/components/custom-quote.d.ts +4 -0
  42. package/es2017/icons/components/custom-quote.js +31 -0
  43. package/es2017/icons/components/custom-record.d.ts +4 -0
  44. package/es2017/icons/components/custom-record.js +37 -0
  45. package/es2017/icons/components/custom-reloading.d.ts +4 -0
  46. package/es2017/icons/components/custom-reloading.js +26 -0
  47. package/es2017/icons/components/custom-retract.d.ts +4 -0
  48. package/es2017/icons/components/custom-retract.js +27 -0
  49. package/es2017/icons/components/custom-round_close.d.ts +4 -0
  50. package/es2017/icons/components/custom-round_close.js +24 -0
  51. package/es2017/icons/components/custom-sending.d.ts +4 -0
  52. package/es2017/icons/components/custom-sending.js +22 -0
  53. package/es2017/icons/components/custom-sound_recording.d.ts +4 -0
  54. package/es2017/icons/components/custom-sound_recording.js +22 -0
  55. package/es2017/icons/components/index.d.ts +15 -0
  56. package/es2017/icons/components/index.js +15 -0
  57. package/es2017/index.d.ts +1 -0
  58. package/es2017/index.js +1 -0
  59. package/es2017/provider/config.js +3 -3
  60. package/esm/customerService/contactsList/index.d.ts +13 -0
  61. package/esm/customerService/contactsList/index.js +326 -0
  62. package/esm/customerService/contactsList/index.module.less +187 -0
  63. package/esm/customerService/function.d.ts +17 -0
  64. package/esm/customerService/function.js +69 -0
  65. package/esm/customerService/historyFun/index.d.ts +13 -0
  66. package/esm/customerService/historyFun/index.js +256 -0
  67. package/esm/customerService/historyFun/index.module.less +189 -0
  68. package/esm/customerService/images/knowledge_icon.png +0 -0
  69. package/esm/customerService/images/voice_btn.gif +0 -0
  70. package/esm/customerService/index.d.ts +16 -0
  71. package/esm/customerService/index.js +2576 -0
  72. package/esm/customerService/index.module.less +727 -0
  73. package/esm/customerService/useMediaRecorder.d.ts +9 -0
  74. package/esm/customerService/useMediaRecorder.js +121 -0
  75. package/esm/customerService/voice_btn.gif +0 -0
  76. package/esm/icons/components/custom-ai_icon.d.ts +4 -0
  77. package/esm/icons/components/custom-ai_icon.js +60 -0
  78. package/esm/icons/components/custom-contacts.d.ts +4 -0
  79. package/esm/icons/components/custom-contacts.js +31 -0
  80. package/esm/icons/components/custom-copy.d.ts +4 -0
  81. package/esm/icons/components/custom-copy.js +38 -0
  82. package/esm/icons/components/custom-dislike.d.ts +4 -0
  83. package/esm/icons/components/custom-dislike.js +24 -0
  84. package/esm/icons/components/custom-duihao.d.ts +4 -0
  85. package/esm/icons/components/custom-duihao.js +24 -0
  86. package/esm/icons/components/custom-exit_full_screen.d.ts +4 -0
  87. package/esm/icons/components/custom-exit_full_screen.js +28 -0
  88. package/esm/icons/components/custom-full_screen.d.ts +4 -0
  89. package/esm/icons/components/custom-full_screen.js +24 -0
  90. package/esm/icons/components/custom-like.d.ts +4 -0
  91. package/esm/icons/components/custom-like.js +24 -0
  92. package/esm/icons/components/custom-quote.d.ts +4 -0
  93. package/esm/icons/components/custom-quote.js +33 -0
  94. package/esm/icons/components/custom-record.d.ts +4 -0
  95. package/esm/icons/components/custom-record.js +39 -0
  96. package/esm/icons/components/custom-reloading.d.ts +4 -0
  97. package/esm/icons/components/custom-reloading.js +28 -0
  98. package/esm/icons/components/custom-retract.d.ts +4 -0
  99. package/esm/icons/components/custom-retract.js +29 -0
  100. package/esm/icons/components/custom-round_close.d.ts +4 -0
  101. package/esm/icons/components/custom-round_close.js +26 -0
  102. package/esm/icons/components/custom-sending.d.ts +4 -0
  103. package/esm/icons/components/custom-sending.js +24 -0
  104. package/esm/icons/components/custom-sound_recording.d.ts +4 -0
  105. package/esm/icons/components/custom-sound_recording.js +24 -0
  106. package/esm/icons/components/index.d.ts +15 -0
  107. package/esm/icons/components/index.js +15 -0
  108. package/esm/index.d.ts +1 -0
  109. package/esm/index.js +1 -0
  110. package/esm/provider/config.js +3 -3
  111. package/package.json +10 -2
  112. package/dist/1951bd5c.esm.es5.development.js +0 -45417
  113. package/dist/28cd83d3.esm.es5.production.js +0 -256
  114. package/dist/table.esm.es5.development.css +0 -772
  115. package/dist/table.esm.es5.development.js +0 -289
  116. package/dist/table.esm.es5.production.css +0 -1
  117. package/dist/table.esm.es5.production.js +0 -1
@@ -0,0 +1,313 @@
1
+ import { _ as _object_spread } from "@swc/helpers/_/_object_spread";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "@ice/jsx-runtime/jsx-runtime";
3
+ import React, { useEffect, useState, useRef } from "react";
4
+ import styles from "./index.module.less";
5
+ import { CustomAiIcon, CustomRetract } from "../../icons/index";
6
+ import { CloseOutlined } from "@ant-design/icons";
7
+ import { getDataTime } from "../function"; //录音使用文件
8
+ const ContactsList = (props)=>{
9
+ let { type , roomId , userData , http , urllocation , onClose , switchChatRoom , saveContactsList } = props;
10
+ const [contactsList, setContactsList] = useState([]); //老师列表
11
+ let timer = useRef(null); //文本框输入时
12
+ //获取聊天室列表
13
+ useEffect(()=>{
14
+ // if (roomId != "") {
15
+ roomsListTimer();
16
+ // }
17
+ return ()=>{
18
+ clearTimeout(timer.current);
19
+ };
20
+ }, []);
21
+ const roomsListTimer = ()=>{
22
+ if (timer != null) clearTimeout(timer.current);
23
+ timer.current = setTimeout(()=>roomsListTimer(), 100000);
24
+ http.get(`${urllocation}/chat-service/public/v1.0/rooms`, {
25
+ params: {
26
+ page: 1,
27
+ maxPageSize: 100002
28
+ },
29
+ headers: {
30
+ "x-module-id": userData.modules.find((ele)=>ele.short == "IntelligentCustomerService").id,
31
+ "x-auth-jwt": window.localStorage.getItem("usertoken") || ""
32
+ }
33
+ }).then((res)=>{
34
+ if (res.data) {
35
+ let list = res.data.contacts;
36
+ // let list2 = list.slice(1);
37
+ let list2 = list;
38
+ setContactsList((contactsList)=>{
39
+ if (contactsList.length > 0 && roomId != '') {
40
+ //查找当前聊天室的未读消息
41
+ let message = 0;
42
+ let messageList = contactsList.filter((item)=>item.id == roomId);
43
+ if (messageList.length > 0) {
44
+ // console.log(messageList,'messagemessagemessage');
45
+ message = messageList[0].unreadCount;
46
+ }
47
+ let new_message = 0;
48
+ if (list.length > 0) {
49
+ let new_message_list = list.filter((item)=>item.id == roomId);
50
+ if (new_message_list.length > 0) {
51
+ console.log(new_message_list, "new_messagenew_messagenew_messagenew_message");
52
+ new_message = new_message_list[0].unreadCount;
53
+ }
54
+ }
55
+ // console.log(message,new_message,'lsdlcksdcmsdlkc')
56
+ //存在新消息
57
+ if (message != new_message) {
58
+ console.log("有新消息");
59
+ switchChatRoom(roomId, "renew");
60
+ }
61
+ }
62
+ list2 = list2.map((item, index)=>{
63
+ // if(contactsList[index] != undefined){
64
+ return _object_spread({}, item, contactsList[index] || "");
65
+ // }else{
66
+ // return item
67
+ // }
68
+ });
69
+ return list2;
70
+ });
71
+ console.log(list2, "list2list2list2list2");
72
+ // setAi(res.data.contacts[0]);
73
+ getUserInfo(list2);
74
+ //切换到有聊天的窗口
75
+ list2.forEach((ele)=>{
76
+ console.log(ele);
77
+ if (ele.unreadCount > 0) {
78
+ switchChatRoom(ele.roomId, "");
79
+ return;
80
+ }
81
+ });
82
+ saveContactsList(list);
83
+ }
84
+ });
85
+ };
86
+ //删除聊天室
87
+ const deleteRoom = (roomId)=>{
88
+ http.delete(`${urllocation}/chat-service/public/v1.0/rooms/${roomId}`, {
89
+ headers: {
90
+ "x-module-id": userData.modules.find((ele)=>ele.short == "IntelligentCustomerService").id,
91
+ "x-auth-jwt": window.localStorage.getItem("usertoken") || ""
92
+ }
93
+ }).then((res)=>{
94
+ console.log(res, "sdcsdcsdc");
95
+ // roomsList();
96
+ roomsListTimer();
97
+ });
98
+ };
99
+ //获取老师的信息等
100
+ const getUserInfo = (list2)=>{
101
+ list2.map((item, i)=>{
102
+ if (!item.name && !item.headImg && item.sender != 'AI') {
103
+ getUserName(item.sender).then((res)=>{
104
+ if (res.data) {
105
+ let list;
106
+ setContactsList((contactsList)=>{
107
+ list = contactsList.map((item, index)=>{
108
+ if (item.sender == res.data.uid) {
109
+ return _object_spread({}, item, res.data);
110
+ } else {
111
+ return item;
112
+ }
113
+ });
114
+ return list;
115
+ });
116
+ saveContactsList(list);
117
+ }
118
+ });
119
+ }
120
+ });
121
+ };
122
+ const getUserName = (uid)=>{
123
+ return http.get(`${urllocation}/chat-service/public/v1.0/userinfo`, {
124
+ params: {
125
+ uid: uid
126
+ },
127
+ headers: {
128
+ "x-module-id": userData.modules.find((ele)=>ele.short == "TeacherAnswer").id,
129
+ "x-auth-jwt": window.localStorage.getItem("usertoken") || ""
130
+ }
131
+ });
132
+ };
133
+ // //获取当前时间
134
+ // const getDataTime = (time: string | number | Date) => {
135
+ // let currentDate;
136
+ // if (time != undefined && time != -1) {
137
+ // currentDate = new Date(time);
138
+ // } else {
139
+ // currentDate = new Date();
140
+ // }
141
+ // const currentYear = currentDate.getFullYear();
142
+ // const currentMonth = currentDate.getMonth() + 1; // 月份从0开始,所以要加1
143
+ // const currentDay = currentDate.getDate();
144
+ // const hour = currentDate.getHours();
145
+ // const minute = currentDate.getMinutes();
146
+ // const second = currentDate.getSeconds();
147
+ // let dataTime =
148
+ // currentYear +
149
+ // "-" +
150
+ // currentMonth +
151
+ // "-" +
152
+ // currentDay +
153
+ // " " +
154
+ // hour +
155
+ // ":" +
156
+ // minute +
157
+ // ":" +
158
+ // second;
159
+ // return dataTime;
160
+ // };
161
+ return type == 2 || type == 4 ? //联系人展开
162
+ /*#__PURE__*/ _jsxs("div", {
163
+ className: styles.teacher_layout_modal,
164
+ children: [
165
+ /*#__PURE__*/ _jsx("div", {
166
+ className: styles.top,
167
+ children: /*#__PURE__*/ _jsxs("div", {
168
+ className: `${styles.ai} ${contactsList.length > 0 && contactsList[0].roomId != undefined && roomId != '' && contactsList[0].roomId == roomId ? styles.active : ""}`,
169
+ onClick: ()=>{
170
+ switchChatRoom(contactsList[0].roomId, "");
171
+ },
172
+ children: [
173
+ /*#__PURE__*/ _jsx(CustomAiIcon, {}),
174
+ /*#__PURE__*/ _jsxs("div", {
175
+ className: styles.user_info,
176
+ children: [
177
+ /*#__PURE__*/ _jsxs("p", {
178
+ className: styles.message,
179
+ children: [
180
+ "AI助手",
181
+ /*#__PURE__*/ _jsx("span", {
182
+ className: styles.time,
183
+ children: contactsList.length > 0 && getDataTime(contactsList[0].createdAt)
184
+ })
185
+ ]
186
+ }),
187
+ /*#__PURE__*/ _jsx("p", {
188
+ className: styles.con,
189
+ children: contactsList.length > 0 && contactsList[0].lastMsg
190
+ })
191
+ ]
192
+ })
193
+ ]
194
+ })
195
+ }),
196
+ /*#__PURE__*/ _jsx("div", {
197
+ className: styles.bottom,
198
+ children: contactsList.map((item, index)=>{
199
+ if (index != 0) {
200
+ return /*#__PURE__*/ _jsxs("div", {
201
+ className: `${styles.ai} ${item.roomId != undefined && roomId != '' && item.roomId == roomId ? styles.active : ""}`,
202
+ onClick: ()=>{
203
+ switchChatRoom(item.roomId, "");
204
+ },
205
+ children: [
206
+ /*#__PURE__*/ _jsx("img", {
207
+ src: item.headImg
208
+ }),
209
+ /*#__PURE__*/ _jsxs("div", {
210
+ className: styles.user_info,
211
+ children: [
212
+ /*#__PURE__*/ _jsxs("p", {
213
+ className: styles.message,
214
+ children: [
215
+ item.name,
216
+ item.unreadCount != undefined && item.unreadCount > 0 && /*#__PURE__*/ _jsx("span", {
217
+ className: styles.num,
218
+ children: item.unreadCount
219
+ }),
220
+ /*#__PURE__*/ _jsx("span", {
221
+ className: styles.time,
222
+ children: getDataTime(item.createdAt)
223
+ })
224
+ ]
225
+ }),
226
+ /*#__PURE__*/ _jsx("p", {
227
+ className: styles.con,
228
+ children: item.lastMsg
229
+ })
230
+ ]
231
+ })
232
+ ]
233
+ }, item.roomId);
234
+ } else {
235
+ return null;
236
+ }
237
+ })
238
+ })
239
+ ]
240
+ }) : /*#__PURE__*/ _jsxs("div", {
241
+ className: `${styles.teacher_layout} ${type == 3 ? styles.teacher_layout_newlabo : ""}`,
242
+ style: {
243
+ left: type == 3 ? document.getElementById("box").offsetWidth + 10 + "px" : "auto"
244
+ },
245
+ children: [
246
+ /*#__PURE__*/ _jsxs("div", {
247
+ className: styles.top,
248
+ children: [
249
+ /*#__PURE__*/ _jsxs("div", {
250
+ className: `${styles.ai} ${styles.shrink}`,
251
+ onClick: ()=>{
252
+ onClose();
253
+ },
254
+ children: [
255
+ /*#__PURE__*/ _jsx(CustomRetract, {}),
256
+ /*#__PURE__*/ _jsx("p", {
257
+ children: "收起"
258
+ })
259
+ ]
260
+ }),
261
+ /*#__PURE__*/ _jsxs("div", {
262
+ className: `${styles.ai} ${contactsList.length > 0 && contactsList[0].roomId != undefined && roomId != '' && contactsList[0].roomId == roomId ? styles.active : ""}`,
263
+ onClick: ()=>{
264
+ switchChatRoom(contactsList[0].roomId, "");
265
+ },
266
+ children: [
267
+ /*#__PURE__*/ _jsx(CustomAiIcon, {}),
268
+ /*#__PURE__*/ _jsx("p", {
269
+ children: "AI助手"
270
+ })
271
+ ]
272
+ })
273
+ ]
274
+ }),
275
+ /*#__PURE__*/ _jsx("div", {
276
+ className: styles.bottom,
277
+ children: contactsList.map((item, index)=>{
278
+ if (index != 0) {
279
+ return /*#__PURE__*/ _jsxs("div", {
280
+ className: `${styles.ai} ${item.roomId != undefined && roomId != '' && item.roomId == roomId ? styles.active : ""}`,
281
+ onClick: ()=>{
282
+ switchChatRoom(item.roomId, "");
283
+ },
284
+ children: [
285
+ /*#__PURE__*/ _jsx("img", {
286
+ src: item.headImg
287
+ }),
288
+ /*#__PURE__*/ _jsx("p", {
289
+ children: item.name
290
+ }),
291
+ item.unreadCount != undefined && item.unreadCount > 0 && /*#__PURE__*/ _jsx("span", {
292
+ className: styles.num,
293
+ children: item.unreadCount
294
+ }),
295
+ /*#__PURE__*/ _jsx("span", {
296
+ className: styles.delete,
297
+ onClick: (e)=>{
298
+ e.stopPropagation();
299
+ deleteRoom(item.roomId);
300
+ },
301
+ children: /*#__PURE__*/ _jsx(CloseOutlined, {})
302
+ })
303
+ ]
304
+ }, item.roomId);
305
+ } else {
306
+ return null;
307
+ }
308
+ })
309
+ })
310
+ ]
311
+ });
312
+ };
313
+ export default ContactsList;
@@ -0,0 +1,187 @@
1
+ @import "../../theme/variable.less";
2
+ //联系人列表
3
+ .teacher_layout {
4
+ position: fixed;
5
+ right: 568px;
6
+
7
+ border-radius: 8px;
8
+ background: rgba(255, 255, 255, 0.5);
9
+ box-shadow: 0px 4px 10px 0px rgba(0, 0, 0, 0.05);
10
+ backdrop-filter: blur(7.5px);
11
+ width: 80px;
12
+ .top > div,
13
+ .bottom > div {
14
+ display: flex;
15
+ flex-direction: column;
16
+ align-items: center;
17
+ padding: 8px;
18
+ border-radius: 8px;
19
+ margin: 8px 0;
20
+ max-width: 60px;
21
+ overflow: hidden;
22
+ position: relative;
23
+ cursor: pointer;
24
+ &:hover {
25
+ background-color: #f5f5f5;
26
+ .delete {
27
+ display: block;
28
+ }
29
+ }
30
+ p {
31
+ max-width: 60px;
32
+ overflow: hidden;
33
+ text-overflow: ellipsis;
34
+ white-space: nowrap;
35
+ color: @color-text-Secondary-Tr;
36
+ font-size: 12px;
37
+ line-height: 1;
38
+ padding-top: 12px;
39
+ }
40
+ img {
41
+ width: 32px;
42
+ height: 32px;
43
+ border-radius: 50%;
44
+ }
45
+ .num {
46
+ position: absolute;
47
+ top: 0;
48
+ right: 0;
49
+ border-radius: 26px;
50
+ background-color: #f4523b;
51
+ color: #fff;
52
+ padding: 2px 5px;
53
+ border-radius: 25px;
54
+ font-size: 12px;
55
+ line-height: 1.2;
56
+ }
57
+
58
+ .delete {
59
+ font-size: 18px;
60
+ position: absolute;
61
+ top: -2px;
62
+ right: 0;
63
+ color: rgba(0, 0, 0, 0.65);
64
+ font-size: 14px;
65
+ display: none;
66
+ }
67
+ }
68
+ .top > div {
69
+ margin: 0 8px;
70
+ }
71
+ .top .shrink {
72
+ border-bottom: 1px solid @color-border-secondary;
73
+ border-radius: 0;
74
+ margin-bottom: 8px;
75
+ margin-top: 8px;
76
+ & > span {
77
+ font-size: 20px;
78
+ }
79
+ p {
80
+ padding-top: 0;
81
+ }
82
+ &:hover {
83
+ background-color: #fff;
84
+ }
85
+ }
86
+ .top .active,
87
+ .bottom .active {
88
+ background: @color-background-primary-weak-hover;
89
+ }
90
+ .bottom > div:last-child {
91
+ margin-bottom: 0;
92
+ }
93
+ .bottom > div:first-child {
94
+ margin-top: 0;
95
+ }
96
+ .bottom {
97
+ max-height: 524px;
98
+ padding: 0 8px;
99
+ padding-right: 4px;
100
+ overflow-y: auto;
101
+ margin-bottom: 8px;
102
+ margin-top: 8px;
103
+ }
104
+ .bottom::-webkit-scrollbar {
105
+ background-color: #eaedf1;
106
+ background-color: transparent;
107
+ width: 4px;
108
+ height: 4px;
109
+ }
110
+ .bottom::-webkit-scrollbar-thumb {
111
+ border-radius: 4px;
112
+ background-color: rgba(0, 0, 0, 0.25);
113
+ }
114
+ }
115
+ .teacher_layout_newlabo {
116
+ top: 50px;
117
+ right: 0;
118
+ }
119
+ .teacher_layout_modal {
120
+ width: 328px;
121
+ height: 100%;
122
+ background-color: #fff;
123
+ position: absolute;
124
+ border-top: 1px solid @color-border-secondary;
125
+ .top,
126
+ .bottom {
127
+ .ai {
128
+ border-bottom: 1px solid @color-border-secondary;
129
+ padding: 16px;
130
+ display: flex;
131
+ align-items: center;
132
+ cursor: pointer;
133
+ img {
134
+ width: 32px;
135
+ height: 32px;
136
+ border-radius: 50%;
137
+ margin-right: 12px;
138
+ }
139
+ & > span {
140
+ margin-right: 12px;
141
+ }
142
+ .user_info {
143
+ width: 252px;
144
+ .message {
145
+ color: #000;
146
+ font-size: 14px;
147
+ line-height: 1;
148
+ padding-right: 10px;
149
+ .num {
150
+ margin-left: 12px;
151
+ border-radius: 26px;
152
+ background-color: #f4523b;
153
+ color: #fff;
154
+ padding: 2px 5px;
155
+ border-radius: 25px;
156
+ font-size: 12px;
157
+ line-height: 1.2;
158
+ }
159
+
160
+ .time {
161
+ font-size: 12px;
162
+ color: @color-text-quaternary-Tr;
163
+ float: right;
164
+ }
165
+ }
166
+ .con {
167
+ color: @color-text-quaternary-Tr;
168
+ font-size: 12px;
169
+ line-height: 1.5;
170
+ margin-top: 8px;
171
+ overflow: hidden;
172
+ white-space: nowrap;
173
+ text-overflow: ellipsis;
174
+ }
175
+ }
176
+ }
177
+ .active {
178
+ background: var(--color-background-primary-weak, #fff4f0);
179
+ }
180
+ }
181
+
182
+ :global {
183
+ .anticon {
184
+ vertical-align: 0;
185
+ }
186
+ }
187
+ }
@@ -0,0 +1,17 @@
1
+ declare const readMessage: (roomId: number | string, urllocation: any, userData: {
2
+ modules: any[];
3
+ }, http: {
4
+ patch: (arg0: string, arg1: {
5
+ roomId: any;
6
+ }, arg2: {
7
+ headers: {
8
+ "x-module-id": any;
9
+ "x-auth-jwt": string;
10
+ };
11
+ }) => void;
12
+ }) => void;
13
+ declare const getByteLen: (val: string) => number;
14
+ declare const serverUrl: () => string;
15
+ declare const copyText: (text: string) => boolean;
16
+ declare const getDataTime: (time: string | number | Date) => string;
17
+ export { readMessage, getByteLen, serverUrl, copyText, getDataTime };
@@ -0,0 +1,67 @@
1
+ //消息已读
2
+ const readMessage = (roomId, urllocation, userData, http)=>{
3
+ http.patch(`${urllocation}/chat-service/public/v1.0/history-messages:read`, {
4
+ roomId: roomId
5
+ }, {
6
+ headers: {
7
+ "x-module-id": userData.modules.find((ele)=>ele.short == "IntelligentCustomerService").id,
8
+ "x-auth-jwt": window.localStorage.getItem("usertoken") || ""
9
+ }
10
+ });
11
+ };
12
+ const getByteLen = (val)=>{
13
+ var len = 0;
14
+ for(var i = 0; i < val.length; i++){
15
+ var a = val.charAt(i);
16
+ if (a.match(/[^\x00-\xff]/gi) != null) {
17
+ //\x00-\xff→GBK双字节编码范围
18
+ len += 2;
19
+ } else {
20
+ len += 1;
21
+ }
22
+ }
23
+ return len;
24
+ };
25
+ //当前服务url
26
+ const serverUrl = ()=>{
27
+ let hashName = "";
28
+ window.location.hash.replace(/#\/(.[^/?]+)([?/].)*/, ($1, $2)=>{
29
+ hashName = $2;
30
+ });
31
+ return hashName;
32
+ };
33
+ //复制内容
34
+ const copyText = (text)=>{
35
+ // text是复制文本
36
+ // 创建input元素
37
+ const el = document.createElement("input");
38
+ // 给input元素赋值需要复制的文本
39
+ el.setAttribute("value", text);
40
+ // 将input元素插入页面
41
+ document.body.appendChild(el);
42
+ // 选中input元素的文本
43
+ el.select();
44
+ // 复制内容到剪贴板
45
+ document.execCommand("copy");
46
+ // 删除input元素
47
+ document.body.removeChild(el);
48
+ return true;
49
+ };
50
+ //获取当前时间
51
+ const getDataTime = (time)=>{
52
+ let currentDate;
53
+ if (time != undefined && time != -1) {
54
+ currentDate = new Date(time);
55
+ } else {
56
+ currentDate = new Date();
57
+ }
58
+ const currentYear = currentDate.getFullYear();
59
+ const currentMonth = currentDate.getMonth() + 1; // 月份从0开始,所以要加1
60
+ const currentDay = currentDate.getDate();
61
+ const hour = currentDate.getHours();
62
+ const minute = currentDate.getMinutes();
63
+ const second = currentDate.getSeconds();
64
+ let dataTime = currentYear + "-" + currentMonth + "-" + currentDay + " " + hour + ":" + minute + ":" + second;
65
+ return dataTime;
66
+ };
67
+ export { readMessage, getByteLen, serverUrl, copyText, getDataTime };
@@ -0,0 +1,13 @@
1
+ /// <reference types="react" />
2
+ interface data {
3
+ type: number;
4
+ roomId: String | number;
5
+ userData: any;
6
+ http: any;
7
+ urllocation: String;
8
+ onClose: any;
9
+ loadSpecifiedData: any;
10
+ roomList: [];
11
+ }
12
+ declare const HistoryFun: (props: data) => JSX.Element;
13
+ export default HistoryFun;