bhd-components 0.7.19 → 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, {
@@ -309,10 +313,10 @@ const CustomerService = (props)=>{
309
313
  let watchTime = params.videoProgress;
310
314
  let courseId = getQuery('yc_id');
311
315
  let sectionId = params.VideoBriefSummaryId;
312
- // let courseId="31007",
313
- // sectionId= "446168",
314
- // videoId= "71399",
315
- // watchTime= 527
316
+ // let courseId="20899",
317
+ // sectionId= "462368",
318
+ // videoId= "29832",
319
+ // watchTime= 753
316
320
  if (videoId && courseId && sectionId) {
317
321
  http.post(`${urllocation}/chat-service/public/v1.0/knowledge-base/questions:recommend`, {
318
322
  "recommendedQuestions": [],
@@ -332,16 +336,22 @@ const CustomerService = (props)=>{
332
336
  let questionsList = null;
333
337
  if (data.length > 0) {
334
338
  questionsList = data.map((item, index)=>{
335
- return {
336
- key: "messageSource",
337
- value: item.id,
338
- question: item.question,
339
- answer: item.answer
340
- };
339
+ if (userData.modules.some((item)=>item.short == "AIservice") || item.answer) {
340
+ return {
341
+ key: "messageSource",
342
+ value: item.id,
343
+ question: item.question,
344
+ answer: item.answer
345
+ };
346
+ } else {
347
+ return null;
348
+ }
341
349
  });
350
+ questionsList = questionsList.filter((i)=>i != null);
342
351
  recommendeQuestionID.current = data.map((item)=>{
343
352
  return item.id;
344
353
  });
354
+ console.log(recommendeQuestionID.current, 4444444);
345
355
  }
346
356
  console.log('dflkvmdfklvdf欢迎语', data);
347
357
  let obj = {
@@ -540,7 +550,7 @@ const CustomerService = (props)=>{
540
550
  });
541
551
  };
542
552
  //消息发送给老师type == 1,召唤老师时发送,type == 2,在老师聊天窗口聊天
543
- const sendToTeacher = (type)=>{
553
+ const sendToTeacher = (type, message = '')=>{
544
554
  console.log("消息发送给老师111");
545
555
  let obj = {};
546
556
  if (type == 1) {
@@ -550,8 +560,11 @@ const CustomerService = (props)=>{
550
560
  recevier: chatWith.uid,
551
561
  message: problem.question
552
562
  };
563
+ if (problem.url) {
564
+ obj.image = problem.url;
565
+ }
553
566
  setProblem({});
554
- } else if (type == 2) {
567
+ } else if (type == 2 || type == 3) {
555
568
  let list = contactsList.filter((item)=>item.roomId == roomId);
556
569
  let recevier = "";
557
570
  if (list.length > 0) {
@@ -561,9 +574,13 @@ const CustomerService = (props)=>{
561
574
  roomId: roomId,
562
575
  sender: mid,
563
576
  recevier: recevier,
564
- message: keyWord,
577
+ message: type == 2 ? keyWord : message,
565
578
  quotedMessage: citationContent.content || ""
566
579
  };
580
+ if (screenshotBese64) {
581
+ obj.image = screenshotBese64;
582
+ setScreenshotBese64("");
583
+ }
567
584
  }
568
585
  http.post(`${urllocation}/chat-service/public/v1.0/chat-with-user/messages`, obj).then((res)=>{
569
586
  if (res.data.id) {
@@ -574,7 +591,13 @@ const CustomerService = (props)=>{
574
591
  id: res.data.id,
575
592
  upvoted: false,
576
593
  downvoted: false,
577
- createdAt: getDataTime(-1)
594
+ createdAt: getDataTime(-1),
595
+ extraInfo: obj.image ? JSON.stringify([
596
+ {
597
+ key: "imageUrl",
598
+ value: obj.image
599
+ }
600
+ ]) : null
578
601
  }));
579
602
  return newHistoryMessageList;
580
603
  });
@@ -1205,8 +1228,9 @@ const CustomerService = (props)=>{
1205
1228
  roomMessage.current = setTimeout(()=>{
1206
1229
  getRoomidHistoryMessage(totalNumber, rid);
1207
1230
  }, 5000);
1208
- if (rid == "") return;
1209
- // console.log(roomList,2222222);
1231
+ // console.log(showType, imgBese64,showScreenshot,newShowType.current,9999999);
1232
+ //newShowType.current 截图中,不循环
1233
+ if (rid == "" || newShowType.current) return;
1210
1234
  return http.get(`${urllocation}/chat-service/public/v1.0/history-messages`, {
1211
1235
  params: {
1212
1236
  roomId: rid,
@@ -1464,19 +1488,6 @@ const CustomerService = (props)=>{
1464
1488
  }
1465
1489
  }
1466
1490
  };
1467
- //获取老师列表
1468
- const getTeacherList = (keyWord)=>{
1469
- http.get(`${urllocation}/chat-service/public/v1.0/teachers`, {
1470
- params: {
1471
- name: keyWord
1472
- }
1473
- }).then((res)=>{
1474
- console.log(res);
1475
- if (res.data) {
1476
- setTeacherList(res.data.teachers);
1477
- }
1478
- });
1479
- };
1480
1491
  //获取聊天室列表
1481
1492
  const roomsListTimer = ()=>{
1482
1493
  if (chatRoomList != null) clearTimeout(chatRoomList.current);
@@ -2021,7 +2032,7 @@ const CustomerService = (props)=>{
2021
2032
  ]
2022
2033
  })
2023
2034
  }),
2024
- showType == 2 || showType == 4 ? /*#__PURE__*/ _jsx("div", {
2035
+ (showType == 2 || showType == 4) && /*#__PURE__*/ _jsx("div", {
2025
2036
  className: styles.head_sculpture,
2026
2037
  style: {
2027
2038
  marginLeft: "12px"
@@ -2029,7 +2040,7 @@ const CustomerService = (props)=>{
2029
2040
  children: /*#__PURE__*/ _jsx("img", {
2030
2041
  src: userData.avatar
2031
2042
  })
2032
- }) : ""
2043
+ })
2033
2044
  ]
2034
2045
  }, item.id)
2035
2046
  ]
@@ -2139,24 +2150,7 @@ const CustomerService = (props)=>{
2139
2150
  ]
2140
2151
  }),
2141
2152
  //findTeacher//是否在召唤老师过程中,是否是最后一条消息
2142
- !item.findTeacher && historyMessageList.length - 1 == i && item.id != "123456" && item.id != '123456_date' && renderLastOperateBtn(item, isAiChatWindow, i),
2143
- //召唤老师回答按钮
2144
- isAiChatWindow && item.findTeacher && userData.modules.some((item)=>item.short == "TeacherAnswer") && /*#__PURE__*/ _jsx("div", {
2145
- className: `${styles.operate_modal_bottom} `,
2146
- children: /*#__PURE__*/ _jsx("p", {
2147
- className: styles.stop_findTeacher,
2148
- children: /*#__PURE__*/ _jsx("span", {
2149
- onClick: ()=>{
2150
- setAnswerMode(-1);
2151
- setTeacherList([]);
2152
- setHistoryMessageList((historyMessageList)=>{
2153
- return historyMessageList.filter((item)=>item.id != "-1");
2154
- });
2155
- },
2156
- children: "停止召唤老师"
2157
- })
2158
- })
2159
- })
2153
+ !item.findTeacher && historyMessageList.length - 1 == i && item.id != "123456" && item.id != '123456_date' && renderLastOperateBtn(item, isAiChatWindow, i)
2160
2154
  ]
2161
2155
  })
