bhd-components 0.7.20 → 0.7.21

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.
@@ -1874,7 +1874,16 @@
1874
1874
  }
1875
1875
  }
1876
1876
  }
1877
-
1877
+ //老师列表
1878
+ .teacher_list{
1879
+ .name{
1880
+ margin-bottom: 0!important;
1881
+ font-weight: 400 !important;
1882
+ .sign{
1883
+ color: @color-text-primary;
1884
+ }
1885
+ }
1886
+ }
1878
1887
  //截图功能
1879
1888
  .screenshot_Modal{
1880
1889
  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,224 @@
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
+ var _useState3 = _sliced_to_array(useState([]), 2), teacher_list = _useState3[0], setTeacher_list = _useState3[1]; //老师列表,有头像
15
+ var timer = useRef(null); //文本框输入时
16
+ useEffect(function() {
17
+ getList("");
18
+ return function() {
19
+ clearTimeout(timer.current);
20
+ };
21
+ }, []);
22
+ var getList = function(val) {
23
+ http.get("".concat(urllocation, "/chat-service/public/v1.0/teachers"), {
24
+ params: {
25
+ name: val
26
+ }
27
+ }).then(function(res) {
28
+ console.log(res);
29
+ var data = res.data;
30
+ if (data.total > 0) {
31
+ setShowLoadingState(3);
32
+ setTotalData(res.data.teachers);
33
+ getUserName(res.data.teachers);
34
+ }
35
+ });
36
+ };
37
+ var getUserName = function(dataList) {
38
+ try {
39
+ var list = dataList;
40
+ var ids = [];
41
+ list = list.map(function(item) {
42
+ if (!item.headImg && teacher_list.filter(function(v) {
43
+ return v.uid == item.uid;
44
+ }).length <= 0) {
45
+ ids.push(item.uid);
46
+ }
47
+ });
48
+ if (ids.length > 0) {
49
+ userName(ids.join(",")).then(function(res) {
50
+ if (res.data) {
51
+ var nameList = res.data;
52
+ setTotalData(function(list1) {
53
+ var list = list1;
54
+ list = list.map(function(item) {
55
+ var name = nameList.filter(function(v) {
56
+ return v.uid == item.uid;
57
+ });
58
+ if (name.length > 0) {
59
+ return _object_spread({}, item, name[0]);
60
+ } else {
61
+ return item;
62
+ }
63
+ });
64
+ setTeacher_list(list);
65
+ return list;
66
+ });
67
+ }
68
+ });
69
+ } else {
70
+ var nameList = teacher_list;
71
+ setTotalData(function(list1) {
72
+ var list = list1;
73
+ list = list.map(function(item) {
74
+ var name = nameList.filter(function(v) {
75
+ return v.uid == item.uid;
76
+ });
77
+ if (name.length > 0) {
78
+ return _object_spread({}, item, name[0]);
79
+ } else {
80
+ return item;
81
+ }
82
+ });
83
+ setTeacher_list(list);
84
+ return list;
85
+ });
86
+ }
87
+ } catch (error) {}
88
+ };
89
+ var userName = function(uid) {
90
+ return http.get("".concat(urllocation, "/chat-service/public/v1.0/userinfo"), {
91
+ params: {
92
+ uid: uid
93
+ },
94
+ headers: {
95
+ "x-module-id": userData.modules.find(function(ele) {
96
+ return ele.short == "IntelligentCustomerService";
97
+ }).id,
98
+ "x-auth-jwt": window.localStorage.getItem("usertoken") || ""
99
+ }
100
+ });
101
+ };
102
+ return /*#__PURE__*/ _jsx("div", {
103
+ className: "".concat(styles.history_list, " ").concat(type == 2 ? styles.history_list_broadside : "", " ").concat(styles.teacher_list),
104
+ children: /*#__PURE__*/ _jsxs("div", {
105
+ className: styles.search_layout,
106
+ children: [
107
+ /*#__PURE__*/ _jsxs("div", {
108
+ className: styles.title,
109
+ children: [
110
+ /*#__PURE__*/ _jsx("span", {
111
+ children: "召唤老师回答"
112
+ }),
113
+ /*#__PURE__*/ _jsx("span", {
114
+ onClick: function() {
115
+ // loadSpecifiedData();
116
+ onClose();
117
+ },
118
+ children: /*#__PURE__*/ _jsx(CustomClose, {})
119
+ })
120
+ ]
121
+ }),
122
+ /*#__PURE__*/ _jsxs("div", {
123
+ className: styles.search_top,
124
+ children: [
125
+ /*#__PURE__*/ _jsx(SearchOutlined, {}),
126
+ /*#__PURE__*/ _jsx(Input, {
127
+ placeholder: "请输入您要召唤的老师姓名",
128
+ value: keyWordProblem,
129
+ onChange: function(e) {
130
+ var val = String(e.target.value);
131
+ setKeyWordProblem(val);
132
+ clearTimeout(timer.current);
133
+ timer.current = setTimeout(function() {
134
+ if (val != "") {
135
+ setTotalData([]);
136
+ getList(val);
137
+ } else {
138
+ setShowLoadingState(1);
139
+ setTotalData([]);
140
+ }
141
+ }, 1000);
142
+ }
143
+ }),
144
+ /*#__PURE__*/ _jsx("i", {
145
+ className: "guanbi_Close",
146
+ onClick: function() {
147
+ setShowLoadingState(1);
148
+ setKeyWordProblem("");
149
+ setTotalData([]);
150
+ },
151
+ children: /*#__PURE__*/ _jsx(CustomClose, {})
152
+ })
153
+ ]
154
+ }),
155
+ /*#__PURE__*/ _jsxs("div", {
156
+ className: styles.main_list,
157
+ id: "history_list",
158
+ children: [
159
+ showLoadingState == 1 && /*#__PURE__*/ _jsxs("div", {
160
+ className: styles.no_data,
161
+ children: [
162
+ /*#__PURE__*/ _jsx("img", {
163
+ src: "/new_yun/images/aiService/search_for_icon.png"
164
+ }),
165
+ /*#__PURE__*/ _jsx("p", {
166
+ children: "输入关键词,搜索老师姓名"
167
+ })
168
+ ]
169
+ }),
170
+ showLoadingState == 2 && /*#__PURE__*/ _jsxs("div", {
171
+ className: styles.no_data,
172
+ children: [
173
+ /*#__PURE__*/ _jsx("img", {
174
+ src: "/new_yun/images/aiService/no_data.png"
175
+ }),
176
+ /*#__PURE__*/ _jsx("p", {
177
+ children: "暂无记录"
178
+ })
179
+ ]
180
+ }),
181
+ /*#__PURE__*/ _jsx("div", {
182
+ className: styles.list_item,
183
+ children: totalData.map(function(item) {
184
+ var span = item.name.replaceAll(new RegExp(keyWordProblem, "ig"), function(i) {
185
+ return "<span class=".concat(styles.sign, ">").concat(i, "</span>");
186
+ });
187
+ return /*#__PURE__*/ _jsx(_Fragment, {
188
+ children: /*#__PURE__*/ _jsxs("div", {
189
+ className: "".concat(styles.list_summary),
190
+ id: item.roomId,
191
+ onClick: function() {
192
+ enterTeacherChat(item);
193
+ },
194
+ children: [
195
+ /*#__PURE__*/ _jsx("div", {
196
+ className: styles.head_img,
197
+ children: /*#__PURE__*/ _jsx("img", {
198
+ src: item.headImg
199
+ })
200
+ }),
201
+ /*#__PURE__*/ _jsx("div", {
202
+ className: styles.list_desc,
203
+ children: /*#__PURE__*/ _jsx("p", {
204
+ className: styles.name,
205
+ style: {
206
+ width: "calc(100% - 36px)"
207
+ },
208
+ dangerouslySetInnerHTML: {
209
+ __html: span
210
+ }
211
+ })
212
+ })
213
+ ]
214
+ })
215
+ });
216
+ })
217
+ })
218
+ ]
219
+ })
220
+ ]
221
+ })
222
+ });
223
+ };
224
+ 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.21",
4
4
  "description": "组件功能描述",
5
5
  "files": [
6
6
  "esm",