|
|
@@ -93,12 +93,11 @@
|
|
|
</p>
|
|
|
</div>
|
|
|
</div>
|
|
|
-
|
|
|
+ <div class="history-info">
|
|
|
+ <el-button type="text" size="small" :loading="historyLoading"
|
|
|
+ @click="getHistoryInfo">{{historyProcess}}</el-button>
|
|
|
+ </div>
|
|
|
<div class="chat-box scroll" id='chat_box'>
|
|
|
- <div class="history-info">
|
|
|
- <el-button type="text" size="small" :loading="historyLoading"
|
|
|
- @click="getHistoryInfo">{{historyProcess}}</el-button>
|
|
|
- </div>
|
|
|
<div v-for="(item,index) in data" :key="index">
|
|
|
<!-- 系统转接 -->
|
|
|
<!-- <div class="row center" v-if="item.type == 'system'">
|
|
|
@@ -522,13 +521,14 @@
|
|
|
this.showHistoryList = true;
|
|
|
redata.data.history.forEach(res => {
|
|
|
let content = JSON.parse(res.content)
|
|
|
- res.content = content;
|
|
|
+ // res.content = content;
|
|
|
if (content.text) {
|
|
|
content.text = this.$public.turnFace(content.text,this.$frce)
|
|
|
- res.content = content
|
|
|
}
|
|
|
+ res.content = content
|
|
|
this.historyList.push(res)
|
|
|
})
|
|
|
+ this.automaticRolling();
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
@@ -661,8 +661,11 @@
|
|
|
},
|
|
|
|
|
|
/*****************切换用户会话对象******************/
|
|
|
- chooseDialogue(type, index) {
|
|
|
- this.inputValue = '' // 清除会话内容
|
|
|
+ chooseDialogue(type,index,system) {
|
|
|
+ if(!system){
|
|
|
+ this.inputValue = '' // 清除会话内容
|
|
|
+ }
|
|
|
+ console.log(type, index);
|
|
|
if (this.userSwitching) {
|
|
|
let data = [];
|
|
|
let order_id = '';
|
|
|
@@ -763,21 +766,31 @@
|
|
|
send.play()
|
|
|
},
|
|
|
|
|
|
+ //判断是否选中访客
|
|
|
+ visitor_info(){
|
|
|
+ if(this.sessionType == 1 && this.sessionList.length <= 0 ){
|
|
|
+ return '-1';
|
|
|
+ }else if(this.sessionType == 2 && this.offlineList <= 0 ){
|
|
|
+ return ' -1';
|
|
|
+ }
|
|
|
+ //this.sessionList.length >0 && this.sessionType == 1
|
|
|
+ },
|
|
|
+
|
|
|
/*********************发送消息*********************/
|
|
|
sendMessage() {
|
|
|
- console.log('websocket',this.$websocket.readyState)
|
|
|
- console.log('sessionType', this.sessionType)
|
|
|
- if(this.sessionType == 1) {
|
|
|
- console.log("???")
|
|
|
- }
|
|
|
- console.log(this.inputValue);
|
|
|
- if (!this.inputValue) return;
|
|
|
+ if (!this.inputValue ) return;
|
|
|
if (this.sessionType == 2) {
|
|
|
this.$message({
|
|
|
message: '只能给在线用户发送消息哦...',
|
|
|
type: 'warning'
|
|
|
});
|
|
|
return false;
|
|
|
+ }else if(this.sessionType == 1 && this.sessionList.length <= 0){
|
|
|
+ this.$message({
|
|
|
+ message: '只能给在线用户发送消息哦...',
|
|
|
+ type: 'warning'
|
|
|
+ });
|
|
|
+ return false;
|
|
|
}
|
|
|
// if(this.offlineList.length <= 0 ) return
|
|
|
let isFirst = true, sensitiveNumber = 0;
|
|
|
@@ -906,6 +919,7 @@
|
|
|
|
|
|
/*****************获取当前聊天用户信息****************/
|
|
|
get_user(id,type,index) {
|
|
|
+ // console.log(id,type,index)
|
|
|
let obj = {
|
|
|
account_id: id
|
|
|
};
|
|
|
@@ -962,6 +976,15 @@
|
|
|
})
|
|
|
},
|
|
|
|
|
|
+ /*****************************/
|
|
|
+ automaticScrollTop(){
|
|
|
+ this.$nextTick(() => {
|
|
|
+ let msg = document.getElementById('chat_box') // 获取对象
|
|
|
+ console.log(msg.scrollHeight);
|
|
|
+ msg.scrollTop = '0px'
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
/**************获取敏感词*****************/
|
|
|
getSensitive() {
|
|
|
let obj = {
|
|
|
@@ -1138,9 +1161,9 @@
|
|
|
/****************访问信息和评价状态***************/
|
|
|
accessTerminal(data) {
|
|
|
if (this.sessionType == 1) {
|
|
|
- console.log('dataIndex', this.dataIndex)
|
|
|
+ // console.log('dataIndex', this.dataIndex)
|
|
|
let List = this.sessionList[this.dataIndex];
|
|
|
- console.log('list', List)
|
|
|
+ // console.log('list', List)
|
|
|
if (data == 'eva') {
|
|
|
if (!List) return false
|
|
|
// console.log(List,'对话信息');
|
|
|
@@ -1164,6 +1187,9 @@
|
|
|
source:List.ipinfo
|
|
|
|
|
|
}
|
|
|
+ if(this.sessionList.length == 1 && this.dataIndex ==0){
|
|
|
+ this.get_user(List.id,1,this.dataIndex);
|
|
|
+ }
|
|
|
} else {
|
|
|
this.terminal_IP = {}
|
|
|
}
|
|
|
@@ -1182,7 +1208,25 @@
|
|
|
// }
|
|
|
}
|
|
|
},
|
|
|
- getHistoryInfo() { // 获取历史数据
|
|
|
+ /****************** 获取历史数据 *******************/
|
|
|
+ getHistoryInfo() { //
|
|
|
+ let visitors_id = '';
|
|
|
+ let conversationId = '';
|
|
|
+ if(this.sessionType == 1){
|
|
|
+ visitors_id = this.sessionList[this.dataIndex] ? this.sessionList[this.dataIndex].id: '';
|
|
|
+ conversationId =this.sessionList[this.dataIndex] ? this.sessionList[this.dataIndex].conversationId : '';
|
|
|
+ }else if(this.sessionType == 2){
|
|
|
+ visitors_id = this.offlineList[this.dataIndex] ? this.offlineList[this.dataIndex].id :'';
|
|
|
+ conversationId = this.offlineList[this.dataIndex] ? this.offlineList[this.dataIndex].conversationId : '';
|
|
|
+ }
|
|
|
+ if(visitors_id == ''){
|
|
|
+ this.$message({
|
|
|
+ message:'没有对应的访客',
|
|
|
+ type: 'warning'
|
|
|
+ });
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
let obj = {
|
|
|
headers: {
|
|
|
apiToken: this.$md5("userhistory" + "customer-service" + "history" + "service"),
|
|
|
@@ -1190,8 +1234,9 @@
|
|
|
userToken: this.token
|
|
|
},
|
|
|
params: {
|
|
|
- // user_name: this.user_info.account_name,
|
|
|
+ account_user_id: visitors_id,
|
|
|
account_id: 'KF' + this.user_info.id,
|
|
|
+ conversationId,
|
|
|
currentPage: this.historyPage,
|
|
|
pageSize: 10
|
|
|
}
|
|
|
@@ -1212,12 +1257,18 @@
|
|
|
let list = res.data.data.list
|
|
|
if(list) {
|
|
|
for(let item of list) {
|
|
|
+ let content = JSON.parse(item.content)
|
|
|
+ if (content.text) {
|
|
|
+ content.text = this.$public.turnFace(content.text,this.$frce)
|
|
|
+ }
|
|
|
let historyItem = {
|
|
|
type: item.from_id.substr(0, 2) === 'KF' ? 'service' : 'user',
|
|
|
time: this.$public.customFormatDateTime(item.time_line),
|
|
|
- content: JSON.parse(item.content)
|
|
|
+ content: content
|
|
|
+
|
|
|
}
|
|
|
- this.data.unshift(historyItem)
|
|
|
+ this.data.unshift(historyItem);
|
|
|
+ this.automaticScrollTop()
|
|
|
}
|
|
|
this.historyPage ++ ;
|
|
|
this.historyProcess = '更多历史记录'
|
|
|
@@ -1284,11 +1335,13 @@
|
|
|
// },
|
|
|
sessionList: {
|
|
|
handler(val) {
|
|
|
+ console.log(val,'事件监听sessionList');
|
|
|
this.accessTerminal(val)
|
|
|
},
|
|
|
deep: true
|
|
|
},
|
|
|
offlineList(e) {
|
|
|
+ console.log(e,'事件监听offlineList')
|
|
|
this.accessTerminal(e)
|
|
|
},
|
|
|
|
|
|
@@ -1309,7 +1362,7 @@
|
|
|
dataIndex: 'get_num',
|
|
|
sessionType: 'get_type',
|
|
|
get_user_info: 'get_session_user', // 会话人详细信息
|
|
|
- // is_eva_btn:'get_is_eva_btn',
|
|
|
+
|
|
|
}),
|
|
|
|
|
|
get_session_message() {
|
|
|
@@ -1455,9 +1508,7 @@
|
|
|
}
|
|
|
|
|
|
.chat-box {
|
|
|
- height: 62vh;
|
|
|
- /* background: red; */
|
|
|
- /* padding: 40px 0; */
|
|
|
+ height: 56vh;
|
|
|
padding-bottom: 10px;
|
|
|
border-bottom: 1px solid #d5e5ff;
|
|
|
overflow-x: hidden;
|
|
|
@@ -1574,7 +1625,7 @@
|
|
|
|
|
|
.FastReplyBox {
|
|
|
padding: 0.4rem 0;
|
|
|
- height: 80vh;
|
|
|
+ height: 75vh;
|
|
|
overflow-x: hidden;
|
|
|
overflow-y: auto;
|
|
|
}
|