|
|
@@ -335,8 +335,8 @@
|
|
|
user_info: '',//用户信息
|
|
|
token: "",
|
|
|
time: "",
|
|
|
- sessionList: [],//会话列表
|
|
|
- offlineList: [],//离线列表
|
|
|
+ // sessionList: [],//会话列表
|
|
|
+ // offlineList: [],//离线列表
|
|
|
transferList: [],//转接列表
|
|
|
// sessionType:1,//选择列表状态默认未1(1是会话中,2是离线)
|
|
|
lineUp: [],//排队列表
|
|
|
@@ -403,45 +403,6 @@
|
|
|
|
|
|
/******************消息数据接收********************/
|
|
|
chatMessage(redata) {
|
|
|
- // 用户接入数据
|
|
|
- if (redata.message_type == "connect") {
|
|
|
- let _this = this;
|
|
|
-
|
|
|
- this.webTime = redata.data.user_info.intime;
|
|
|
- let arr = [
|
|
|
- redata.data,
|
|
|
- this.offlineList,
|
|
|
- this.sessionList,
|
|
|
- this.sessionType,
|
|
|
- this.dataIndex,
|
|
|
- this.data,
|
|
|
- this.sessionName
|
|
|
- ]
|
|
|
- _this.$public.visitorsConnect(arr, function (data) {
|
|
|
- //离线匹配列表访客链接回调
|
|
|
- _this.$store.dispatch("SET_OFFLINE", data);
|
|
|
- }, function (data, list, offline, type, num, dataList, name) {
|
|
|
- // console.log(name)
|
|
|
- //新访客链接回调
|
|
|
- _this.sessionType = type;
|
|
|
- _this.dataIndex = num;
|
|
|
- //将用户添加到会话列表中
|
|
|
- _this.sessionList.push(data.user_info);
|
|
|
- //获取接入的用户信息
|
|
|
- _this.get_user_info(list);
|
|
|
- //获取接入的用户信息写入vuex
|
|
|
- _this.$store.dispatch("SET_SESSION", list);
|
|
|
- _this.$store.dispatch("SET_OFFLINE", offline);
|
|
|
- _this.$store.dispatch("SET_TYPE", type);//选择类型(会话/离线)
|
|
|
- _this.$store.dispatch("SET_NUM", num);//列表下标
|
|
|
- _this.$store.dispatch("SET_CURRENT", dataList);//当前会话数据
|
|
|
- if (name) {
|
|
|
- _this.$store.dispatch("SET_SESSION_NAME", name);//当前会话对象名
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
//用户离线后会话窗口切换
|
|
|
if (redata.message_type == "userClose") {
|
|
|
let _this = this;
|
|
|
@@ -455,12 +416,6 @@
|
|
|
this.data
|
|
|
]
|
|
|
_this.$public.userOffline(arr, function (session, offline, type, index, name, list, userInfo) {
|
|
|
- _this.sessionList = [];
|
|
|
- _this.sessionList = session;
|
|
|
- _this.offlineList = [];
|
|
|
- _this.offlineList = offline;
|
|
|
- _this.sessionType = type;
|
|
|
- _this.dataIndex = index;
|
|
|
this.$store.dispatch("SET_CURRENT", list);//当前会话数据
|
|
|
_this.$store.dispatch("SET_NUM", index);
|
|
|
_this.$store.dispatch("SET_TYPE", type);
|
|
|
@@ -483,12 +438,6 @@
|
|
|
this.data
|
|
|
]
|
|
|
_this.$public.sessionEnd(arr, function (session, offline, type, index, name, list, userInfo) {
|
|
|
- _this.sessionList = [];
|
|
|
- _this.sessionList = session;
|
|
|
- _this.offlineList = [];
|
|
|
- _this.offlineList = offline;
|
|
|
- _this.sessionType = type;
|
|
|
- _this.dataIndex = index;
|
|
|
_this.$store.dispatch("SET_CURRENT", list);//当前会话数据
|
|
|
_this.$store.dispatch("SET_NUM", index);
|
|
|
_this.$store.dispatch("SET_TYPE", type);
|
|
|
@@ -518,8 +467,9 @@
|
|
|
|
|
|
//接收会话时间
|
|
|
if (redata.message_type == "webTime") {
|
|
|
- // console.log(this.data);
|
|
|
- this.$set(this.data[this.session_marked], 'time', redata.data.webTime);
|
|
|
+ let data = this.data;
|
|
|
+ data[this.session_marked].time = redata.data.webTime
|
|
|
+ this.$store.dispatch("SET_CURRENT", data);
|
|
|
}
|
|
|
|
|
|
//客服手动转接用户成功
|
|
|
@@ -530,7 +480,6 @@
|
|
|
type: 'success'
|
|
|
});
|
|
|
if (this.sessionList.length > 1) {
|
|
|
- this.dataIndex = 0;
|
|
|
this.$store.dispatch("SET_NUM", 0);
|
|
|
// this.data = []
|
|
|
|
|
|
@@ -664,9 +613,7 @@
|
|
|
/*****************切换用户会话对象******************/
|
|
|
chooseDialogue(type, index) {
|
|
|
let data = [];
|
|
|
- this.sessionType = type;
|
|
|
this.$store.dispatch("SET_TYPE", type);
|
|
|
- this.dataIndex = index;
|
|
|
this.$store.dispatch("SET_NUM", index);
|
|
|
if (type == 1) {
|
|
|
data = this.sessionList[index].data;
|
|
|
@@ -678,7 +625,6 @@
|
|
|
this.$store.dispatch("SET_SESSION_NAME", this.offlineList[index].name);
|
|
|
this.session_user_info = this.offlineList[index];
|
|
|
}
|
|
|
- //this.data = data;
|
|
|
this.$store.dispatch("SET_CURRENT", data);//当前会话数据
|
|
|
},
|
|
|
|
|
|
@@ -708,16 +654,18 @@
|
|
|
}
|
|
|
}
|
|
|
if (this.sessionType == 1) {
|
|
|
- this.sessionList.splice(this.dataIndex, 1);
|
|
|
- if (this.sessionList.length > 0) {
|
|
|
- this.$store.dispatch("SET_CURRENT", this.sessionList[0]);//当前会话数据
|
|
|
- this.$store.dispatch("SET_SESSION_NAME", this.sessionList[0].name);
|
|
|
+ let sessionList = this.sessionList;
|
|
|
+ sessionList.splice(this.dataIndex, 1);
|
|
|
+ if (sessionList.length > 0) {
|
|
|
+ this.$store.dispatch("SET_CURRENT", sessionList[0]);//当前会话数据
|
|
|
+ this.$store.dispatch("SET_SESSION_NAME", sessionList[0].name);
|
|
|
} else {
|
|
|
this.$store.dispatch("SET_CURRENT", []);//当前会话数据
|
|
|
this.$store.dispatch("SET_SESSION_NAME", '');
|
|
|
}
|
|
|
} else {
|
|
|
- this.offlineList.splice(this.dataIndex, 1);
|
|
|
+ let offlineList = this.offlineList;
|
|
|
+ offlineList.splice(this.dataIndex, 1);
|
|
|
this.$store.dispatch("SET_CURRENT", []);//当前会话数据
|
|
|
this.$store.dispatch("SET_SESSION_NAME", '');
|
|
|
}
|
|
|
@@ -893,7 +841,7 @@
|
|
|
if (res.data.code == 1) {
|
|
|
// console.log(res.data.data);
|
|
|
this.session_user_info = res.data.data;
|
|
|
- console.log(this.options);
|
|
|
+ // console.log(this.options);
|
|
|
for (let i = 0; this.options.length > i; i++) {
|
|
|
if (this.options[i].id == res.data.data.label_id) {
|
|
|
this.value = this.options[i].name;
|
|
|
@@ -964,10 +912,10 @@
|
|
|
this.token = getters.get_user_info.token;//token
|
|
|
this.user_info = getters.get_user_info;//用户消息
|
|
|
console.log(this.user_info,'用户信息');
|
|
|
- this.sessionList = getters.get_session;//会话
|
|
|
- this.offlineList = getters.get_offline;//离线
|
|
|
- this.dataIndex = getters.get_num; //getters.get_num;列表下标
|
|
|
- this.sessionType = getters.get_type;//选择类型
|
|
|
+ // this.sessionList = getters.get_session;//会话
|
|
|
+ // this.offlineList = getters.get_offline;//离线
|
|
|
+ // this.dataIndex = getters.get_num; //getters.get_num;列表下标
|
|
|
+ // this.sessionType = getters.get_type;//选择类型
|
|
|
// this.data = getters.get_current;//当前会话数据
|
|
|
// this.sessionName = getters.get_session_name;//会话对象名字
|
|
|
this.time = JSON.parse(sessionStorage.getItem("time"));
|
|
|
@@ -1152,7 +1100,11 @@
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
-
|
|
|
+ // _this.$store.dispatch("SET_SESSION", list);
|
|
|
+ // _this.$store.dispatch("SET_OFFLINE", offline);
|
|
|
+ // _this.$store.dispatch("SET_TYPE", type);//选择类型(会话/离线)
|
|
|
+ // _this.$store.dispatch("SET_NUM", num);//列表下标
|
|
|
+ // _this.$store.dispatch("SET_CURRENT", dataList);//当前会话数
|
|
|
/**
|
|
|
* 计算属性
|
|
|
*/
|
|
|
@@ -1160,6 +1112,10 @@
|
|
|
...mapGetters({
|
|
|
data: 'get_current',
|
|
|
sessionName: 'get_session_name',
|
|
|
+ sessionList:'get_session',
|
|
|
+ offlineList:'get_offline',
|
|
|
+ dataIndex:'get_num',
|
|
|
+ sessionType:'get_type',
|
|
|
}),
|
|
|
|
|
|
get_session_message() {
|