bhd-components 0.7.20 → 0.7.22

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.
@@ -431,6 +431,10 @@
431
431
  }
432
432
  }
433
433
 
434
+ .find_teacher_con{
435
+ color: @color-text-primary;
436
+ cursor: pointer;
437
+ }
434
438
  }
435
439
  .sign{
436
440
  background-color: #1890ff;
@@ -1874,7 +1878,16 @@
1874
1878
  }
1875
1879
  }
1876
1880
  }
1877
-
1881
+ //老师列表
1882
+ .teacher_list{
1883
+ .name{
1884
+ margin-bottom: 0!important;
1885
+ font-weight: 400 !important;
1886
+ .sign{
1887
+ color: @color-text-primary;
1888
+ }
1889
+ }
1890
+ }
1878
1891
  //截图功能
1879
1892
  .screenshot_Modal{
1880
1893
  position: fixed;
@@ -0,0 +1,11 @@
1
+ /// <reference types="react" />
2
+ interface data {
3
+ type: number;
4
+ userData: any;
5
+ http: any;
6
+ urllocation: String;
7
+ onClose: any;
8
+ enterTeacherChat: any;
9
+ }
10
+ declare const TeacherList: (props: data) => JSX.Element;
11
+ export default TeacherList;
@@ -0,0 +1,273 @@
1
+ import { _ as _object_spread } from "@swc/helpers/_/_object_spread";
2
+ import { _ as _sliced_to_array } from "@swc/helpers/_/_sliced_to_array";
3
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "@ice/jsx-runtime/jsx-runtime";
4
+ import React, { useEffect, useState, useRef } from "react";
5
+ import styles from "./index.module.less";
6
+ import { Input } from "antd";
7
+ import { CustomClose } from "../icons/index";
8
+ import { SearchOutlined } from "@ant-design/icons";
9
+ var TeacherList = function(props) {
10
+ var type = props.type, userData = props.userData, http = props.http, urllocation = props.urllocation, onClose = props.onClose, enterTeacherChat = props.enterTeacherChat;
11
+ var _useState = _sliced_to_array(useState(""), 2), keyWordProblem = _useState[0], setKeyWordProblem = _useState[1]; //搜索内容
12
+ var _useState1 = _sliced_to_array(useState(1), 2), showLoadingState = _useState1[0], setShowLoadingState = _useState1[1]; //1,初始状态,2、无数据 ,3、不显示图片
13
+ var _useState2 = _sliced_to_array(useState([]), 2), totalData = _useState2[0], setTotalData = _useState2[1]; //总数据
14
+ // const [teacher_list, setTeacher_list] = useState([]); //老师列表,有头像
15
+ var teacher_list = useRef([]); //老师列表,有头像
16
+ var timer = useRef(null); //文本框输入时
17
+ var page = useRef(1);
18
+ var loading = useRef(true);
19
+ var sliderRef = useRef(null);
20
+ useEffect(function() {
21
+ var handleScroll = function(e) {
22
+ // 处理滚轮事件的逻辑
23
+ var container = document.getElementById("teacher_list");
24
+ var scrollTop = container.scrollTop;
25
+ var clientHeight = container.clientHeight;
26
+ var scrollHeight = container.scrollHeight;
27
+ if (scrollTop + clientHeight + 60 >= scrollHeight && loading.current) {
28
+ loading.current = false;
29
+ // console.log('加载下一页');
30
+ page.current = page.current + 1;
31
+ getList(keyWordProblem);
32
+ }
33
+ };
34
+ // 添加滚轮事件监听器
35
+ sliderRef.current.addEventListener("wheel", handleScroll);
36
+ // 清除滚轮事件监听器
37
+ return function() {
38
+ sliderRef.current.removeEventListener("wheel", handleScroll);
39
+ };
40
+ }, [
41
+ keyWordProblem
42
+ ]);
43
+ useEffect(function() {
44
+ getList("");
45
+ return function() {
46
+ clearTimeout(timer.current);
47
+ };
48
+ }, []);
49
+ var getList = function(val) {
50
+ if (page.current == 1) {
51
+ setTotalData([]);
52
+ }
53
+ http.get("".concat(urllocation, "/chat-service/public/v1.0/teachers"), {
54
+ params: {
55
+ name: val,
56
+ page: page.current,
57
+ maxPageSize: 20
58
+ }
59
+ }).then(function(res) {
60
+ console.log(res);
61
+ if (res.data.total > 0) {
62
+ loading.current = true;
63
+ setShowLoadingState(3);
64
+ var data = new Map();
65
+ setTotalData(function(totalData) {
66
+ return totalData.concat(res.data.teachers).filter(function(a) {
67
+ return !data.has(a.uid) && data.set(a.uid, 1);
68
+ });
69
+ });
70
+ getUserName(res.data.teachers);
71
+ } else {
72
+ loading.current = false;
73
+ if (page.current == 1) {
74
+ setShowLoadingState(2);
75
+ }
76
+ }
77
+ });
78
+ };
79
+ var getUserName = function(dataList) {
80
+ try {
81
+ var list = dataList;
82
+ var ids = [];
83
+ list = list.map(function(item) {
84
+ if (!item.headImg && teacher_list.current.filter(function(v) {
85
+ return v.uid == item.uid;
86
+ }).length <= 0) {
87
+ ids.push(item.uid);
88
+ }
89
+ });
90
+ if (ids.length > 0) {
91
+ userName(ids.join(",")).then(function(res) {
92
+ if (res.data) {
93
+ var nameList = res.data;
94
+ setTotalData(function(list1) {
95
+ var list = list1;
96
+ list = list.map(function(item) {
97
+ var name = nameList.filter(function(v) {
98
+ return v.uid == item.uid;
99
+ });
100
+ if (name.length > 0) {
101
+ return _object_spread({}, item, name[0]);
102
+ } else {
103
+ var nameList1 = teacher_list.current;
104
+ var name1 = nameList1.filter(function(v) {
105
+ return v.uid == item.uid;
106
+ });
107
+ if (name1.length > 0) {
108
+ return _object_spread({}, item, name1[0]);
109
+ } else {
110
+ return item;
111
+ }
112
+ }
113
+ });
114
+ var data = new Map();
115
+ teacher_list.current = teacher_list.current.concat(list).filter(function(a) {
116
+ return !data.has(a.uid) && data.set(a.uid, 1);
117
+ });
118
+ return list;
119
+ });
120
+ }
121
+ });
122
+ } else {
123
+ var nameList = teacher_list.current;
124
+ setTotalData(function(list1) {
125
+ var list = list1;
126
+ list = list.map(function(item) {
127
+ var name = nameList.filter(function(v) {
128
+ return v.uid == item.uid;
129
+ });
130
+ if (name.length > 0) {
131
+ return _object_spread({}, item, name[0]);
132
+ } else {
133
+ return item;
134
+ }
135
+ });
136
+ return list;
137
+ });
138
+ }
139
+ } catch (error) {}
140
+ };
141
+ var userName = function(uid) {
142
+ return http.get("".concat(urllocation, "/chat-service/public/v1.0/userinfo"), {
143
+ params: {
144
+ uid: uid
145
+ },
146
+ headers: {
147
+ "x-module-id": userData.modules.find(function(ele) {
148
+ return ele.short == "IntelligentCustomerService";
149
+ }).id,
150
+ "x-auth-jwt": window.localStorage.getItem("usertoken") || ""
151
+ }
152
+ });
153
+ };
154
+ return /*#__PURE__*/ _jsx("div", {
155
+ className: "".concat(styles.history_list, " ").concat(type == 2 ? styles.history_list_broadside : "", " ").concat(styles.teacher_list),
156
+ children: /*#__PURE__*/ _jsxs("div", {
157
+ className: styles.search_layout,
158
+ children: [
159
+ /*#__PURE__*/ _jsxs("div", {
160
+ className: styles.title,
161
+ children: [
162
+ /*#__PURE__*/ _jsx("span", {
163
+ children: "召唤老师回答"
164
+ }),
165
+ /*#__PURE__*/ _jsx("span", {
166
+ onClick: function() {
167
+ // loadSpecifiedData();
168
+ onClose();
169
+ },
170
+ children: /*#__PURE__*/ _jsx(CustomClose, {})
171
+ })
172
+ ]
173
+ }),
174
+ /*#__PURE__*/ _jsxs("div", {
175
+ className: styles.search_top,
176
+ children: [
177
+ /*#__PURE__*/ _jsx(SearchOutlined, {}),
178
+ /*#__PURE__*/ _jsx(Input, {
179
+ placeholder: "请输入您要召唤的老师姓名",
180
+ value: keyWordProblem,
181
+ onChange: function(e) {
182
+ var val = String(e.target.value);
183
+ setKeyWordProblem(val);
184
+ clearTimeout(timer.current);
185
+ timer.current = setTimeout(function() {
186
+ page.current = 1;
187
+ setTotalData([]);
188
+ getList(val);
189
+ }, 1000);
190
+ }
191
+ }),
192
+ /*#__PURE__*/ _jsx("i", {
193
+ className: "guanbi_Close",
194
+ onClick: function() {
195
+ setShowLoadingState(1);
196
+ setKeyWordProblem("");
197
+ setTotalData([]);
198
+ },
199
+ children: /*#__PURE__*/ _jsx(CustomClose, {})
200
+ })
201
+ ]
202
+ }),
203
+ /*#__PURE__*/ _jsxs("div", {
204
+ className: styles.main_list,
205
+ id: "teacher_list",
206
+ children: [
207
+ showLoadingState == 1 && /*#__PURE__*/ _jsxs("div", {
208
+ className: styles.no_data,
209
+ children: [
210
+ /*#__PURE__*/ _jsx("img", {
211
+ src: "/new_yun/images/aiService/search_for_icon.png"
212
+ }),
213
+ /*#__PURE__*/ _jsx("p", {
214
+ children: "输入关键词,搜索老师姓名"
215
+ })
216
+ ]
217
+ }),
218
+ showLoadingState == 2 && /*#__PURE__*/ _jsxs("div", {
219
+ className: styles.no_data,
220
+ children: [
221
+ /*#__PURE__*/ _jsx("img", {
222
+ src: "/new_yun/images/aiService/no_data.png"
223
+ }),
224
+ /*#__PURE__*/ _jsx("p", {
225
+ children: "未搜索到老师"
226
+ })
227
+ ]
228
+ }),
229
+ /*#__PURE__*/ _jsx("div", {
230
+ className: styles.list_item,
231
+ ref: sliderRef,
232
+ children: totalData.map(function(item) {
233
+ var span = item.name.replaceAll(new RegExp(keyWordProblem, "ig"), function(i) {
234
+ return "<span class=".concat(styles.sign, ">").concat(i, "</span>");
235
+ });
236
+ return /*#__PURE__*/ _jsx(_Fragment, {
237
+ children: /*#__PURE__*/ _jsxs("div", {
238
+ className: "".concat(styles.list_summary),
239
+ id: item.roomId,
240
+ onClick: function() {
241
+ enterTeacherChat(item);
242
+ },
243
+ children: [
244
+ /*#__PURE__*/ _jsx("div", {
245
+ className: styles.head_img,
246
+ children: /*#__PURE__*/ _jsx("img", {
247
+ src: item.headImg
248
+ })
249
+ }),
250
+ /*#__PURE__*/ _jsx("div", {
251
+ className: styles.list_desc,
252
+ children: /*#__PURE__*/ _jsx("p", {
253
+ className: styles.name,
254
+ style: {
255
+ width: "calc(100% - 36px)"
256
+ },
257
+ dangerouslySetInnerHTML: {
258
+ __html: span
259
+ }
260
+ })
261
+ })
262
+ ]
263
+ })
264
+ });
265
+ })
266
+ })
267
+ ]
268
+ })
269
+ ]
270
+ })
271
+ });
272
+ };
273
+ export default TeacherList;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bhd-components",
3
- "version": "0.7.20",
3
+ "version": "0.7.22",
4
4
  "description": "组件功能描述",
5
5
  "files": [
6
6
  "esm",