2162
2156
  ]
@@ -2202,50 +2196,24 @@ const CustomerService = (props)=>{
2202
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") {
2203
2197
  return "";
2204
2198
  }
2205
- // console.log(historyMessageList,i,'sdcsd;sldcscsdsd')
2206
- //根据上一行数据,判断是否显示招唤老师按钮
2207
- let showTeacherBtn = true;
2208
- let previousLineData = historyMessageList[i - 1];
2209
- if (!previousLineData) {
2210
- showTeacherBtn = true;
2211
- } else if (!previousLineData.extraInfo) {
2212
- showTeacherBtn = true;
2213
- } else if (JSON.parse(previousLineData.extraInfo).length > 0 && JSON.parse(previousLineData.extraInfo)[0].key == "imageUrl") {
2214
- showTeacherBtn = false;
2215
- }
2216
2199
  return /*#__PURE__*/ _jsxs("p", {
2217
2200
  className: styles.operate,
2218
2201
  children: [
2219
2202
  // 不在智能客服窗口,并已经点击了召唤老师,并有召唤老师权限
2220
- 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", {
2221
2204
  className: styles.ask_question,
2222
2205
  onClick: ()=>{
2223
- 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
+ }
2224
2212
  setProblem({
2225
2213
  question: historyMessageList[i - 1].message,
2226
- user: problem.user
2227
- });
2228
- setHistoryMessageList((historyMessageList)=>{
2229
- let newHistoryMessageList = historyMessageList.concat({
2230
- id: -1,
2231
- roomId: roomId,
2232
- sender: "AI",
2233
- recevier: mid,
2234
- message: "请告诉我您要召唤的老师名字",
2235
- createdAt: getDataTime(-1),
2236
- findTeacher: true,
2237
- extraInfo: item.extraInfo == null ? null : JSON.stringify([
2238
- {
2239
- key: "questionId",
2240
- value: "questionId"
2241
- }
2242
- ])
2243
- });
2244
- return newHistoryMessageList;
2214
+ url
2245
2215
  });
2246
- setTimeout(()=>{
2247
- scrollToBottom();
2248
- }, 200);
2216
+ setShowTeacherList(true);
2249
2217
  },
2250
2218
  children: "召唤老师回答"
2251
2219
  }),
