bhd-components 0.6.8 → 0.6.9

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.
@@ -105,7 +105,10 @@ const HistoryFun = (props)=>{
105
105
  number = index;
106
106
  }
107
107
  });
108
- const pageNumber = findPageNumber(30, Math.ceil(total / 30), number);
108
+ let pageNumber = findPageNumber(30, Math.ceil(total / 30), number);
109
+ if (number == 0) {
110
+ pageNumber = 1;
111
+ }
109
112
  console.log(roomId, pageNumber, id, receiver, "第几页第几页第几页第几页第几页第几页");
110
113
  loadSpecifiedData(roomId, pageNumber, id, receiver);
111
114
  onClose();
@@ -62,6 +62,8 @@ const CustomerService = (props)=>{
62
62
  let chatRoomList = useRef(null); //获取聊天室列表
63
63
  const ctrl = useRef(); //停止生成ai回答时使用
64
64
  let childRef = useRef(null); //获取子组件方法
65
+ let scrollTopHei = useRef(0);
66
+ let isPosition = useRef(true);
65
67
  const mid = props.userData.mid;
66
68
  const remarkable = new Remarkable({
67
69
  highlight: function(str, lang) {
@@ -128,6 +130,16 @@ const CustomerService = (props)=>{
128
130
  getHistoryMessage(number, 2);
129
131
  }, 1000);
130
132
  }
133
+ //生成答案过程中
134
+ if (!finished && scrollTopHei.current > scrollTop) {
135
+ // setIsPosition(false);
136
+ isPosition.current = false;
137
+ }
138
+ if (!finished && clientHeight + scrollTop >= scrollHeight) {
139
+ // console.log('到顶了111');
140
+ isPosition.current = true;
141
+ }
142
+ scrollTopHei.current = scrollTop;
131
143
  }
132
144
  const content = document.getElementById(showType == 1 || showType == 3 ? "chat_content" : "chat_content_modal");
133
145
  if (content) {
@@ -402,11 +414,13 @@ const CustomerService = (props)=>{
402
414
  }));
403
415
  return newHistoryMessageList;
404
416
  });
405
- if (!lastId) {
406
- setTimeout(()=>{
407
- scrollToBottom();
408
- }, 100);
409
- }
417
+ // console.log(lastId,'消息发送给老师111');
418
+ // if (!lastId) {
419
+ setTimeout(()=>{
420
+ console.log('滚动到底部');
421
+ scrollToBottom();
422
+ }, 100);
423
+ // }
410
424
  }
411
425
  //判断当前窗口是否是
412
426
  if (type == 1) {
@@ -721,11 +735,19 @@ const CustomerService = (props)=>{
721
735
  }
722
736
  if (msg.finished) {
723
737
  setFinished(true); //发送结束
738
+ // isPosition.current = true;
739
+ setTimeout(()=>{
740
+ isPosition.current = true;
741
+ }, 100);
724
742
  testLabQuestion(JSON.parse(data).message, content, "");
725
743
  }
726
744
  },
727
745
  onclose () {
728
746
  setFinished(true); //发送结束
747
+ // isPosition.current = true;
748
+ setTimeout(()=>{
749
+ isPosition.current = true;
750
+ }, 100);
729
751
  setHistoryMessageList((historyMessageList)=>{
730
752
  return historyMessageList.filter((item)=>item.id != "123456");
731
753
  });
@@ -789,7 +811,9 @@ const CustomerService = (props)=>{
789
811
  }
790
812
  });
791
813
  setTimeout(()=>{
792
- scrollToBottom();
814
+ if (isPosition.current) {
815
+ scrollToBottom();
816
+ }
793
817
  }, 10);
794
818
  };
795
819
  //问题记录到实验报告中
