bhd-components 0.5.6 → 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 (115) 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/esm/customerService/contactsList/index.d.ts +13 -0
  60. package/esm/customerService/contactsList/index.js +326 -0
  61. package/esm/customerService/contactsList/index.module.less +187 -0
  62. package/esm/customerService/function.d.ts +17 -0
  63. package/esm/customerService/function.js +69 -0
  64. package/esm/customerService/historyFun/index.d.ts +13 -0
  65. package/esm/customerService/historyFun/index.js +256 -0
  66. package/esm/customerService/historyFun/index.module.less +189 -0
  67. package/esm/customerService/images/knowledge_icon.png +0 -0
  68. package/esm/customerService/images/voice_btn.gif +0 -0
  69. package/esm/customerService/index.d.ts +16 -0
  70. package/esm/customerService/index.js +2576 -0
  71. package/esm/customerService/index.module.less +727 -0
  72. package/esm/customerService/useMediaRecorder.d.ts +9 -0
  73. package/esm/customerService/useMediaRecorder.js +121 -0
  74. package/esm/customerService/voice_btn.gif +0 -0
  75. package/esm/icons/components/custom-ai_icon.d.ts +4 -0
  76. package/esm/icons/components/custom-ai_icon.js +60 -0
  77. package/esm/icons/components/custom-contacts.d.ts +4 -0
  78. package/esm/icons/components/custom-contacts.js +31 -0
  79. package/esm/icons/components/custom-copy.d.ts +4 -0
  80. package/esm/icons/components/custom-copy.js +38 -0
  81. package/esm/icons/components/custom-dislike.d.ts +4 -0
  82. package/esm/icons/components/custom-dislike.js +24 -0
  83. package/esm/icons/components/custom-duihao.d.ts +4 -0
  84. package/esm/icons/components/custom-duihao.js +24 -0
  85. package/esm/icons/components/custom-exit_full_screen.d.ts +4 -0
  86. package/esm/icons/components/custom-exit_full_screen.js +28 -0
  87. package/esm/icons/components/custom-full_screen.d.ts +4 -0
  88. package/esm/icons/components/custom-full_screen.js +24 -0
  89. package/esm/icons/components/custom-like.d.ts +4 -0
  90. package/esm/icons/components/custom-like.js +24 -0
  91. package/esm/icons/components/custom-quote.d.ts +4 -0
  92. package/esm/icons/components/custom-quote.js +33 -0
  93. package/esm/icons/components/custom-record.d.ts +4 -0
  94. package/esm/icons/components/custom-record.js +39 -0
  95. package/esm/icons/components/custom-reloading.d.ts +4 -0
  96. package/esm/icons/components/custom-reloading.js +28 -0
  97. package/esm/icons/components/custom-retract.d.ts +4 -0
  98. package/esm/icons/components/custom-retract.js +29 -0
  99. package/esm/icons/components/custom-round_close.d.ts +4 -0
  100. package/esm/icons/components/custom-round_close.js +26 -0
  101. package/esm/icons/components/custom-sending.d.ts +4 -0
  102. package/esm/icons/components/custom-sending.js +24 -0
  103. package/esm/icons/components/custom-sound_recording.d.ts +4 -0
  104. package/esm/icons/components/custom-sound_recording.js +24 -0
  105. package/esm/icons/components/index.d.ts +15 -0
  106. package/esm/icons/components/index.js +15 -0
  107. package/esm/index.d.ts +1 -0
  108. package/esm/index.js +1 -0
  109. package/package.json +10 -2
  110. package/dist/1951bd5c.esm.es5.development.js +0 -45417
  111. package/dist/28cd83d3.esm.es5.production.js +0 -256
  112. package/dist/table.esm.es5.development.css +0 -772
  113. package/dist/table.esm.es5.development.js +0 -289
  114. package/dist/table.esm.es5.production.css +0 -1
  115. package/dist/table.esm.es5.production.js +0 -1
