|
|
|
|
@ -12,8 +12,8 @@
|
|
|
|
|
<view v-if="grouplist.length==0 && loadStatus=='nomore'" class="nodata">暂无消息~</view>
|
|
|
|
|
|
|
|
|
|
<view class="listcell">
|
|
|
|
|
<u-swipe-action :options="options" v-for="(info, index) in grouplist" :key="index" @click="$u.throttle(actionClick(info,index), 2000)" >
|
|
|
|
|
<view class="lcon" @click="gotoGroup(info,index)">
|
|
|
|
|
<u-swipe-action ref="swipeRef" :options="options" v-for="(info, index) in grouplist" :key="index" @click="$u.throttle(actionClick(info,index), 2000)" >
|
|
|
|
|
<view class="lcon" @click="gotoGroup(info,index)" :key="index" @longpress="handleLongPress(info,index)">
|
|
|
|
|
<view class="limg">
|
|
|
|
|
<image class="img" :src="info.img" mode="aspectFill"></image>
|
|
|
|
|
</view>
|
|
|
|
|
@ -96,7 +96,7 @@
|
|
|
|
|
if(this.heartbeatInterval){
|
|
|
|
|
clearInterval(this.heartbeatInterval); // 停止心跳包发送
|
|
|
|
|
}
|
|
|
|
|
// 从缓存聊天群里获取聊天群列表 chatlist
|
|
|
|
|
// 从缓存聊天群里获取聊天群列表
|
|
|
|
|
this.loadData();
|
|
|
|
|
},
|
|
|
|
|
onPullDownRefresh() {
|
|
|
|
|
@ -128,6 +128,25 @@
|
|
|
|
|
next();
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
handleLongPress(info,index) {
|
|
|
|
|
console.log(index);
|
|
|
|
|
this.$refs.swipeRef[index].open()
|
|
|
|
|
// var that=this;
|
|
|
|
|
// uni.showModal({
|
|
|
|
|
// title: '提示',
|
|
|
|
|
// content: "确定要删除此聊天记录吗?",
|
|
|
|
|
// cancelText: '取消',
|
|
|
|
|
// confirmText: '确定',
|
|
|
|
|
// success: ress => {
|
|
|
|
|
// if (ress.confirm) {
|
|
|
|
|
// // myCache(info.id,"");
|
|
|
|
|
// // that.grouplist.splice(index, 1);
|
|
|
|
|
// // that.$forceUpdate();
|
|
|
|
|
// // myCache("chatlist-"+this.userid,that.grouplist);
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// });
|
|
|
|
|
},
|
|
|
|
|
// 删除
|
|
|
|
|
actionClick(info,index) {
|
|
|
|
|
console.log(info,index);
|
|
|
|
|
@ -142,7 +161,7 @@
|
|
|
|
|
myCache(info.id,"");
|
|
|
|
|
that.grouplist.splice(index, 1);
|
|
|
|
|
that.$forceUpdate();
|
|
|
|
|
myCache("chatlist",that.grouplist);
|
|
|
|
|
myCache("chatlist-"+this.userid,that.grouplist);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
@ -361,7 +380,7 @@
|
|
|
|
|
// 当前消息未读数据消除
|
|
|
|
|
this.grouplist[index]["sl"]=0;
|
|
|
|
|
this.$forceUpdate();
|
|
|
|
|
myCache("chatlist",this.grouplist);
|
|
|
|
|
myCache("chatlist-"+this.userid,this.grouplist);
|
|
|
|
|
// 去聊天室
|
|
|
|
|
if(chat.sort=="privatechat"){
|
|
|
|
|
// 私聊
|
|
|
|
|
@ -422,7 +441,7 @@
|
|
|
|
|
async getgroupsmembers(){
|
|
|
|
|
// 获取聊天群列表
|
|
|
|
|
this.grouplist=[];
|
|
|
|
|
var chatlist=myCache("chatlist")?myCache("chatlist"):[];
|
|
|
|
|
var chatlist=myCache("chatlist-"+this.userid)?myCache("chatlist-"+this.userid):[];
|
|
|
|
|
chatlist.forEach(cell=>{
|
|
|
|
|
if(cell.userid==this.userid){
|
|
|
|
|
this.grouplist.push(cell);
|
|
|
|
|
@ -439,7 +458,7 @@
|
|
|
|
|
var that=this;
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
that.reorder();
|
|
|
|
|
myCache("chatlist",that.grouplist);
|
|
|
|
|
myCache("chatlist-"+this.userid,that.grouplist);
|
|
|
|
|
}, 300);
|
|
|
|
|
|
|
|
|
|
// socket接收实时消息
|
|
|
|
|
@ -482,7 +501,7 @@
|
|
|
|
|
this.$forceUpdate();
|
|
|
|
|
// 重新排序
|
|
|
|
|
this.reorder();
|
|
|
|
|
myCache("chatlist",this.grouplist);
|
|
|
|
|
myCache("chatlist-"+this.userid,this.grouplist);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@ -505,7 +524,7 @@
|
|
|
|
|
this.$forceUpdate();
|
|
|
|
|
// 重新排序
|
|
|
|
|
this.reorder();
|
|
|
|
|
myCache("chatlist",this.grouplist);
|
|
|
|
|
myCache("chatlist-"+this.userid,this.grouplist);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@ -542,7 +561,7 @@
|
|
|
|
|
}
|
|
|
|
|
// 重新排序 保存缓存
|
|
|
|
|
this.reorder();
|
|
|
|
|
myCache("chatlist",this.grouplist);
|
|
|
|
|
myCache("chatlist-"+this.userid,this.grouplist);
|
|
|
|
|
// 聊天框消息缓存
|
|
|
|
|
var msgchat=myCache(info.id);
|
|
|
|
|
if(ifexist==0||!msgchat){
|
|
|
|
|
@ -597,7 +616,7 @@
|
|
|
|
|
}
|
|
|
|
|
// 重新排序
|
|
|
|
|
this.reorder();
|
|
|
|
|
myCache("chatlist",this.grouplist);
|
|
|
|
|
myCache("chatlist-"+this.userid,this.grouplist);
|
|
|
|
|
var msgchat=myCache(info.id);
|
|
|
|
|
if(ifexist==0||!msgchat){
|
|
|
|
|
// 第一条聊天记录保存缓存
|
|
|
|
|
@ -654,7 +673,7 @@
|
|
|
|
|
}
|
|
|
|
|
// 重新排序 保存缓存
|
|
|
|
|
this.reorder();
|
|
|
|
|
myCache("chatlist",this.grouplist);
|
|
|
|
|
myCache("chatlist-"+this.userid,this.grouplist);
|
|
|
|
|
// 聊天框消息缓存
|
|
|
|
|
var msgchat=myCache(info.id);
|
|
|
|
|
if(ifexist==0||!msgchat){
|
|
|
|
|
@ -710,7 +729,7 @@
|
|
|
|
|
}
|
|
|
|
|
// 重新排序
|
|
|
|
|
this.reorder();
|
|
|
|
|
myCache("chatlist",this.grouplist);
|
|
|
|
|
myCache("chatlist-"+this.userid,this.grouplist);
|
|
|
|
|
var msgchat=myCache(info.id);
|
|
|
|
|
if(ifexist==0||!msgchat){
|
|
|
|
|
// 第一条聊天记录保存缓存
|
|
|
|
|
|