|
|
|
|
@ -157,6 +157,18 @@
|
|
|
|
|
},
|
|
|
|
|
onShow(){
|
|
|
|
|
// this.loadData();
|
|
|
|
|
// id:"coach",
|
|
|
|
|
// name:'教练',
|
|
|
|
|
// id:"customerService",
|
|
|
|
|
// name:'客服',
|
|
|
|
|
// id:"adviser",
|
|
|
|
|
// name:'课程顾问',
|
|
|
|
|
// id:"storeManager",
|
|
|
|
|
// name:'店长',
|
|
|
|
|
// id:"groupchat",
|
|
|
|
|
// name:'群聊',
|
|
|
|
|
// id:"consumer",
|
|
|
|
|
// name:'学员',
|
|
|
|
|
},
|
|
|
|
|
onPullDownRefresh() {
|
|
|
|
|
console.log('onPullDownRefresh');
|
|
|
|
|
@ -178,79 +190,110 @@
|
|
|
|
|
delta: 1
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
// 获取群信息
|
|
|
|
|
async getGroupInfo(id) {
|
|
|
|
|
const {data: res} = await uni.$http.get('/api/group/find/'+id);
|
|
|
|
|
if(res.data){
|
|
|
|
|
var data = res.data;
|
|
|
|
|
// info.name=data.name;
|
|
|
|
|
// info.img=data.headImage||'/static/image/qltx.png';
|
|
|
|
|
// info.notice=data.notice;
|
|
|
|
|
// info.remarkNickName=data.remarkNickName;
|
|
|
|
|
// info.showNickName=data.showNickName;
|
|
|
|
|
// info.showGroupName=data.showGroupName;
|
|
|
|
|
// info.remarkGroupName=data.remarkGroupName;
|
|
|
|
|
// info.customerService=data.customerService;
|
|
|
|
|
// info.instructor=data.instructor;
|
|
|
|
|
// info.productId=data.productId;
|
|
|
|
|
// info.productName=data.productName;
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
// 跳转聊天框
|
|
|
|
|
gotoGroup(item){
|
|
|
|
|
console.log(item);
|
|
|
|
|
// 直接跳转到聊天框
|
|
|
|
|
var timestamp = new Date().getTime();
|
|
|
|
|
var info={
|
|
|
|
|
chatId: "privatechat-" + this.userid +"-"+ item.friendId,
|
|
|
|
|
chatType: (this.tabCurrentIndex==0?"coach":(this.tabCurrentIndex==1?"customerService":(this.tabCurrentIndex==2?"adviser":
|
|
|
|
|
(this.tabCurrentIndex==3?"storeManager":(this.tabCurrentIndex==4?"groupchat":(this.tabCurrentIndex==5?"consumer":"")))))),
|
|
|
|
|
chatName: item.friendNickName,
|
|
|
|
|
chatAvatar: item.friendHeadImage,
|
|
|
|
|
chatTime: timestamp,
|
|
|
|
|
userid: this.userid,
|
|
|
|
|
friendId: item.friendId, // 会话对象
|
|
|
|
|
minId: null, // 已读消息的最大id
|
|
|
|
|
sort: this.tabCurrentIndex==4?"groupchat":"privatechat", // privatechat 私聊 groupchat 群聊
|
|
|
|
|
from: "message" // yh 用户咨询进入聊天框,message 从消息进入聊天框
|
|
|
|
|
}
|
|
|
|
|
// id:"coach",
|
|
|
|
|
// name:'教练',
|
|
|
|
|
// id:"customerService",
|
|
|
|
|
// name:'客服',
|
|
|
|
|
// id:"adviser",
|
|
|
|
|
// name:'课程顾问',
|
|
|
|
|
// id:"storeManager",
|
|
|
|
|
// name:'店长',
|
|
|
|
|
// id:"groupchat",
|
|
|
|
|
// name:'群聊',
|
|
|
|
|
// id:"consumer",
|
|
|
|
|
// name:'学员',
|
|
|
|
|
|
|
|
|
|
console.log(info);
|
|
|
|
|
if(this.tabCurrentIndex==0){
|
|
|
|
|
// 教练
|
|
|
|
|
var data=encodeURIComponent(JSON.stringify(info));
|
|
|
|
|
uni.navigateTo({
|
|
|
|
|
url: `/pages/chat/chat?data=${data}`
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
else if(this.tabCurrentIndex==1){
|
|
|
|
|
// 客服
|
|
|
|
|
var data=encodeURIComponent(JSON.stringify(info));
|
|
|
|
|
uni.navigateTo({
|
|
|
|
|
url: `/pages/chat/chat?data=${data}`
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
else if(this.tabCurrentIndex==2){
|
|
|
|
|
// 顾问
|
|
|
|
|
var data=encodeURIComponent(JSON.stringify(info));
|
|
|
|
|
uni.navigateTo({
|
|
|
|
|
url: `/pages/chat/chat?data=${data}`
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
else if(this.tabCurrentIndex==3){
|
|
|
|
|
// 店长
|
|
|
|
|
var data=encodeURIComponent(JSON.stringify(info));
|
|
|
|
|
uni.navigateTo({
|
|
|
|
|
url: `/pages/chat/chat?data=${data}`
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
else if(this.tabCurrentIndex==4){
|
|
|
|
|
if(this.tabCurrentIndex==4){
|
|
|
|
|
// 群聊
|
|
|
|
|
// this.getGroupInfo(item.id);
|
|
|
|
|
var chatid="groupchat-" + item.id;
|
|
|
|
|
var info={
|
|
|
|
|
chatId: chatid,
|
|
|
|
|
groupId: item.id,
|
|
|
|
|
chatName: item.name,
|
|
|
|
|
chatAvatar: item.headImage?item.headImage:'/static/image/kfr.png',
|
|
|
|
|
chatTime: timestamp,
|
|
|
|
|
friendId: item.customerService,
|
|
|
|
|
teacherId: item.instructor,
|
|
|
|
|
minId: "",
|
|
|
|
|
sort:"groupchat", // privatechat 私聊 groupchat 群聊
|
|
|
|
|
from:"message", // yh 用户咨询进入聊天框,message 从消息进入聊天框
|
|
|
|
|
notice: item.notice,
|
|
|
|
|
remarkNickName: item.remarkNickName,
|
|
|
|
|
remarkGroupName: item.remarkGroupName,
|
|
|
|
|
showNickName: item.showNickName,
|
|
|
|
|
showGroupName: item.showGroupName,
|
|
|
|
|
reason: item.reason,
|
|
|
|
|
customerService: item.customerService,
|
|
|
|
|
instructor: item.instructor,
|
|
|
|
|
productId: item.productId,
|
|
|
|
|
productName: item.productName
|
|
|
|
|
}
|
|
|
|
|
var data=encodeURIComponent(JSON.stringify(info));
|
|
|
|
|
uni.navigateTo({
|
|
|
|
|
url: `/pages/chat/groupchat?data=${data}`
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
else if(this.tabCurrentIndex==5){
|
|
|
|
|
// 学员
|
|
|
|
|
var data=encodeURIComponent(JSON.stringify(info));
|
|
|
|
|
uni.navigateTo({
|
|
|
|
|
url: `/pages/chat/chat?data=${data}`
|
|
|
|
|
});
|
|
|
|
|
else{
|
|
|
|
|
// 直接跳转到聊天框
|
|
|
|
|
var info={
|
|
|
|
|
chatId: "privatechat-" + this.userid +"-"+ item.friendId,
|
|
|
|
|
chatType: (this.tabCurrentIndex==0?"coach":(this.tabCurrentIndex==1?"customerService":(this.tabCurrentIndex==2?"adviser":
|
|
|
|
|
(this.tabCurrentIndex==3?"storeManager":(this.tabCurrentIndex==4?"groupchat":(this.tabCurrentIndex==5?"consumer":"")))))),
|
|
|
|
|
chatName: item.friendNickName,
|
|
|
|
|
chatAvatar: item.friendHeadImage,
|
|
|
|
|
chatTime: timestamp,
|
|
|
|
|
userid: this.userid,
|
|
|
|
|
friendId: item.friendId, // 会话对象
|
|
|
|
|
minId: null, // 已读消息的最大id
|
|
|
|
|
sort: this.tabCurrentIndex==4?"groupchat":"privatechat", // privatechat 私聊 groupchat 群聊
|
|
|
|
|
from: "message" // yh 用户咨询进入聊天框,message 从消息进入聊天框
|
|
|
|
|
}
|
|
|
|
|
console.log(info);
|
|
|
|
|
if(this.tabCurrentIndex==0){
|
|
|
|
|
// 教练
|
|
|
|
|
var data=encodeURIComponent(JSON.stringify(info));
|
|
|
|
|
uni.navigateTo({
|
|
|
|
|
url: `/pages/chat/chat?data=${data}`
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
else if(this.tabCurrentIndex==1){
|
|
|
|
|
// 客服
|
|
|
|
|
var data=encodeURIComponent(JSON.stringify(info));
|
|
|
|
|
uni.navigateTo({
|
|
|
|
|
url: `/pages/chat/chat?data=${data}`
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
else if(this.tabCurrentIndex==2){
|
|
|
|
|
// 顾问
|
|
|
|
|
var data=encodeURIComponent(JSON.stringify(info));
|
|
|
|
|
uni.navigateTo({
|
|
|
|
|
url: `/pages/chat/chat?data=${data}`
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
else if(this.tabCurrentIndex==3){
|
|
|
|
|
// 店长
|
|
|
|
|
var data=encodeURIComponent(JSON.stringify(info));
|
|
|
|
|
uni.navigateTo({
|
|
|
|
|
url: `/pages/chat/chat?data=${data}`
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
else if(this.tabCurrentIndex==5){
|
|
|
|
|
// 学员
|
|
|
|
|
var data=encodeURIComponent(JSON.stringify(info));
|
|
|
|
|
uni.navigateTo({
|
|
|
|
|
url: `/pages/chat/chat?data=${data}`
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
loadData(){
|
|
|
|
|
|