@@ -2258,7 +2226,6 @@ const CustomerService = (props)=>{
2258
2226
  });
2259
2227
  resettingBottomHei();
2260
2228
  onEvent(serverName + serverUrl(), "click_智能问答_引用", "提交");
2261
- console.log("引用222222");
2262
2229
  },
2263
2230
  children: /*#__PURE__*/ _jsx(CustomQuote, {})
2264
2231
  }),
@@ -2295,7 +2262,6 @@ const CustomerService = (props)=>{
2295
2262
  if (!isAiChatWindow) return;
2296
2263
  //只有最后一条回答,支持发送点赞或踩
2297
2264
  if (!item.upvoted && (historyMessageList.length == i + 1 || historyMessageList.length - 2 == i)) {
2298
- console.log("判断是AI还是智能问答", item);
2299
2265
  if (!item.extraInfo && item.sender == "AI") {
2300
2266
  aiSendQuestions(1, {
2301
2267
  roomId: roomId,
@@ -2305,7 +2271,6 @@ const CustomerService = (props)=>{
2305
2271
  generateUpvoteOrDownvoteMessage: true
2306
2272
  }, 1);
2307
2273
  } else {
2308
- console.log("AI回答2255555");
2309
2274
  sendGreetingMessage(2);
2310
2275
  }
2311
2276
  }
@@ -2363,17 +2328,6 @@ const CustomerService = (props)=>{
2363
2328
  if (!showStopBtn && isAiChatWindow && (extraInfo != undefined && JSON.parse(extraInfo).length > 0 && JSON.parse(extraInfo)[0].key == "questionId" || extraInfo == null)) {
2364
2329
  findTeacherBtn = true;
2365
2330
  }
2366
- //根据上一行数据,判断是否显示招唤老师按钮
2367
- let showTeacherBtn = true;
2368
- let previousLineData = historyMessageList[i - 1];
2369
- if (!previousLineData) {
2370
- showTeacherBtn = true;
2371
- } else if (!previousLineData.extraInfo) {
2372
- showTeacherBtn = true;
2373
- } else if (JSON.parse(previousLineData.extraInfo).length > 0 && JSON.parse(previousLineData.extraInfo)[0].key == "imageUrl") {
2374
- showTeacherBtn = false;
2375
- }
2376
- /// style={{position:showStopBtn && isPosition.current ? 'sticky' : 'relative'}}
2377
2331
  return /*#__PURE__*/ _jsxs("div", {
2378
2332
  className: `${styles.operate_modal_bottom}`,
2379
2333
  children: [
@@ -2418,35 +2372,19 @@ const CustomerService = (props)=>{
2418
2372
  ]
2419
2373
  }),
2420
2374
  //在ai窗口并ai已经生成完答案
2421
- findTeacherBtn && userData.modules.some((item)=>item.short == "TeacherAnswer") && showTeacherBtn && /*#__PURE__*/ _jsx("span", {
2375
+ findTeacherBtn && userData.modules.some((item)=>item.short == "TeacherAnswer") && /*#__PURE__*/ _jsx("span", {
2422
2376
  className: styles.find_teacher,
2423
2377
  onClick: ()=>{
2424
- 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
+ }
2425
2383
  setProblem({
2426
2384
  question: historyMessageList[i - 1].message,
2427
- user: problem.user
2428
- });
2429
- setHistoryMessageList((historyMessageList)=>{
2430
- let newHistoryMessageList = historyMessageList.concat({
2431
- id: -1,
2432
- roomId: roomId,
2433
- sender: "AI",
2434
- recevier: mid,
2435
- message: "请告诉我您要召唤的老师名字",
2436
- createdAt: getDataTime(-1),
2437
- findTeacher: true,
2438
- extraInfo: item.extraInfo == null ? null : JSON.stringify([
2439
- {
2440
- key: "questionId",
2441
- value: "questionId"
2442
- }
2443
- ])
2444
- });
2445
- return newHistoryMessageList;
2385
+ url
2446
2386
  });
2447
- setTimeout(()=>{
2448
- scrollToBottom();
2449
- }, 200);
2387
+ setShowTeacherList(true);
2450
2388
  },
2451
2389
  children: "召唤老师回答"
2452
2390
  })
@@ -2592,6 +2530,44 @@ const CustomerService = (props)=>{
2592
2530
  }
2593
2531
  }
2594
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
+ };
2595
2571
  //渲染底部按钮
2596
2572
  const renderBottomAnt = ()=>{
2597
2573
  let placeholder = "";
@@ -2649,35 +2625,7 @@ const CustomerService = (props)=>{
2649
2625
  children: [
2650
2626
  /*#__PURE__*/ _jsxs("p", {
2651
2627
  onClick: ()=>{
2652
- setHistoryMessageList((historyMessageList)=>{
2653
- let newHistoryMessageList = historyMessageList.concat({
2654
- id: 'p' + new Date().getTime(),
2655
- roomId: roomId,
2656
- sender: mid,
2657
- recevier: 'AI',
2658
- message: "讲解这张图片涉及到的知识内容",
2659
- createdAt: getDataTime(-1),
2660
- extraInfo: JSON.stringify([
2661
- {
2662
- key: "imageUrl",
2663
- value: screenshotBese64
2664
- }
2665
- ])
2666
- });
2667
- return newHistoryMessageList;
2668
- });
2669
- scrollToBottom();
2670
- aiSendQuestions(3, {
2671
- //相关数据
2672
- roomId: roomId,
2673
- message: '讲解这张图片涉及到的知识内容',
2674
- image: screenshotBese64,
2675
- quotedMessage: citationContent.content || "",
2676
- regenerate: citationContent.content != "" ? false : true,
2677
- generateUpvoteOrDownvoteMessage: false
2678
- }, 1);
2679
- setScreenshotBese64('');
2680
- resettingBottomHei();
2628
+ sendScreenshotData('讲解这张图片涉及到的知识内容');
2681
2629
  },
2682
2630
  children: [
2683
2631
  /*#__PURE__*/ _jsx(CustomKnowledgeContent, {}),
@@ -2687,35 +2635,7 @@ const CustomerService = (props)=>{
2687
2635
  /*#__PURE__*/ _jsx("br", {}),
2688
2636
  /*#__PURE__*/ _jsxs("p", {
2689
2637
  onClick: ()=>{
2690
- setHistoryMessageList((historyMessageList)=>{
2691
- let newHistoryMessageList = historyMessageList.concat({
2692
- id: 'p' + new Date().getTime(),
2693
- roomId: roomId,
2694
- sender: mid,
2695
- recevier: 'AI',
2696
- message: "帮助我更深入地理解图片中的概念",
2697
- createdAt: getDataTime(-1),
2698
- extraInfo: JSON.stringify([
2699
- {
2700
- key: "imageUrl",
2701
- value: screenshotBese64
2702
- }
2703
- ])
2704
- });
2705
- return newHistoryMessageList;
2706
- });
2707
- scrollToBottom();
2708
- aiSendQuestions(3, {
2709
- //相关数据
2710
- roomId: roomId,
2711
- message: '帮助我更深入地理解图片中的概念',
2712
- image: screenshotBese64,
2713
- quotedMessage: citationContent.content || "",
2714
- regenerate: citationContent.content != "" ? false : true,
2715
- generateUpvoteOrDownvoteMessage: false
2716
- }, 1);
2717
- setScreenshotBese64('');
2718
- resettingBottomHei();
2638
+ sendScreenshotData('帮助我更深入地理解图片中的概念');
2719
2639
  },
2720
2640
  children: [
2721
2641
  /*#__PURE__*/ _jsx(CustomWenhaoRound, {}),
@@ -2737,22 +2657,14 @@ const CustomerService = (props)=>{
2737
2657
  setKeyWord(e.target.value);
2738
2658
  if (e.target.value == "") {
2739
2659
  setQuestionsList([]);
2740
- setTeacherList([]);
2741
2660
  clearTimeout(timer.current);
2742
2661
  } else {
2743
2662
  clearTimeout(timer.current);
2744
2663
  timer.current = setTimeout(()=>{
2745
- if (answerMode == 1) {
2746
- getTeacherList(String(e.target.value));
2664
+ if (config && config.type == 'video') {
2665
+ getQuestiionsList(String(e.target.value), 3);
2747
2666
  } else {
2748
- let roomList = contactsList;
2749
- if (roomList.length > 0 && roomList[0].roomId != roomId) return;
2750
- console.log(props, 333333);
2751
- if (config && config.type == 'video') {
2752
- getQuestiionsList(String(e.target.value), 3);
2753
- } else {
2754
- getQuestiionsList(String(e.target.value), 2);
2755
- }
2667
+ getQuestiionsList(String(e.target.value), 2);
2756
2668
  }
2757
2669
  }, 1000);
2758
2670
  }
@@ -2769,40 +2681,21 @@ const CustomerService = (props)=>{
2769
2681
  setKeyWord("");
2770
2682
  setCitationContent({});
2771
2683
  setBottomRecommendationQuestions([]);
2772
- resettingBottomHei();
2773
- //查找是否是召唤老师回答并有相应的老师名称
2774
- if (answerMode == 1 && teacherList.length > 0) {
2775
- let list = teacherList.filter((v)=>v.name == keyWord.trim());
2776
- if (list.length > 0) {
2777
- //直接进入召唤老师回答模式
2778
- enterTeacherChat(list[0]);
2779
- setButtomHei(45);
2780
- return;
2781
- }
2782
- }
2783
2684
  //跟老师对话
2784
- let roomList = contactsList;
2785
- if (roomList.length > 0 && roomList[0].roomId != roomId) {
2685
+ if (contactsList.length > 0 && contactsList[0].roomId != roomId) {
2786
2686
  sendToTeacher(2);
2787
2687
  } else {
2788
2688
  setFinished(false);
2789
- clearTimeout(timer.current);
2790
2689
  setQuestionsList([]);
2791
- setAnswerMode(-1);
2792
- setTeacherList([]);
2793
- setTimeout(()=>{
2794
- setQuestionsList([]);
2795
- setTeacherList([]);
2796
- clearTimeout(timer.current);
2797
- }, 200);
2798
- setHistoryMessageList((historyMessageList)=>{
2799
- return historyMessageList.filter((item)=>item.id != "-1");
2800
- });
2801
2690
  sendMessage("", 0);
2802
2691
  }
2692
+ setTimeout(()=>{
2693
+ setQuestionsList([]);
2694
+ clearTimeout(timer.current);
2695
+ }, 200);
2696
+ resettingBottomHei();
2803
2697
  setButtomHei(45);
2804
2698
  } else {
2805
- console.log("回车事件");
2806
2699
  resettingBottomHei();
2807
2700
  }
2808
2701
  },
@@ -2836,7 +2729,7 @@ const CustomerService = (props)=>{
2836
2729
  })
2837
2730
  ]
2838
2731
  }),
2839
- 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", {
2840
2733
  className: styles.screenshot,
2841
2734
  children: /*#__PURE__*/ _jsx("i", {
2842
2735
  className: `${!finished ? styles.disabled : ""}`,
@@ -2863,36 +2756,20 @@ const CustomerService = (props)=>{
2863
2756
  setCitationContent({});
2864
2757
  setButtomHei(45);
2865
2758
  if (keyWord.trim() != "") {
2866
- //查找是否是召唤老师回答并有相应的老师名称
2867
- if (answerMode == 1 && teacherList.length > 0) {
2868
- let list = teacherList.filter((v)=>v.name == keyWord.trim());
2869
- if (list.length > 0) {
2870
- //直接进入召唤老师回答模式
2871
- enterTeacherChat(list[0]);
2872
- setButtomHei(45);
2873
- return;
2874
- }
2875
- }
2876
2759
  setKeyWord("");
2877
2760
  //跟老师对话
2878
- let roomList = contactsList;
2879
- if (roomList.length > 0 && roomList[0].roomId != roomId) {
2761
+ if (contactsList.length > 0 && contactsList[0].roomId != roomId) {
2880
2762
  sendToTeacher(2);
2881
2763
  } else {
2882
2764
  clearTimeout(timer.current);
2883
2765
  setQuestionsList([]);
2884
- setAnswerMode(-1);
2885
- setTeacherList([]);
2886
- setTimeout(()=>{
2887
- setQuestionsList([]);
2888
- setTeacherList([]);
2889
- clearTimeout(timer.current);
2890
- }, 200);
2891
- setHistoryMessageList((historyMessageList)=>{
2892
- return historyMessageList.filter((item)=>item.id != "-1");
2893
- });
2894
2766
  sendMessage("", 0);
2895
2767
  }
2768
+ resettingBottomHei();
2769
+ setTimeout(()=>{
2770
+ setQuestionsList([]);
2771
+ clearTimeout(timer.current);
2772
+ }, 200);
2896
2773
  onEvent(serverName + serverUrl(), "click_智能问答_ Enter", "提交");
2897
2774
  }
2898
2775
  },
@@ -2904,15 +2781,12 @@ const CustomerService = (props)=>{
2904
2781
  };
2905
2782
  //进入与老师的聊天
2906
2783
  const enterTeacherChat = (item)=>{
2907
- setTeacherList([]);
2784
+ setShowTeacherList(false);
2908
2785
  //提问的问题
2909
- setProblem({
2786
+ setProblem(_object_spread_props(_object_spread({}, problem), {
2910
2787
  question: problem.question,
2911
2788
  user: item.uid
2912
- });
2913
- setKeyWord("");
2914
- //setUpdateRecords(true);
2915
- setAnswerMode(-1);
2789
+ }));
2916
2790
  setChatWith(item);
2917
2791
  let roomList = contactsList;
2918
2792
  let list = roomList.filter((e)=>e.sender == item.uid);
@@ -2921,7 +2795,6 @@ const CustomerService = (props)=>{
2921
2795
  setRoomId(list[0].roomId); //已有聊天室
2922
2796
  } else {
2923
2797
  createRooms(item.uid).then((res)=>{
2924
- // childRef.current.roomsListTimer();
2925
2798
  roomsListTimer();
2926
2799
  let id = res.data.id;
2927
2800
  setRoomId(id); //新的聊天室id
@@ -2930,60 +2803,27 @@ const CustomerService = (props)=>{
2930
2803
  };
2931
2804
  //渲染联想问题及联想的老师名称
2932
2805
  const renderAssociationProblem = ()=>{
2933
- if (answerMode == 1) {
2934
- return /*#__PURE__*/ _jsx("div", {
2935
- className: `${styles.issues_list} ${styles.issues_list_teacherList}`,
2936
- style: {
2937
- bottom: `${buttomHei + 14}px`
2938
- },
2939
- children: teacherList.map((item)=>{
2940
- let reg = /[`~!@#$%^&*()_\-+=<>?:"{}|,.\/;'\\[\]·~!@#¥%……&*()——\-+={}|《》?:“”【】、;‘’,。、]/im;
2941
- let span = '';
2942
- //搜索内容是否有特殊字符
2943
- if (reg.test(keyWord)) {
2944
- span = item.name.replaceAll(keyWord, (e)=>{
2945
- return `<span class=${styles.sign}>${e}</span>`;
2946
- });
2947
- } else {
2948
- span = item.name.replaceAll(new RegExp(keyWord, "ig"), (i)=>{
2949
- // console.log(i,'skdcnsdjk')
2950
- return `<span class=${styles.sign}>${i}</span>`;
2951
- });
2952
- }
2953
- return /*#__PURE__*/ _jsx("p", {
2954
- className: styles.item,
2955
- children: /*#__PURE__*/ _jsx("span", {
2956
- onClick: ()=>{
2957
- enterTeacherChat(item);
2958
- },
2959
- dangerouslySetInnerHTML: {
2960
- __html: span
2961
- }
2962
- })
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>`;
2963
2819
  });
2964
- })
2965
- });
2966
- } else {
2967
- return /*#__PURE__*/ _jsx("div", {
2968
- className: styles.issues_list,
2969
- style: {
2970
- bottom: `${buttomHei + 6}px`
2971
- },
2972
- children: questionsList.map((item, i)=>{
2973
- if (i > 4) return '';
2974
- let reg = /[`~!@#$%^&*()_\-+=<>?:"{}|,.\/;'\\[\]·~!@#¥%……&*()——\-+={}|《》?:“”【】、;‘’,。、]/im;
2975
- let span = '';
2976
- //搜索内容是否有特殊字符
2977
- if (reg.test(keyWord)) {
2978
- span = item.question.replaceAll(keyWord, (e)=>{
2979
- return `<span class=${styles.sign}>${e}</span>`;
2980
- });
2981
- } else {
2982
- span = item.question.replaceAll(new RegExp(keyWord, "ig"), (i)=>{
2983
- // console.log(i,'skdcnsdjk')
2984
- return `<span class=${styles.sign}>${i}</span>`;
2985
- });
2986
- }
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) {
2987
2827
  return /*#__PURE__*/ _jsx("p", {
2988
2828
  className: styles.item,
2989
2829
  children: /*#__PURE__*/ _jsx("span", {
@@ -2997,9 +2837,11 @@ const CustomerService = (props)=>{
2997
2837
  }
2998
2838
  })
2999
2839
  });
3000
- })
3001
- });
3002
- }
2840
+ } else {
2841
+ return null;
2842
+ }
2843
+ })
2844
+ });
3003
2845
  };
3004
2846
  //视频页面底部推荐问题
3005
2847
  const renderBottomAssociationProblem = ()=>{
@@ -3008,21 +2850,25 @@ const CustomerService = (props)=>{
3008
2850
  className: styles.issues_list_flag,
3009
2851
  id: "BottomAssociationProblem",
3010
2852
  children: bottomRecommendationQuestions.map((item)=>{
3011
- return /*#__PURE__*/ _jsxs(_Fragment, {
3012
- children: [
3013
- /*#__PURE__*/ _jsx("p", {
3014
- onClick: ()=>{
3015
- sendMessage(item, 1);
3016
- if (config && config.type == 'video') {
3017
- setBottomRecommendationQuestions([]);
3018
- resettingBottomHei();
3019
- }
3020
- },
3021
- children: item.question
3022
- }, item.id),
3023
- /*#__PURE__*/ _jsx("br", {})
3024
- ]
3025
- });
2853
+ if (userData.modules.some((item)=>item.short == "AIservice") || item.answer) {
2854
+ return /*#__PURE__*/ _jsxs(_Fragment, {
2855
+ children: [
2856
+ /*#__PURE__*/ _jsx("p", {
2857
+ onClick: ()=>{
2858
+ sendMessage(item, 1);
2859
+ if (config && config.type == 'video') {
2860
+ setBottomRecommendationQuestions([]);
2861
+ resettingBottomHei();
2862
+ }
2863
+ },
2864
+ children: item.question
2865
+ }, item.id),
2866
+ /*#__PURE__*/ _jsx("br", {})
2867
+ ]
2868
+ });
2869
+ } else {
2870
+ return null;
2871
+ }
3026
2872
  })
3027
2873
  });
3028
2874
  } else {
@@ -3030,21 +2876,25 @@ const CustomerService = (props)=>{
3030
2876
  className: styles.issues_list_flag,
3031
2877
  id: "BottomAssociationProblem_modal",
3032
2878
  children: bottomRecommendationQuestions.map((item)=>{
3033
- return /*#__PURE__*/ _jsxs(_Fragment, {
3034
- children: [
3035
- /*#__PURE__*/ _jsx("p", {
3036
- onClick: ()=>{
3037
- sendMessage(item, 1);
3038
- if (config && config.type == 'video') {
3039
- setBottomRecommendationQuestions([]);
3040
- resettingBottomHei();
3041
- }
3042
- },
3043
- children: item.question
3044
- }, item.id),
3045
- /*#__PURE__*/ _jsx("br", {})
3046
- ]
3047
- });
2879
+ if (userData.modules.some((item)=>item.short == "AIservice") || item.answer) {
2880
+ return /*#__PURE__*/ _jsxs(_Fragment, {
2881
+ children: [
2882
+ /*#__PURE__*/ _jsx("p", {
2883
+ onClick: ()=>{
2884
+ sendMessage(item, 1);
2885
+ if (config && config.type == 'video') {
2886
+ setBottomRecommendationQuestions([]);
2887
+ resettingBottomHei();
2888
+ }
2889
+ },
2890
+ children: item.question
2891
+ }, item.id),
2892
+ /*#__PURE__*/ _jsx("br", {})
2893
+ ]
2894
+ });
2895
+ } else {
2896
+ return null;
2897
+ }
3048
2898
  })
3049
2899
  });
3050
2900
  }
@@ -3163,6 +3013,16 @@ const CustomerService = (props)=>{
3163
3013
  setShowHistory(false);
3164
3014
  },
3165
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
3166
3026
  })
3167
3027
  ]
3168
3028
  }),
@@ -3250,6 +3110,16 @@ const CustomerService = (props)=>{
3250
3110
  setShowHistory(false);
3251
3111
  },
3252
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
3253
3123
  })
3254
3124
  ]
3255
3125
  })
@@ -3347,6 +3217,16 @@ const CustomerService = (props)=>{
3347
3217
  },
3348
3218
  loadSpecifiedData: loadSpecifiedData
3349
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
+ }),
3350
3230
  showType == 3 && /*#__PURE__*/ _jsx("div", {
3351
3231
  style: {
3352
3232
  display: `${showType == 3 && showContacts && roomId != "" ? "block" : "none"}`
@@ -3454,6 +3334,16 @@ const CustomerService = (props)=>{
3454
3334
  setShowHistory(false);
3455
3335
  },
3456
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
3457
3347
  })
3458
3348
  ]
3459
3349
  })
@@ -3561,6 +3451,7 @@ const CustomerService = (props)=>{
3561
3451
  (showType == 5 || showScreenshot) && imgBese64 && /*#__PURE__*/ _jsx(ScreenshotTool, {
3562
3452
  imgBese64: imgBese64,
3563
3453
  saveScreenshotBese64: (base64)=>{
3454
+ newShowType.current = false;
3564
3455
  setScreenshotBese64(base64);
3565
3456
  if (saveShowType != -1) {
3566
3457
  setShowType(saveShowType);
@@ -3570,6 +3461,7 @@ const CustomerService = (props)=>{
3570
3461
  setShowScreenshot(false);
3571
3462
  },
3572
3463
  cancelScreenshot: ()=>{
3464
+ newShowType.current = false;
3573
3465
  if (saveShowType != -1) {
3574
3466
  setShowType(saveShowType);
3575
3467
  } else {