@@ -0,0 +1,241 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "@ice/jsx-runtime/jsx-runtime";
2
+ import React, { useState, useRef } from "react";
3
+ import styles from "./index.module.less";
4
+ import { Input } from "antd";
5
+ import { CustomClose } from "../../icons/index";
6
+ import { SearchOutlined } from "@ant-design/icons";
7
+ import { getDataTime } from "../function"; //录音使用文件
8
+ const HistoryFun = (props)=>{
9
+ let { type , roomId , userData , http , urllocation , onClose , loadSpecifiedData , roomList } = props;
10
+ const [keyWordProblem, setKeyWordProblem] = useState(""); //搜索内容
11
+ const [keyHistoryMessageList, setKeyHistoryMessageList] = useState([]); //搜索的历史记录
12
+ const [userNameObj, setUserNameObj] = useState([]); //根据用户id,存储一些用户名
13
+ const timer = useRef(null); //文本框输入时
14
+ //获取搜索中的历史消息记录
15
+ const getKeyHistoryMessage = (keyWordProblem)=>{
16
+ if (roomId == "") return;
17
+ return http.get(`${urllocation}/chat-service/public/v1.0/history-messages`, {
18
+ params: {
19
+ roomId: "",
20
+ message: keyWordProblem,
21
+ page: 1,
22
+ maxPageSize: 300,
23
+ direction: "desc"
24
+ },
25
+ headers: {
26
+ "x-module-id": userData.modules.find((ele)=>ele.short == "IntelligentCustomerService").id,
27
+ "x-auth-jwt": window.localStorage.getItem("usertoken") || ""
28
+ }
29
+ }).then((res)=>{
30
+ console.log(res.data, 3434378);
31
+ if (res.data.messages.length > 0) {
32
+ let dataList = res.data.messages;
33
+ setKeyHistoryMessageList(dataList);
34
+ getUserName(dataList);
35
+ }
36
+ }).catch((res)=>{});
37
+ };
38
+ //获取全部数据
39
+ const allData = (roomId)=>{
40
+ if (roomId == "") return;
41
+ return http.get(`${urllocation}/chat-service/public/v1.0/history-messages`, {
42
+ params: {
43
+ roomId: roomId,
44
+ page: 1,
45
+ maxPageSize: 9999999
46
+ },
47
+ headers: {
48
+ "x-module-id": userData.modules.find((ele)=>ele.short == "IntelligentCustomerService").id,
49
+ "x-auth-jwt": window.localStorage.getItem("usertoken") || ""
50
+ }
51
+ });
52
+ };
53
+ const findPageNumber = (perPage, totalPages, targetPosition)=>{
54
+ const pageNumber = Math.ceil(targetPosition / perPage);
55
+ if (pageNumber > totalPages) {
56
+ return -1; // 数据不存在于给定的页数范围内
57
+ }
58
+ return pageNumber;
59
+ };
60
+ //根据index,计算历史数据在第几页
61
+ const calculationData = (roomId, index, id)=>{
62
+ allData(roomId).then((res)=>{
63
+ // console.log(res.data.messages,'11111111')
64
+ if (res.data) {
65
+ let total = res.data.total;
66
+ let dataList = res.data.messages.reverse();
67
+ // console.log(dataList,'sldkcmsdklc');
68
+ let number;
69
+ dataList.map((item, index)=>{
70
+ if (item.id == id) {
71
+ number = index;
72
+ }
73
+ });
74
+ const pageNumber = findPageNumber(30, Math.ceil(total / 30), number);
75
+ console.log(number, pageNumber, "第几页第几页第几页第几页第几页第几页");
76
+ loadSpecifiedData(roomId, pageNumber, id);
77
+ onClose();
78
+ setKeyWordProblem("");
79
+ setKeyHistoryMessageList([]);
80
+ }
81
+ });
82
+ };
83
+ const getUserName = (dataList)=>{
84
+ try {
85
+ dataList.map((item)=>{
86
+ let id = item.sender;
87
+ //判断 不是当前登录用户
88
+ if (id != userData.mid) {
89
+ let roomListName = roomList.filter((item)=>item.sender == id);
90
+ console.log(roomListName, 1111111);
91
+ //判断如果是当前聊天列表中的用户
92
+ if (roomListName.length > 0 && !roomListName[0].name) {
93
+ console.log(roomListName[0], "2222222222");
94
+ setUserNameObj((userNameObj)=>{
95
+ let list = userNameObj;
96
+ return list.concat({
97
+ id: id,
98
+ name: roomListName[0].name
99
+ });
100
+ });
101
+ } else {
102
+ //判断是否需要重新请求数据
103
+ let getData = false;
104
+ setUserNameObj((userNameObj)=>{
105
+ console.log(userNameObj, "userNameObjuserNameObj");
106
+ if (userNameObj.filter((e)=>e.id == id).length == 0) {
107
+ console.log("没有相同的id");
108
+ getData = true;
109
+ }
110
+ return userNameObj;
111
+ });
112
+ if (getData) {
113
+ if (id == 'AI') {
114
+ id == item.recevier;
115
+ }
116
+ userName(id).then((res)=>{
117
+ if (res.data) {
118
+ setUserNameObj((userNameObj)=>{
119
+ let list = userNameObj;
120
+ return list.concat({
121
+ name: res.data.name,
122
+ id: id
123
+ });
124
+ });
125
+ console.log(7777777, res.data.name);
126
+ }
127
+ });
128
+ }
129
+ }
130
+ }
131
+ });
132
+ } catch (error) {}
133
+ };
134
+ const userName = (uid)=>{
135
+ return http.get(`${urllocation}/chat-service/public/v1.0/userinfo`, {
136
+ params: {
137
+ uid: uid
138
+ },
139
+ headers: {
140
+ "x-module-id": userData.modules.find((ele)=>ele.short == "TeacherAnswer").id,
141
+ "x-auth-jwt": window.localStorage.getItem("usertoken") || ""
142
+ }
143
+ });
144
+ };
145
+ return /*#__PURE__*/ _jsx("div", {
146
+ className: `${styles.history_list} ${type == 2 ? styles.history_list_broadside : ""} `,
147
+ children: /*#__PURE__*/ _jsxs("div", {
148
+ className: styles.search_layout,
149
+ children: [
150
+ /*#__PURE__*/ _jsxs("div", {
151
+ className: styles.title,
152
+ children: [
153
+ /*#__PURE__*/ _jsx("span", {
154
+ children: "历史记录"
155
+ }),
156
+ /*#__PURE__*/ _jsx("span", {
157
+ onClick: ()=>{
158
+ onClose();
159
+ },
160
+ children: /*#__PURE__*/ _jsx(CustomClose, {})
161
+ })
162
+ ]
163
+ }),
164
+ /*#__PURE__*/ _jsxs("div", {
165
+ className: styles.search_top,
166
+ children: [
167
+ /*#__PURE__*/ _jsx(SearchOutlined, {}),
168
+ /*#__PURE__*/ _jsx(Input, {
169
+ placeholder: "请输入您要搜索的内容",
170
+ value: keyWordProblem,
171
+ onChange: (e)=>{
172
+ let val = String(e.target.value);
173
+ setKeyWordProblem(val);
174
+ clearTimeout(timer.current);
175
+ timer.current = setTimeout(()=>{
176
+ if (val != "") {
177
+ getKeyHistoryMessage(val);
178
+ }
179
+ }, 1000);
180
+ }
181
+ }),
182
+ /*#__PURE__*/ _jsx("i", {
183
+ className: "guanbi_Close",
184
+ onClick: ()=>{
185
+ setKeyWordProblem("");
186
+ setKeyHistoryMessageList([]);
187
+ },
188
+ children: /*#__PURE__*/ _jsx(CustomClose, {})
189
+ })
190
+ ]
191
+ }),
192
+ /*#__PURE__*/ _jsx("div", {
193
+ className: styles.main_list,
194
+ children: keyHistoryMessageList.map((item, index)=>{
195
+ let span = item.message.replaceAll(keyWordProblem, ()=>{
196
+ return `<span class=${styles.sign}>${keyWordProblem}</span>`;
197
+ });
198
+ {
199
+ console.log(userNameObj), 9999999;
200
+ }
201
+ let name = "";
202
+ if (item.sender == userData.mid) {
203
+ name = userData.real_name;
204
+ } else if (item.sender == 'AI') {
205
+ name = userNameObj.filter((e)=>e.id == item.recevier)[0].name;
206
+ } else {
207
+ name = userNameObj.filter((e)=>e.id == item.sender)[0].name;
208
+ }
209
+ return /*#__PURE__*/ _jsxs("div", {
210
+ className: styles.list,
211
+ onClick: ()=>{
212
+ calculationData(item.roomId, item.messageIdWithinRoom, item.id);
213
+ },
214
+ children: [
215
+ /*#__PURE__*/ _jsxs("div", {
216
+ className: styles.name,
217
+ children: [
218
+ /*#__PURE__*/ _jsx("p", {
219
+ children: name
220
+ }),
221
+ /*#__PURE__*/ _jsx("span", {
222
+ className: styles.time,
223
+ children: getDataTime(item.updatedAt)
224
+ })
225
+ ]
226
+ }),
227
+ /*#__PURE__*/ _jsx("div", {
228
+ className: styles.con,
229
+ dangerouslySetInnerHTML: {
230
+ __html: span
231
+ }
232
+ })
233
+ ]
234
+ }, item.id);
235
+ })
236
+ })
237
+ ]
238
+ })
239
+ });
240
+ };
241
+ export default HistoryFun;
@@ -0,0 +1,189 @@
1
+ @import "../../theme/variable.less";
2
+ //历史记录11
3
+ .history_list {
4
+ position: absolute;
5
+ top: 0;
6
+ background: rgba(0, 0, 0, 0.3);
7
+ width: 100%;
8
+ height: 100%;
9
+ overflow: hidden;
10
+ .search_layout {
11
+ background: #fff;
12
+ position: absolute;
13
+ bottom: -500px;
14
+ width: 100%;
15
+ border-radius: 16px 16px 0px 0px;
16
+ overflow: hidden;
17
+ animation: mymove 1s forwards;
18
+
19
+ .title {
20
+ border-bottom: 1px solid @color-border-Tr;
21
+ font-size: 16px;
22
+ font-weight: 600;
23
+ line-height: 150%;
24
+ padding: 16px;
25
+ display: flex;
26
+ justify-content: space-between;
27
+ svg {
28
+ font-size: 12px;
29
+ cursor: pointer;
30
+ opacity: 0.65;
31
+ font-weight: 300;
32
+ }
33
+ }
34
+ .search_top {
35
+ position: relative;
36
+ margin: 16px 24px;
37
+ // margin-bottom: 0;
38
+ // display: flex;
39
+ // align-items: center;
40
+ // justify-content: space-between;
41
+ background-color: #fff;
42
+
43
+ input {
44
+ width: 100%;
45
+ height: 40px;
46
+ line-height: 40px;
47
+ border-radius: 2px;
48
+ border: 1px solid @color-border-secondary;
49
+ padding-left: 46px;
50
+ padding-right: 30px;
51
+ color: @color-text-Tr;
52
+ }
53
+ :global {
54
+ .anticon {
55
+ position: absolute;
56
+ top: 11px;
57
+ z-index: 1;
58
+ left: 14px;
59
+ font-size: 16px;
60
+ color: rgba(0, 0, 0, 0.65);
61
+ }
62
+ .guanbi_Close {
63
+ position: absolute;
64
+ top: 2px;
65
+ right: 38px;
66
+ font-size: 16px;
67
+ z-index: 1;
68
+ color: rgba(0, 0, 0, 0.65);
69
+ cursor: pointer;
70
+ svg {
71
+ font-size: 12px;
72
+ opacity: 0.65;
73
+ }
74
+ }
75
+ }
76
+ svg {
77
+ opacity: 0.65;
78
+ font-weight: 300;
79
+ }
80
+ }
81
+ .main_list:first-child {
82
+ margin-top: 0;
83
+ }
84
+ .main_list {
85
+ overflow: auto;
86
+ height: 510px;
87
+ &::-webkit-scrollbar {
88
+ background-color: #eaedf1;
89
+ background-color: transparent;
90
+ width: 4px;
91
+ height: 4px;
92
+ }
93
+ &::-webkit-scrollbar-thumb {
94
+ border-radius: 4px;
95
+ background-color: rgba(0, 0, 0, 0.25);
96
+ }
97
+ .list {
98
+ margin: 8px 24px;
99
+ padding: 8px;
100
+ // border-bottom: 1px solid @color-border-secondary;
101
+ margin-bottom: 17px;
102
+ position: relative;
103
+ cursor: pointer;
104
+ &:hover {
105
+ background-color: rgba(0, 0, 0, 0.04);
106
+ border-radius: 8px;
107
+ }
108
+ &::before {
109
+ content: "";
110
+ display: inline-block;
111
+ width: 100%;
112
+ height: 1px;
113
+ background-color: @color-border-secondary;
114
+ position: absolute;
115
+ bottom: -9px;
116
+ left: -1px;
117
+ }
118
+ .name {
119
+ display: flex;
120
+ justify-content: space-between;
121
+ align-items: center;
122
+ margin-bottom: 9px;
123
+ p {
124
+ color: @color-text-Tr;
125
+ font-size: 16px;
126
+ font-weight: 600;
127
+ line-height: 1.5;
128
+ }
129
+ .time {
130
+ font-size: 14px;
131
+ color: @color-text-tertiary;
132
+ }
133
+ }
134
+ .con {
135
+ color: @color-text-Tr;
136
+ font-size: 14px;
137
+ font-weight: 400;
138
+ line-height: 150%;
139
+ overflow: hidden;
140
+ white-space: nowrap;
141
+ text-overflow: ellipsis;
142
+ span {
143
+ color: @color-text-primary;
144
+ }
145
+ }
146
+ }
147
+ }
148
+ }
149
+ @keyframes mymove {
150
+ from {
151
+ bottom: -500px;
152
+ }
153
+ to {
154
+ bottom: 0;
155
+ }
156
+ }
157
+
158
+ @-webkit-keyframes mymove /*Safari and Chrome*/ {
159
+ from {
160
+ bottom: -500px;
161
+ }
162
+ to {
163
+ bottom: 0;
164
+ }
165
+ }
166
+
167
+ :global {
168
+ .anticon {
169
+ vertical-align: 0;
170
+ }
171
+ }
172
+ }
173
+ //全屏下的历史记录
174
+ .history_list_broadside {
175
+ width: 417px;
176
+ height: calc(100% - 50px);
177
+ right: 0;
178
+ top: 48px;
179
+ border-radius: 0px 8px 8px 0px;
180
+ background: transparent;
181
+ .search_layout {
182
+ height: 100%;
183
+ border-radius: 0;
184
+ .main_list {
185
+ height: calc(100% - 140px);
186
+ max-height: calc(100% - 140px);
187
+ }
188
+ }
189
+ }
@@ -0,0 +1,16 @@
1
+ /// <reference types="react" />
2
+ import "highlight.js/styles/default.css";
3
+ interface Service {
4
+ userData: any;
5
+ http?: any;
6
+ urllocation?: string;
7
+ onCancel?: () => {};
8
+ serverName?: string;
9
+ fetchEventSource?: any;
10
+ initShowType?: string | number;
11
+ stepIds: string;
12
+ stepId: string | number;
13
+ onEvent: (a: string, b: string, c: string) => {};
14
+ }
15
+ declare const CustomerService: (props: Service) => JSX.Element;
16
+ export default CustomerService;