@@ -835,13 +859,14 @@ const CustomerService = (props)=>{
835
859
  //获取历史消息 flag:1,历史记录点击定位,2,代表是上拉加载,3,存在新的消息-->老师回答等,4,下拉加载,滚动到底部时,主要用于查看历史记录
836
860
  const getHistoryMessage = (pageNum, flag, id = "1", raw_data = [])=>{
837
861
  clearTimeout(roomMessage.current);
838
- // console.log(pageNum,flag,'dkfjvndfjvndfkvdf')
862
+ console.log(pageNum, flag, 'dkfjvndfjvndfkvdf');
839
863
  // flag == 1 时已经设置好了位置标记
840
864
  let last_id = "";
841
865
  if (flag == 2 && historyMessageList.length > 0) {
842
866
  last_id = historyMessageList[0].id;
843
867
  }
844
868
  if (flag != 1 && last_id != "") {
869
+ console.log(last_id, 'dkfjvndfjvndfkvdflast_idlast_idlast_id');
845
870
  setLastId(last_id);
846
871
  }
847
872
  //取消搜索页码标记
@@ -1880,7 +1905,7 @@ const CustomerService = (props)=>{
1880
1905
  return /*#__PURE__*/ _jsxs("div", {
1881
1906
  className: `${styles.operate_modal_bottom}`,
1882
1907
  style: {
1883
- position: showStopBtn ? 'sticky' : 'relative'
1908
+ position: showStopBtn && isPosition.current ? 'sticky' : 'relative'
1884
1909
  },
1885
1910
  children: [
1886
1911
  /*#__PURE__*/ _jsxs("p", {
@@ -2147,6 +2172,11 @@ const CustomerService = (props)=>{
2147
2172
  setQuestionsList([]);
2148
2173
  setAnswerMode(-1);
2149
2174
  setTeacherList([]);
2175
+ setTimeout(()=>{
2176
+ setQuestionsList([]);
2177
+ setTeacherList([]);
2178
+ clearTimeout(timer.current);
2179
+ }, 200);
2150
2180
  setHistoryMessageList((historyMessageList)=>{
2151
2181
  return historyMessageList.filter((item)=>item.id != "-1");
2152
2182
  });
@@ -2250,6 +2280,11 @@ const CustomerService = (props)=>{
2250
2280
  setQuestionsList([]);
2251
2281
  setAnswerMode(-1);
2252
2282
  setTeacherList([]);
2283
+ setTimeout(()=>{
2284
+ setQuestionsList([]);
2285
+ setTeacherList([]);
2286
+ clearTimeout(timer.current);
2287
+ }, 200);
2253
2288
  setHistoryMessageList((historyMessageList)=>{
2254
2289
  return historyMessageList.filter((item)=>item.id != "-1");
2255
2290
  });
@@ -151,6 +151,8 @@
151
151
  display: flex;
152
152
  flex-direction: column;
153
153
  align-items: flex-end;
154
+
155
+
154
156
  }
155
157
  }
156
158
  .right {
@@ -204,6 +206,7 @@
204
206
  line-height: 1;
205
207
  p{
206
208
  word-break: break-all;
209
+ white-space: break-spaces;
207
210
  }
208
211
  p,
209
212
  li {
@@ -217,6 +220,13 @@
217
220
  padding: 10px 0;
218
221
  }
219
222
  ol {
223
+ list-style: decimal;
224
+ padding-inline-start: 20px;
225
+
226
+ li{
227
+ list-style-type: auto;
228
+ }
229
+
220
230
  li p {
221
231
  padding: 4px 0;
222
232
  font-size: 14px;
@@ -415,6 +425,7 @@
415
425
  font-weight: 400;
416
426
  line-height: 1.8;
417
427
  cursor: pointer;
428
+ list-style-type: none;
418
429
  }
419
430
  }
420
431
  .time {
@@ -153,6 +153,8 @@
153
153
  display: flex;
154
154
  flex-direction: column;
155
155
  align-items: flex-end;
156
+
157
+
156
158
  }
157
159
  }
158
160
  .right {
@@ -206,6 +208,7 @@
206
208
  line-height: 1;
207
209
  p{
208
210
  word-break: break-all;
211
+ white-space: break-spaces;
209
212
  }
210
213
  p,
211
214
  li {
@@ -219,6 +222,13 @@
219
222
  padding: 10px 0;
220
223
  }
221
224
  ol {
225
+ list-style: decimal;
226
+ padding-inline-start: 20px;
227
+
228
+ li{
229
+ list-style-type: auto;
230
+ }
231
+
222
232
  li p {
223
233
  padding: 4px 0;
224
234
  font-size: 14px;
@@ -417,6 +427,7 @@
417
427
  font-weight: 400;
418
428
  line-height: 1.8;
419
429
  cursor: pointer;
430
+ list-style-type: none;
420
431
  }
421
432
  }
422
433
  .time {
@@ -107,6 +107,9 @@ var HistoryFun = function(props) {
107
107
  }
108
108
  });
109
109
  var pageNumber = findPageNumber(30, Math.ceil(total / 30), number);
110
+ if (number == 0) {
111
+ pageNumber = 1;
112
+ }
110
113
  console.log(roomId, pageNumber, id, receiver, "第几页第几页第几页第几页第几页第几页");
111
114
  loadSpecifiedData(roomId, pageNumber, id, receiver);
112
115
  onClose();
@@ -63,6 +63,8 @@ var CustomerService = function(props) {
63
63
  var chatRoomList = useRef(null); //获取聊天室列表
64
64
  var ctrl = useRef(); //停止生成ai回答时使用
65
65
  var childRef = useRef(null); //获取子组件方法
66
+ var scrollTopHei = useRef(0);
67
+ var isPosition = useRef(true);
66
68
  var mid = props.userData.mid;
67
69
  var remarkable = new Remarkable({
68
70
  highlight: function highlight(str, lang) {
@@ -123,6 +125,16 @@ var CustomerService = function(props) {
123
125
  getHistoryMessage(number1, 2);
124
126
  }, 1000);
125
127
  }
128
+ //生成答案过程中
129
+ if (!finished && scrollTopHei.current > scrollTop) {
130
+ // setIsPosition(false);
131
+ isPosition.current = false;
132
+ }
133
+ if (!finished && clientHeight + scrollTop >= scrollHeight) {
134
+ // console.log('到顶了111');
135
+ isPosition.current = true;
136
+ }
137
+ scrollTopHei.current = scrollTop;
126
138
  };
127
139
  if (showType != 1 && !firstLoad && pageCount > 0) {
128
140
  setFirstLoad(true);
@@ -407,11 +419,13 @@ var CustomerService = function(props) {
407
419
  }));
408
420
  return newHistoryMessageList;
409
421
  });
410
- if (!lastId) {
411
- setTimeout(function() {
412
- scrollToBottom();
413
- }, 100);
414
- }
422
+ // console.log(lastId,'消息发送给老师111');
423
+ // if (!lastId) {
424
+ setTimeout(function() {
425
+ console.log("滚动到底部");
426
+ scrollToBottom();
427
+ }, 100);
428
+ // }
415
429
  }
416
430
  //判断当前窗口是否是
417
431
  if (type == 1) {
@@ -738,11 +752,19 @@ var CustomerService = function(props) {
738
752
  }
739
753
  if (msg.finished) {
740
754
  setFinished(true); //发送结束
755
+ // isPosition.current = true;
756
+ setTimeout(function() {
757
+ isPosition.current = true;
758
+ }, 100);
741
759
  testLabQuestion(JSON.parse(data).message, content, "");
742
760
  }
743
761
  },
744
762
  onclose: function onclose() {
745
763
  setFinished(true); //发送结束
764
+ // isPosition.current = true;
765
+ setTimeout(function() {
766
+ isPosition.current = true;
767
+ }, 100);
746
768
  setHistoryMessageList(function(historyMessageList) {
747
769
  return historyMessageList.filter(function(item) {
748
770
  return item.id != "123456";
@@ -808,7 +830,9 @@ var CustomerService = function(props) {
808
830
  }
809
831
  });
810
832
  setTimeout(function() {
811
- scrollToBottom();
833
+ if (isPosition.current) {
834
+ scrollToBottom();
835
+ }
812
836
  }, 10);
813
837
  };
814
838
  //问题记录到实验报告中
@@ -857,13 +881,14 @@ var CustomerService = function(props) {
857
881
  var getHistoryMessage = function(pageNum, flag) {
858
882
  var id = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "1", raw_data = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : [];
859
883
  clearTimeout(roomMessage.current);
860
- // console.log(pageNum,flag,'dkfjvndfjvndfkvdf')
884
+ console.log(pageNum, flag, "dkfjvndfjvndfkvdf");
861
885
  // flag == 1 时已经设置好了位置标记
862
886
  var last_id = "";
863
887
  if (flag == 2 && historyMessageList.length > 0) {
864
888
  last_id = historyMessageList[0].id;
865
889
  }
866
890
  if (flag != 1 && last_id != "") {
891
+ console.log(last_id, "dkfjvndfjvndfkvdflast_idlast_idlast_id");
867
892
  setLastId(last_id);
868
893
  }
869
894
  //取消搜索页码标记
@@ -1944,7 +1969,7 @@ var CustomerService = function(props) {
1944
1969
  return /*#__PURE__*/ _jsxs("div", {
1945
1970
  className: "".concat(styles.operate_modal_bottom),
1946
1971
  style: {
1947
- position: showStopBtn ? "sticky" : "relative"
1972
+ position: showStopBtn && isPosition.current ? "sticky" : "relative"
1948
1973
  },
1949
1974
  children: [
1950
1975
  /*#__PURE__*/ _jsxs("p", {
@@ -2227,6 +2252,11 @@ var CustomerService = function(props) {
2227
2252
  setQuestionsList([]);
2228
2253
  setAnswerMode(-1);
2229
2254
  setTeacherList([]);
2255
+ setTimeout(function() {
2256
+ setQuestionsList([]);
2257
+ setTeacherList([]);
2258
+ clearTimeout(timer.current);
2259
+ }, 200);
2230
2260
  setHistoryMessageList(function(historyMessageList) {
2231
2261
  return historyMessageList.filter(function(item) {
2232
2262
  return item.id != "-1";
@@ -2336,6 +2366,11 @@ var CustomerService = function(props) {
2336
2366
  setQuestionsList([]);
2337
2367
  setAnswerMode(-1);
2338
2368
  setTeacherList([]);
2369
+ setTimeout(function() {
2370
+ setQuestionsList([]);
2371
+ setTeacherList([]);
2372
+ clearTimeout(timer.current);
2373
+ }, 200);
2339
2374
  setHistoryMessageList(function(historyMessageList) {
2340
2375
  return historyMessageList.filter(function(item) {
2341
2376
  return item.id != "-1";
@@ -151,6 +151,8 @@
151
151
  display: flex;
152
152
  flex-direction: column;
153
153
  align-items: flex-end;
154
+
155
+
154
156
  }
155
157
  }
156
158
  .right {
@@ -204,6 +206,7 @@
204
206
  line-height: 1;
205
207
  p{
206
208
  word-break: break-all;
209
+ white-space: break-spaces;
207
210
  }
208
211
  p,
209
212
  li {
@@ -217,6 +220,13 @@
217
220
  padding: 10px 0;
218
221
  }
219
222
  ol {
223
+ list-style: decimal;
224
+ padding-inline-start: 20px;
225
+
226
+ li{
227
+ list-style-type: auto;
228
+ }
229
+
220
230
  li p {
221
231
  padding: 4px 0;
222
232
  font-size: 14px;
@@ -415,6 +425,7 @@
415
425
  font-weight: 400;
416
426
  line-height: 1.8;
417
427
  cursor: pointer;
428
+ list-style-type: none;
418
429
  }
419
430
  }
420
431
  .time {
@@ -153,6 +153,8 @@
153
153
  display: flex;
154
154
  flex-direction: column;
155
155
  align-items: flex-end;
156
+
157
+
156
158
  }
157
159
  }
158
160
  .right {
@@ -206,6 +208,7 @@
206
208
  line-height: 1;
207
209
  p{
208
210
  word-break: break-all;
211
+ white-space: break-spaces;
209
212
  }
210
213
  p,
211
214
  li {
@@ -219,6 +222,13 @@
219
222
  padding: 10px 0;
220
223
  }
221
224
  ol {
225
+ list-style: decimal;
226
+ padding-inline-start: 20px;
227
+
228
+ li{
229
+ list-style-type: auto;
230
+ }
231
+
222
232
  li p {
223
233
  padding: 4px 0;
224
234
  font-size: 14px;
@@ -417,6 +427,7 @@
417
427
  font-weight: 400;
418
428
  line-height: 1.8;
419
429
  cursor: pointer;
430
+ list-style-type: none;
420
431
  }
421
432
  }
422
433
  .time {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bhd-components",
3
- "version": "0.6.8",
3
+ "version": "0.6.9",
4
4
  "description": "组件功能描述",
5
5
  "files": [
6
6
  "esm",