|
|
@@ -95,46 +95,6 @@
|
|
|
</div>
|
|
|
|
|
|
<div class="chat-box scroll" id='chat_box'>
|
|
|
- <!-- 转接 历史信息-->
|
|
|
- <div v-if="showHistoryList">
|
|
|
- <div v-for="(item,index) in historyList" :key="index">
|
|
|
- <!-- 客服消息 -->
|
|
|
- <div style="padding:0 10px;margin-top:20px;" class="rightAlignment" v-if="item.from_id.startsWith('KF')" >
|
|
|
- <div style="height:37px;font-size:12px;color:#bbb;" class="row item-center rightAlignment">
|
|
|
- {{item.time_line | formatDate}}
|
|
|
- </div>
|
|
|
- <div class="row item-center rightAlignment">
|
|
|
- <p v-if="item.content.text != ''" class="chatMsg message_box" v-html="item.content.text"></p>
|
|
|
- <div v-if="item.content.img !=''">
|
|
|
- <!-- :fit="contain" style="background:#F5F5F5; border-radius: 10px 0 10px 10px;"-->
|
|
|
- <el-image style="width: 200px; height: 100px"
|
|
|
- @click="handlePictureCardPreview(img_http+item.content.img)"
|
|
|
- :src="img_http + item.content.img" :fit="fit"></el-image>
|
|
|
- </div>
|
|
|
-
|
|
|
- </div>
|
|
|
- </div>
|
|
|
-
|
|
|
- <!-- 用户消息 -->
|
|
|
- <div style="padding:0 10px;margin-top:20px;" v-else>
|
|
|
- <div style="height:37px;font-size:.12px;color:#bbb;" class="row item-center">
|
|
|
- {{item.time_line | formatDate}}
|
|
|
- </div>
|
|
|
- <div class="row">
|
|
|
- <p v-if="item.content.text != ''" class="chatMsg user_box" v-html="item.content.text"></p>
|
|
|
- <div v-if="item.content.img != ''">
|
|
|
- <el-image style="width: 200px; height: 100px"
|
|
|
- @click="handlePictureCardPreview(img_http+item.content.img)"
|
|
|
- :src="img_http + item.content.img"
|
|
|
- :fit="fit">
|
|
|
- </el-image>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
-
|
|
|
-
|
|
|
<div v-for="(item,index) in data" :key="index">
|
|
|
<!-- 系统转接 -->
|
|
|
<!-- <div class="row center" v-if="item.type == 'system'">
|
|
|
@@ -420,40 +380,40 @@
|
|
|
historyTime:'',
|
|
|
}
|
|
|
},
|
|
|
- filters: {
|
|
|
- /**
|
|
|
- * 时间戳转日期自定义时间格式
|
|
|
- * timeStamp:时间戳
|
|
|
- * custom:转换日期时定义年月日用是什么符号隔开
|
|
|
- * isDtae:0=月份、1=日期、3=时间
|
|
|
- */
|
|
|
-
|
|
|
- formatDate: function (value, custom = '', isDtae = 3) {
|
|
|
- let timeStamp = value;
|
|
|
- var date = new Date();
|
|
|
- date.setTime(timeStamp * 1000);
|
|
|
- var y = date.getFullYear();
|
|
|
- var m = date.getMonth() + 1;
|
|
|
- m = m < 10 ? ('0' + m) : m;
|
|
|
- var d = date.getDate();
|
|
|
- d = d < 10 ? ('0' + d) : d;
|
|
|
- var h = date.getHours();
|
|
|
- h = h < 10 ? ('0' + h) : h;
|
|
|
- var minute = date.getMinutes();
|
|
|
- var second = date.getSeconds();
|
|
|
- minute = minute < 10 ? ('0' + minute) : minute;
|
|
|
- second = second < 10 ? ('0' + second) : second;
|
|
|
- if (isDtae == 0) {
|
|
|
- return y + custom + m //+'student';
|
|
|
- } else if (isDtae == 1) {
|
|
|
- return y + custom + m + custom + d;
|
|
|
- } else if (isDtae == 3) {
|
|
|
- return h + ':' + minute;
|
|
|
- } else {
|
|
|
- return y + '-' + m + '-' + d + ' ' + h + ':' + minute //+ ':' + second;
|
|
|
- }
|
|
|
- }
|
|
|
- },
|
|
|
+ // filters: {
|
|
|
+ // /**
|
|
|
+ // * 时间戳转日期自定义时间格式
|
|
|
+ // * timeStamp:时间戳
|
|
|
+ // * custom:转换日期时定义年月日用是什么符号隔开
|
|
|
+ // * isDtae:0=月份、1=日期、3=时间
|
|
|
+ // */
|
|
|
+
|
|
|
+ // formatDate: function (value, custom = '', isDtae = 3) {
|
|
|
+ // let timeStamp = value;
|
|
|
+ // var date = new Date();
|
|
|
+ // date.setTime(timeStamp * 1000);
|
|
|
+ // var y = date.getFullYear();
|
|
|
+ // var m = date.getMonth() + 1;
|
|
|
+ // m = m < 10 ? ('0' + m) : m;
|
|
|
+ // var d = date.getDate();
|
|
|
+ // d = d < 10 ? ('0' + d) : d;
|
|
|
+ // var h = date.getHours();
|
|
|
+ // h = h < 10 ? ('0' + h) : h;
|
|
|
+ // var minute = date.getMinutes();
|
|
|
+ // var second = date.getSeconds();
|
|
|
+ // minute = minute < 10 ? ('0' + minute) : minute;
|
|
|
+ // second = second < 10 ? ('0' + second) : second;
|
|
|
+ // if (isDtae == 0) {
|
|
|
+ // return y + custom + m //+'student';
|
|
|
+ // } else if (isDtae == 1) {
|
|
|
+ // return y + custom + m + custom + d;
|
|
|
+ // } else if (isDtae == 3) {
|
|
|
+ // return h + ':' + minute;
|
|
|
+ // } else {
|
|
|
+ // return y + '-' + m + '-' + d + ' ' + h + ':' + minute //+ ':' + second;
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // },
|
|
|
methods: {
|
|
|
/****************************/
|
|
|
validation_user_info(type) {
|
|
|
@@ -511,7 +471,7 @@
|
|
|
|
|
|
/******************消息数据接收********************/
|
|
|
chatMessage(redata) {
|
|
|
- console.log(this.historyList,'historyList');
|
|
|
+ //console.log(this.historyList,'historyList');
|
|
|
//console.log(this.data,'data');
|
|
|
|
|
|
//用户离线后会话窗口切换
|
|
|
@@ -725,7 +685,7 @@
|
|
|
|
|
|
/*****************切换用户会话对象******************/
|
|
|
chooseDialogue(type, index) {
|
|
|
- console.log(this.sessionList);
|
|
|
+ //console.log(this.sessionList);
|
|
|
if (this.userSwitching) {
|
|
|
let data = [];
|
|
|
let order_id = '';
|
|
|
@@ -735,20 +695,18 @@
|
|
|
data = this.sessionList[index].data;
|
|
|
order_id = this.sessionList[index].id;
|
|
|
this.$set(this.sessionList[index], 'num', 0);
|
|
|
- this.$store.dispatch("SET_SESSION_NAME", this.sessionList[index].name);
|
|
|
} else if (type == 2) {
|
|
|
data = this.offlineList[index].data;
|
|
|
- this.$store.dispatch("SET_SESSION_NAME", this.offlineList[index].name);
|
|
|
order_id = this.offlineList[index].id;
|
|
|
}
|
|
|
this.$store.dispatch("SET_CURRENT", data);//当前会话数据
|
|
|
this.userSwitching = false;
|
|
|
- this.get_user(order_id)
|
|
|
+ this.get_user(order_id,type,index)
|
|
|
} else {
|
|
|
- this.$message({
|
|
|
- message: '警告!,操作太频繁',
|
|
|
- type: 'warning'
|
|
|
- });
|
|
|
+ // this.$message({
|
|
|
+ // message: '警告!,操作太频繁',
|
|
|
+ // type: 'warning'
|
|
|
+ // });
|
|
|
}
|
|
|
},
|
|
|
|
|
|
@@ -767,6 +725,7 @@
|
|
|
}).then(() => {
|
|
|
let to_id = this.sessionType == 1 ? this.sessionList[this.dataIndex].id : this.offlineList[this.dataIndex].id;
|
|
|
let conversationId = this.sessionType == 1 ? this.sessionList[this.dataIndex].conversationId : this.offlineList[this.dataIndex].conversationId;
|
|
|
+ // console.log(conversationId,'ssss');
|
|
|
let data = {
|
|
|
"type": "kfCloseUser",
|
|
|
data: {
|
|
|
@@ -793,7 +752,7 @@
|
|
|
this.$store.dispatch("SET_CURRENT", []);//当前会话数据
|
|
|
this.$store.dispatch("SET_SESSION_NAME", '');
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
this.websocketsend(JSON.stringify(data))
|
|
|
}).catch(() => {
|
|
|
// this.$message({
|
|
|
@@ -951,7 +910,7 @@
|
|
|
},
|
|
|
|
|
|
/*****************获取当前聊天用户信息****************/
|
|
|
- get_user(id) {
|
|
|
+ get_user(id,type,index) {
|
|
|
let obj = {
|
|
|
headers: {
|
|
|
"apiToken": this.$md5('accountInfo' + "customer-service" + 'service' + 'service'),
|
|
|
@@ -959,13 +918,22 @@
|
|
|
},
|
|
|
account_id: id
|
|
|
};
|
|
|
-
|
|
|
this.post('api' + this.$ports.userInfo.accountInfo, obj).then(res => {
|
|
|
if (res.data.code == 1) {
|
|
|
this.session_user_info = res.data.data;
|
|
|
this.value = res.data.data.label
|
|
|
- this.userSwitching = true;
|
|
|
+ if(this.session_user_info.nick_name){
|
|
|
+ this.$store.dispatch("SET_SESSION_NAME", this.session_user_info.nick_name);
|
|
|
+ }
|
|
|
+ if(type ==1){
|
|
|
+ this.sessionList[index].name = this.session_user_info.nick_name
|
|
|
+ this.$store.dispatch("SET_SESSION",this.sessionList)
|
|
|
+ }else if(type == 2){
|
|
|
+ this.offlineList[index].name = this.session_user_info.nick_name
|
|
|
+ this.$store.dispatch("SET_SESSION", this.offlineList);
|
|
|
+ }
|
|
|
}
|
|
|
+ this.userSwitching = true;
|
|
|
})
|
|
|
},
|
|
|
|
|
|
@@ -1021,7 +989,7 @@
|
|
|
this.time = JSON.parse(sessionStorage.getItem("time"));
|
|
|
},
|
|
|
|
|
|
- /**********************编辑用户信息**********************/
|
|
|
+ /**********************保存编辑用户信息**********************/
|
|
|
bt_update() {
|
|
|
if (!this.isTrue) return false;
|
|
|
this.isTrue = false;
|
|
|
@@ -1042,6 +1010,7 @@
|
|
|
|
|
|
this.post('api' + this.$ports.userInfo.update, obj).then(res => {
|
|
|
if (res.data.code == 1) {
|
|
|
+ this.websocketsend(JSON.stringify({"type":"updateusercache","data":{"userid":this.session_user_info.id}}))
|
|
|
this.$message({
|
|
|
showClose: true,
|
|
|
message: `恭喜你,${res.data.msg}`,
|