|
|
@@ -15,7 +15,7 @@
|
|
|
</template>
|
|
|
<div :class="{session_choose:dataIndex ==index && sessionType ==1}"
|
|
|
class="user session_style" @click="chooseDialogue(1,index)"
|
|
|
- v-for="(item,index) in sessionList">
|
|
|
+ v-for="(item,index) in sessionList" :key="index">
|
|
|
<div class="row allAlignment item-center">
|
|
|
<span style="font-weight:bold;color:#666;font-size:14px;">{{item.name}}</span>
|
|
|
<span style="color:#999;font-size:.12px;">{{item.intime}}</span>
|
|
|
@@ -34,7 +34,7 @@
|
|
|
</template>
|
|
|
<div :class="{session_choose:dataIndex == index && sessionType ==2}"
|
|
|
class="user session_style" @click="chooseDialogue(2,index)"
|
|
|
- v-for="(item,index) in offlineList">
|
|
|
+ v-for="(item,index) in offlineList" :key="index">
|
|
|
<div class="row allAlignment item-center">
|
|
|
<span style="font-weight:bold;color:#999;font-size:14px;">{{item.name}}</span>
|
|
|
<span style="color:#999;font-size:12px;">{{item.intime}}</span>
|
|
|
@@ -95,6 +95,10 @@
|
|
|
</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'">
|
|
|
@@ -169,7 +173,7 @@
|
|
|
<textarea draggable="false" class="input scroll" id="input" v-model.trim="inputValue"
|
|
|
@keyup.enter="listenEnter($event)" @keyup.ctrl.enter="lineFeed()"></textarea>
|
|
|
<div class="row rightAlignment" style="width: 100%;">
|
|
|
- <div @click="sendMessage()" class="msgInputBtn row center">发送</div>
|
|
|
+ <div @click="sendMessage()" @keyup.enter="sendMessage" class="msgInputBtn row center">发送</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
<!-- 发送消息音频提示 -->
|
|
|
@@ -333,6 +337,7 @@
|
|
|
import leftNav from "@/components/leftNav";
|
|
|
import hader from "@/components/hader";
|
|
|
import messageCenter from "@/components/messageCenter";
|
|
|
+ import historicalRecord from "@/components/historicalRecord";
|
|
|
|
|
|
export default {
|
|
|
name: "TheCurrentSession",
|
|
|
@@ -375,6 +380,9 @@
|
|
|
showHistoryList: false,
|
|
|
historyList: [],
|
|
|
historyTime:'',
|
|
|
+ historyLoading: false, // 历史记录加载
|
|
|
+ historyProcess: '更多历史记录', // 查看历史历史记录或者加载中
|
|
|
+ historyPage: 1 // 当前的历史记录页
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
@@ -692,6 +700,7 @@
|
|
|
/***************关闭当前和用户聊天对话***************/
|
|
|
open() {
|
|
|
let _this = this;
|
|
|
+ console.log(this.sessionList)
|
|
|
if (this.sessionType == 1) {
|
|
|
if (this.sessionList.length < 1) return
|
|
|
} else {
|
|
|
@@ -708,7 +717,7 @@
|
|
|
let data = {
|
|
|
"type": "kfCloseUser",
|
|
|
data: {
|
|
|
- to_id,
|
|
|
+ to_id: '',
|
|
|
kf_id: "KF" + _this.user_info.id,
|
|
|
group_id: _this.user_info.group_id,
|
|
|
conversationId: conversationId,
|
|
|
@@ -756,6 +765,11 @@
|
|
|
|
|
|
/*********************发送消息*********************/
|
|
|
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.sessionType == 2) {
|
|
|
@@ -805,7 +819,8 @@
|
|
|
type: 'service', content: {
|
|
|
text: this.$public.turnFace(this.inputValue, this.$frce),
|
|
|
img: '',
|
|
|
- }, time: this.time[1]
|
|
|
+ },
|
|
|
+ // time: this.time[1]
|
|
|
});
|
|
|
//this.data = [];
|
|
|
//标记当前会话位置
|
|
|
@@ -824,7 +839,7 @@
|
|
|
//计算关键词次数
|
|
|
this.sensitiveNumber = this.sensitiveNumber + sensitive_data.num;
|
|
|
}
|
|
|
-
|
|
|
+ this.historyProcess = '更多历史消息' // 发送信息成功后改变说明
|
|
|
|
|
|
},
|
|
|
|
|
|
@@ -1123,7 +1138,9 @@
|
|
|
/****************访问信息和评价状态***************/
|
|
|
accessTerminal(data) {
|
|
|
if (this.sessionType == 1) {
|
|
|
+ console.log('dataIndex', this.dataIndex)
|
|
|
let List = this.sessionList[this.dataIndex];
|
|
|
+ console.log('list', List)
|
|
|
if (data == 'eva') {
|
|
|
if (!List) return false
|
|
|
// console.log(List,'对话信息');
|
|
|
@@ -1164,8 +1181,64 @@
|
|
|
}
|
|
|
// }
|
|
|
}
|
|
|
+ },
|
|
|
+ getHistoryInfo() { // 获取历史数据
|
|
|
+ let obj = {
|
|
|
+ headers: {
|
|
|
+ apiToken: this.$md5("userhistory" + "customer-service" + "history" + "service"),
|
|
|
+ // 'apiToken': this.$md5("historylist" + "customer-service" + "history" + "service"),
|
|
|
+ userToken: this.token
|
|
|
+ },
|
|
|
+ params: {
|
|
|
+ // user_name: this.user_info.account_name,
|
|
|
+ account_id: 'KF' + this.user_info.id,
|
|
|
+ currentPage: this.historyPage,
|
|
|
+ pageSize: 10
|
|
|
+ }
|
|
|
+ };
|
|
|
+ this.historyLoading = true
|
|
|
+ this.historyProcess = '加载中'
|
|
|
+ this.$http.get(this.$ports.history.userHistory,obj).then(res => {
|
|
|
+ if(res.data.code == 1) {
|
|
|
+ if(!res.data.data.total ) { // 历史记录总数
|
|
|
+ this.historyProcess = '没有更多历史记录'
|
|
|
+ this.historyLoading = false
|
|
|
+ } else {
|
|
|
+ // 遍历封装数据
|
|
|
+ if(this.historyPage > res.data.data.countPage) {
|
|
|
+ this.historyProcess = '没有更多历史记录'
|
|
|
+ this.historyLoading = false
|
|
|
+ } else {
|
|
|
+ let list = res.data.data.list
|
|
|
+ if(list) {
|
|
|
+ for(let item of list) {
|
|
|
+ let historyItem = {
|
|
|
+ type: item.from_id.substr(0, 2) === 'KF' ? 'service' : 'user',
|
|
|
+ time: this.$public.customFormatDateTime(item.time_line),
|
|
|
+ content: JSON.parse(item.content)
|
|
|
+ }
|
|
|
+ this.data.unshift(historyItem)
|
|
|
+ }
|
|
|
+ this.historyPage ++ ;
|
|
|
+ this.historyProcess = '更多历史记录'
|
|
|
+ this.historyLoading = false;
|
|
|
+ } else {
|
|
|
+ this.historyProcess = '没有更多历史记录'
|
|
|
+ this.historyLoading = false
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }).catch(err => {
|
|
|
+ this.$message.error(err.message)
|
|
|
+ this.historyLoading = false;
|
|
|
+ this.historyProcess = '更多历史记录'
|
|
|
+ })
|
|
|
}
|
|
|
},
|
|
|
+ created() {
|
|
|
+ this.get_vuex_info();
|
|
|
+ },
|
|
|
/**
|
|
|
* 挂载前执行
|
|
|
*/
|
|
|
@@ -1206,8 +1279,14 @@
|
|
|
this.chatMessage(e)
|
|
|
},
|
|
|
|
|
|
- sessionList(e) {
|
|
|
- this.accessTerminal(e)
|
|
|
+ // sessionList(e) {
|
|
|
+ // this.accessTerminal(e)
|
|
|
+ // },
|
|
|
+ sessionList: {
|
|
|
+ handler(val) {
|
|
|
+ this.accessTerminal(val)
|
|
|
+ },
|
|
|
+ deep: true
|
|
|
},
|
|
|
offlineList(e) {
|
|
|
this.accessTerminal(e)
|
|
|
@@ -1229,7 +1308,7 @@
|
|
|
offlineList: 'get_offline',
|
|
|
dataIndex: 'get_num',
|
|
|
sessionType: 'get_type',
|
|
|
- get_user_info: 'get_session_user',
|
|
|
+ get_user_info: 'get_session_user', // 会话人详细信息
|
|
|
// is_eva_btn:'get_is_eva_btn',
|
|
|
}),
|
|
|
|
|
|
@@ -1247,7 +1326,8 @@
|
|
|
components: {
|
|
|
leftNav,
|
|
|
hader,
|
|
|
- messageCenter
|
|
|
+ messageCenter,
|
|
|
+ historicalRecord
|
|
|
}
|
|
|
};
|
|
|
</script>
|
|
|
@@ -1680,4 +1760,9 @@
|
|
|
.rightAlignment .el-button {
|
|
|
border: none;
|
|
|
}
|
|
|
+ .history-info {
|
|
|
+ color: #5399f5;
|
|
|
+ text-align: center;
|
|
|
+ margin-top: 5px;
|
|
|
+ }
|
|
|
</style>
|