bhd-components 0.6.5 → 0.6.7
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.
- package/dist/{8bda9e2e.esm.es5.production.js → 0acf50ef.esm.es5.production.js} +1 -1
- package/dist/{d4259367.esm.es5.development.js → 4fa3313f.esm.es5.development.js} +1402 -1140
- package/dist/index.esm.es5.development.css +864 -732
- package/dist/index.esm.es5.development.js +945 -780
- package/dist/index.esm.es5.production.css +1 -1
- package/dist/index.esm.es5.production.js +1 -1
- package/es2017/customerService/contactsList.d.ts +1 -1
- package/es2017/customerService/contactsList.js +11 -145
- package/es2017/customerService/function.js +20 -13
- package/es2017/customerService/historyFun.js +334 -154
- package/es2017/customerService/index.js +567 -437
- package/es2017/customerService/index.module.less +169 -65
- package/es2017/customerService/index2.module.less +170 -65
- package/es2017/icons/components/custom-expand.d.ts +4 -0
- package/es2017/icons/components/custom-expand.js +22 -0
- package/es2017/icons/components/index.d.ts +1 -0
- package/es2017/icons/components/index.js +1 -0
- package/esm/customerService/contactsList.d.ts +1 -1
- package/esm/customerService/contactsList.js +11 -158
- package/esm/customerService/function.js +20 -13
- package/esm/customerService/historyFun.js +338 -167
- package/esm/customerService/index.js +557 -445
- package/esm/customerService/index.module.less +169 -65
- package/esm/customerService/index2.module.less +170 -65
- package/esm/icons/components/custom-expand.d.ts +4 -0
- package/esm/icons/components/custom-expand.js +24 -0
- package/esm/icons/components/index.d.ts +1 -0
- package/esm/icons/components/index.js +1 -0
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { z as zhCN, C as ConfigProvider, _ as _extends, a as _object_destructuring_empty, j as jsx, b as _object_spread_props, S as StyleProvider, t as transform, c as _object_spread, d as _sliced_to_array, T as Tooltip, e as Table$2, I as Icon, f as jsxs, m as message, E as ExclamationCircleFilled, P as Pagination, g as Select, h as CaretDownOutlined, M as Modal, i as _inherits, k as _create_super, l as _create_class, n as _class_call_check, o as _define_property, p as _assert_this_initialized, q as _async_to_generator, L as LeftOutlined, R as RightOutlined, r as MinusOutlined, s as PlusOutlined, u as __generator, v as Input, w as SearchOutlined, x as CloseOutlined, y as Remarkable, D as Drawer, H as HighlightJS } from './
|
|
2
|
-
export { A as Affix, B as Alert, F as Anchor, aA as App, G as AutoComplete, J as Avatar, N as BackTop, O as Badge, Q as Breadcrumb, U as Button, V as Calendar, W as Card, X as Carousel, Y as Cascader, Z as Checkbox, $ as Col, a0 as Collapse, a1 as DatePicker, a2 as Descriptions, a3 as Divider, D as Drawer, a4 as Dropdown, a5 as Empty, K as FloatButton, a6 as Form, a7 as Grid, a8 as Image, v as Input, a9 as InputNumber, aa as Layout, ab as List, ac as Mentions, ad as Menu, M as Modal, af as Popconfirm, ag as Popover, ah as Progress, aH as QRCode, ai as Radio, aj as Rate, ak as Result, al as Row, am as Segmented, g as Select, an as Skeleton, ao as Slider, ap as Space, aq as Spin, ar as Statistic, as as Steps, at as Switch, au as Tabs, av as Tag, ax as TimePicker, ay as Timeline, T as Tooltip, az as Tour, aB as Transfer, aC as Tree, aD as TreeSelect, aE as Typography, aF as Upload, aG as Watermark, aJ as en_US, ae as notification, aw as theme, aI as version, z as zh_CN } from './
|
|
1
|
+
import { z as zhCN, C as ConfigProvider, _ as _extends, a as _object_destructuring_empty, j as jsx, b as _object_spread_props, S as StyleProvider, t as transform, c as _object_spread, d as _sliced_to_array, T as Tooltip, e as Table$2, I as Icon, f as jsxs, m as message, E as ExclamationCircleFilled, P as Pagination, g as Select, h as CaretDownOutlined, M as Modal, i as _inherits, k as _create_super, l as _create_class, n as _class_call_check, o as _define_property, p as _assert_this_initialized, q as _async_to_generator, L as LeftOutlined, R as RightOutlined, r as MinusOutlined, s as PlusOutlined, u as __generator, v as Input, w as SearchOutlined, x as CloseOutlined, y as Remarkable, D as Drawer, H as HighlightJS } from './4fa3313f.esm.es5.development.js';
|
|
2
|
+
export { A as Affix, B as Alert, F as Anchor, aA as App, G as AutoComplete, J as Avatar, N as BackTop, O as Badge, Q as Breadcrumb, U as Button, V as Calendar, W as Card, X as Carousel, Y as Cascader, Z as Checkbox, $ as Col, a0 as Collapse, a1 as DatePicker, a2 as Descriptions, a3 as Divider, D as Drawer, a4 as Dropdown, a5 as Empty, K as FloatButton, a6 as Form, a7 as Grid, a8 as Image, v as Input, a9 as InputNumber, aa as Layout, ab as List, ac as Mentions, ad as Menu, M as Modal, af as Popconfirm, ag as Popover, ah as Progress, aH as QRCode, ai as Radio, aj as Rate, ak as Result, al as Row, am as Segmented, g as Select, an as Skeleton, ao as Slider, ap as Space, aq as Spin, ar as Statistic, as as Steps, at as Switch, au as Tabs, av as Tag, ax as TimePicker, ay as Timeline, T as Tooltip, az as Tour, aB as Transfer, aC as Tree, aD as TreeSelect, aE as Typography, aF as Upload, aG as Watermark, aJ as en_US, ae as notification, aw as theme, aI as version, z as zh_CN } from './4fa3313f.esm.es5.development.js';
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import { useState, useRef, useEffect, useLayoutEffect, forwardRef, useImperativeHandle } from 'react';
|
|
5
5
|
import { Fragment } from 'react/jsx-runtime';
|
|
@@ -865,6 +865,26 @@ var CustomAiIcon = function(props) {
|
|
|
865
865
|
};
|
|
866
866
|
var CustomAiIcon$1 = CustomAiIcon;
|
|
867
867
|
|
|
868
|
+
var CustomExpandSvg = function() {
|
|
869
|
+
return /*#__PURE__*/ jsx("svg", {
|
|
870
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
871
|
+
width: "1em",
|
|
872
|
+
height: "1em",
|
|
873
|
+
viewBox: "0 0 24 25",
|
|
874
|
+
"shape-rendering": "geometricPrecision",
|
|
875
|
+
fill: "currentColor",
|
|
876
|
+
children: /*#__PURE__*/ jsx("path", {
|
|
877
|
+
d: "M8.36358 5.86364C8.01211 6.21511 8.01211 6.78496 8.36358 7.13643L13.7272 12.5L8.36358 17.8636C8.01211 18.2151 8.01211 18.785 8.36358 19.1364C8.71505 19.4879 9.2849 19.4879 9.63637 19.1364L15.6364 13.1364C15.9878 12.785 15.9878 12.2151 15.6364 11.8636L9.63637 5.86364C9.2849 5.51217 8.71505 5.51217 8.36358 5.86364Z"
|
|
878
|
+
})
|
|
879
|
+
});
|
|
880
|
+
};
|
|
881
|
+
var CustomExpand = function(props) {
|
|
882
|
+
return /*#__PURE__*/ jsx(Icon, _object_spread_props(_object_spread({}, props), {
|
|
883
|
+
component: CustomExpandSvg
|
|
884
|
+
}));
|
|
885
|
+
};
|
|
886
|
+
var CustomExpand$1 = CustomExpand;
|
|
887
|
+
|
|
868
888
|
var BhdMessage = _object_spread_props(_object_spread({}, message), {
|
|
869
889
|
customSuccess: function(config) {
|
|
870
890
|
var className = modules_63b47c51$8.customSuccess;
|
|
@@ -2312,7 +2332,7 @@ function BhdAppLayout(props) {
|
|
|
2312
2332
|
});
|
|
2313
2333
|
}
|
|
2314
2334
|
|
|
2315
|
-
var modules_63b47c51 = {"service_ChatWindow_Drawer":"
|
|
2335
|
+
var modules_63b47c51 = {"service_ChatWindow_Drawer":"index_module_service_ChatWindow_Drawer__9cd6a734","ChatWindow_Modal":"index_module_ChatWindow_Modal__9cd6a734","ChatWindow_Drawer":"index_module_ChatWindow_Drawer__9cd6a734","header_wrap":"index_module_header_wrap__9cd6a734","top":"index_module_top__9cd6a734","user":"index_module_user__9cd6a734","count":"index_module_count__9cd6a734","operate":"index_module_operate__9cd6a734","line":"index_module_line__9cd6a734","header_wrap_newlabo":"index_module_header_wrap_newlabo__9cd6a734","Drawer_main":"index_module_Drawer_main__9cd6a734","loading":"index_module_loading__9cd6a734","message_con":"index_module_message_con__9cd6a734","left":"index_module_left__9cd6a734","head_sculpture":"index_module_head_sculpture__9cd6a734","main_content":"index_module_main_content__9cd6a734","right":"index_module_right__9cd6a734","main":"index_module_main__9cd6a734","main_content_flag":"index_module_main_content_flag__9cd6a734","operate_modal":"index_module_operate_modal__9cd6a734","content":"index_module_content__9cd6a734","content_child":"index_module_content_child__9cd6a734","active":"index_module_active__9cd6a734","ask_question":"index_module_ask_question__9cd6a734","operate_modal_bottom":"index_module_operate_modal_bottom__9cd6a734","stop_generate":"index_module_stop_generate__9cd6a734","icon":"index_module_icon__9cd6a734","find_teacher":"index_module_find_teacher__9cd6a734","stop_findTeacher":"index_module_stop_findTeacher__9cd6a734","association_problem":"index_module_association_problem__9cd6a734","time":"index_module_time__9cd6a734","citation_content":"index_module_citation_content__9cd6a734","text_exceed":"index_module_text_exceed__9cd6a734","popover_content":"index_module_popover_content__9cd6a734","Drawer_main_newlabo":"index_module_Drawer_main_newlabo__9cd6a734","Drawer_main_newlabo_no_pic":"index_module_Drawer_main_newlabo_no_pic__9cd6a734","Drawer_buttom_Issues_List":"index_module_Drawer_buttom_Issues_List__9cd6a734","issues_list_teacherList":"index_module_issues_list_teacherList__9cd6a734","item":"index_module_item__9cd6a734","issues_list":"index_module_issues_list__9cd6a734","sign":"index_module_sign__9cd6a734","Drawer_buttom":"index_module_Drawer_buttom__9cd6a734","input_wrap":"index_module_input_wrap__9cd6a734","input":"index_module_input__9cd6a734","no_AI":"index_module_no_AI__9cd6a734","voice":"index_module_voice__9cd6a734","voice_btn":"index_module_voice_btn__9cd6a734","disabled":"index_module_disabled__9cd6a734","content_main":"index_module_content_main__9cd6a734","content_con":"index_module_content_con__9cd6a734","delete_quote":"index_module_delete_quote__9cd6a734","sending":"index_module_sending__9cd6a734","Drawer_buttom_Issues_List_newlabo":"index_module_Drawer_buttom_Issues_List_newlabo__9cd6a734","main_list":"index_module_main_list__9cd6a734","chat_content":"index_module_chat_content__9cd6a734","popover_main_content":"index_module_popover_main_content__9cd6a734","popover_main_content_name":"index_module_popover_main_content_name__9cd6a734","teacher_layout":"index_module_teacher_layout__9cd6a734","bottom":"index_module_bottom__9cd6a734","delete":"index_module_delete__9cd6a734","num":"index_module_num__9cd6a734","shrink":"index_module_shrink__9cd6a734","teacher_layout_newlabo":"index_module_teacher_layout_newlabo__9cd6a734","teacher_layout_modal":"index_module_teacher_layout_modal__9cd6a734","ai":"index_module_ai__9cd6a734","user_info":"index_module_user_info__9cd6a734","message":"index_module_message__9cd6a734","con":"index_module_con__9cd6a734","teacher_layout_modal_newlabo":"index_module_teacher_layout_modal_newlabo__9cd6a734","history_list":"index_module_history_list__9cd6a734","search_layout":"index_module_search_layout__9cd6a734","mymove":"index_module_mymove__9cd6a734","title":"index_module_title__9cd6a734","search_top":"index_module_search_top__9cd6a734","list_item":"index_module_list_item__9cd6a734","list_summary":"index_module_list_summary__9cd6a734","head_img":"index_module_head_img__9cd6a734","list_desc":"index_module_list_desc__9cd6a734","name":"index_module_name__9cd6a734","decs":"index_module_decs__9cd6a734","open":"index_module_open__9cd6a734","list_detail":"index_module_list_detail__9cd6a734","list":"index_module_list__9cd6a734","list_more":"index_module_list_more__9cd6a734","no_data":"index_module_no_data__9cd6a734","history_list_broadside":"index_module_history_list_broadside__9cd6a734"};
|
|
2316
2336
|
|
|
2317
2337
|
//消息已读
|
|
2318
2338
|
var readMessage = function(roomId, urllocation, userData, http) {
|
|
@@ -2350,19 +2370,26 @@ var serverUrl = function() {
|
|
|
2350
2370
|
};
|
|
2351
2371
|
//复制内容
|
|
2352
2372
|
var copyText = function(text) {
|
|
2353
|
-
// text是复制文本
|
|
2354
|
-
// 创建input元素
|
|
2355
|
-
|
|
2356
|
-
// 给input元素赋值需要复制的文本
|
|
2357
|
-
el.setAttribute("value", text);
|
|
2358
|
-
// 将input元素插入页面
|
|
2359
|
-
document.body.appendChild(el);
|
|
2360
|
-
// 选中input元素的文本
|
|
2361
|
-
el.select();
|
|
2362
|
-
// 复制内容到剪贴板
|
|
2373
|
+
// // text是复制文本
|
|
2374
|
+
// // 创建input元素
|
|
2375
|
+
// const el = document.createElement("textarea");
|
|
2376
|
+
// // 给input元素赋值需要复制的文本
|
|
2377
|
+
// el.setAttribute("value", text);
|
|
2378
|
+
// // 将input元素插入页面
|
|
2379
|
+
// document.body.appendChild(el);
|
|
2380
|
+
// // 选中input元素的文本
|
|
2381
|
+
// el.select();
|
|
2382
|
+
// // 复制内容到剪贴板
|
|
2383
|
+
// document.execCommand("copy");
|
|
2384
|
+
// // 删除input元素
|
|
2385
|
+
// document.body.removeChild(el);
|
|
2386
|
+
// return true;
|
|
2387
|
+
var tempInput = document.createElement("textarea");
|
|
2388
|
+
document.body.appendChild(tempInput);
|
|
2389
|
+
tempInput.value = text;
|
|
2390
|
+
tempInput.select();
|
|
2363
2391
|
document.execCommand("copy");
|
|
2364
|
-
|
|
2365
|
-
document.body.removeChild(el);
|
|
2392
|
+
document.body.removeChild(tempInput);
|
|
2366
2393
|
return true;
|
|
2367
2394
|
};
|
|
2368
2395
|
//获取当前时间
|
|
@@ -2384,7 +2411,7 @@ var getDataTime = function(time) {
|
|
|
2384
2411
|
var hours = String(now.getHours()).padStart(2, "0");
|
|
2385
2412
|
var minutes = String(now.getMinutes()).padStart(2, "0");
|
|
2386
2413
|
var seconds = String(now.getSeconds()).padStart(2, "0");
|
|
2387
|
-
var currentDateTime = "".concat(year, "-").concat(month, "-").concat(day, " ").concat(hours, ":").concat(minutes
|
|
2414
|
+
var currentDateTime = "".concat(year, "-").concat(month, "-").concat(day, " ").concat(hours, ":").concat(minutes);
|
|
2388
2415
|
if (type == 1) {
|
|
2389
2416
|
return "".concat(year, "-").concat(month, "-").concat(day);
|
|
2390
2417
|
} else if (type == 2) {
|
|
@@ -2398,96 +2425,66 @@ var getDataTime = function(time) {
|
|
|
2398
2425
|
};
|
|
2399
2426
|
|
|
2400
2427
|
var HistoryFun = function(props) {
|
|
2401
|
-
var type = props.type
|
|
2428
|
+
var type = props.type; props.roomId; var userData = props.userData, http = props.http, urllocation = props.urllocation, onClose = props.onClose, loadSpecifiedData = props.loadSpecifiedData;
|
|
2402
2429
|
var _useState = _sliced_to_array(useState(""), 2), keyWordProblem = _useState[0], setKeyWordProblem = _useState[1]; //搜索内容
|
|
2403
|
-
var _useState1 = _sliced_to_array(useState(
|
|
2404
|
-
var _useState2 = _sliced_to_array(useState(1), 2),
|
|
2405
|
-
var _useState3 = _sliced_to_array(useState(
|
|
2406
|
-
var _useState4 = _sliced_to_array(useState(
|
|
2407
|
-
var _useState5 = _sliced_to_array(useState(
|
|
2430
|
+
var _useState1 = _sliced_to_array(useState(1), 2), showLoadingState = _useState1[0], setShowLoadingState = _useState1[1]; //1,初始状态,2、无数据 ,3、不显示图片
|
|
2431
|
+
var _useState2 = _sliced_to_array(useState(1), 2), pageNum = _useState2[0], setPageNum = _useState2[1];
|
|
2432
|
+
var _useState3 = _sliced_to_array(useState(0), 2), pageCount = _useState3[0], setPageCount = _useState3[1];
|
|
2433
|
+
var _useState4 = _sliced_to_array(useState(10), 2), maxPageSize = _useState4[0]; _useState4[1];
|
|
2434
|
+
var _useState5 = _sliced_to_array(useState([]), 2), totalData = _useState5[0], setTotalData = _useState5[1]; //总数据
|
|
2408
2435
|
var timer = useRef(null); //文本框输入时
|
|
2409
|
-
var objName = useRef([]);
|
|
2410
|
-
// useEffect(() => {
|
|
2411
|
-
// function handleScroll() {
|
|
2412
|
-
// const container = document.getElementById('history_list');
|
|
2413
|
-
// const scrollTop = container.scrollTop;
|
|
2414
|
-
// const clientHeight = container.clientHeight;
|
|
2415
|
-
// const scrollHeight = container.scrollHeight;
|
|
2416
|
-
// // console.log(scrollTop,clientHeight,scrollHeight,'333dfkvmdfv')
|
|
2417
|
-
// // if((clientHeight + scrollTop + 10) >= scrollHeight && pageCount > pageNum && pageCount > 0){
|
|
2418
|
-
// // // console.log(11111111,pageNumHistory)
|
|
2419
|
-
// // let number = pageNum + 1;
|
|
2420
|
-
// // console.log('到底部了22222',number)
|
|
2421
|
-
// // setPageNum((pageNum) => {
|
|
2422
|
-
// // return pageNum + 1;
|
|
2423
|
-
// // });
|
|
2424
|
-
// // getKeyHistoryMessage(keyWordProblem,number);
|
|
2425
|
-
// // }
|
|
2426
|
-
// }
|
|
2427
|
-
// const content = document.getElementById('history_list');
|
|
2428
|
-
// if (content) {
|
|
2429
|
-
// content.addEventListener("scroll", handleScroll);
|
|
2430
|
-
// }
|
|
2431
|
-
// return () => {
|
|
2432
|
-
// const content = document.getElementById('history_list');
|
|
2433
|
-
// if (content) {
|
|
2434
|
-
// content.removeEventListener("scroll", handleScroll);
|
|
2435
|
-
// }
|
|
2436
|
-
// };
|
|
2437
|
-
// }, [keyHistoryMessageList]);
|
|
2438
2436
|
useEffect(function() {
|
|
2439
|
-
|
|
2440
|
-
var
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
name: name
|
|
2437
|
+
function handleScroll() {
|
|
2438
|
+
var container = document.getElementById("history_list");
|
|
2439
|
+
var scrollTop = container.scrollTop;
|
|
2440
|
+
var clientHeight = container.clientHeight;
|
|
2441
|
+
var scrollHeight = container.scrollHeight;
|
|
2442
|
+
// console.log(pageCount, pageNum, "333dfkvmdfv");
|
|
2443
|
+
if (clientHeight + scrollTop + 10 >= scrollHeight && pageCount > pageNum && pageCount > 0) {
|
|
2444
|
+
// console.log("到底部了22222", number);
|
|
2445
|
+
setPageNum(function(page) {
|
|
2446
|
+
return page + 1;
|
|
2450
2447
|
});
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2448
|
+
// console.log(pageNum,444455556666)
|
|
2449
|
+
getList(keyWordProblem, pageNum + 1);
|
|
2450
|
+
}
|
|
2451
|
+
}
|
|
2452
|
+
var content = document.getElementById("history_list");
|
|
2453
|
+
if (content) {
|
|
2454
|
+
content.addEventListener("scroll", handleScroll);
|
|
2455
|
+
}
|
|
2456
|
+
return function() {
|
|
2457
|
+
var content = document.getElementById("history_list");
|
|
2458
|
+
if (content) {
|
|
2459
|
+
content.removeEventListener("scroll", handleScroll);
|
|
2460
|
+
}
|
|
2461
|
+
};
|
|
2454
2462
|
}, [
|
|
2455
|
-
|
|
2463
|
+
pageCount,
|
|
2464
|
+
pageNum
|
|
2456
2465
|
]);
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
var page = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 1;
|
|
2460
|
-
if (roomId == "") return;
|
|
2461
|
-
setLoad(false);
|
|
2462
|
-
setKeyHistoryMessageList([]);
|
|
2463
|
-
return http.get("".concat(urllocation, "/chat-service/public/v1.0/history-messages"), {
|
|
2466
|
+
var getList = function(val, pageNum) {
|
|
2467
|
+
return http.get("".concat(urllocation, "/chat-service/public/v1.0/history-messages-total"), {
|
|
2464
2468
|
params: {
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
maxPageSize: 1000,
|
|
2469
|
-
direction: "desc"
|
|
2470
|
-
},
|
|
2471
|
-
headers: {
|
|
2472
|
-
"x-module-id": userData.modules.find(function(ele) {
|
|
2473
|
-
return ele.short == "IntelligentCustomerService";
|
|
2474
|
-
}).id,
|
|
2475
|
-
"x-auth-jwt": window.localStorage.getItem("usertoken") || ""
|
|
2469
|
+
message: val,
|
|
2470
|
+
page: pageNum,
|
|
2471
|
+
maxPageSize: maxPageSize
|
|
2476
2472
|
}
|
|
2477
2473
|
}).then(function(res) {
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
setPageCount(Math.ceil(total / maxPageSize));
|
|
2474
|
+
console.log(res, 7777779999);
|
|
2475
|
+
var data = res.data;
|
|
2476
|
+
if (data.total > 0) {
|
|
2482
2477
|
setShowLoadingState(3);
|
|
2483
|
-
var
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
|
|
2478
|
+
var list = data.messageHistories;
|
|
2479
|
+
setPageCount(Math.ceil(data.total / maxPageSize));
|
|
2480
|
+
// setTotalData(totalData.concat(list));
|
|
2481
|
+
setTotalData(function(list1) {
|
|
2482
|
+
var new_list = list1;
|
|
2483
|
+
new_list = new_list.concat(list);
|
|
2484
|
+
return new_list;
|
|
2487
2485
|
});
|
|
2488
|
-
getUserName(
|
|
2486
|
+
getUserName(list);
|
|
2489
2487
|
} else {
|
|
2490
|
-
// setKeyHistoryMessageList([]);
|
|
2491
2488
|
setShowLoadingState(2);
|
|
2492
2489
|
}
|
|
2493
2490
|
}).catch(function(res) {});
|
|
@@ -2499,13 +2496,7 @@ var HistoryFun = function(props) {
|
|
|
2499
2496
|
params: {
|
|
2500
2497
|
roomId: roomId,
|
|
2501
2498
|
page: 1,
|
|
2502
|
-
maxPageSize:
|
|
2503
|
-
},
|
|
2504
|
-
headers: {
|
|
2505
|
-
"x-module-id": userData.modules.find(function(ele) {
|
|
2506
|
-
return ele.short == "IntelligentCustomerService";
|
|
2507
|
-
}).id,
|
|
2508
|
-
"x-auth-jwt": window.localStorage.getItem("usertoken") || ""
|
|
2499
|
+
maxPageSize: 99999999
|
|
2509
2500
|
}
|
|
2510
2501
|
});
|
|
2511
2502
|
};
|
|
@@ -2531,47 +2522,153 @@ var HistoryFun = function(props) {
|
|
|
2531
2522
|
}
|
|
2532
2523
|
});
|
|
2533
2524
|
var pageNumber = findPageNumber(30, Math.ceil(total / 30), number);
|
|
2534
|
-
|
|
2535
|
-
// roomId, pageNumber, id,
|
|
2536
|
-
// "第几页第几页第几页第几页第几页第几页"
|
|
2537
|
-
// );
|
|
2525
|
+
console.log(roomId, pageNumber, id, receiver, "第几页第几页第几页第几页第几页第几页");
|
|
2538
2526
|
loadSpecifiedData(roomId, pageNumber, id, receiver);
|
|
2539
2527
|
onClose();
|
|
2540
2528
|
setKeyWordProblem("");
|
|
2541
|
-
|
|
2529
|
+
setTotalData([]);
|
|
2530
|
+
// setKeyHistoryMessageList([]);
|
|
2542
2531
|
}
|
|
2543
2532
|
});
|
|
2544
2533
|
};
|
|
2545
2534
|
var getUserName = function(dataList) {
|
|
2546
2535
|
try {
|
|
2547
|
-
|
|
2548
|
-
var
|
|
2549
|
-
|
|
2550
|
-
|
|
2551
|
-
|
|
2552
|
-
|
|
2553
|
-
});
|
|
2554
|
-
filterList = filterList.filter(function(item) {
|
|
2555
|
-
return item.receiver != userData.mid && item.receiver != "AI";
|
|
2536
|
+
var list = dataList;
|
|
2537
|
+
var ids = [];
|
|
2538
|
+
list = list.map(function(item) {
|
|
2539
|
+
if (item.member != "AI") {
|
|
2540
|
+
ids.push(item.member);
|
|
2541
|
+
}
|
|
2556
2542
|
});
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
userName(item.receiver).then(function(res) {
|
|
2543
|
+
if (ids.length > 0) {
|
|
2544
|
+
userName(ids.join(",")).then(function(res) {
|
|
2560
2545
|
if (res.data) {
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2546
|
+
var nameList = res.data;
|
|
2547
|
+
setTotalData(function(list1) {
|
|
2548
|
+
var list = list1;
|
|
2549
|
+
list = list.map(function(item) {
|
|
2550
|
+
var name = nameList.filter(function(v) {
|
|
2551
|
+
return v.uid == item.member;
|
|
2552
|
+
});
|
|
2553
|
+
if (name.length > 0) {
|
|
2554
|
+
return _object_spread({}, item, name[0]);
|
|
2555
|
+
} else {
|
|
2556
|
+
return item;
|
|
2557
|
+
}
|
|
2558
|
+
});
|
|
2559
|
+
return list;
|
|
2564
2560
|
});
|
|
2565
|
-
console.log(objName, "kdfvdfdfvjkdfnv");
|
|
2566
|
-
if (obj.length == filterList.length) {
|
|
2567
|
-
objName.current = obj;
|
|
2568
|
-
setLoad(true);
|
|
2569
|
-
}
|
|
2570
2561
|
}
|
|
2571
2562
|
});
|
|
2572
|
-
}
|
|
2563
|
+
}
|
|
2564
|
+
// let objName: { id: string; name: String; }[] = [];//[{id:'用户id',name:'用户名字‘}]
|
|
2565
|
+
// let obj: any[] = [];
|
|
2566
|
+
// //去重
|
|
2567
|
+
// let res = new Map();
|
|
2568
|
+
// let filterList = dataList.filter(
|
|
2569
|
+
// (a: { receiver: string }) =>
|
|
2570
|
+
// !res.has(a.receiver) && res.set(a.receiver, 1)
|
|
2571
|
+
// );
|
|
2572
|
+
// filterList = filterList.filter(
|
|
2573
|
+
// (item) => item.receiver != userData.mid && item.receiver != "AI"
|
|
2574
|
+
// );
|
|
2575
|
+
// console.log(filterList, "wefwekfjwef");
|
|
2576
|
+
// filterList.map((item)=>{
|
|
2577
|
+
// userName(item.receiver).then((res: { data: { name: String } }) => {
|
|
2578
|
+
// if (res.data) {
|
|
2579
|
+
// obj.push({id:item.receiver,name:res.data.name,});
|
|
2580
|
+
// console.log(objName,'kdfvdfdfvjkdfnv');
|
|
2581
|
+
// if(obj.length == filterList.length){
|
|
2582
|
+
// objName.current = obj;
|
|
2583
|
+
// setLoad(true)
|
|
2584
|
+
// }
|
|
2585
|
+
// }
|
|
2586
|
+
// });
|
|
2587
|
+
// })
|
|
2573
2588
|
} catch (error) {}
|
|
2574
2589
|
};
|
|
2590
|
+
//显示详情
|
|
2591
|
+
var showDetails = function(roomId, show) {
|
|
2592
|
+
//展开
|
|
2593
|
+
if (show === true || show === false) {
|
|
2594
|
+
setTotalData(function(list) {
|
|
2595
|
+
console.log(list, 33333);
|
|
2596
|
+
var new_list = list;
|
|
2597
|
+
new_list = new_list.map(function(item) {
|
|
2598
|
+
if (roomId == item.roomId) {
|
|
2599
|
+
return _object_spread_props(_object_spread({}, item), {
|
|
2600
|
+
show: !show
|
|
2601
|
+
});
|
|
2602
|
+
} else {
|
|
2603
|
+
return _object_spread_props(_object_spread({}, item), {
|
|
2604
|
+
show: item.show == undefined ? undefined : false
|
|
2605
|
+
});
|
|
2606
|
+
}
|
|
2607
|
+
});
|
|
2608
|
+
return new_list;
|
|
2609
|
+
});
|
|
2610
|
+
} else {
|
|
2611
|
+
return http.get("".concat(urllocation, "/chat-service/public/v1.0/history-messages"), {
|
|
2612
|
+
params: {
|
|
2613
|
+
roomId: roomId,
|
|
2614
|
+
message: keyWordProblem,
|
|
2615
|
+
page: 1,
|
|
2616
|
+
maxPageSize: 20,
|
|
2617
|
+
direction: "desc"
|
|
2618
|
+
}
|
|
2619
|
+
}).then(function(res) {
|
|
2620
|
+
if (res.data.messages.length > 0) {
|
|
2621
|
+
setTotalData(function(list) {
|
|
2622
|
+
var new_list = list;
|
|
2623
|
+
new_list = new_list.map(function(item) {
|
|
2624
|
+
if (item.roomId == roomId) {
|
|
2625
|
+
return _object_spread_props(_object_spread({}, item), {
|
|
2626
|
+
detailsList: res.data.messages,
|
|
2627
|
+
pageCount: Math.ceil(res.data.total / 20),
|
|
2628
|
+
show: true,
|
|
2629
|
+
pageNum: 1
|
|
2630
|
+
});
|
|
2631
|
+
} else {
|
|
2632
|
+
return item;
|
|
2633
|
+
}
|
|
2634
|
+
});
|
|
2635
|
+
return new_list;
|
|
2636
|
+
});
|
|
2637
|
+
}
|
|
2638
|
+
});
|
|
2639
|
+
}
|
|
2640
|
+
};
|
|
2641
|
+
//加载更多
|
|
2642
|
+
var loadMore = function(pageNum, roomId) {
|
|
2643
|
+
return http.get("".concat(urllocation, "/chat-service/public/v1.0/history-messages"), {
|
|
2644
|
+
params: {
|
|
2645
|
+
roomId: roomId,
|
|
2646
|
+
message: keyWordProblem,
|
|
2647
|
+
page: pageNum,
|
|
2648
|
+
maxPageSize: 20,
|
|
2649
|
+
direction: "desc"
|
|
2650
|
+
}
|
|
2651
|
+
}).then(function(res) {
|
|
2652
|
+
if (res.data.messages.length > 0) {
|
|
2653
|
+
setTotalData(function(list) {
|
|
2654
|
+
var new_list = list;
|
|
2655
|
+
new_list = new_list.map(function(item) {
|
|
2656
|
+
if (item.roomId == roomId) {
|
|
2657
|
+
return _object_spread_props(_object_spread({}, item), {
|
|
2658
|
+
detailsList: item.detailsList.concat(res.data.messages),
|
|
2659
|
+
pageCount: Math.ceil(res.data.total / 20),
|
|
2660
|
+
show: true,
|
|
2661
|
+
pageNum: pageNum
|
|
2662
|
+
});
|
|
2663
|
+
} else {
|
|
2664
|
+
return item;
|
|
2665
|
+
}
|
|
2666
|
+
});
|
|
2667
|
+
return new_list;
|
|
2668
|
+
});
|
|
2669
|
+
}
|
|
2670
|
+
});
|
|
2671
|
+
};
|
|
2575
2672
|
var userName = function(uid) {
|
|
2576
2673
|
return http.get("".concat(urllocation, "/chat-service/public/v1.0/userinfo"), {
|
|
2577
2674
|
params: {
|
|
@@ -2579,7 +2676,7 @@ var HistoryFun = function(props) {
|
|
|
2579
2676
|
},
|
|
2580
2677
|
headers: {
|
|
2581
2678
|
"x-module-id": userData.modules.find(function(ele) {
|
|
2582
|
-
return ele.short == "
|
|
2679
|
+
return ele.short == "IntelligentCustomerService";
|
|
2583
2680
|
}).id,
|
|
2584
2681
|
"x-auth-jwt": window.localStorage.getItem("usertoken") || ""
|
|
2585
2682
|
}
|
|
@@ -2598,6 +2695,7 @@ var HistoryFun = function(props) {
|
|
|
2598
2695
|
}),
|
|
2599
2696
|
/*#__PURE__*/ jsx("span", {
|
|
2600
2697
|
onClick: function() {
|
|
2698
|
+
loadSpecifiedData();
|
|
2601
2699
|
onClose();
|
|
2602
2700
|
},
|
|
2603
2701
|
children: /*#__PURE__*/ jsx(CustomClose$1, {})
|
|
@@ -2617,11 +2715,11 @@ var HistoryFun = function(props) {
|
|
|
2617
2715
|
clearTimeout(timer.current);
|
|
2618
2716
|
timer.current = setTimeout(function() {
|
|
2619
2717
|
if (val != "") {
|
|
2620
|
-
|
|
2718
|
+
setTotalData([]);
|
|
2719
|
+
getList(val, 1);
|
|
2621
2720
|
} else {
|
|
2622
2721
|
setShowLoadingState(1);
|
|
2623
|
-
|
|
2624
|
-
setLoad(false);
|
|
2722
|
+
setTotalData([]);
|
|
2625
2723
|
}
|
|
2626
2724
|
}, 1000);
|
|
2627
2725
|
}
|
|
@@ -2631,8 +2729,7 @@ var HistoryFun = function(props) {
|
|
|
2631
2729
|
onClick: function() {
|
|
2632
2730
|
setShowLoadingState(1);
|
|
2633
2731
|
setKeyWordProblem("");
|
|
2634
|
-
|
|
2635
|
-
setLoad(false);
|
|
2732
|
+
setTotalData([]);
|
|
2636
2733
|
},
|
|
2637
2734
|
children: /*#__PURE__*/ jsx(CustomClose$1, {})
|
|
2638
2735
|
})
|
|
@@ -2664,56 +2761,157 @@ var HistoryFun = function(props) {
|
|
|
2664
2761
|
})
|
|
2665
2762
|
]
|
|
2666
2763
|
}),
|
|
2667
|
-
|
|
2668
|
-
|
|
2669
|
-
|
|
2670
|
-
|
|
2671
|
-
|
|
2672
|
-
|
|
2673
|
-
|
|
2674
|
-
|
|
2675
|
-
|
|
2676
|
-
|
|
2677
|
-
|
|
2764
|
+
/*#__PURE__*/ jsx("div", {
|
|
2765
|
+
className: modules_63b47c51.list_item,
|
|
2766
|
+
children: totalData.map(function(item) {
|
|
2767
|
+
var span = "";
|
|
2768
|
+
var time = "";
|
|
2769
|
+
if (item.count == 1) {
|
|
2770
|
+
var reg = /[`~!@#$%^&*()_\-+=<>?:"{}|,.\/;'\\[\]·~!@#¥%……&*()——\-+={}|《》?:“”【】、;‘’,。、]/im;
|
|
2771
|
+
//搜索内容是否有特殊字符
|
|
2772
|
+
if (reg.test(keyWordProblem)) {
|
|
2773
|
+
span = item.message.replaceAll(keyWordProblem, function(e) {
|
|
2774
|
+
return "<span class=".concat(modules_63b47c51.sign, ">").concat(e, "</span>");
|
|
2775
|
+
});
|
|
2776
|
+
} else {
|
|
2777
|
+
span = item.message.replaceAll(new RegExp(keyWordProblem, "ig"), function(i) {
|
|
2778
|
+
// console.log(i,'skdcnsdjk')
|
|
2779
|
+
return "<span class=".concat(modules_63b47c51.sign, ">").concat(i, "</span>");
|
|
2780
|
+
});
|
|
2781
|
+
}
|
|
2782
|
+
var currentTime = getDataTime(-1, 1); //当前时间
|
|
2783
|
+
var createdAt = getDataTime(item.createdAt, 1);
|
|
2784
|
+
if (currentTime == createdAt) {
|
|
2785
|
+
time = getDataTime(item.createdAt, 2);
|
|
2786
|
+
} else {
|
|
2787
|
+
time = getDataTime(item.createdAt);
|
|
2788
|
+
}
|
|
2678
2789
|
}
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
|
|
2682
|
-
|
|
2683
|
-
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
|
|
2693
|
-
|
|
2694
|
-
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
|
|
2701
|
-
|
|
2702
|
-
|
|
2703
|
-
|
|
2704
|
-
|
|
2705
|
-
|
|
2706
|
-
|
|
2707
|
-
|
|
2708
|
-
|
|
2709
|
-
|
|
2710
|
-
|
|
2711
|
-
|
|
2712
|
-
|
|
2713
|
-
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
|
|
2790
|
+
return /*#__PURE__*/ jsxs(Fragment, {
|
|
2791
|
+
children: [
|
|
2792
|
+
/*#__PURE__*/ jsxs("div", {
|
|
2793
|
+
className: modules_63b47c51.list_summary,
|
|
2794
|
+
id: item.roomId,
|
|
2795
|
+
onClick: function() {
|
|
2796
|
+
if (item.count == 1) {
|
|
2797
|
+
calculationData(item.roomId, item.id, item.member);
|
|
2798
|
+
} else {
|
|
2799
|
+
showDetails(item.roomId, item.show);
|
|
2800
|
+
}
|
|
2801
|
+
},
|
|
2802
|
+
children: [
|
|
2803
|
+
/*#__PURE__*/ jsx("div", {
|
|
2804
|
+
className: modules_63b47c51.head_img,
|
|
2805
|
+
children: item.member == "AI" ? /*#__PURE__*/ jsx(CustomAiIcon$1, {}) : /*#__PURE__*/ jsx("img", {
|
|
2806
|
+
src: item.headImg
|
|
2807
|
+
})
|
|
2808
|
+
}),
|
|
2809
|
+
/*#__PURE__*/ jsxs("div", {
|
|
2810
|
+
className: modules_63b47c51.list_desc,
|
|
2811
|
+
children: [
|
|
2812
|
+
/*#__PURE__*/ jsxs("p", {
|
|
2813
|
+
className: modules_63b47c51.name,
|
|
2814
|
+
children: [
|
|
2815
|
+
item.member == "AI" ? "AI助手" : item.name,
|
|
2816
|
+
item.count == 1 ? /*#__PURE__*/ jsx("span", {
|
|
2817
|
+
className: modules_63b47c51.time,
|
|
2818
|
+
children: time
|
|
2819
|
+
}) : ""
|
|
2820
|
+
]
|
|
2821
|
+
}),
|
|
2822
|
+
item.count == 1 ? /*#__PURE__*/ jsx("p", {
|
|
2823
|
+
className: modules_63b47c51.decs,
|
|
2824
|
+
style: {
|
|
2825
|
+
width: "calc(100% - 36px)"
|
|
2826
|
+
},
|
|
2827
|
+
dangerouslySetInnerHTML: {
|
|
2828
|
+
__html: span
|
|
2829
|
+
}
|
|
2830
|
+
}) : /*#__PURE__*/ jsx("p", {
|
|
2831
|
+
className: modules_63b47c51.decs,
|
|
2832
|
+
children: "".concat(item.count, "条相关聊天记录")
|
|
2833
|
+
})
|
|
2834
|
+
]
|
|
2835
|
+
}),
|
|
2836
|
+
item.count != 1 ? /*#__PURE__*/ jsx("div", {
|
|
2837
|
+
className: "".concat(modules_63b47c51.open, " ").concat(item.show ? modules_63b47c51.active : ""),
|
|
2838
|
+
children: /*#__PURE__*/ jsx(CustomExpand$1, {})
|
|
2839
|
+
}) : ""
|
|
2840
|
+
]
|
|
2841
|
+
}),
|
|
2842
|
+
/*#__PURE__*/ jsxs("div", {
|
|
2843
|
+
className: modules_63b47c51.list_detail,
|
|
2844
|
+
children: [
|
|
2845
|
+
item.show && item.detailsList && item.detailsList.map(function(list) {
|
|
2846
|
+
// console.log(list,item,'dklfvmdflkvmdfklv')
|
|
2847
|
+
var name = "";
|
|
2848
|
+
if (list.sender == "AI") {
|
|
2849
|
+
name = "AI助手";
|
|
2850
|
+
} else if (list.sender == item.member) {
|
|
2851
|
+
name = item.name;
|
|
2852
|
+
} else {
|
|
2853
|
+
name = userData.real_name;
|
|
2854
|
+
}
|
|
2855
|
+
var time = "";
|
|
2856
|
+
var currentTime = getDataTime(-1, 1); //当前时间
|
|
2857
|
+
var updatedAt = getDataTime(list.updatedAt, 1);
|
|
2858
|
+
if (currentTime == updatedAt) {
|
|
2859
|
+
time = getDataTime(list.updatedAt, 2);
|
|
2860
|
+
} else {
|
|
2861
|
+
time = getDataTime(list.updatedAt);
|
|
2862
|
+
}
|
|
2863
|
+
var reg = /[`~!@#$%^&*()_\-+=<>?:"{}|,.\/;'\\[\]·~!@#¥%……&*()——\-+={}|《》?:“”【】、;‘’,。、]/im;
|
|
2864
|
+
var span = "";
|
|
2865
|
+
//搜索内容是否有特殊字符
|
|
2866
|
+
if (reg.test(keyWordProblem)) {
|
|
2867
|
+
span = list.message.replaceAll(keyWordProblem, function(e) {
|
|
2868
|
+
return "<span class=".concat(modules_63b47c51.sign, ">").concat(e, "</span>");
|
|
2869
|
+
});
|
|
2870
|
+
} else {
|
|
2871
|
+
span = list.message.replaceAll(new RegExp(keyWordProblem, "ig"), function(i) {
|
|
2872
|
+
// console.log(i,'skdcnsdjk')
|
|
2873
|
+
return "<span class=".concat(modules_63b47c51.sign, ">").concat(i, "</span>");
|
|
2874
|
+
});
|
|
2875
|
+
}
|
|
2876
|
+
return /*#__PURE__*/ jsxs("div", {
|
|
2877
|
+
className: modules_63b47c51.list,
|
|
2878
|
+
onClick: function() {
|
|
2879
|
+
calculationData(item.roomId, list.id, list.receiver);
|
|
2880
|
+
},
|
|
2881
|
+
children: [
|
|
2882
|
+
/*#__PURE__*/ jsxs("div", {
|
|
2883
|
+
className: modules_63b47c51.name,
|
|
2884
|
+
children: [
|
|
2885
|
+
/*#__PURE__*/ jsx("p", {
|
|
2886
|
+
children: name
|
|
2887
|
+
}),
|
|
2888
|
+
/*#__PURE__*/ jsx("span", {
|
|
2889
|
+
className: modules_63b47c51.time,
|
|
2890
|
+
children: time
|
|
2891
|
+
})
|
|
2892
|
+
]
|
|
2893
|
+
}),
|
|
2894
|
+
/*#__PURE__*/ jsx("div", {
|
|
2895
|
+
className: modules_63b47c51.con,
|
|
2896
|
+
dangerouslySetInnerHTML: {
|
|
2897
|
+
__html: span
|
|
2898
|
+
}
|
|
2899
|
+
})
|
|
2900
|
+
]
|
|
2901
|
+
}, list.id);
|
|
2902
|
+
}),
|
|
2903
|
+
item.show && item.pageCount > 1 && item.pageCount > item.pageNum && /*#__PURE__*/ jsx("div", {
|
|
2904
|
+
className: "".concat(modules_63b47c51.list, " ").concat(modules_63b47c51.list_more),
|
|
2905
|
+
onClick: function() {
|
|
2906
|
+
loadMore(item.pageNum + 1, item.roomId);
|
|
2907
|
+
},
|
|
2908
|
+
children: "点击加载更多"
|
|
2909
|
+
})
|
|
2910
|
+
]
|
|
2911
|
+
})
|
|
2912
|
+
]
|
|
2913
|
+
});
|
|
2914
|
+
})
|
|
2717
2915
|
})
|
|
2718
2916
|
]
|
|
2719
2917
|
})
|
|
@@ -2724,123 +2922,19 @@ var HistoryFun = function(props) {
|
|
|
2724
2922
|
var HistoryFun$1 = HistoryFun;
|
|
2725
2923
|
|
|
2726
2924
|
var ContactsList = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
2727
|
-
var type = props.type, roomId = props.roomId, userData = props.userData, http = props.http, urllocation = props.urllocation, onClose = props.onClose, switchChatRoom = props.switchChatRoom,
|
|
2728
|
-
|
|
2729
|
-
|
|
2730
|
-
|
|
2731
|
-
|
|
2732
|
-
|
|
2733
|
-
|
|
2734
|
-
clearTimeout(timer.current);
|
|
2735
|
-
};
|
|
2736
|
-
}, []);
|
|
2737
|
-
// //获取聊天室列表
|
|
2738
|
-
// useEffect(() => {
|
|
2739
|
-
// roomsListTimer();
|
|
2740
|
-
// }, [contactsList]);
|
|
2741
|
-
useImperativeHandle(ref, function() {
|
|
2742
|
-
return {
|
|
2743
|
-
roomsListTimer: function() {
|
|
2744
|
-
return roomsListTimer();
|
|
2745
|
-
}
|
|
2746
|
-
};
|
|
2747
|
-
});
|
|
2748
|
-
var roomsListTimer = function() {
|
|
2749
|
-
if (timer != null) clearTimeout(timer.current);
|
|
2750
|
-
timer.current = setTimeout(function() {
|
|
2751
|
-
return roomsListTimer();
|
|
2752
|
-
}, 60000);
|
|
2753
|
-
http.get("".concat(urllocation, "/chat-service/public/v1.0/rooms"), {
|
|
2754
|
-
params: {
|
|
2755
|
-
page: 1,
|
|
2756
|
-
maxPageSize: 100002
|
|
2757
|
-
},
|
|
2758
|
-
headers: {
|
|
2759
|
-
"x-module-id": userData.modules.find(function(ele) {
|
|
2760
|
-
return ele.short == "IntelligentCustomerService";
|
|
2761
|
-
}).id,
|
|
2762
|
-
"x-auth-jwt": window.localStorage.getItem("usertoken") || ""
|
|
2763
|
-
}
|
|
2764
|
-
}).then(function(res) {
|
|
2765
|
-
if (res.data) {
|
|
2766
|
-
var list = res.data.contacts;
|
|
2767
|
-
setContactsList(function(contactsList) {
|
|
2768
|
-
list = list.map(function(item, index) {
|
|
2769
|
-
var c_list = contactsList.filter(function(e) {
|
|
2770
|
-
return e.sender == item.sender;
|
|
2771
|
-
});
|
|
2772
|
-
var obj = {};
|
|
2773
|
-
if (c_list.length > 0) {
|
|
2774
|
-
obj = c_list[0];
|
|
2775
|
-
}
|
|
2776
|
-
return _object_spread({}, obj, item);
|
|
2777
|
-
});
|
|
2778
|
-
return list;
|
|
2779
|
-
});
|
|
2780
|
-
getUserInfo(list);
|
|
2781
|
-
saveContactsList(list);
|
|
2782
|
-
}
|
|
2783
|
-
});
|
|
2784
|
-
};
|
|
2925
|
+
var type = props.type, roomId = props.roomId, userData = props.userData, http = props.http, urllocation = props.urllocation, onClose = props.onClose, switchChatRoom = props.switchChatRoom, contactsList = props.contactsList;
|
|
2926
|
+
// useImperativeHandle(ref, () => ({
|
|
2927
|
+
// roomsListTimer: () => {
|
|
2928
|
+
// return roomsListTimer();
|
|
2929
|
+
// },
|
|
2930
|
+
// roomsList:contactsList,
|
|
2931
|
+
// }),[contactsList]);
|
|
2785
2932
|
//删除聊天室
|
|
2786
2933
|
var deleteRoom = function(roomId) {
|
|
2787
|
-
var contactsList;
|
|
2788
|
-
setContactsList(function(list) {
|
|
2789
|
-
contactsList = list.filter(function(e) {
|
|
2790
|
-
return e.roomId != roomId;
|
|
2791
|
-
});
|
|
2792
|
-
//切换到AI聊天窗口
|
|
2793
|
-
if (roomId == props.roomId) {
|
|
2794
|
-
switchChatRoom(contactsList[0].roomId, "");
|
|
2795
|
-
}
|
|
2796
|
-
saveContactsList(contactsList);
|
|
2797
|
-
return contactsList;
|
|
2798
|
-
});
|
|
2799
2934
|
http.delete("".concat(urllocation, "/chat-service/public/v1.0/rooms/").concat(roomId), {
|
|
2800
|
-
headers: {
|
|
2801
|
-
"x-module-id": userData.modules.find(function(ele) {
|
|
2802
|
-
return ele.short == "IntelligentCustomerService";
|
|
2803
|
-
}).id,
|
|
2804
|
-
"x-auth-jwt": window.localStorage.getItem("usertoken") || ""
|
|
2805
|
-
}
|
|
2806
2935
|
}).then(function(res) {
|
|
2807
|
-
roomsListTimer();
|
|
2808
|
-
|
|
2809
|
-
};
|
|
2810
|
-
//获取老师的信息等
|
|
2811
|
-
var getUserInfo = function(list) {
|
|
2812
|
-
list.map(function(item, i) {
|
|
2813
|
-
if (!item.name && !item.headImg && item.sender != "AI") {
|
|
2814
|
-
getUserName(item.sender).then(function(res) {
|
|
2815
|
-
if (res.data) {
|
|
2816
|
-
var _$list;
|
|
2817
|
-
setContactsList(function(contactsList) {
|
|
2818
|
-
_$list = contactsList.map(function(item, index) {
|
|
2819
|
-
if (item.sender == res.data.uid) {
|
|
2820
|
-
return _object_spread({}, item, res.data);
|
|
2821
|
-
} else {
|
|
2822
|
-
return item;
|
|
2823
|
-
}
|
|
2824
|
-
});
|
|
2825
|
-
return _$list;
|
|
2826
|
-
});
|
|
2827
|
-
saveContactsList(_$list);
|
|
2828
|
-
}
|
|
2829
|
-
});
|
|
2830
|
-
}
|
|
2831
|
-
});
|
|
2832
|
-
};
|
|
2833
|
-
var getUserName = function(uid) {
|
|
2834
|
-
return http.get("".concat(urllocation, "/chat-service/public/v1.0/userinfo"), {
|
|
2835
|
-
params: {
|
|
2836
|
-
uid: uid
|
|
2837
|
-
},
|
|
2838
|
-
headers: {
|
|
2839
|
-
"x-module-id": userData.modules.find(function(ele) {
|
|
2840
|
-
return ele.short == "TeacherAnswer";
|
|
2841
|
-
}).id,
|
|
2842
|
-
"x-auth-jwt": window.localStorage.getItem("usertoken") || ""
|
|
2843
|
-
}
|
|
2936
|
+
// roomsListTimer();
|
|
2937
|
+
switchChatRoom(roomId, "1");
|
|
2844
2938
|
});
|
|
2845
2939
|
};
|
|
2846
2940
|
return type == 2 || type == 4 ? //联系人展开
|
|
@@ -2852,8 +2946,7 @@ var ContactsList = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
2852
2946
|
children: /*#__PURE__*/ jsxs("div", {
|
|
2853
2947
|
className: "".concat(modules_63b47c51.ai, " ").concat(contactsList.length > 0 && contactsList[0].roomId != undefined && roomId != "" && contactsList[0].roomId == roomId || contactsList.length == 0 ? modules_63b47c51.active : ""),
|
|
2854
2948
|
onClick: function() {
|
|
2855
|
-
switchChatRoom(contactsList[0].roomId, "");
|
|
2856
|
-
// roomsListTimer();
|
|
2949
|
+
return switchChatRoom(contactsList[0].roomId, "");
|
|
2857
2950
|
},
|
|
2858
2951
|
children: [
|
|
2859
2952
|
/*#__PURE__*/ jsx(CustomAiIcon$1, {}),
|
|
@@ -2896,25 +2989,6 @@ var ContactsList = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
2896
2989
|
className: "".concat(modules_63b47c51.ai, " ").concat(item.roomId != undefined && roomId != "" && item.roomId == roomId ? modules_63b47c51.active : ""),
|
|
2897
2990
|
onClick: function() {
|
|
2898
2991
|
switchChatRoom(item.roomId, "");
|
|
2899
|
-
// roomsListTimer();
|
|
2900
|
-
var newList = [];
|
|
2901
|
-
setContactsList(function(list) {
|
|
2902
|
-
newList = list;
|
|
2903
|
-
newList = newList.map(function(v) {
|
|
2904
|
-
if (v.roomId == item.roomId) {
|
|
2905
|
-
return _object_spread_props(_object_spread({}, v), {
|
|
2906
|
-
unreadCount: 0
|
|
2907
|
-
});
|
|
2908
|
-
} else {
|
|
2909
|
-
return v;
|
|
2910
|
-
}
|
|
2911
|
-
});
|
|
2912
|
-
return newList;
|
|
2913
|
-
});
|
|
2914
|
-
// console.log(newList,9999999999)
|
|
2915
|
-
setTimeout(function() {
|
|
2916
|
-
saveContactsList(newList);
|
|
2917
|
-
}, 100);
|
|
2918
2992
|
},
|
|
2919
2993
|
children: [
|
|
2920
2994
|
/*#__PURE__*/ jsx("img", {
|
|
@@ -3005,26 +3079,6 @@ var ContactsList = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
3005
3079
|
className: "".concat(modules_63b47c51.ai, " ").concat(item.roomId != undefined && roomId != "" && item.roomId == roomId ? modules_63b47c51.active : ""),
|
|
3006
3080
|
onClick: function() {
|
|
3007
3081
|
switchChatRoom(item.roomId, "");
|
|
3008
|
-
// roomsListTimer();
|
|
3009
|
-
//消息更改为已读
|
|
3010
|
-
var newList = [];
|
|
3011
|
-
setContactsList(function(list) {
|
|
3012
|
-
newList = list;
|
|
3013
|
-
newList = newList.map(function(v) {
|
|
3014
|
-
if (v.roomId == item.roomId) {
|
|
3015
|
-
return _object_spread_props(_object_spread({}, v), {
|
|
3016
|
-
unreadCount: 0
|
|
3017
|
-
});
|
|
3018
|
-
} else {
|
|
3019
|
-
return v;
|
|
3020
|
-
}
|
|
3021
|
-
});
|
|
3022
|
-
return newList;
|
|
3023
|
-
});
|
|
3024
|
-
// console.log(newList,9999999999)
|
|
3025
|
-
setTimeout(function() {
|
|
3026
|
-
saveContactsList(newList);
|
|
3027
|
-
}, 100);
|
|
3028
3082
|
},
|
|
3029
3083
|
children: [
|
|
3030
3084
|
/*#__PURE__*/ jsx("img", {
|
|
@@ -3226,21 +3280,22 @@ var CustomerService = function(props) {
|
|
|
3226
3280
|
var _useState17 = _sliced_to_array(useState(false), 2), firstLoad = _useState17[0], setFirstLoad = _useState17[1]; //第一次切换全屏时滚动到页面底部
|
|
3227
3281
|
var _useState18 = _sliced_to_array(useState(45), 2), buttomHei = _useState18[0], setButtomHei = _useState18[1]; //底部输入框的高度
|
|
3228
3282
|
var _useState19 = _sliced_to_array(useState(false), 2), showHistory = _useState19[0], setShowHistory = _useState19[1]; //是否显示历史记录
|
|
3229
|
-
var _useState20 = _sliced_to_array(useState(false), 2), showContacts = _useState20[0], setShowContacts = _useState20[1];
|
|
3283
|
+
var _useState20 = _sliced_to_array(useState(false), 2), showContacts = _useState20[0], setShowContacts = _useState20[1]; //是否显示老师列表
|
|
3230
3284
|
var _useState21 = _sliced_to_array(useState(-1), 2), showType = _useState21[0], setShowType = _useState21[1]; //显示聊天框类型 1、侧边栏 2 modal 3 相应的div中 newlabo中使用
|
|
3231
3285
|
var _useState22 = _sliced_to_array(useState(-1), 2), answerMode = _useState22[0], setAnswerMode = _useState22[1]; //设置回答模式。1,召唤老师回答
|
|
3232
3286
|
var _useState23 = _sliced_to_array(useState([]), 2), teacherList = _useState23[0], setTeacherList = _useState23[1]; //老师列表
|
|
3233
3287
|
var _useState24 = _sliced_to_array(useState({}), 2), problem = _useState24[0], setProblem = _useState24[1]; //召唤老师回答的问题
|
|
3234
|
-
|
|
3288
|
+
// const [roomList,setRoomList] = useState([]);//聊天列表
|
|
3289
|
+
var _useState25 = _sliced_to_array(useState([]), 2), contactsList = _useState25[0], setContactsList = _useState25[1]; //老师列表
|
|
3235
3290
|
var _useState26 = _sliced_to_array(useState([]), 2), chatObj = _useState26[0], setChatObj = _useState26[1]; //聊天记录id保存,用来在实验报告中记录
|
|
3236
3291
|
var timer = useRef(null); //文本框输入时
|
|
3237
3292
|
var receiveMessageTimer = useRef(null); //接收ai发回的消息
|
|
3238
3293
|
var voiceCountdownTimer = useRef(null); //语音录制倒计时
|
|
3239
3294
|
var listTimer = useRef(null); // 请求列表倒计时
|
|
3240
3295
|
var roomMessage = useRef(null); //循环当前页面的新消息
|
|
3296
|
+
var chatRoomList = useRef(null); //获取聊天室列表
|
|
3241
3297
|
var ctrl = useRef(); //停止生成ai回答时使用
|
|
3242
3298
|
var childRef = useRef(null); //获取子组件方法
|
|
3243
|
-
// const [mid, setmid] = useState(props.userData.mid); //当前用户id
|
|
3244
3299
|
var mid = props.userData.mid;
|
|
3245
3300
|
var remarkable = new Remarkable({
|
|
3246
3301
|
highlight: function highlight(str, lang) {
|
|
@@ -3262,6 +3317,7 @@ var CustomerService = function(props) {
|
|
|
3262
3317
|
clearTimeout(listTimer.current);
|
|
3263
3318
|
clearTimeout(timer.current);
|
|
3264
3319
|
clearTimeout(roomMessage.current);
|
|
3320
|
+
clearTimeout(chatRoomList.current);
|
|
3265
3321
|
};
|
|
3266
3322
|
}, []);
|
|
3267
3323
|
useEffect(function() {
|
|
@@ -3274,26 +3330,27 @@ var CustomerService = function(props) {
|
|
|
3274
3330
|
function handleScroll() {
|
|
3275
3331
|
var container = document.getElementById(showType == 1 || showType == 3 ? "chat_content" : "chat_content_modal");
|
|
3276
3332
|
var scrollTop = container.scrollTop;
|
|
3277
|
-
// const scrollBottom = container.scroll;
|
|
3278
3333
|
var clientHeight = container.clientHeight;
|
|
3279
3334
|
var scrollHeight = container.scrollHeight;
|
|
3280
3335
|
// console.log(scrollTop,clientHeight,scrollHeight,'333dfkvmdfv')
|
|
3281
|
-
if (clientHeight + scrollTop + 0.5 >= scrollHeight) {
|
|
3336
|
+
if (clientHeight + scrollTop + 0.5 >= scrollHeight && pageNumHistory > 1) {
|
|
3282
3337
|
console.log("到底部了22222");
|
|
3283
|
-
//
|
|
3284
|
-
|
|
3285
|
-
|
|
3286
|
-
|
|
3287
|
-
|
|
3288
|
-
|
|
3289
|
-
|
|
3290
|
-
|
|
3291
|
-
// console.log("加载下一页", number);
|
|
3338
|
+
// if (pageNumHistory > 1) {
|
|
3339
|
+
// console.log(pageNumHistory,'pageNumpageNumpageNum')
|
|
3340
|
+
var number = pageNumHistory - 1;
|
|
3341
|
+
setPageNumHistory(number);
|
|
3342
|
+
clearTimeout(listTimer.current);
|
|
3343
|
+
listTimer.current = setTimeout(function() {
|
|
3344
|
+
if (number > 0) {
|
|
3345
|
+
setBottomLoading(true);
|
|
3292
3346
|
getHistoryMessage(number, 4);
|
|
3293
|
-
}
|
|
3294
|
-
|
|
3295
|
-
|
|
3296
|
-
}
|
|
3347
|
+
} else {
|
|
3348
|
+
setPageNumHistory(0);
|
|
3349
|
+
}
|
|
3350
|
+
}, 100);
|
|
3351
|
+
// } else {
|
|
3352
|
+
// setLastId("");
|
|
3353
|
+
// }
|
|
3297
3354
|
}
|
|
3298
3355
|
if (scrollTop == 0 && pageCount > pageNum && pageCount > 0) {
|
|
3299
3356
|
console.log("到顶了", pageNum);
|
|
@@ -3346,13 +3403,11 @@ var CustomerService = function(props) {
|
|
|
3346
3403
|
// console.log(props,'lsdkcmsdlcksd')
|
|
3347
3404
|
getQuestiionsList("", 1);
|
|
3348
3405
|
scrollToBottom();
|
|
3349
|
-
// less.modifyVars({ "@color-border-Tr": "#f4523b" });
|
|
3350
3406
|
setShowType(initShowType);
|
|
3351
3407
|
}, [
|
|
3352
3408
|
initShowType
|
|
3353
3409
|
]);
|
|
3354
3410
|
useEffect(function() {
|
|
3355
|
-
// console.log(roomId,1111111)
|
|
3356
3411
|
if (roomId != "") {
|
|
3357
3412
|
if (lastId == "") {
|
|
3358
3413
|
getHistoryMessage(pageNum, 2);
|
|
@@ -3364,30 +3419,28 @@ var CustomerService = function(props) {
|
|
|
3364
3419
|
}, [
|
|
3365
3420
|
roomId
|
|
3366
3421
|
]);
|
|
3422
|
+
//创建聊天室并获取聊天室列表
|
|
3367
3423
|
useEffect(function() {
|
|
3368
|
-
|
|
3369
|
-
|
|
3370
|
-
|
|
3371
|
-
|
|
3372
|
-
|
|
3373
|
-
|
|
3374
|
-
|
|
3375
|
-
|
|
3376
|
-
sender: "AI"
|
|
3377
|
-
}
|
|
3378
|
-
]);
|
|
3379
|
-
});
|
|
3380
|
-
} else {
|
|
3381
|
-
setRoomList(roomList);
|
|
3382
|
-
}
|
|
3383
|
-
// recordRef.current.roomList=JSON.parse(JSON.stringify(roomList))
|
|
3384
|
-
}, [
|
|
3385
|
-
roomList
|
|
3386
|
-
]);
|
|
3424
|
+
createRooms("AI").then(function(res) {
|
|
3425
|
+
setRoomId(res.data.id);
|
|
3426
|
+
});
|
|
3427
|
+
roomsListTimer();
|
|
3428
|
+
return function() {
|
|
3429
|
+
clearTimeout(chatRoomList.current);
|
|
3430
|
+
};
|
|
3431
|
+
}, []);
|
|
3387
3432
|
//进入页面,发送打招呼信息
|
|
3388
3433
|
useEffect(function() {
|
|
3389
|
-
// console.log(historyMessageList, "dkjvndfkjvd33333f");
|
|
3390
3434
|
//老师的聊天窗口不发送打招呼信息
|
|
3435
|
+
var roomList = contactsList;
|
|
3436
|
+
// console.log(roomList,'dkfvdfkjvndfkjvdfv')
|
|
3437
|
+
var count = 0;
|
|
3438
|
+
roomList.map(function(item) {
|
|
3439
|
+
count += item.unreadCount;
|
|
3440
|
+
});
|
|
3441
|
+
if (count > 0) {
|
|
3442
|
+
setShowContacts(true);
|
|
3443
|
+
}
|
|
3391
3444
|
if (!(roomList.length > 0 && roomList[0].roomId != roomId)) {
|
|
3392
3445
|
//是否发送打招呼信息
|
|
3393
3446
|
if (greetingMessage && historyMessageList.length == 0) {
|
|
@@ -3422,7 +3475,7 @@ var CustomerService = function(props) {
|
|
|
3422
3475
|
}, [
|
|
3423
3476
|
bese64String
|
|
3424
3477
|
]);
|
|
3425
|
-
//AI窗口,type:1发送打招呼信息 2点赞消息 3踩消息 4没有AI客服权限,5,发送超过10万字消息 6, 没有AI客服权限,发送最热的问题
|
|
3478
|
+
//AI窗口,type:1发送打招呼信息 2点赞消息 3踩消息 4没有AI客服权限,5,发送超过10万字消息 6, 没有AI客服权限,发送最热的问题
|
|
3426
3479
|
var sendGreetingMessage = function(type) {
|
|
3427
3480
|
var questionsList = [];
|
|
3428
3481
|
var obj = {};
|
|
@@ -3527,26 +3580,21 @@ var CustomerService = function(props) {
|
|
|
3527
3580
|
setKeyWord("");
|
|
3528
3581
|
setQuestionsList([]);
|
|
3529
3582
|
setCitationContent({});
|
|
3530
|
-
http.post("".concat(urllocation, "/chat-service/public/v1.0/history-messages"), obj
|
|
3531
|
-
headers: {
|
|
3532
|
-
"x-module-id": userData.modules.find(function(ele) {
|
|
3533
|
-
return ele.short == "IntelligentCustomerService";
|
|
3534
|
-
}).id,
|
|
3535
|
-
"x-auth-jwt": window.localStorage.getItem("usertoken") || ""
|
|
3536
|
-
}
|
|
3537
|
-
}).then(function(res) {
|
|
3583
|
+
http.post("".concat(urllocation, "/chat-service/public/v1.0/history-messages"), obj).then(function(res) {
|
|
3538
3584
|
if (res.data.id) {
|
|
3539
|
-
|
|
3540
|
-
|
|
3541
|
-
|
|
3542
|
-
|
|
3543
|
-
|
|
3544
|
-
|
|
3545
|
-
|
|
3546
|
-
|
|
3547
|
-
|
|
3548
|
-
|
|
3549
|
-
|
|
3585
|
+
if (pageNumHistory <= 1) {
|
|
3586
|
+
setHistoryMessageList(function(historyMessageList) {
|
|
3587
|
+
var newHistoryMessageList = historyMessageList.concat(_object_spread_props(_object_spread({}, obj), {
|
|
3588
|
+
id: res.data.id,
|
|
3589
|
+
upvoted: false,
|
|
3590
|
+
downvoted: false,
|
|
3591
|
+
quotedMessage: "",
|
|
3592
|
+
createdAt: getDataTime(-1),
|
|
3593
|
+
extraInfo: JSON.stringify(obj.extraInfos)
|
|
3594
|
+
}));
|
|
3595
|
+
return newHistoryMessageList;
|
|
3596
|
+
});
|
|
3597
|
+
}
|
|
3550
3598
|
scrollToBottom();
|
|
3551
3599
|
if (type == 4) {
|
|
3552
3600
|
sendGreetingMessage(6);
|
|
@@ -3569,7 +3617,7 @@ var CustomerService = function(props) {
|
|
|
3569
3617
|
};
|
|
3570
3618
|
setProblem({});
|
|
3571
3619
|
} else if (type == 2) {
|
|
3572
|
-
var list =
|
|
3620
|
+
var list = contactsList.filter(function(item) {
|
|
3573
3621
|
return item.roomId == roomId;
|
|
3574
3622
|
});
|
|
3575
3623
|
var recevier = "";
|
|
@@ -3584,16 +3632,9 @@ var CustomerService = function(props) {
|
|
|
3584
3632
|
quotedMessage: citationContent.content || ""
|
|
3585
3633
|
};
|
|
3586
3634
|
}
|
|
3587
|
-
http.post("".concat(urllocation, "/chat-service/public/v1.0/chat-with-user/messages"), obj
|
|
3588
|
-
headers: {
|
|
3589
|
-
"x-module-id": userData.modules.find(function(ele) {
|
|
3590
|
-
return ele.short == "TeacherAnswer";
|
|
3591
|
-
}).id,
|
|
3592
|
-
"x-auth-jwt": window.localStorage.getItem("usertoken") || ""
|
|
3593
|
-
}
|
|
3594
|
-
}).then(function(res) {
|
|
3635
|
+
http.post("".concat(urllocation, "/chat-service/public/v1.0/chat-with-user/messages"), obj).then(function(res) {
|
|
3595
3636
|
if (res.data.id) {
|
|
3596
|
-
console.log(pageNum, pageNumHistory, lastId, "dlskskdsd4444");
|
|
3637
|
+
// console.log(pageNum, pageNumHistory, lastId, "dlskskdsd4444");
|
|
3597
3638
|
if (pageNum == 1 || pageNumHistory == 1 || pageNumHistory == 0) {
|
|
3598
3639
|
setHistoryMessageList(function(historyMessageList) {
|
|
3599
3640
|
var newHistoryMessageList = historyMessageList.concat(_object_spread_props(_object_spread({}, obj), {
|
|
@@ -3614,8 +3655,8 @@ var CustomerService = function(props) {
|
|
|
3614
3655
|
if (type == 1) {
|
|
3615
3656
|
var roomList = [
|
|
3616
3657
|
{
|
|
3617
|
-
|
|
3618
|
-
|
|
3658
|
+
roomId: roomId,
|
|
3659
|
+
id: res.data.id
|
|
3619
3660
|
}
|
|
3620
3661
|
];
|
|
3621
3662
|
setChatObj(function(list) {
|
|
@@ -3666,21 +3707,23 @@ var CustomerService = function(props) {
|
|
|
3666
3707
|
} else if (userData.modules.some(function(item) {
|
|
3667
3708
|
return item.short == "AIservice";
|
|
3668
3709
|
})) {
|
|
3669
|
-
|
|
3670
|
-
|
|
3671
|
-
|
|
3672
|
-
|
|
3673
|
-
|
|
3674
|
-
|
|
3675
|
-
|
|
3676
|
-
|
|
3677
|
-
|
|
3678
|
-
|
|
3679
|
-
|
|
3680
|
-
|
|
3710
|
+
if (pageNumHistory <= 1) {
|
|
3711
|
+
setHistoryMessageList(function(historyMessageList) {
|
|
3712
|
+
var newHistoryMessageList = historyMessageList.concat({
|
|
3713
|
+
roomId: roomId,
|
|
3714
|
+
sender: mid,
|
|
3715
|
+
recevier: "AI",
|
|
3716
|
+
message: keyWord,
|
|
3717
|
+
quotedMessage: citationContent.content,
|
|
3718
|
+
id: "654321",
|
|
3719
|
+
upvoted: false,
|
|
3720
|
+
downvoted: false,
|
|
3721
|
+
createdAt: getDataTime(-1),
|
|
3722
|
+
extraInfo: JSON.stringify([])
|
|
3723
|
+
});
|
|
3724
|
+
return newHistoryMessageList;
|
|
3681
3725
|
});
|
|
3682
|
-
|
|
3683
|
-
});
|
|
3726
|
+
}
|
|
3684
3727
|
setFinished(false);
|
|
3685
3728
|
aiSendQuestions(3, {
|
|
3686
3729
|
//相关数据
|
|
@@ -3698,39 +3741,36 @@ var CustomerService = function(props) {
|
|
|
3698
3741
|
};
|
|
3699
3742
|
//向知识库发送问题 或答案 type:1 发送问题 2 接受答案
|
|
3700
3743
|
var sendingExistingIssues = function(type, obj, questions) {
|
|
3701
|
-
|
|
3702
|
-
|
|
3703
|
-
|
|
3704
|
-
|
|
3705
|
-
|
|
3706
|
-
|
|
3707
|
-
|
|
3708
|
-
|
|
3709
|
-
|
|
3710
|
-
|
|
3711
|
-
|
|
3712
|
-
|
|
3713
|
-
|
|
3714
|
-
|
|
3715
|
-
return ele.short == "IntelligentCustomerService";
|
|
3716
|
-
}).id,
|
|
3717
|
-
"x-auth-jwt": window.localStorage.getItem("usertoken") || ""
|
|
3718
|
-
}
|
|
3719
|
-
}).then(function(res) {
|
|
3744
|
+
if (pageNumHistory <= 1) {
|
|
3745
|
+
setHistoryMessageList(function(historyMessageList) {
|
|
3746
|
+
var newHistoryMessageList = historyMessageList.concat(_object_spread_props(_object_spread({}, obj), {
|
|
3747
|
+
id: null,
|
|
3748
|
+
upvoted: false,
|
|
3749
|
+
downvoted: false,
|
|
3750
|
+
createdAt: getDataTime(-1),
|
|
3751
|
+
extraInfo: JSON.stringify(obj.extraInfos)
|
|
3752
|
+
}));
|
|
3753
|
+
return newHistoryMessageList;
|
|
3754
|
+
});
|
|
3755
|
+
scrollToBottom();
|
|
3756
|
+
}
|
|
3757
|
+
http.post("".concat(urllocation, "/chat-service/public/v1.0/history-messages"), obj).then(function(res) {
|
|
3720
3758
|
if (res.data.id) {
|
|
3721
|
-
|
|
3722
|
-
|
|
3723
|
-
|
|
3724
|
-
|
|
3725
|
-
|
|
3726
|
-
|
|
3727
|
-
|
|
3728
|
-
|
|
3729
|
-
|
|
3730
|
-
|
|
3759
|
+
if (pageNumHistory <= 1) {
|
|
3760
|
+
//更新聊天记录id
|
|
3761
|
+
setHistoryMessageList(function(historyMessageList) {
|
|
3762
|
+
var newHistoryMessageList = historyMessageList.map(function(item) {
|
|
3763
|
+
if (item.id == null) {
|
|
3764
|
+
return _object_spread_props(_object_spread({}, item), {
|
|
3765
|
+
id: res.data.id
|
|
3766
|
+
});
|
|
3767
|
+
} else {
|
|
3768
|
+
return item;
|
|
3769
|
+
}
|
|
3770
|
+
});
|
|
3771
|
+
return newHistoryMessageList;
|
|
3731
3772
|
});
|
|
3732
|
-
|
|
3733
|
-
});
|
|
3773
|
+
}
|
|
3734
3774
|
}
|
|
3735
3775
|
if (type == 1) {
|
|
3736
3776
|
//发送答案,调用自动回答
|
|
@@ -3749,31 +3789,15 @@ var CustomerService = function(props) {
|
|
|
3749
3789
|
sendingExistingIssues(2, dataObj, "");
|
|
3750
3790
|
testLabQuestion(obj.message, questions.answer, "");
|
|
3751
3791
|
}
|
|
3752
|
-
}).then(function(res) {
|
|
3753
|
-
console.log(res);
|
|
3754
3792
|
});
|
|
3755
3793
|
};
|
|
3756
3794
|
//向AI发送问题 type == 1 发送点赞或踩消息,type == 2 发送重新生成消息,type == 3 正常发送消息
|
|
3757
3795
|
var content = ""; //用于实验报告的问题记录
|
|
3758
3796
|
var aiSendQuestions = function(type, obj, id) {
|
|
3759
3797
|
content = "";
|
|
3760
|
-
// if (type == 3) {
|
|
3761
|
-
// try {
|
|
3762
|
-
// if (ctrl && ctrl.current) {
|
|
3763
|
-
// ctrl.current.abort();
|
|
3764
|
-
// }
|
|
3765
|
-
// } catch (error) {}
|
|
3766
|
-
// clearTimeout(receiveMessageTimer.current);
|
|
3767
|
-
// setHistoryMessageList((historyMessageList) => {
|
|
3768
|
-
// return historyMessageList.filter((item) => item.id != "123456");
|
|
3769
|
-
// });
|
|
3770
|
-
// setFinished(true);
|
|
3771
|
-
// return;
|
|
3772
|
-
// }
|
|
3773
3798
|
ctrl.current = new AbortController();
|
|
3774
3799
|
clearTimeout(receiveMessageTimer.current);
|
|
3775
3800
|
receiveMessageTimer.current = setTimeout(function() {
|
|
3776
|
-
// console.log('超时终止1111')
|
|
3777
3801
|
setHistoryMessageList(function(historyMessageList) {
|
|
3778
3802
|
return historyMessageList.filter(function(item) {
|
|
3779
3803
|
return item.id != "123456" && item.id != "654321";
|
|
@@ -3811,39 +3835,42 @@ var CustomerService = function(props) {
|
|
|
3811
3835
|
setTimeout(function() {
|
|
3812
3836
|
setQuestionsList([]);
|
|
3813
3837
|
}, 2000);
|
|
3838
|
+
// console.log(pageNumHistory,44444444444444);
|
|
3814
3839
|
//占位信息
|
|
3815
|
-
|
|
3816
|
-
|
|
3817
|
-
|
|
3818
|
-
|
|
3819
|
-
|
|
3820
|
-
|
|
3821
|
-
|
|
3822
|
-
|
|
3823
|
-
|
|
3824
|
-
|
|
3825
|
-
|
|
3826
|
-
|
|
3827
|
-
|
|
3828
|
-
|
|
3829
|
-
|
|
3830
|
-
|
|
3831
|
-
|
|
3832
|
-
|
|
3833
|
-
|
|
3834
|
-
|
|
3835
|
-
|
|
3836
|
-
|
|
3837
|
-
|
|
3838
|
-
|
|
3839
|
-
|
|
3840
|
-
|
|
3841
|
-
|
|
3842
|
-
|
|
3843
|
-
|
|
3844
|
-
|
|
3845
|
-
|
|
3846
|
-
|
|
3840
|
+
if (pageNumHistory <= 1) {
|
|
3841
|
+
setHistoryMessageList(function(historyMessageList) {
|
|
3842
|
+
if (type == 2) {
|
|
3843
|
+
return historyMessageList.map(function(item) {
|
|
3844
|
+
if (item.id == id) {
|
|
3845
|
+
return {
|
|
3846
|
+
roomId: roomId,
|
|
3847
|
+
sender: "AI",
|
|
3848
|
+
recevier: mid,
|
|
3849
|
+
message: "正在输入...",
|
|
3850
|
+
id: "123456",
|
|
3851
|
+
createdAt: getDataTime(-1),
|
|
3852
|
+
extraInfo: null
|
|
3853
|
+
};
|
|
3854
|
+
} else {
|
|
3855
|
+
return item;
|
|
3856
|
+
}
|
|
3857
|
+
});
|
|
3858
|
+
} else {
|
|
3859
|
+
return historyMessageList.concat({
|
|
3860
|
+
roomId: roomId,
|
|
3861
|
+
sender: "AI",
|
|
3862
|
+
recevier: mid,
|
|
3863
|
+
message: "正在输入...",
|
|
3864
|
+
id: "123456",
|
|
3865
|
+
createdAt: getDataTime(-1),
|
|
3866
|
+
extraInfo: null
|
|
3867
|
+
});
|
|
3868
|
+
}
|
|
3869
|
+
});
|
|
3870
|
+
setTimeout(function() {
|
|
3871
|
+
scrollToBottom();
|
|
3872
|
+
}, 10);
|
|
3873
|
+
}
|
|
3847
3874
|
//使用fetchEventSource接收数据
|
|
3848
3875
|
fetchEventSource("".concat(urllocation, "/chat-service/public/v1.0/chat-with-ai/messages"), {
|
|
3849
3876
|
method: "POST",
|
|
@@ -3853,7 +3880,7 @@ var CustomerService = function(props) {
|
|
|
3853
3880
|
"X-Auth-Jwt": window.localStorage.getItem("usertoken") || "",
|
|
3854
3881
|
"Auth-Token": userData.token,
|
|
3855
3882
|
"X-Module-Id": userData.modules.find(function(ele) {
|
|
3856
|
-
return ele.short == "
|
|
3883
|
+
return ele.short == "IntelligentCustomerService";
|
|
3857
3884
|
}).id
|
|
3858
3885
|
},
|
|
3859
3886
|
body: data,
|
|
@@ -3962,7 +3989,9 @@ var CustomerService = function(props) {
|
|
|
3962
3989
|
};
|
|
3963
3990
|
//渲染AI回答
|
|
3964
3991
|
var renderAiAnswer = function(msg, message_id, type) {
|
|
3992
|
+
// console.log(pageNumHistory,5555555);
|
|
3965
3993
|
// console.log(aiSendQuestions().abort(),'slkdsdsdsd')
|
|
3994
|
+
if (pageNumHistory > 1) return;
|
|
3966
3995
|
var obj = msg;
|
|
3967
3996
|
var id = msg.messageId;
|
|
3968
3997
|
setHistoryMessageList(function(historyMessageList) {
|
|
@@ -4014,9 +4043,9 @@ var CustomerService = function(props) {
|
|
|
4014
4043
|
return newHistoryMessageList2;
|
|
4015
4044
|
}
|
|
4016
4045
|
});
|
|
4017
|
-
setTimeout(
|
|
4018
|
-
|
|
4019
|
-
|
|
4046
|
+
// setTimeout(() => {
|
|
4047
|
+
scrollToBottom();
|
|
4048
|
+
// }, 10);
|
|
4020
4049
|
};
|
|
4021
4050
|
//问题记录到实验报告中
|
|
4022
4051
|
var testLabQuestion = function(title, content, teachId) {
|
|
@@ -4028,13 +4057,6 @@ var CustomerService = function(props) {
|
|
|
4028
4057
|
teachId: teachId != undefined ? teachId : chatWith.uid | mid,
|
|
4029
4058
|
stepId: stepId,
|
|
4030
4059
|
stepIds: stepIds
|
|
4031
|
-
}, {
|
|
4032
|
-
headers: {
|
|
4033
|
-
"x-module-id": userData.modules.find(function(ele) {
|
|
4034
|
-
return ele.short == "IntelligentCustomerService";
|
|
4035
|
-
}).id,
|
|
4036
|
-
"x-auth-jwt": window.localStorage.getItem("usertoken") || ""
|
|
4037
|
-
}
|
|
4038
4060
|
}).then(function() {
|
|
4039
4061
|
console.log(roomId, chatObj, "roomIdroomIdroomIdroomId");
|
|
4040
4062
|
setChatObj(function(list1) {
|
|
@@ -4050,13 +4072,6 @@ var CustomerService = function(props) {
|
|
|
4050
4072
|
var speechToText = function() {
|
|
4051
4073
|
http.post("".concat(urllocation, "/chat-service/public/v1.0/speech:recognize"), {
|
|
4052
4074
|
audio: bese64String
|
|
4053
|
-
}, {
|
|
4054
|
-
headers: {
|
|
4055
|
-
"x-module-id": userData.modules.find(function(ele) {
|
|
4056
|
-
return ele.short == "AIservice";
|
|
4057
|
-
}).id,
|
|
4058
|
-
"x-auth-jwt": window.localStorage.getItem("usertoken") || ""
|
|
4059
|
-
}
|
|
4060
4075
|
}).then(function(res) {
|
|
4061
4076
|
setVoiceRecordingStatus(3);
|
|
4062
4077
|
if (res.data) {
|
|
@@ -4072,20 +4087,13 @@ var CustomerService = function(props) {
|
|
|
4072
4087
|
var createRooms = function(uid) {
|
|
4073
4088
|
return http.post("".concat(urllocation, "/chat-service/public/v1.0/rooms"), {
|
|
4074
4089
|
chatWith: uid
|
|
4075
|
-
}, {
|
|
4076
|
-
headers: {
|
|
4077
|
-
"x-module-id": userData.modules.find(function(ele) {
|
|
4078
|
-
return ele.short == "IntelligentCustomerService";
|
|
4079
|
-
}).id,
|
|
4080
|
-
"x-auth-jwt": window.localStorage.getItem("usertoken") || ""
|
|
4081
|
-
}
|
|
4082
4090
|
});
|
|
4083
4091
|
};
|
|
4084
4092
|
//获取历史消息 flag:1,历史记录点击定位,2,代表是上拉加载,3,存在新的消息-->老师回答等,4,下拉加载,滚动到底部时,主要用于查看历史记录
|
|
4085
4093
|
var getHistoryMessage = function(pageNum, flag) {
|
|
4086
|
-
var id = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "1";
|
|
4094
|
+
var id = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "1", raw_data = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : [];
|
|
4087
4095
|
clearTimeout(roomMessage.current);
|
|
4088
|
-
console.log(pageNum,
|
|
4096
|
+
// console.log(pageNum,flag,'dkfjvndfjvndfkvdf')
|
|
4089
4097
|
// flag == 1 时已经设置好了位置标记
|
|
4090
4098
|
var last_id = "";
|
|
4091
4099
|
if (flag == 2 && historyMessageList.length > 0) {
|
|
@@ -4100,31 +4108,29 @@ var CustomerService = function(props) {
|
|
|
4100
4108
|
}
|
|
4101
4109
|
var rid = flag == 3 ? id : roomId;
|
|
4102
4110
|
if (rid == "") return;
|
|
4111
|
+
var page = pageNum ? pageNum : 1;
|
|
4103
4112
|
return http.get("".concat(urllocation, "/chat-service/public/v1.0/history-messages"), {
|
|
4104
4113
|
params: {
|
|
4105
4114
|
roomId: rid,
|
|
4106
|
-
page:
|
|
4115
|
+
page: page,
|
|
4107
4116
|
maxPageSize: 30,
|
|
4108
4117
|
direction: "desc"
|
|
4109
|
-
},
|
|
4110
|
-
headers: {
|
|
4111
|
-
"x-module-id": userData.modules.find(function(ele) {
|
|
4112
|
-
return ele.short == "IntelligentCustomerService";
|
|
4113
|
-
}).id,
|
|
4114
|
-
"x-auth-jwt": window.localStorage.getItem("usertoken") || ""
|
|
4115
4118
|
}
|
|
4116
4119
|
}).then(function(res) {
|
|
4117
4120
|
var totalNumber = 0;
|
|
4118
|
-
var roomList =
|
|
4119
|
-
setRoomList(function(list) {
|
|
4120
|
-
roomList = list;
|
|
4121
|
-
return list;
|
|
4122
|
-
});
|
|
4121
|
+
var roomList = contactsList;
|
|
4123
4122
|
if (res.data.messages.length > 0) {
|
|
4124
4123
|
clearTimeout(listTimer.current);
|
|
4125
4124
|
var total = res.data.total;
|
|
4126
4125
|
var maxPageSize = 30;
|
|
4127
4126
|
var dataList = res.data.messages.reverse();
|
|
4127
|
+
//历史记录点击进来的,多加载一页,防止定位不准
|
|
4128
|
+
if (flag == 1 && page > 1) {
|
|
4129
|
+
var markPage = page - 1;
|
|
4130
|
+
setPageNumHistory(markPage);
|
|
4131
|
+
getHistoryMessage(page - 1, 5, "1", dataList);
|
|
4132
|
+
return;
|
|
4133
|
+
}
|
|
4128
4134
|
setPageCount(Math.ceil(total / maxPageSize));
|
|
4129
4135
|
var newHistoryMessageList = [];
|
|
4130
4136
|
setHistoryMessageList(function(historyMessageList) {
|
|
@@ -4133,6 +4139,9 @@ var CustomerService = function(props) {
|
|
|
4133
4139
|
if (flag == 1) {
|
|
4134
4140
|
newHistoryMessageList = dataList;
|
|
4135
4141
|
}
|
|
4142
|
+
if (flag == 5) {
|
|
4143
|
+
newHistoryMessageList = raw_data.concat(dataList);
|
|
4144
|
+
}
|
|
4136
4145
|
if (flag == 4) {
|
|
4137
4146
|
newHistoryMessageList = historyMessageList.concat(dataList); //下拉加载,向后追加内容
|
|
4138
4147
|
}
|
|
@@ -4154,6 +4163,7 @@ var CustomerService = function(props) {
|
|
|
4154
4163
|
totalNumber = newHistoryMessageList.length;
|
|
4155
4164
|
return newHistoryMessageList;
|
|
4156
4165
|
});
|
|
4166
|
+
// console.log(lastId,'lastIdlastId-------')
|
|
4157
4167
|
//如果在跟老师的聊天窗口,用于找到与老师的最新的聊天,并不在与老师对话的窗口中,并聊天窗口相同
|
|
4158
4168
|
try {
|
|
4159
4169
|
if (stepIds != undefined && stepIds != "" && (showType == 3 || showType == 4)) {
|
|
@@ -4192,6 +4202,7 @@ var CustomerService = function(props) {
|
|
|
4192
4202
|
});
|
|
4193
4203
|
var isAiChatWindow = chatWindow.length > 0 && chatWindow[0].sender != undefined && chatWindow[0].sender == "AI" ? true : false;
|
|
4194
4204
|
if (!isAiChatWindow && roomList.length > 0 && (pageNum == 1 || pageNumHistory == 0)) {
|
|
4205
|
+
//&& pageNum == 1
|
|
4195
4206
|
getRoomidHistoryMessage(totalNumber, rid);
|
|
4196
4207
|
}
|
|
4197
4208
|
}).catch(function(res) {
|
|
@@ -4210,14 +4221,8 @@ var CustomerService = function(props) {
|
|
|
4210
4221
|
params: {
|
|
4211
4222
|
roomId: rid,
|
|
4212
4223
|
page: 1,
|
|
4213
|
-
maxPageSize: totalNumber,
|
|
4224
|
+
maxPageSize: totalNumber == 0 ? 30 : totalNumber,
|
|
4214
4225
|
direction: "desc"
|
|
4215
|
-
},
|
|
4216
|
-
headers: {
|
|
4217
|
-
"x-module-id": userData.modules.find(function(ele) {
|
|
4218
|
-
return ele.short == "IntelligentCustomerService";
|
|
4219
|
-
}).id,
|
|
4220
|
-
"x-auth-jwt": window.localStorage.getItem("usertoken") || ""
|
|
4221
4226
|
}
|
|
4222
4227
|
}).then(function(res) {
|
|
4223
4228
|
var newHistoryMessageList = [];
|
|
@@ -4236,7 +4241,7 @@ var CustomerService = function(props) {
|
|
|
4236
4241
|
newList = newHistoryMessageList.length;
|
|
4237
4242
|
return newHistoryMessageList;
|
|
4238
4243
|
});
|
|
4239
|
-
console.log(dataList.length, originList,
|
|
4244
|
+
// console.log(dataList.length , originList,lastId,'dfkvdnfkvdfj44444');
|
|
4240
4245
|
if (!lastId && originList != newList) {
|
|
4241
4246
|
setTimeout(function() {
|
|
4242
4247
|
scrollToBottom();
|
|
@@ -4284,8 +4289,7 @@ var CustomerService = function(props) {
|
|
|
4284
4289
|
console.log(newMessage, "newMessagenewMessage");
|
|
4285
4290
|
var result = [];
|
|
4286
4291
|
newMessage.forEach(function(item, index) {
|
|
4287
|
-
var isQuestion = item.receiver !== mid //是否为问题
|
|
4288
|
-
;
|
|
4292
|
+
var isQuestion = item.receiver !== mid; //是否为问题
|
|
4289
4293
|
if (isQuestion) {
|
|
4290
4294
|
//问题
|
|
4291
4295
|
if (newMessage[index + 1] && newMessage[index + 1].receiver === mid) {
|
|
@@ -4317,13 +4321,6 @@ var CustomerService = function(props) {
|
|
|
4317
4321
|
}
|
|
4318
4322
|
http.post(url, {
|
|
4319
4323
|
messageId: id
|
|
4320
|
-
}, {
|
|
4321
|
-
headers: {
|
|
4322
|
-
"x-module-id": userData.modules.find(function(ele) {
|
|
4323
|
-
return ele.short == "IntelligentCustomerService";
|
|
4324
|
-
}).id,
|
|
4325
|
-
"x-auth-jwt": window.localStorage.getItem("usertoken") || ""
|
|
4326
|
-
}
|
|
4327
4324
|
}).then(function(res) {
|
|
4328
4325
|
setHistoryMessageList(function(historyMessageList) {
|
|
4329
4326
|
var list = historyMessageList;
|
|
@@ -4348,13 +4345,6 @@ var CustomerService = function(props) {
|
|
|
4348
4345
|
}
|
|
4349
4346
|
http.post(url, {
|
|
4350
4347
|
messageId: id
|
|
4351
|
-
}, {
|
|
4352
|
-
headers: {
|
|
4353
|
-
"x-module-id": userData.modules.find(function(ele) {
|
|
4354
|
-
return ele.short == "IntelligentCustomerService";
|
|
4355
|
-
}).id,
|
|
4356
|
-
"x-auth-jwt": window.localStorage.getItem("usertoken") || ""
|
|
4357
|
-
}
|
|
4358
4348
|
}).then(function(res) {
|
|
4359
4349
|
setHistoryMessageList(function(historyMessageList) {
|
|
4360
4350
|
var list = historyMessageList;
|
|
@@ -4384,13 +4374,7 @@ var CustomerService = function(props) {
|
|
|
4384
4374
|
};
|
|
4385
4375
|
}
|
|
4386
4376
|
http.get("".concat(urllocation, "/chat-service/public/v1.0/knowledge-base/questions"), {
|
|
4387
|
-
params: data
|
|
4388
|
-
headers: {
|
|
4389
|
-
"x-module-id": userData.modules.find(function(ele) {
|
|
4390
|
-
return ele.short == "IntelligentCustomerService";
|
|
4391
|
-
}).id,
|
|
4392
|
-
"x-auth-jwt": window.localStorage.getItem("usertoken") || ""
|
|
4393
|
-
}
|
|
4377
|
+
params: data
|
|
4394
4378
|
}).then(function(res) {
|
|
4395
4379
|
if (res.data.questions) {
|
|
4396
4380
|
if (flag == 1) {
|
|
@@ -4406,12 +4390,6 @@ var CustomerService = function(props) {
|
|
|
4406
4390
|
http.get("".concat(urllocation, "/chat-service/public/v1.0/teachers"), {
|
|
4407
4391
|
params: {
|
|
4408
4392
|
name: keyWord
|
|
4409
|
-
},
|
|
4410
|
-
headers: {
|
|
4411
|
-
"x-module-id": userData.modules.find(function(ele) {
|
|
4412
|
-
return ele.short == "TeacherAnswer";
|
|
4413
|
-
}).id,
|
|
4414
|
-
"x-auth-jwt": window.localStorage.getItem("usertoken") || ""
|
|
4415
4393
|
}
|
|
4416
4394
|
}).then(function(res) {
|
|
4417
4395
|
console.log(res);
|
|
@@ -4420,6 +4398,90 @@ var CustomerService = function(props) {
|
|
|
4420
4398
|
}
|
|
4421
4399
|
});
|
|
4422
4400
|
};
|
|
4401
|
+
//获取聊天室列表
|
|
4402
|
+
var roomsListTimer = function() {
|
|
4403
|
+
if (chatRoomList != null) clearTimeout(chatRoomList.current);
|
|
4404
|
+
chatRoomList.current = setTimeout(function() {
|
|
4405
|
+
return roomsListTimer();
|
|
4406
|
+
}, 60000);
|
|
4407
|
+
http.get("".concat(urllocation, "/chat-service/public/v1.0/rooms"), {
|
|
4408
|
+
params: {
|
|
4409
|
+
page: 1,
|
|
4410
|
+
maxPageSize: 100002
|
|
4411
|
+
}
|
|
4412
|
+
}).then(function(res) {
|
|
4413
|
+
if (res.data) {
|
|
4414
|
+
var list = res.data.contacts;
|
|
4415
|
+
setContactsList(function(list1) {
|
|
4416
|
+
list = list.map(function(item, index) {
|
|
4417
|
+
var c_list = list1.filter(function(e) {
|
|
4418
|
+
return e.sender == item.sender;
|
|
4419
|
+
});
|
|
4420
|
+
var obj = {};
|
|
4421
|
+
if (c_list.length > 0) {
|
|
4422
|
+
obj = c_list[0];
|
|
4423
|
+
}
|
|
4424
|
+
return _object_spread({}, obj, item);
|
|
4425
|
+
});
|
|
4426
|
+
return list;
|
|
4427
|
+
});
|
|
4428
|
+
getUserInfo(list);
|
|
4429
|
+
}
|
|
4430
|
+
});
|
|
4431
|
+
};
|
|
4432
|
+
//获取老师的信息等
|
|
4433
|
+
var getUserInfo = function(list) {
|
|
4434
|
+
var getUserid = [];
|
|
4435
|
+
//查找需要用户名和头像的
|
|
4436
|
+
list.map(function(item, i) {
|
|
4437
|
+
if (!item.name && !item.headImg && item.sender != "AI") {
|
|
4438
|
+
getUserid.push(item.sender);
|
|
4439
|
+
}
|
|
4440
|
+
});
|
|
4441
|
+
if (getUserid.length > 0) {
|
|
4442
|
+
getUserName(getUserid.join(",")).then(function(res) {
|
|
4443
|
+
if (res.data) {
|
|
4444
|
+
var nameList = res.data;
|
|
4445
|
+
// console.log(nameList,contactsList,'kdsjnvjdkvdfj')
|
|
4446
|
+
setContactsList(function(contactsList) {
|
|
4447
|
+
list = list.map(function(item, index) {
|
|
4448
|
+
var name = nameList.filter(function(v) {
|
|
4449
|
+
return v.uid == item.sender;
|
|
4450
|
+
});
|
|
4451
|
+
if (name.length > 0) {
|
|
4452
|
+
return _object_spread({}, item, name[0]);
|
|
4453
|
+
} else {
|
|
4454
|
+
return item;
|
|
4455
|
+
}
|
|
4456
|
+
});
|
|
4457
|
+
return list;
|
|
4458
|
+
});
|
|
4459
|
+
}
|
|
4460
|
+
});
|
|
4461
|
+
} else {
|
|
4462
|
+
setContactsList(function(contactsList) {
|
|
4463
|
+
list = list.map(function(item, index) {
|
|
4464
|
+
var c_list = contactsList.filter(function(e) {
|
|
4465
|
+
return e.sender == item.sender;
|
|
4466
|
+
});
|
|
4467
|
+
var obj = {};
|
|
4468
|
+
if (c_list.length > 0) {
|
|
4469
|
+
obj = c_list[0];
|
|
4470
|
+
}
|
|
4471
|
+
return _object_spread({}, obj, item);
|
|
4472
|
+
});
|
|
4473
|
+
return list;
|
|
4474
|
+
});
|
|
4475
|
+
}
|
|
4476
|
+
};
|
|
4477
|
+
//获取老师用户名
|
|
4478
|
+
var getUserName = function(uid) {
|
|
4479
|
+
return http.get("".concat(urllocation, "/chat-service/public/v1.0/userinfo"), {
|
|
4480
|
+
params: {
|
|
4481
|
+
uid: uid
|
|
4482
|
+
}
|
|
4483
|
+
});
|
|
4484
|
+
};
|
|
4423
4485
|
//设置滚动条滚动到底部
|
|
4424
4486
|
var scrollToBottom = function() {
|
|
4425
4487
|
var container = document.getElementById(showType == 1 || showType == 3 ? "chat_content" : "chat_content_modal");
|
|
@@ -4435,10 +4497,16 @@ var CustomerService = function(props) {
|
|
|
4435
4497
|
try {
|
|
4436
4498
|
setTimeout(function() {
|
|
4437
4499
|
var top = showType == 1 || showType == 3 ? $("#li_flag").offset().top - 20 : $("#chat_content_modal #li_flag").offset().top - $("#chat_content_modal").offset().top + 24;
|
|
4500
|
+
// let top =
|
|
4501
|
+
// showType == 1 || showType == 3
|
|
4502
|
+
// ? $("#li_flag").offset().top
|
|
4503
|
+
// : $("#chat_content_modal #li_flag").offset().top -
|
|
4504
|
+
// $("#chat_content_modal").offset().top;
|
|
4505
|
+
// console.log(top2,top,444444444444)
|
|
4438
4506
|
$("#".concat(showType == 1 || showType == 3 ? "chat_content" : "chat_content_modal")).animate({
|
|
4439
4507
|
scrollTop: top
|
|
4440
4508
|
}, 0);
|
|
4441
|
-
},
|
|
4509
|
+
}, 100);
|
|
4442
4510
|
} catch (error) {}
|
|
4443
4511
|
setLoading(false);
|
|
4444
4512
|
}
|
|
@@ -4458,19 +4526,34 @@ var CustomerService = function(props) {
|
|
|
4458
4526
|
});
|
|
4459
4527
|
});
|
|
4460
4528
|
};
|
|
4461
|
-
|
|
4462
|
-
var
|
|
4463
|
-
var
|
|
4529
|
+
//显示未读消息
|
|
4530
|
+
var showUnreadMessage = function() {
|
|
4531
|
+
var count = 0;
|
|
4532
|
+
contactsList.map(function(item) {
|
|
4533
|
+
count = count + item.unreadCount;
|
|
4534
|
+
});
|
|
4535
|
+
if (count > 0) {
|
|
4536
|
+
return /*#__PURE__*/ jsx("span", {
|
|
4537
|
+
className: styles.count,
|
|
4538
|
+
children: count > 99 ? "99+" : count
|
|
4539
|
+
});
|
|
4540
|
+
} else {
|
|
4541
|
+
return "";
|
|
4542
|
+
}
|
|
4543
|
+
};
|
|
4544
|
+
//显示聊天室名字
|
|
4545
|
+
var showChatRoomName = function() {
|
|
4546
|
+
var title = "AI助手";
|
|
4547
|
+
var list = contactsList.filter(function(e) {
|
|
4464
4548
|
return e.roomId == roomId;
|
|
4465
4549
|
});
|
|
4466
|
-
var title = "智能问答";
|
|
4467
4550
|
if (list.length > 0 && list[0].name) {
|
|
4468
4551
|
title = list[0].name;
|
|
4469
4552
|
}
|
|
4470
|
-
|
|
4471
|
-
|
|
4472
|
-
|
|
4473
|
-
|
|
4553
|
+
return title;
|
|
4554
|
+
};
|
|
4555
|
+
//渲染头部
|
|
4556
|
+
var renderHeader = function() {
|
|
4474
4557
|
if (showType == 4) {
|
|
4475
4558
|
return /*#__PURE__*/ jsxs("div", {
|
|
4476
4559
|
className: styles.top,
|
|
@@ -4478,7 +4561,7 @@ var CustomerService = function(props) {
|
|
|
4478
4561
|
/*#__PURE__*/ jsx("div", {
|
|
4479
4562
|
className: styles.user,
|
|
4480
4563
|
children: /*#__PURE__*/ jsx("p", {
|
|
4481
|
-
children:
|
|
4564
|
+
children: showChatRoomName()
|
|
4482
4565
|
})
|
|
4483
4566
|
}),
|
|
4484
4567
|
/*#__PURE__*/ jsxs("div", {
|
|
@@ -4529,13 +4612,10 @@ var CustomerService = function(props) {
|
|
|
4529
4612
|
},
|
|
4530
4613
|
children: [
|
|
4531
4614
|
/*#__PURE__*/ jsx(CustomContacts$1, {}),
|
|
4532
|
-
|
|
4533
|
-
className: styles.count,
|
|
4534
|
-
children: count > 99 ? "99+" : count
|
|
4535
|
-
}) : ""
|
|
4615
|
+
showUnreadMessage()
|
|
4536
4616
|
]
|
|
4537
4617
|
}),
|
|
4538
|
-
|
|
4618
|
+
showChatRoomName()
|
|
4539
4619
|
]
|
|
4540
4620
|
})
|
|
4541
4621
|
}),
|
|
@@ -4558,7 +4638,13 @@ var CustomerService = function(props) {
|
|
|
4558
4638
|
onEvent(serverName + serverUrl(), "click_智能问答_全屏", "提交");
|
|
4559
4639
|
// switchDialogBox(3, true);
|
|
4560
4640
|
setShowType(2);
|
|
4561
|
-
|
|
4641
|
+
setTimeout(function() {
|
|
4642
|
+
setKeyWord(" ");
|
|
4643
|
+
}, 100);
|
|
4644
|
+
setTimeout(function() {
|
|
4645
|
+
setKeyWord("");
|
|
4646
|
+
}, 300);
|
|
4647
|
+
// childRef.current.roomsListTimer();
|
|
4562
4648
|
},
|
|
4563
4649
|
children: /*#__PURE__*/ jsx(CustomFullScreen$1, {})
|
|
4564
4650
|
}) : /*#__PURE__*/ jsx("i", {
|
|
@@ -4583,7 +4669,7 @@ var CustomerService = function(props) {
|
|
|
4583
4669
|
var resettingBottomHei = function() {
|
|
4584
4670
|
setTimeout(function() {
|
|
4585
4671
|
if (showType == 1 || showType == 3) {
|
|
4586
|
-
if (document.getElementById("
|
|
4672
|
+
if (document.getElementById("Drawer_buttom")) {
|
|
4587
4673
|
var hei = document.getElementById("Drawer_buttom").offsetHeight;
|
|
4588
4674
|
setButtomHei(hei);
|
|
4589
4675
|
}
|
|
@@ -4597,28 +4683,50 @@ var CustomerService = function(props) {
|
|
|
4597
4683
|
};
|
|
4598
4684
|
//切换聊天室 type == renew ,存在新消息
|
|
4599
4685
|
var switchChatRoom = function(id, type) {
|
|
4600
|
-
|
|
4601
|
-
|
|
4602
|
-
|
|
4603
|
-
|
|
4604
|
-
|
|
4605
|
-
|
|
4606
|
-
|
|
4607
|
-
|
|
4608
|
-
|
|
4609
|
-
|
|
4610
|
-
|
|
4611
|
-
|
|
4612
|
-
|
|
4613
|
-
|
|
4614
|
-
|
|
4686
|
+
if (type != "1") {
|
|
4687
|
+
readMessage(id, urllocation, userData, http);
|
|
4688
|
+
setLastId("");
|
|
4689
|
+
setPageNum(1);
|
|
4690
|
+
setPageCount(0);
|
|
4691
|
+
setRoomId(id);
|
|
4692
|
+
try {
|
|
4693
|
+
if (ctrl && ctrl.current) {
|
|
4694
|
+
ctrl.current.abort();
|
|
4695
|
+
}
|
|
4696
|
+
setFinished(true);
|
|
4697
|
+
} catch (error) {}
|
|
4698
|
+
setTimeout(function() {
|
|
4699
|
+
roomsListTimer();
|
|
4700
|
+
}, 500);
|
|
4701
|
+
}
|
|
4702
|
+
//删除聊天室
|
|
4703
|
+
if (type == "1") {
|
|
4704
|
+
if (id == roomId) {
|
|
4705
|
+
// console.log(contactsList,888888);
|
|
4706
|
+
switchChatRoom(contactsList[0].roomId, "");
|
|
4707
|
+
}
|
|
4708
|
+
setContactsList(function(list) {
|
|
4709
|
+
var newList = list;
|
|
4710
|
+
newList = newList.filter(function(v) {
|
|
4711
|
+
return v.roomId != id;
|
|
4712
|
+
});
|
|
4713
|
+
return newList;
|
|
4714
|
+
});
|
|
4615
4715
|
}
|
|
4716
|
+
// if (type == "renew") {
|
|
4717
|
+
// getHistoryMessage(1, 3,id);
|
|
4718
|
+
// }else{
|
|
4719
|
+
// setRoomId(id);
|
|
4720
|
+
// }
|
|
4616
4721
|
};
|
|
4722
|
+
// const saveContactsList = (list: any)=>{
|
|
4723
|
+
// console.log(list,44444444)
|
|
4724
|
+
// // if(list != undefined){
|
|
4725
|
+
// // setRoomList(list);
|
|
4726
|
+
// // }
|
|
4727
|
+
// }
|
|
4617
4728
|
//渲染问答
|
|
4618
4729
|
var renderQuestion = function() {
|
|
4619
|
-
// 2023-12-01T14:34:07
|
|
4620
|
-
// console.log(lastId,'lastIdlastIdlastId')
|
|
4621
|
-
// console.log(mid, historyMessageList, "ddkfdscksdcs");
|
|
4622
4730
|
if (historyMessageList.length > 0) {
|
|
4623
4731
|
return /*#__PURE__*/ jsx("ul", {
|
|
4624
4732
|
className: styles.message_con,
|
|
@@ -4669,62 +4777,67 @@ var CustomerService = function(props) {
|
|
|
4669
4777
|
children: /*#__PURE__*/ jsxs("div", {
|
|
4670
4778
|
className: styles.main_content,
|
|
4671
4779
|
children: [
|
|
4672
|
-
/*#__PURE__*/
|
|
4673
|
-
className: styles.
|
|
4674
|
-
children:
|
|
4675
|
-
|
|
4676
|
-
|
|
4677
|
-
/*#__PURE__*/
|
|
4678
|
-
className:
|
|
4679
|
-
|
|
4680
|
-
|
|
4681
|
-
|
|
4682
|
-
|
|
4683
|
-
|
|
4684
|
-
|
|
4685
|
-
|
|
4686
|
-
|
|
4687
|
-
|
|
4688
|
-
|
|
4689
|
-
|
|
4690
|
-
|
|
4691
|
-
|
|
4692
|
-
|
|
4693
|
-
|
|
4694
|
-
|
|
4695
|
-
|
|
4696
|
-
|
|
4697
|
-
|
|
4698
|
-
|
|
4699
|
-
|
|
4700
|
-
|
|
4701
|
-
|
|
4702
|
-
|
|
4703
|
-
|
|
4704
|
-
|
|
4705
|
-
|
|
4706
|
-
|
|
4707
|
-
|
|
4708
|
-
|
|
4709
|
-
|
|
4710
|
-
|
|
4711
|
-
|
|
4712
|
-
|
|
4713
|
-
|
|
4780
|
+
/*#__PURE__*/ jsxs("div", {
|
|
4781
|
+
className: styles.main_content_flag,
|
|
4782
|
+
children: [
|
|
4783
|
+
/*#__PURE__*/ jsx("div", {
|
|
4784
|
+
className: styles.operate_modal,
|
|
4785
|
+
children: /*#__PURE__*/ jsxs("p", {
|
|
4786
|
+
className: styles.operate,
|
|
4787
|
+
children: [
|
|
4788
|
+
/*#__PURE__*/ jsx("i", {
|
|
4789
|
+
className: "yinyong_quote1",
|
|
4790
|
+
onClick: function() {
|
|
4791
|
+
setCitationContent({
|
|
4792
|
+
content: item.message,
|
|
4793
|
+
id: item.id
|
|
4794
|
+
});
|
|
4795
|
+
resettingBottomHei();
|
|
4796
|
+
onEvent(serverName + serverUrl(), "click_智能问答_引用", "提交");
|
|
4797
|
+
},
|
|
4798
|
+
children: /*#__PURE__*/ jsx(CustomQuote$1, {})
|
|
4799
|
+
}),
|
|
4800
|
+
copyTextOBJ.length > 0 && copyTextOBJ.some(function(list) {
|
|
4801
|
+
return list == item.id;
|
|
4802
|
+
}) ? /*#__PURE__*/ jsx("i", {
|
|
4803
|
+
className: "tongyong-xuanzhongdui",
|
|
4804
|
+
children: /*#__PURE__*/ jsx(CustomDuihao$1, {})
|
|
4805
|
+
}) : /*#__PURE__*/ jsx("i", {
|
|
4806
|
+
className: "fuzhi21",
|
|
4807
|
+
onClick: function() {
|
|
4808
|
+
copyText(item.message);
|
|
4809
|
+
{
|
|
4810
|
+
var obj = copyTextOBJ;
|
|
4811
|
+
obj = obj.filter(function(list) {
|
|
4812
|
+
return list != item.id;
|
|
4813
|
+
});
|
|
4814
|
+
obj.push(item.id);
|
|
4815
|
+
setCopyTextObj(obj);
|
|
4816
|
+
}
|
|
4817
|
+
setTimeout(function() {
|
|
4818
|
+
var obj = copyTextOBJ;
|
|
4819
|
+
obj = obj.filter(function(list) {
|
|
4820
|
+
return list != item.id;
|
|
4821
|
+
});
|
|
4822
|
+
setCopyTextObj(obj);
|
|
4823
|
+
}, 3000);
|
|
4824
|
+
onEvent(serverName + serverUrl(), "click_智能问答_复制", "提交");
|
|
4825
|
+
},
|
|
4826
|
+
children: /*#__PURE__*/ jsx(CustomCopy$1, {})
|
|
4827
|
+
})
|
|
4828
|
+
]
|
|
4829
|
+
})
|
|
4830
|
+
}),
|
|
4831
|
+
/*#__PURE__*/ jsx("div", {
|
|
4832
|
+
className: styles.content,
|
|
4833
|
+
children: /*#__PURE__*/ jsx("p", {
|
|
4834
|
+
dangerouslySetInnerHTML: {
|
|
4835
|
+
__html: remarkable.render(message)
|
|
4714
4836
|
},
|
|
4715
|
-
|
|
4837
|
+
className: styles.content_child
|
|
4716
4838
|
})
|
|
4717
|
-
|
|
4718
|
-
|
|
4719
|
-
}),
|
|
4720
|
-
/*#__PURE__*/ jsx("div", {
|
|
4721
|
-
className: styles.content,
|
|
4722
|
-
children: /*#__PURE__*/ jsx("p", {
|
|
4723
|
-
dangerouslySetInnerHTML: {
|
|
4724
|
-
__html: remarkable.render(message)
|
|
4725
|
-
},
|
|
4726
|
-
className: styles.content_child
|
|
4727
|
-
})
|
|
4839
|
+
})
|
|
4840
|
+
]
|
|
4728
4841
|
}),
|
|
4729
4842
|
//引用消息
|
|
4730
4843
|
item.quotedMessage && /*#__PURE__*/ jsx("div", {
|
|
@@ -4763,14 +4876,17 @@ var CustomerService = function(props) {
|
|
|
4763
4876
|
} else {
|
|
4764
4877
|
//获取用户头像
|
|
4765
4878
|
var headImg = "";
|
|
4766
|
-
var chatWindow =
|
|
4879
|
+
var chatWindow = [];
|
|
4880
|
+
var isAiChatWindow;
|
|
4881
|
+
chatWindow = contactsList.filter(function(item) {
|
|
4767
4882
|
return item.roomId == roomId;
|
|
4768
4883
|
});
|
|
4769
4884
|
if (chatWindow.length > 0 && chatWindow[0].headImg != "") {
|
|
4770
4885
|
headImg = chatWindow[0].headImg;
|
|
4771
4886
|
}
|
|
4887
|
+
// console.log(chatWindow,'chatWindowchatWindow')
|
|
4772
4888
|
//是否在智能客服窗口
|
|
4773
|
-
|
|
4889
|
+
isAiChatWindow = chatWindow.length > 0 && chatWindow[0].sender != undefined && chatWindow[0].sender == "AI" ? true : false;
|
|
4774
4890
|
var header = 2; //代表是ai头像
|
|
4775
4891
|
if (isAiChatWindow && item.extraInfo != undefined && JSON.parse(item.extraInfo).length > 0 && JSON.parse(item.extraInfo)[0].key == "isVoteMessage") {
|
|
4776
4892
|
//使用AI头像
|
|
@@ -4802,34 +4918,39 @@ var CustomerService = function(props) {
|
|
|
4802
4918
|
children: /*#__PURE__*/ jsxs("div", {
|
|
4803
4919
|
className: styles.main_content,
|
|
4804
4920
|
children: [
|
|
4805
|
-
/*#__PURE__*/ jsx("div", {
|
|
4806
|
-
className: styles.operate_modal,
|
|
4807
|
-
children: // 不是最后一行,
|
|
4808
|
-
historyMessageList.length - 1 != i && renderOperateBtn(item, isAiChatWindow, i)
|
|
4809
|
-
}),
|
|
4810
4921
|
/*#__PURE__*/ jsxs("div", {
|
|
4811
|
-
className: styles.
|
|
4922
|
+
className: styles.main_content_flag,
|
|
4812
4923
|
children: [
|
|
4813
|
-
/*#__PURE__*/ jsx("
|
|
4814
|
-
|
|
4815
|
-
|
|
4816
|
-
|
|
4817
|
-
className: styles.content_child
|
|
4924
|
+
/*#__PURE__*/ jsx("div", {
|
|
4925
|
+
className: styles.operate_modal,
|
|
4926
|
+
children: // 不是最后一行,
|
|
4927
|
+
historyMessageList.length - 1 != i && renderOperateBtn(item, isAiChatWindow, i)
|
|
4818
4928
|
}),
|
|
4819
|
-
|
|
4820
|
-
className: styles.
|
|
4821
|
-
children:
|
|
4822
|
-
|
|
4823
|
-
|
|
4824
|
-
|
|
4929
|
+
/*#__PURE__*/ jsxs("div", {
|
|
4930
|
+
className: styles.content,
|
|
4931
|
+
children: [
|
|
4932
|
+
/*#__PURE__*/ jsx("p", {
|
|
4933
|
+
dangerouslySetInnerHTML: {
|
|
4934
|
+
__html: remarkable.render(message)
|
|
4825
4935
|
},
|
|
4826
|
-
|
|
4827
|
-
|
|
4828
|
-
|
|
4829
|
-
|
|
4830
|
-
|
|
4831
|
-
|
|
4832
|
-
|
|
4936
|
+
className: styles.content_child
|
|
4937
|
+
}),
|
|
4938
|
+
item.extraInfo != undefined && JSON.parse(item.extraInfo).length > 0 && JSON.parse(item.extraInfo)[0].key == "messageSource" && JSON.parse(item.extraInfo)[0].value != "knowledgebase" && /*#__PURE__*/ jsx("ul", {
|
|
4939
|
+
className: styles.association_problem,
|
|
4940
|
+
children: JSON.parse(item.extraInfo).map(function(list, index) {
|
|
4941
|
+
return /*#__PURE__*/ jsxs("li", {
|
|
4942
|
+
onClick: function() {
|
|
4943
|
+
sendMessage(list, 1);
|
|
4944
|
+
},
|
|
4945
|
+
children: [
|
|
4946
|
+
index + 1,
|
|
4947
|
+
".",
|
|
4948
|
+
list.question
|
|
4949
|
+
]
|
|
4950
|
+
}, i + "_" + index + "_" + list.value);
|
|
4951
|
+
})
|
|
4952
|
+
})
|
|
4953
|
+
]
|
|
4833
4954
|
})
|
|
4834
4955
|
]
|
|
4835
4956
|
}),
|
|
@@ -4857,7 +4978,7 @@ var CustomerService = function(props) {
|
|
|
4857
4978
|
isAiChatWindow && item.findTeacher && userData.modules.some(function(item) {
|
|
4858
4979
|
return item.short == "TeacherAnswer";
|
|
4859
4980
|
}) ? /*#__PURE__*/ jsx("div", {
|
|
4860
|
-
className: "".concat(styles.operate_modal_bottom),
|
|
4981
|
+
className: "".concat(styles.operate_modal_bottom, " "),
|
|
4861
4982
|
children: /*#__PURE__*/ jsx("p", {
|
|
4862
4983
|
className: styles.stop_findTeacher,
|
|
4863
4984
|
children: /*#__PURE__*/ jsx("span", {
|
|
@@ -5055,6 +5176,9 @@ var CustomerService = function(props) {
|
|
|
5055
5176
|
}
|
|
5056
5177
|
return /*#__PURE__*/ jsxs("div", {
|
|
5057
5178
|
className: "".concat(styles.operate_modal_bottom),
|
|
5179
|
+
style: {
|
|
5180
|
+
position: showStopBtn ? "sticky" : "relative"
|
|
5181
|
+
},
|
|
5058
5182
|
children: [
|
|
5059
5183
|
/*#__PURE__*/ jsxs("p", {
|
|
5060
5184
|
className: styles.stop_generate,
|
|
@@ -5111,8 +5235,6 @@ var CustomerService = function(props) {
|
|
|
5111
5235
|
question: historyMessageList[i - 1].message,
|
|
5112
5236
|
user: problem.user
|
|
5113
5237
|
});
|
|
5114
|
-
console.log(item, "88888999999");
|
|
5115
|
-
// if(item.extraInfo == null){
|
|
5116
5238
|
setHistoryMessageList(function(historyMessageList) {
|
|
5117
5239
|
var newHistoryMessageList = historyMessageList.concat({
|
|
5118
5240
|
id: -1,
|
|
@@ -5131,30 +5253,6 @@ var CustomerService = function(props) {
|
|
|
5131
5253
|
});
|
|
5132
5254
|
return newHistoryMessageList;
|
|
5133
5255
|
});
|
|
5134
|
-
// }else{
|
|
5135
|
-
// setHistoryMessageList(
|
|
5136
|
-
// (historyMessageList) => {
|
|
5137
|
-
// let newHistoryMessageList =
|
|
5138
|
-
// historyMessageList.concat({
|
|
5139
|
-
// id: -1,
|
|
5140
|
-
// roomId: roomId,
|
|
5141
|
-
// sender: "AI",
|
|
5142
|
-
// recevier: mid,
|
|
5143
|
-
// message:
|
|
5144
|
-
// "请告诉我您要召唤的老师名字",
|
|
5145
|
-
// createdAt: getDataTime(-1),
|
|
5146
|
-
// findTeacher:true,
|
|
5147
|
-
// extraInfo: JSON.stringify([
|
|
5148
|
-
// {
|
|
5149
|
-
// key: "questionId",
|
|
5150
|
-
// value: "questionId",
|
|
5151
|
-
// },
|
|
5152
|
-
// ])
|
|
5153
|
-
// });
|
|
5154
|
-
// return newHistoryMessageList;
|
|
5155
|
-
// }
|
|
5156
|
-
// );
|
|
5157
|
-
// }
|
|
5158
5256
|
setTimeout(function() {
|
|
5159
5257
|
scrollToBottom();
|
|
5160
5258
|
}, 200);
|
|
@@ -5325,6 +5423,7 @@ var CustomerService = function(props) {
|
|
|
5325
5423
|
if (answerMode == 1) {
|
|
5326
5424
|
getTeacherList(String(e.target.value));
|
|
5327
5425
|
} else {
|
|
5426
|
+
var roomList = contactsList;
|
|
5328
5427
|
if (roomList.length > 0 && roomList[0].roomId != roomId) return;
|
|
5329
5428
|
getQuestiionsList(String(e.target.value), 2);
|
|
5330
5429
|
}
|
|
@@ -5340,10 +5439,32 @@ var CustomerService = function(props) {
|
|
|
5340
5439
|
clearTimeout(timer.current);
|
|
5341
5440
|
setKeyWord("");
|
|
5342
5441
|
setCitationContent({});
|
|
5442
|
+
//查找是否是召唤老师回答并有相应的老师名称
|
|
5443
|
+
if (answerMode == 1 && teacherList.length > 0) {
|
|
5444
|
+
var list = teacherList.filter(function(v) {
|
|
5445
|
+
return v.name == keyWord.trim();
|
|
5446
|
+
});
|
|
5447
|
+
if (list.length > 0) {
|
|
5448
|
+
//直接进入召唤老师回答模式
|
|
5449
|
+
enterTeacherChat(list[0]);
|
|
5450
|
+
setButtomHei(45);
|
|
5451
|
+
return;
|
|
5452
|
+
}
|
|
5453
|
+
}
|
|
5343
5454
|
//跟老师对话
|
|
5455
|
+
var roomList = contactsList;
|
|
5344
5456
|
if (roomList.length > 0 && roomList[0].roomId != roomId) {
|
|
5345
5457
|
sendToTeacher(2);
|
|
5346
5458
|
} else {
|
|
5459
|
+
clearTimeout(timer.current);
|
|
5460
|
+
setQuestionsList([]);
|
|
5461
|
+
setAnswerMode(-1);
|
|
5462
|
+
setTeacherList([]);
|
|
5463
|
+
setHistoryMessageList(function(historyMessageList) {
|
|
5464
|
+
return historyMessageList.filter(function(item) {
|
|
5465
|
+
return item.id != "-1";
|
|
5466
|
+
});
|
|
5467
|
+
});
|
|
5347
5468
|
sendMessage("", 0);
|
|
5348
5469
|
}
|
|
5349
5470
|
setButtomHei(45);
|
|
@@ -5426,11 +5547,33 @@ var CustomerService = function(props) {
|
|
|
5426
5547
|
setCitationContent({});
|
|
5427
5548
|
setButtomHei(45);
|
|
5428
5549
|
if (keyWord.trim() != "") {
|
|
5550
|
+
//查找是否是召唤老师回答并有相应的老师名称
|
|
5551
|
+
if (answerMode == 1 && teacherList.length > 0) {
|
|
5552
|
+
var list = teacherList.filter(function(v) {
|
|
5553
|
+
return v.name == keyWord.trim();
|
|
5554
|
+
});
|
|
5555
|
+
if (list.length > 0) {
|
|
5556
|
+
//直接进入召唤老师回答模式
|
|
5557
|
+
enterTeacherChat(list[0]);
|
|
5558
|
+
setButtomHei(45);
|
|
5559
|
+
return;
|
|
5560
|
+
}
|
|
5561
|
+
}
|
|
5429
5562
|
setKeyWord("");
|
|
5430
5563
|
//跟老师对话
|
|
5564
|
+
var roomList = contactsList;
|
|
5431
5565
|
if (roomList.length > 0 && roomList[0].roomId != roomId) {
|
|
5432
5566
|
sendToTeacher(2);
|
|
5433
5567
|
} else {
|
|
5568
|
+
clearTimeout(timer.current);
|
|
5569
|
+
setQuestionsList([]);
|
|
5570
|
+
setAnswerMode(-1);
|
|
5571
|
+
setTeacherList([]);
|
|
5572
|
+
setHistoryMessageList(function(historyMessageList) {
|
|
5573
|
+
return historyMessageList.filter(function(item) {
|
|
5574
|
+
return item.id != "-1";
|
|
5575
|
+
});
|
|
5576
|
+
});
|
|
5434
5577
|
sendMessage("", 0);
|
|
5435
5578
|
}
|
|
5436
5579
|
onEvent(serverName + serverUrl(), "click_智能问答_ Enter", "提交");
|
|
@@ -5442,6 +5585,34 @@ var CustomerService = function(props) {
|
|
|
5442
5585
|
]
|
|
5443
5586
|
});
|
|
5444
5587
|
};
|
|
5588
|
+
//进入与老师的聊天
|
|
5589
|
+
var enterTeacherChat = function(item) {
|
|
5590
|
+
setTeacherList([]);
|
|
5591
|
+
//提问的问题
|
|
5592
|
+
setProblem({
|
|
5593
|
+
question: problem.question,
|
|
5594
|
+
user: item.uid
|
|
5595
|
+
});
|
|
5596
|
+
setKeyWord("");
|
|
5597
|
+
//setUpdateRecords(true);
|
|
5598
|
+
setAnswerMode(-1);
|
|
5599
|
+
setChatWith(item);
|
|
5600
|
+
var roomList = contactsList;
|
|
5601
|
+
var list = roomList.filter(function(e) {
|
|
5602
|
+
return e.sender == item.uid;
|
|
5603
|
+
});
|
|
5604
|
+
setShowContacts(true);
|
|
5605
|
+
if (list.length > 0) {
|
|
5606
|
+
setRoomId(list[0].roomId); //已有聊天室
|
|
5607
|
+
} else {
|
|
5608
|
+
createRooms(item.uid).then(function(res) {
|
|
5609
|
+
// childRef.current.roomsListTimer();
|
|
5610
|
+
roomsListTimer();
|
|
5611
|
+
var id = res.data.id;
|
|
5612
|
+
setRoomId(id); //新的聊天室id
|
|
5613
|
+
});
|
|
5614
|
+
}
|
|
5615
|
+
};
|
|
5445
5616
|
//渲染联想问题及联想的老师名称
|
|
5446
5617
|
var renderAssociationProblem = function() {
|
|
5447
5618
|
if (answerMode == 1) {
|
|
@@ -5451,35 +5622,24 @@ var CustomerService = function(props) {
|
|
|
5451
5622
|
bottom: "".concat(buttomHei + 14, "px")
|
|
5452
5623
|
},
|
|
5453
5624
|
children: teacherList.map(function(item) {
|
|
5454
|
-
var
|
|
5455
|
-
|
|
5456
|
-
|
|
5625
|
+
var reg = /[`~!@#$%^&*()_\-+=<>?:"{}|,.\/;'\\[\]·~!@#¥%……&*()——\-+={}|《》?:“”【】、;‘’,。、]/im;
|
|
5626
|
+
var span = "";
|
|
5627
|
+
//搜索内容是否有特殊字符
|
|
5628
|
+
if (reg.test(keyWord)) {
|
|
5629
|
+
span = item.name.replaceAll(keyWord, function(e) {
|
|
5630
|
+
return "<span class=".concat(styles.sign, ">").concat(e, "</span>");
|
|
5631
|
+
});
|
|
5632
|
+
} else {
|
|
5633
|
+
span = item.name.replaceAll(new RegExp(keyWord, "ig"), function(i) {
|
|
5634
|
+
// console.log(i,'skdcnsdjk')
|
|
5635
|
+
return "<span class=".concat(styles.sign, ">").concat(i, "</span>");
|
|
5636
|
+
});
|
|
5637
|
+
}
|
|
5457
5638
|
return /*#__PURE__*/ jsx("p", {
|
|
5458
5639
|
className: styles.item,
|
|
5459
5640
|
children: /*#__PURE__*/ jsx("span", {
|
|
5460
5641
|
onClick: function() {
|
|
5461
|
-
|
|
5462
|
-
//提问的问题
|
|
5463
|
-
setProblem({
|
|
5464
|
-
question: problem.question,
|
|
5465
|
-
user: item.uid
|
|
5466
|
-
});
|
|
5467
|
-
setKeyWord("");
|
|
5468
|
-
//setUpdateRecords(true);
|
|
5469
|
-
setAnswerMode(-1);
|
|
5470
|
-
setChatWith(item);
|
|
5471
|
-
var list = roomList.filter(function(e) {
|
|
5472
|
-
return e.sender == item.uid;
|
|
5473
|
-
});
|
|
5474
|
-
if (list.length > 0) {
|
|
5475
|
-
setRoomId(list[0].roomId); //已有聊天室
|
|
5476
|
-
} else {
|
|
5477
|
-
createRooms(item.uid).then(function(res) {
|
|
5478
|
-
childRef.current.roomsListTimer();
|
|
5479
|
-
var id = res.data.id;
|
|
5480
|
-
setRoomId(id); //新的聊天室id
|
|
5481
|
-
});
|
|
5482
|
-
}
|
|
5642
|
+
enterTeacherChat(item);
|
|
5483
5643
|
},
|
|
5484
5644
|
dangerouslySetInnerHTML: {
|
|
5485
5645
|
__html: span
|
|
@@ -5495,9 +5655,19 @@ var CustomerService = function(props) {
|
|
|
5495
5655
|
bottom: "".concat(buttomHei + 6, "px")
|
|
5496
5656
|
},
|
|
5497
5657
|
children: questionsList.map(function(item) {
|
|
5498
|
-
var
|
|
5499
|
-
|
|
5500
|
-
|
|
5658
|
+
var reg = /[`~!@#$%^&*()_\-+=<>?:"{}|,.\/;'\\[\]·~!@#¥%……&*()——\-+={}|《》?:“”【】、;‘’,。、]/im;
|
|
5659
|
+
var span = "";
|
|
5660
|
+
//搜索内容是否有特殊字符
|
|
5661
|
+
if (reg.test(keyWord)) {
|
|
5662
|
+
span = item.question.replaceAll(keyWord, function(e) {
|
|
5663
|
+
return "<span class=".concat(styles.sign, ">").concat(e, "</span>");
|
|
5664
|
+
});
|
|
5665
|
+
} else {
|
|
5666
|
+
span = item.question.replaceAll(new RegExp(keyWord, "ig"), function(i) {
|
|
5667
|
+
// console.log(i,'skdcnsdjk')
|
|
5668
|
+
return "<span class=".concat(styles.sign, ">").concat(i, "</span>");
|
|
5669
|
+
});
|
|
5670
|
+
}
|
|
5501
5671
|
return /*#__PURE__*/ jsx("p", {
|
|
5502
5672
|
className: styles.item,
|
|
5503
5673
|
children: /*#__PURE__*/ jsx("span", {
|
|
@@ -5517,30 +5687,33 @@ var CustomerService = function(props) {
|
|
|
5517
5687
|
};
|
|
5518
5688
|
//加载指定数据,点击历史记录
|
|
5519
5689
|
var loadSpecifiedData = function(renewRoomId, page, id, receiver) {
|
|
5690
|
+
// let renewRoomId = '4a615d7126b343f78d10dcb06dbc29b0';
|
|
5691
|
+
// let page = 1;
|
|
5692
|
+
// let id = '0e459f0a3a62438698f170b42b94d150';
|
|
5693
|
+
// let receiver = mid;
|
|
5520
5694
|
if (page != 1) {
|
|
5521
5695
|
setPageNumHistory(page);
|
|
5522
5696
|
}
|
|
5523
|
-
setPageNum(page);
|
|
5524
5697
|
setLastId(id); //用于定位
|
|
5698
|
+
setPageNum(page);
|
|
5525
5699
|
//如果是当前聊天室
|
|
5526
5700
|
if (renewRoomId == roomId) {
|
|
5527
5701
|
getHistoryMessage(page, 1);
|
|
5528
5702
|
} else {
|
|
5529
5703
|
setRoomId(renewRoomId);
|
|
5530
|
-
if (
|
|
5531
|
-
|
|
5532
|
-
createRooms(receiver);
|
|
5533
|
-
}
|
|
5534
|
-
setTimeout(function() {
|
|
5535
|
-
childRef.current.roomsListTimer();
|
|
5536
|
-
}, 500);
|
|
5704
|
+
if (receiver != mid) {
|
|
5705
|
+
createRooms(receiver);
|
|
5537
5706
|
}
|
|
5707
|
+
setTimeout(function() {
|
|
5708
|
+
roomsListTimer();
|
|
5709
|
+
}, 500);
|
|
5538
5710
|
}
|
|
5711
|
+
setShowContacts(true);
|
|
5539
5712
|
};
|
|
5540
5713
|
return /*#__PURE__*/ jsxs(Fragment, {
|
|
5541
5714
|
children: [
|
|
5542
5715
|
/*#__PURE__*/ jsxs(Drawer, {
|
|
5543
|
-
title: "
|
|
5716
|
+
title: "AI助手",
|
|
5544
5717
|
width: 560,
|
|
5545
5718
|
onClose: function() {
|
|
5546
5719
|
onCancel();
|
|
@@ -5565,9 +5738,9 @@ var CustomerService = function(props) {
|
|
|
5565
5738
|
onClose: function() {
|
|
5566
5739
|
setShowContacts(false);
|
|
5567
5740
|
},
|
|
5568
|
-
// roomIdAi={roomIdAi}
|
|
5569
5741
|
switchChatRoom: switchChatRoom,
|
|
5570
|
-
|
|
5742
|
+
// saveContactsList={saveContactsList}
|
|
5743
|
+
contactsList: contactsList,
|
|
5571
5744
|
ref: childRef
|
|
5572
5745
|
})
|
|
5573
5746
|
}),
|
|
@@ -5624,7 +5797,7 @@ var CustomerService = function(props) {
|
|
|
5624
5797
|
]
|
|
5625
5798
|
}),
|
|
5626
5799
|
/*#__PURE__*/ jsxs(Modal, {
|
|
5627
|
-
title: "
|
|
5800
|
+
title: "AI助手",
|
|
5628
5801
|
open: showType == 2 ? true : false,
|
|
5629
5802
|
onCancel: function() {
|
|
5630
5803
|
onCancel();
|
|
@@ -5663,7 +5836,8 @@ var CustomerService = function(props) {
|
|
|
5663
5836
|
setShowContacts(false);
|
|
5664
5837
|
},
|
|
5665
5838
|
switchChatRoom: switchChatRoom,
|
|
5666
|
-
|
|
5839
|
+
contactsList: contactsList,
|
|
5840
|
+
// saveContactsList={saveContactsList}
|
|
5667
5841
|
ref: childRef
|
|
5668
5842
|
}),
|
|
5669
5843
|
/*#__PURE__*/ jsxs("div", {
|
|
@@ -5719,13 +5893,7 @@ var CustomerService = function(props) {
|
|
|
5719
5893
|
/*#__PURE__*/ jsx("div", {
|
|
5720
5894
|
className: styles.user,
|
|
5721
5895
|
children: /*#__PURE__*/ jsx("p", {
|
|
5722
|
-
children:
|
|
5723
|
-
return e.roomId == roomId;
|
|
5724
|
-
}).length > 0 && roomList.filter(function(e) {
|
|
5725
|
-
return e.roomId == roomId;
|
|
5726
|
-
})[0].name != undefined ? roomList.filter(function(e) {
|
|
5727
|
-
return e.roomId == roomId;
|
|
5728
|
-
})[0].name : "智能问答"
|
|
5896
|
+
children: showChatRoomName()
|
|
5729
5897
|
})
|
|
5730
5898
|
}),
|
|
5731
5899
|
/*#__PURE__*/ jsxs("div", {
|
|
@@ -5746,7 +5914,7 @@ var CustomerService = function(props) {
|
|
|
5746
5914
|
onEvent(serverName + serverUrl(), "click_智能问答_全屏", "提交");
|
|
5747
5915
|
setFirstLoad(false);
|
|
5748
5916
|
setShowType(4);
|
|
5749
|
-
|
|
5917
|
+
// childRef.current.roomsListTimer();
|
|
5750
5918
|
},
|
|
5751
5919
|
children: /*#__PURE__*/ jsx(CustomFullScreen$1, {})
|
|
5752
5920
|
}),
|
|
@@ -5814,8 +5982,9 @@ var CustomerService = function(props) {
|
|
|
5814
5982
|
onClose: function() {
|
|
5815
5983
|
setShowContacts(false);
|
|
5816
5984
|
},
|
|
5985
|
+
contactsList: contactsList,
|
|
5817
5986
|
switchChatRoom: switchChatRoom,
|
|
5818
|
-
|
|
5987
|
+
// saveContactsList={saveContactsList}
|
|
5819
5988
|
ref: childRef
|
|
5820
5989
|
})
|
|
5821
5990
|
})
|
|
@@ -5824,7 +5993,7 @@ var CustomerService = function(props) {
|
|
|
5824
5993
|
showType == 4 && /*#__PURE__*/ jsxs(Fragment, {
|
|
5825
5994
|
children: [
|
|
5826
5995
|
/*#__PURE__*/ jsxs(Modal, {
|
|
5827
|
-
title: "
|
|
5996
|
+
title: "AI助手",
|
|
5828
5997
|
open: true,
|
|
5829
5998
|
onCancel: function() {
|
|
5830
5999
|
onCancel();
|
|
@@ -5862,8 +6031,9 @@ var CustomerService = function(props) {
|
|
|
5862
6031
|
onClose: function() {
|
|
5863
6032
|
setShowContacts(false);
|
|
5864
6033
|
},
|
|
6034
|
+
contactsList: contactsList,
|
|
5865
6035
|
switchChatRoom: switchChatRoom,
|
|
5866
|
-
|
|
6036
|
+
// saveContactsList={saveContactsList}
|
|
5867
6037
|
ref: childRef
|
|
5868
6038
|
}),
|
|
5869
6039
|
/*#__PURE__*/ jsxs("div", {
|
|
@@ -5919,13 +6089,7 @@ var CustomerService = function(props) {
|
|
|
5919
6089
|
/*#__PURE__*/ jsx("div", {
|
|
5920
6090
|
className: styles.user,
|
|
5921
6091
|
children: /*#__PURE__*/ jsx("p", {
|
|
5922
|
-
children:
|
|
5923
|
-
return e.roomId == roomId;
|
|
5924
|
-
}).length > 0 && !roomList.filter(function(e) {
|
|
5925
|
-
return e.roomId == roomId;
|
|
5926
|
-
})[0].name ? roomList.filter(function(e) {
|
|
5927
|
-
return e.roomId == roomId;
|
|
5928
|
-
})[0].name : "智能问答"
|
|
6092
|
+
children: showChatRoomName()
|
|
5929
6093
|
})
|
|
5930
6094
|
}),
|
|
5931
6095
|
/*#__PURE__*/ jsxs("div", {
|
|
@@ -5944,7 +6108,7 @@ var CustomerService = function(props) {
|
|
|
5944
6108
|
onClick: function() {
|
|
5945
6109
|
onEvent(serverName + serverUrl(), "click_智能问答_全屏", "提交");
|
|
5946
6110
|
setShowType(4);
|
|
5947
|
-
|
|
6111
|
+
// childRef.current.roomsListTimer();
|
|
5948
6112
|
},
|
|
5949
6113
|
children: /*#__PURE__*/ jsx(CustomFullScreen$1, {})
|
|
5950
6114
|
}),
|
|
@@ -6001,8 +6165,9 @@ var CustomerService = function(props) {
|
|
|
6001
6165
|
onClose: function() {
|
|
6002
6166
|
setShowContacts(false);
|
|
6003
6167
|
},
|
|
6168
|
+
contactsList: contactsList,
|
|
6004
6169
|
switchChatRoom: switchChatRoom,
|
|
6005
|
-
|
|
6170
|
+
// saveContactsList={saveContactsList}
|
|
6006
6171
|
ref: childRef
|
|
6007
6172
|
})
|
|
6008
6173
|
})
|