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.
@@ -3,7 +3,7 @@ import { _ as _object_spread_props } from "@swc/helpers/_/_object_spread_props";
3
3
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "@ice/jsx-runtime/jsx-runtime";
4
4
  import React, { useEffect, useState, useRef } from "react";
5
5
  import { Modal, Drawer, Input, Tooltip } from "antd";
6
- import { ViewImage } from "bhd-components";
6
+ import ViewImage from "../viewImage";
7
7
  // import html2canvas from "html2canvas";
8
8
  import cssStyle from "./index.module.less";
9
9
  import cssStyleOnline from "./index2.module.less";
@@ -16,6 +16,7 @@ import { CloseOutlined, RightOutlined, ZoomInOutlined } from "@ant-design/icons"
16
16
  import HistoryFun from "./historyFun";
17
17
  import ContactsList from "./contactsList";
18
18
  import ScreenshotTool from "./screenshotTool";
19
+ import TeacherList from "./teacherList";
19
20
  import { parseDate } from "../utils/Date";
20
21
  import { Remarkable } from "remarkable";
21
22
  import hljs from "highlight.js";
@@ -52,11 +53,11 @@ const CustomerService = (props)=>{
52
53
  const [buttomHei, setButtomHei] = useState(45); //底部输入框的高度
53
54
  const [showHistory, setShowHistory] = useState(false); //是否显示历史记录
54
55
  const [showContacts, setShowContacts] = useState(false); //是否显示老师列表
56
+ const [contactsList, setContactsList] = useState([]); //老师列表
55
57
  const [showType, setShowType] = useState(-1); //显示聊天框类型 1、侧边栏 2 modal 3 相应的div中 newlabo中使用
56
- const [answerMode, setAnswerMode] = useState(-1); //设置回答模式。1,召唤老师回答
57
- const [teacherList, setTeacherList] = useState([]); //老师列表
58
+ // const [answerMode, setAnswerMode] = useState(-1); //设置回答模式。1,召唤老师回答
59
+ // const [teacherList, setTeacherList] = useState([]); //老师列表
58
60
  const [problem, setProblem] = useState({}); //召唤老师回答的问题
59
- const [contactsList, setContactsList] = useState([]); //老师列表
60
61
  const [chatObj, setChatObj] = useState([]); //聊天记录id保存,用来在实验报告中记录
61
62
  const [keyWordProblem, setKeyWordProblem] = useState(""); //历史记录搜索的内容
62
63
  const [imgBese64, setImgBese64] = useState(""); //屏幕截图
@@ -66,6 +67,7 @@ const CustomerService = (props)=>{
66
67
  const [bottomRecommendationQuestions, setBottomRecommendationQuestions] = useState([]); //底部推荐问题
67
68
  const [showScreenshot, setShowScreenshot] = useState(false); //是否显示截图 主要用于newlabo页面
68
69
  const [saveShowType, setSaveShowType] = useState(-1); //保存截图时的状态
70
+ const [showTeacherList, setShowTeacherList] = useState(false); //是否显示召唤老师列表
69
71
  const timer = useRef(null); //文本框输入时
70
72
  let receiveMessageTimer = useRef(null); //接收ai发回的消息
71
73
  // let voiceCountdownTimer = useRef(null); //语音录制倒计时
@@ -79,6 +81,7 @@ const CustomerService = (props)=>{
79
81
  let recommendeQuestionID = useRef([]); //推荐问题id
80
82
  let videoHotQuestionsList = useRef([]); //视频热门问题
81
83
  let newHotQuestionsList = useRef([]); //视频热门问题
84
+ let newShowType = useRef(false);
82
85
  const mid = props.userData.mid;
83
86
  const remarkable = new Remarkable({
84
87
  highlight: function(str, lang) {
@@ -106,6 +109,7 @@ const CustomerService = (props)=>{
106
109
  //|| showScreenshot
107
110
  if (showType == 5 || showScreenshot) {
108
111
  try {
112
+ newShowType.current = true;
109
113
  setImgBese64('');
110
114
  // let dom = document.getElementById(screenshotAreaId);
111
115
  html2canvas(screenshotAreaId, {
@@ -546,7 +550,7 @@ const CustomerService = (props)=>{
546
550
  });
547
551
  };
548
552
  //消息发送给老师type == 1,召唤老师时发送,type == 2,在老师聊天窗口聊天
549
- const sendToTeacher = (type)=>{
553
+ const sendToTeacher = (type, message = '')=>{
550
554
  console.log("消息发送给老师111");
551
555
  let obj = {};
552
556
  if (type == 1) {
@@ -556,8 +560,11 @@ const CustomerService = (props)=>{
556
560
  recevier: chatWith.uid,
557
561
  message: problem.question
558
562
  };
563
+ if (problem.url) {
564
+ obj.image = problem.url;
565
+ }
559
566
  setProblem({});
560
- } else if (type == 2) {
567
+ } else if (type == 2 || type == 3) {
561
568
  let list = contactsList.filter((item)=>item.roomId == roomId);
562
569
  let recevier = "";
563
570
  if (list.length > 0) {
@@ -567,9 +574,13 @@ const CustomerService = (props)=>{
567
574
  roomId: roomId,
568
575
  sender: mid,
569
576
  recevier: recevier,
570
- message: keyWord,
577
+ message: type == 2 ? keyWord : message,
571
578
  quotedMessage: citationContent.content || ""
572
579
  };
580
+ if (screenshotBese64) {
581
+ obj.image = screenshotBese64;
582
+ setScreenshotBese64("");
583
+ }
573
584
  }
574
585
  http.post(`${urllocation}/chat-service/public/v1.0/chat-with-user/messages`, obj).then((res)=>{
575
586
  if (res.data.id) {
@@ -580,7 +591,13 @@ const CustomerService = (props)=>{
580
591
  id: res.data.id,
581
592
  upvoted: false,
582
593
  downvoted: false,
583
- createdAt: getDataTime(-1)
594
+ createdAt: getDataTime(-1),
595
+ extraInfo: obj.image ? JSON.stringify([
596
+ {
597
+ key: "imageUrl",
598
+ value: obj.image
599
+ }
600
+ ]) : null
584
601
  }));
585
602
  return newHistoryMessageList;
586
603
  });
@@ -1211,8 +1228,9 @@ const CustomerService = (props)=>{
1211
1228
  roomMessage.current = setTimeout(()=>{
1212
1229
  getRoomidHistoryMessage(totalNumber, rid);
1213
1230
  }, 5000);
1214
- if (rid == "") return;
1215
- // console.log(roomList,2222222);
1231
+ // console.log(showType, imgBese64,showScreenshot,newShowType.current,9999999);
1232
+ //newShowType.current 截图中,不循环
1233
+ if (rid == "" || newShowType.current) return;
1216
1234
  return http.get(`${urllocation}/chat-service/public/v1.0/history-messages`, {
1217
1235
  params: {
1218
1236
  roomId: rid,
@@ -1470,19 +1488,6 @@ const CustomerService = (props)=>{
1470
1488
  }
1471
1489
  }
1472
1490
  };
1473
- //获取老师列表
1474
- const getTeacherList = (keyWord)=>{
1475
- http.get(`${urllocation}/chat-service/public/v1.0/teachers`, {
1476
- params: {
1477
- name: keyWord
1478
- }
1479
- }).then((res)=>{
1480
- console.log(res);
1481
- if (res.data) {
1482
- setTeacherList(res.data.teachers);
1483
- }
1484
- });
1485
- };
1486
1491
  //获取聊天室列表
1487
1492
  const roomsListTimer = ()=>{
1488
1493
  if (chatRoomList != null) clearTimeout(chatRoomList.current);
@@ -2027,7 +2032,7 @@ const CustomerService = (props)=>{
2027
2032
  ]
2028
2033
  })
2029
2034
  }),
2030
- showType == 2 || showType == 4 ? /*#__PURE__*/ _jsx("div", {
2035
+ (showType == 2 || showType == 4) && /*#__PURE__*/ _jsx("div", {
2031
2036
  className: styles.head_sculpture,
2032
2037
  style: {
2033
2038
  marginLeft: "12px"
@@ -2035,7 +2040,7 @@ const CustomerService = (props)=>{
2035
2040
  children: /*#__PURE__*/ _jsx("img", {
2036
2041
  src: userData.avatar
2037
2042
  })
2038
- }) : ""
2043
+ })
2039
2044
  ]
2040
2045
  }, item.id)
2041
2046
  ]
@@ -2145,24 +2150,7 @@ const CustomerService = (props)=>{
2145
2150
  ]
2146
2151
  }),
2147
2152
  //findTeacher//是否在召唤老师过程中,是否是最后一条消息
2148
- !item.findTeacher && historyMessageList.length - 1 == i && item.id != "123456" && item.id != '123456_date' && renderLastOperateBtn(item, isAiChatWindow, i),
2149
- //召唤老师回答按钮
2150
- isAiChatWindow && item.findTeacher && userData.modules.some((item)=>item.short == "TeacherAnswer") && /*#__PURE__*/ _jsx("div", {
2151
- className: `${styles.operate_modal_bottom} `,
2152
- children: /*#__PURE__*/ _jsx("p", {
2153
- className: styles.stop_findTeacher,
2154
- children: /*#__PURE__*/ _jsx("span", {
2155
- onClick: ()=>{
2156
- setAnswerMode(-1);
2157
- setTeacherList([]);
2158
- setHistoryMessageList((historyMessageList)=>{
2159
- return historyMessageList.filter((item)=>item.id != "-1");
2160
- });
2161
- },
2162
- children: "停止召唤老师"
2163
- })
2164
- })
2165
- })
2153
+ !item.findTeacher && historyMessageList.length - 1 == i && item.id != "123456" && item.id != '123456_date' && renderLastOperateBtn(item, isAiChatWindow, i)
2166
2154
  ]
2167
2155
  })
2168
2156
  ]
@@ -2208,50 +2196,24 @@ const CustomerService = (props)=>{
2208
2196
  if (extraInfo && JSON.parse(extraInfo).length > 0 && JSON.parse(extraInfo)[0].key == "messageSource" || extraInfo && JSON.parse(extraInfo).length > 0 && JSON.parse(extraInfo)[0].key == "isVoteMessage") {
2209
2197
  return "";
2210
2198
  }
2211
- // console.log(historyMessageList,i,'sdcsd;sldcscsdsd')
2212
- //根据上一行数据,判断是否显示招唤老师按钮
2213
- let showTeacherBtn = true;
2214
- let previousLineData = historyMessageList[i - 1];
2215
- if (!previousLineData) {
2216
- showTeacherBtn = true;
2217
- } else if (!previousLineData.extraInfo) {
2218
- showTeacherBtn = true;
2219
- } else if (JSON.parse(previousLineData.extraInfo).length > 0 && JSON.parse(previousLineData.extraInfo)[0].key == "imageUrl") {
2220
- showTeacherBtn = false;
2221
- }
2222
2199
  return /*#__PURE__*/ _jsxs("p", {
2223
2200
  className: styles.operate,
2224
2201
  children: [
2225
2202
  // 不在智能客服窗口,并已经点击了召唤老师,并有召唤老师权限
2226
- isAiChatWindow && answerMode != 1 && userData.modules.some((item)=>item.short == "TeacherAnswer") && showTeacherBtn && /*#__PURE__*/ _jsx("span", {
2203
+ isAiChatWindow && userData.modules.some((item)=>item.short == "TeacherAnswer") && /*#__PURE__*/ _jsx("span", {
2227
2204
  className: styles.ask_question,
2228
2205
  onClick: ()=>{
2229
- setAnswerMode(1);
2206
+ console.log(historyMessageList[i - 1], 4444444);
2207
+ let extraInfo = historyMessageList[i - 1].extraInfo;
2208
+ let url = '';
2209
+ if (extraInfo && JSON.parse(extraInfo).length > 0 && JSON.parse(extraInfo)[0].key == "imageUrl" && JSON.parse(extraInfo)[0].value) {
2210
+ url = JSON.parse(extraInfo)[0].value;
2211
+ }
2230
2212
  setProblem({
2231
2213
  question: historyMessageList[i - 1].message,
2232
- user: problem.user
2233
- });
2234
- setHistoryMessageList((historyMessageList)=>{
2235
- let newHistoryMessageList = historyMessageList.concat({
2236
- id: -1,
2237
- roomId: roomId,
2238
- sender: "AI",
2239
- recevier: mid,
2240
- message: "请告诉我您要召唤的老师名字",
2241
- createdAt: getDataTime(-1),
2242
- findTeacher: true,
2243
- extraInfo: item.extraInfo == null ? null : JSON.stringify([
2244
- {
2245
- key: "questionId",
2246
- value: "questionId"
2247
- }
2248
- ])
2249
- });
2250
- return newHistoryMessageList;
2214
+ url
2251
2215
  });
2252
- setTimeout(()=>{
2253
- scrollToBottom();
2254
- }, 200);
2216
+ setShowTeacherList(true);
2255
2217
  },
2256
2218
  children: "召唤老师回答"
2257
2219
  }),
@@ -2264,7 +2226,6 @@ const CustomerService = (props)=>{
2264
2226
  });
2265
2227
  resettingBottomHei();
2266
2228
  onEvent(serverName + serverUrl(), "click_智能问答_引用", "提交");
2267
- console.log("引用222222");
2268
2229
  },
2269
2230
  children: /*#__PURE__*/ _jsx(CustomQuote, {})
2270
2231
  }),
@@ -2301,7 +2262,6 @@ const CustomerService = (props)=>{
2301
2262
  if (!isAiChatWindow) return;
2302
2263
  //只有最后一条回答,支持发送点赞或踩
2303
2264
  if (!item.upvoted && (historyMessageList.length == i + 1 || historyMessageList.length - 2 == i)) {
2304
- console.log("判断是AI还是智能问答", item);
2305
2265
  if (!item.extraInfo && item.sender == "AI") {
2306
2266
  aiSendQuestions(1, {
2307
2267
  roomId: roomId,
@@ -2311,7 +2271,6 @@ const CustomerService = (props)=>{
2311
2271
  generateUpvoteOrDownvoteMessage: true
2312
2272
  }, 1);
2313
2273
  } else {
2314
- console.log("AI回答2255555");
2315
2274
  sendGreetingMessage(2);
2316
2275
  }
2317
2276
  }
@@ -2369,17 +2328,6 @@ const CustomerService = (props)=>{
2369
2328
  if (!showStopBtn && isAiChatWindow && (extraInfo != undefined && JSON.parse(extraInfo).length > 0 && JSON.parse(extraInfo)[0].key == "questionId" || extraInfo == null)) {
2370
2329
  findTeacherBtn = true;
2371
2330
  }
2372
- //根据上一行数据,判断是否显示招唤老师按钮
2373
- let showTeacherBtn = true;
2374
- let previousLineData = historyMessageList[i - 1];
2375
- if (!previousLineData) {
2376
- showTeacherBtn = true;
2377
- } else if (!previousLineData.extraInfo) {
2378
- showTeacherBtn = true;
2379
- } else if (JSON.parse(previousLineData.extraInfo).length > 0 && JSON.parse(previousLineData.extraInfo)[0].key == "imageUrl") {
2380
- showTeacherBtn = false;
2381
- }
2382
- /// style={{position:showStopBtn && isPosition.current ? 'sticky' : 'relative'}}
2383
2331
  return /*#__PURE__*/ _jsxs("div", {
2384
2332
  className: `${styles.operate_modal_bottom}`,
2385
2333
  children: [
@@ -2424,35 +2372,19 @@ const CustomerService = (props)=>{
2424
2372
  ]
2425
2373
  }),
2426
2374
  //在ai窗口并ai已经生成完答案
2427
- findTeacherBtn && userData.modules.some((item)=>item.short == "TeacherAnswer") && showTeacherBtn && /*#__PURE__*/ _jsx("span", {
2375
+ findTeacherBtn && userData.modules.some((item)=>item.short == "TeacherAnswer") && /*#__PURE__*/ _jsx("span", {
2428
2376
  className: styles.find_teacher,
2429
2377
  onClick: ()=>{
2430
- setAnswerMode(1);
2378
+ let extraInfo = historyMessageList[i - 1].extraInfo;
2379
+ let url = '';
2380
+ if (extraInfo && JSON.parse(extraInfo).length > 0 && JSON.parse(extraInfo)[0].key == "imageUrl" && JSON.parse(extraInfo)[0].value) {
2381
+ url = JSON.parse(extraInfo)[0].value;
2382
+ }
2431
2383
  setProblem({
2432
2384
  question: historyMessageList[i - 1].message,
2433
- user: problem.user
2385
+ url
2434
2386
  });
2435
- setHistoryMessageList((historyMessageList)=>{
2436
- let newHistoryMessageList = historyMessageList.concat({
2437
- id: -1,
2438
- roomId: roomId,
2439
- sender: "AI",
2440
- recevier: mid,
2441
- message: "请告诉我您要召唤的老师名字",
2442
- createdAt: getDataTime(-1),
2443
- findTeacher: true,
2444
- extraInfo: item.extraInfo == null ? null : JSON.stringify([
2445
- {
2446
- key: "questionId",
2447
- value: "questionId"
2448
- }
2449
- ])
2450
- });
2451
- return newHistoryMessageList;
2452
- });
2453
- setTimeout(()=>{
2454
- scrollToBottom();
2455
- }, 200);
2387
+ setShowTeacherList(true);
2456
2388
  },
2457
2389
  children: "召唤老师回答"
2458
2390
  })
@@ -2598,6 +2530,44 @@ const CustomerService = (props)=>{
2598
2530
  }
2599
2531
  }
2600
2532
  };
2533
+ //发送截图信息
2534
+ const sendScreenshotData = (message)=>{
2535
+ if (contactsList.length > 0 && contactsList[0].roomId == roomId) {
2536
+ setHistoryMessageList((historyMessageList)=>{
2537
+ let newHistoryMessageList = historyMessageList.concat({
2538
+ id: 'p' + new Date().getTime(),
2539
+ roomId: roomId,
2540
+ sender: mid,
2541
+ recevier: 'AI',
2542
+ message: message,
2543
+ createdAt: getDataTime(-1),
2544
+ extraInfo: JSON.stringify([
2545
+ {
2546
+ key: "imageUrl",
2547
+ value: screenshotBese64
2548
+ }
2549
+ ])
2550
+ });
2551
+ return newHistoryMessageList;
2552
+ });
2553
+ //ai窗口
2554
+ aiSendQuestions(3, {
2555
+ //相关数据
2556
+ roomId: roomId,
2557
+ message: message,
2558
+ image: screenshotBese64,
2559
+ quotedMessage: citationContent.content || "",
2560
+ regenerate: citationContent.content != "" ? false : true,
2561
+ generateUpvoteOrDownvoteMessage: false
2562
+ }, 1);
2563
+ setScreenshotBese64('');
2564
+ } else {
2565
+ //老师窗口
2566
+ sendToTeacher(3, message);
2567
+ }
2568
+ scrollToBottom();
2569
+ resettingBottomHei();
2570
+ };
2601
2571
  //渲染底部按钮
2602
2572
  const renderBottomAnt = ()=>{
2603
2573
  let placeholder = "";
@@ -2655,35 +2625,7 @@ const CustomerService = (props)=>{
2655
2625
  children: [
2656
2626
  /*#__PURE__*/ _jsxs("p", {
2657
2627
  onClick: ()=>{
2658
- setHistoryMessageList((historyMessageList)=>{
2659
- let newHistoryMessageList = historyMessageList.concat({
2660
- id: 'p' + new Date().getTime(),
2661
- roomId: roomId,
2662
- sender: mid,
2663
- recevier: 'AI',
2664
- message: "讲解这张图片涉及到的知识内容",
2665
- createdAt: getDataTime(-1),
2666
- extraInfo: JSON.stringify([
2667
- {
2668
- key: "imageUrl",
2669
- value: screenshotBese64
2670
- }
2671
- ])
2672
- });
2673
- return newHistoryMessageList;
2674
- });
2675
- scrollToBottom();
2676
- aiSendQuestions(3, {
2677
- //相关数据
2678
- roomId: roomId,
2679
- message: '讲解这张图片涉及到的知识内容',
2680
- image: screenshotBese64,
2681
- quotedMessage: citationContent.content || "",
2682
- regenerate: citationContent.content != "" ? false : true,
2683
- generateUpvoteOrDownvoteMessage: false
2684
- }, 1);
2685
- setScreenshotBese64('');
2686
- resettingBottomHei();
2628
+ sendScreenshotData('讲解这张图片涉及到的知识内容');
2687
2629
  },
2688
2630
  children: [
2689
2631
  /*#__PURE__*/ _jsx(CustomKnowledgeContent, {}),
@@ -2693,35 +2635,7 @@ const CustomerService = (props)=>{
2693
2635
  /*#__PURE__*/ _jsx("br", {}),
2694
2636
  /*#__PURE__*/ _jsxs("p", {
2695
2637
  onClick: ()=>{
2696
- setHistoryMessageList((historyMessageList)=>{
2697
- let newHistoryMessageList = historyMessageList.concat({
2698
- id: 'p' + new Date().getTime(),
2699
- roomId: roomId,
2700
- sender: mid,
2701
- recevier: 'AI',
2702
- message: "帮助我更深入地理解图片中的概念",
2703
- createdAt: getDataTime(-1),
2704
- extraInfo: JSON.stringify([
2705
- {
2706
- key: "imageUrl",
2707
- value: screenshotBese64
2708
- }
2709
- ])
2710
- });
2711
- return newHistoryMessageList;
2712
- });
2713
- scrollToBottom();
2714
- aiSendQuestions(3, {
2715
- //相关数据
2716
- roomId: roomId,
2717
- message: '帮助我更深入地理解图片中的概念',
2718
- image: screenshotBese64,
2719
- quotedMessage: citationContent.content || "",
2720
- regenerate: citationContent.content != "" ? false : true,
2721
- generateUpvoteOrDownvoteMessage: false
2722
- }, 1);
2723
- setScreenshotBese64('');
2724
- resettingBottomHei();
2638
+ sendScreenshotData('帮助我更深入地理解图片中的概念');
2725
2639
  },
2726
2640
  children: [
2727
2641
  /*#__PURE__*/ _jsx(CustomWenhaoRound, {}),
@@ -2743,22 +2657,14 @@ const CustomerService = (props)=>{
2743
2657
  setKeyWord(e.target.value);
2744
2658
  if (e.target.value == "") {
2745
2659
  setQuestionsList([]);
2746
- setTeacherList([]);
2747
2660
  clearTimeout(timer.current);
2748
2661
  } else {
2749
2662
  clearTimeout(timer.current);
2750
2663
  timer.current = setTimeout(()=>{
2751
- if (answerMode == 1) {
2752
- getTeacherList(String(e.target.value));
2664
+ if (config && config.type == 'video') {
2665
+ getQuestiionsList(String(e.target.value), 3);
2753
2666
  } else {
2754
- let roomList = contactsList;
2755
- if (roomList.length > 0 && roomList[0].roomId != roomId) return;
2756
- console.log(props, 333333);
2757
- if (config && config.type == 'video') {
2758
- getQuestiionsList(String(e.target.value), 3);
2759
- } else {
2760
- getQuestiionsList(String(e.target.value), 2);
2761
- }
2667
+ getQuestiionsList(String(e.target.value), 2);
2762
2668
  }
2763
2669
  }, 1000);
2764
2670
  }
@@ -2775,40 +2681,21 @@ const CustomerService = (props)=>{
2775
2681
  setKeyWord("");
2776
2682
  setCitationContent({});
2777
2683
  setBottomRecommendationQuestions([]);
2778
- resettingBottomHei();
2779
- //查找是否是召唤老师回答并有相应的老师名称
2780
- if (answerMode == 1 && teacherList.length > 0) {
2781
- let list = teacherList.filter((v)=>v.name == keyWord.trim());
2782
- if (list.length > 0) {
2783
- //直接进入召唤老师回答模式
2784
- enterTeacherChat(list[0]);
2785
- setButtomHei(45);
2786
- return;
2787
- }
2788
- }
2789
2684
  //跟老师对话
2790
- let roomList = contactsList;
2791
- if (roomList.length > 0 && roomList[0].roomId != roomId) {
2685
+ if (contactsList.length > 0 && contactsList[0].roomId != roomId) {
2792
2686
  sendToTeacher(2);
2793
2687
  } else {
2794
2688
  setFinished(false);
2795
- clearTimeout(timer.current);
2796
2689
  setQuestionsList([]);
2797
- setAnswerMode(-1);
2798
- setTeacherList([]);
2799
- setTimeout(()=>{
2800
- setQuestionsList([]);
2801
- setTeacherList([]);
2802
- clearTimeout(timer.current);
2803
- }, 200);
2804
- setHistoryMessageList((historyMessageList)=>{
2805
- return historyMessageList.filter((item)=>item.id != "-1");
2806
- });
2807
2690
  sendMessage("", 0);
2808
2691
  }
2692
+ setTimeout(()=>{
2693
+ setQuestionsList([]);
2694
+ clearTimeout(timer.current);
2695
+ }, 200);
2696
+ resettingBottomHei();
2809
2697
  setButtomHei(45);
2810
2698
  } else {
2811
- console.log("回车事件");
2812
2699
  resettingBottomHei();
2813
2700
  }
2814
2701
  },
@@ -2842,7 +2729,7 @@ const CustomerService = (props)=>{
2842
2729
  })
2843
2730
  ]
2844
2731
  }),
2845
- userData.modules.some((item)=>item.short == "AIservice") && contactsList.length > 0 && contactsList[0].roomId == roomId && /*#__PURE__*/ _jsx("p", {
2732
+ (userData.modules.some((item)=>item.short == "AIservice") || contactsList.length > 0 && contactsList[0].roomId !== roomId) && /*#__PURE__*/ _jsx("p", {
2846
2733
  className: styles.screenshot,
2847
2734
  children: /*#__PURE__*/ _jsx("i", {
2848
2735
  className: `${!finished ? styles.disabled : ""}`,
@@ -2869,36 +2756,20 @@ const CustomerService = (props)=>{
2869
2756
  setCitationContent({});
2870
2757
  setButtomHei(45);
2871
2758
  if (keyWord.trim() != "") {
2872
- //查找是否是召唤老师回答并有相应的老师名称
2873
- if (answerMode == 1 && teacherList.length > 0) {
2874
- let list = teacherList.filter((v)=>v.name == keyWord.trim());
2875
- if (list.length > 0) {
2876
- //直接进入召唤老师回答模式
2877
- enterTeacherChat(list[0]);
2878
- setButtomHei(45);
2879
- return;
2880
- }
2881
- }
2882
2759
  setKeyWord("");
2883
2760
  //跟老师对话
2884
- let roomList = contactsList;
2885
- if (roomList.length > 0 && roomList[0].roomId != roomId) {
2761
+ if (contactsList.length > 0 && contactsList[0].roomId != roomId) {
2886
2762
  sendToTeacher(2);
2887
2763
  } else {
2888
2764
  clearTimeout(timer.current);
2889
2765
  setQuestionsList([]);
2890
- setAnswerMode(-1);
2891
- setTeacherList([]);
2892
- setTimeout(()=>{
2893
- setQuestionsList([]);
2894
- setTeacherList([]);
2895
- clearTimeout(timer.current);
2896
- }, 200);
2897
- setHistoryMessageList((historyMessageList)=>{
2898
- return historyMessageList.filter((item)=>item.id != "-1");
2899
- });
2900
2766
  sendMessage("", 0);
2901
2767
  }
2768
+ resettingBottomHei();
2769
+ setTimeout(()=>{
2770
+ setQuestionsList([]);
2771
+ clearTimeout(timer.current);
2772
+ }, 200);
2902
2773
  onEvent(serverName + serverUrl(), "click_智能问答_ Enter", "提交");
2903
2774
  }
2904
2775
  },
@@ -2910,15 +2781,12 @@ const CustomerService = (props)=>{
2910
2781
  };
2911
2782
  //进入与老师的聊天
2912
2783
  const enterTeacherChat = (item)=>{
2913
- setTeacherList([]);
2784
+ setShowTeacherList(false);
2914
2785
  //提问的问题
2915
- setProblem({
2786
+ setProblem(_object_spread_props(_object_spread({}, problem), {
2916
2787
  question: problem.question,
2917
2788
  user: item.uid
2918
- });
2919
- setKeyWord("");
2920
- //setUpdateRecords(true);
2921
- setAnswerMode(-1);
2789
+ }));
2922
2790
  setChatWith(item);
2923
2791
  let roomList = contactsList;
2924
2792
  let list = roomList.filter((e)=>e.sender == item.uid);
@@ -2927,7 +2795,6 @@ const CustomerService = (props)=>{
2927
2795
  setRoomId(list[0].roomId); //已有聊天室
2928
2796
  } else {
2929
2797
  createRooms(item.uid).then((res)=>{
2930
- // childRef.current.roomsListTimer();
2931
2798
  roomsListTimer();
2932
2799
  let id = res.data.id;
2933
2800
  setRoomId(id); //新的聊天室id
@@ -2936,80 +2803,45 @@ const CustomerService = (props)=>{
2936
2803
  };
2937
2804
  //渲染联想问题及联想的老师名称
2938
2805
  const renderAssociationProblem = ()=>{
2939
- if (answerMode == 1) {
2940
- return /*#__PURE__*/ _jsx("div", {
2941
- className: `${styles.issues_list} ${styles.issues_list_teacherList}`,
2942
- style: {
2943
- bottom: `${buttomHei + 14}px`
2944
- },
2945
- children: teacherList.map((item)=>{
2946
- let reg = /[`~!@#$%^&*()_\-+=<>?:"{}|,.\/;'\\[\]·~!@#¥%……&*()——\-+={}|《》?:“”【】、;‘’,。、]/im;
2947
- let span = '';
2948
- //搜索内容是否有特殊字符
2949
- if (reg.test(keyWord)) {
2950
- span = item.name.replaceAll(keyWord, (e)=>{
2951
- return `<span class=${styles.sign}>${e}</span>`;
2952
- });
2953
- } else {
2954
- span = item.name.replaceAll(new RegExp(keyWord, "ig"), (i)=>{
2955
- // console.log(i,'skdcnsdjk')
2956
- return `<span class=${styles.sign}>${i}</span>`;
2957
- });
2958
- }
2806
+ return /*#__PURE__*/ _jsx("div", {
2807
+ className: styles.issues_list,
2808
+ style: {
2809
+ bottom: `${buttomHei + 6}px`
2810
+ },
2811
+ children: questionsList.map((item, i)=>{
2812
+ if (i > 4) return '';
2813
+ let reg = /[`~!@#$%^&*()_\-+=<>?:"{}|,.\/;'\\[\]·~!@#¥%……&*()——\-+={}|《》?:“”【】、;‘’,。、]/im;
2814
+ let span = '';
2815
+ //搜索内容是否有特殊字符
2816
+ if (reg.test(keyWord)) {
2817
+ span = item.question.replaceAll(keyWord, (e)=>{
2818
+ return `<span class=${styles.sign}>${e}</span>`;
2819
+ });
2820
+ } else {
2821
+ span = item.question.replaceAll(new RegExp(keyWord, "ig"), (i)=>{
2822
+ // console.log(i,'skdcnsdjk')
2823
+ return `<span class=${styles.sign}>${i}</span>`;
2824
+ });
2825
+ }
2826
+ if (userData.modules.some((item)=>item.short == "AIservice") || item.answer) {
2959
2827
  return /*#__PURE__*/ _jsx("p", {
2960
2828
  className: styles.item,
2961
2829
  children: /*#__PURE__*/ _jsx("span", {
2962
2830
  onClick: ()=>{
2963
- enterTeacherChat(item);
2831
+ sendMessage(item, 2, 'AssociativeProblem');
2832
+ setKeyWord("");
2833
+ onEvent(serverName + serverUrl(), "click_智能问答_ 发送", "提交");
2964
2834
  },
2965
2835
  dangerouslySetInnerHTML: {
2966
2836
  __html: span
2967
2837
  }
2968
2838
  })
2969
2839
  });
2970
- })
2971
- });
2972
- } else {
2973
- return /*#__PURE__*/ _jsx("div", {
2974
- className: styles.issues_list,
2975
- style: {
2976
- bottom: `${buttomHei + 6}px`
2977
- },
2978
- children: questionsList.map((item, i)=>{
2979
- if (i > 4) return '';
2980
- let reg = /[`~!@#$%^&*()_\-+=<>?:"{}|,.\/;'\\[\]·~!@#¥%……&*()——\-+={}|《》?:“”【】、;‘’,。、]/im;
2981
- let span = '';
2982
- //搜索内容是否有特殊字符
2983
- if (reg.test(keyWord)) {
2984
- span = item.question.replaceAll(keyWord, (e)=>{
2985
- return `<span class=${styles.sign}>${e}</span>`;
2986
- });
2987
- } else {
2988
- span = item.question.replaceAll(new RegExp(keyWord, "ig"), (i)=>{
2989
- // console.log(i,'skdcnsdjk')
2990
- return `<span class=${styles.sign}>${i}</span>`;
2991
- });
2992
- }
2993
- if (userData.modules.some((item)=>item.short == "AIservice") || item.answer) {
2994
- return /*#__PURE__*/ _jsx("p", {
2995
- className: styles.item,
2996
- children: /*#__PURE__*/ _jsx("span", {
2997
- onClick: ()=>{
2998
- sendMessage(item, 2, 'AssociativeProblem');
2999
- setKeyWord("");
3000
- onEvent(serverName + serverUrl(), "click_智能问答_ 发送", "提交");
3001
- },
3002
- dangerouslySetInnerHTML: {
3003
- __html: span
3004
- }
3005
- })
3006
- });
3007
- } else {
3008
- return null;
3009
- }
3010
- })
3011
- });
3012
- }
2840
+ } else {
2841
+ return null;
2842
+ }
2843
+ })
2844
+ });
3013
2845
  };
3014
2846
  //视频页面底部推荐问题
3015
2847
  const renderBottomAssociationProblem = ()=>{
@@ -3181,6 +3013,16 @@ const CustomerService = (props)=>{
3181
3013
  setShowHistory(false);
3182
3014
  },
3183
3015
  loadSpecifiedData: loadSpecifiedData
3016
+ }),
3017
+ showType == 1 && showTeacherList && /*#__PURE__*/ _jsx(TeacherList, {
3018
+ type: showType,
3019
+ userData: userData,
3020
+ http: http,
3021
+ urllocation: urllocation,
3022
+ onClose: ()=>{
3023
+ setShowTeacherList(false);
3024
+ },
3025
+ enterTeacherChat: enterTeacherChat
3184
3026
  })
3185
3027
  ]
3186
3028
  }),
@@ -3268,6 +3110,16 @@ const CustomerService = (props)=>{
3268
3110
  setShowHistory(false);
3269
3111
  },
3270
3112
  loadSpecifiedData: loadSpecifiedData
3113
+ }),
3114
+ showType == 2 && showTeacherList && /*#__PURE__*/ _jsx(TeacherList, {
3115
+ type: showType,
3116
+ userData: userData,
3117
+ http: http,
3118
+ urllocation: urllocation,
3119
+ onClose: ()=>{
3120
+ setShowTeacherList(false);
3121
+ },
3122
+ enterTeacherChat: enterTeacherChat
3271
3123
  })
3272
3124
  ]
3273
3125
  })
@@ -3365,6 +3217,16 @@ const CustomerService = (props)=>{
3365
3217
  },
3366
3218
  loadSpecifiedData: loadSpecifiedData
3367
3219
  }),
3220
+ showType == 3 && showTeacherList && /*#__PURE__*/ _jsx(TeacherList, {
3221
+ type: showType,
3222
+ userData: userData,
3223
+ http: http,
3224
+ urllocation: urllocation,
3225
+ onClose: ()=>{
3226
+ setShowTeacherList(false);
3227
+ },
3228
+ enterTeacherChat: enterTeacherChat
3229
+ }),
3368
3230
  showType == 3 && /*#__PURE__*/ _jsx("div", {
3369
3231
  style: {
3370
3232
  display: `${showType == 3 && showContacts && roomId != "" ? "block" : "none"}`
@@ -3472,6 +3334,16 @@ const CustomerService = (props)=>{
3472
3334
  setShowHistory(false);
3473
3335
  },
3474
3336
  loadSpecifiedData: loadSpecifiedData
3337
+ }),
3338
+ showTeacherList && /*#__PURE__*/ _jsx(TeacherList, {
3339
+ type: showType,
3340
+ userData: userData,
3341
+ http: http,
3342
+ urllocation: urllocation,
3343
+ onClose: ()=>{
3344
+ setShowTeacherList(false);
3345
+ },
3346
+ enterTeacherChat: enterTeacherChat
3475
3347
  })
3476
3348
  ]
3477
3349
  })
@@ -3579,6 +3451,7 @@ const CustomerService = (props)=>{
3579
3451
  (showType == 5 || showScreenshot) && imgBese64 && /*#__PURE__*/ _jsx(ScreenshotTool, {
3580
3452
  imgBese64: imgBese64,
3581
3453
  saveScreenshotBese64: (base64)=>{
3454
+ newShowType.current = false;
3582
3455
  setScreenshotBese64(base64);
3583
3456
  if (saveShowType != -1) {
3584
3457
  setShowType(saveShowType);
@@ -3588,6 +3461,7 @@ const CustomerService = (props)=>{
3588
3461
  setShowScreenshot(false);
3589
3462
  },
3590
3463
  cancelScreenshot: ()=>{
3464
+ newShowType.current = false;
3591
3465
  if (saveShowType != -1) {
3592
3466
  setShowType(saveShowType);
3593
3467
  } else {