Compare commits
No commits in common. "bee3ab9fba54c73321c11cf9efd1ffa785b0ca30" and "d8840edb30efff45fed48b902461b5398b9e975c" have entirely different histories.
bee3ab9fba
...
d8840edb30
@ -196,40 +196,7 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
// 跳转详情页面
|
// 跳转详情页面
|
||||||
tochat(ID){
|
tochat(ID){
|
||||||
function Friend(uuid, name, avatar,time = "", text = "",date = "") {
|
|
||||||
this.uuid = uuid;
|
|
||||||
this.name = name;
|
|
||||||
this.avatar = avatar;
|
|
||||||
this.online = false;
|
|
||||||
this.unReadMessage = 0;
|
|
||||||
this.text = text;
|
|
||||||
this.time = time;
|
|
||||||
this.date = date
|
|
||||||
}
|
|
||||||
console.log(ID)
|
console.log(ID)
|
||||||
const token = uni.getStorageSync('token');
|
|
||||||
let that = this
|
|
||||||
uni.request({
|
|
||||||
url:"https://dmmall.sdbairui.com/api/Specialci/getAtwillUserInfo",
|
|
||||||
data:{
|
|
||||||
userId: ID
|
|
||||||
},
|
|
||||||
method:"POST",
|
|
||||||
header:{
|
|
||||||
"Authorization" : 'Bearer' + " " + token
|
|
||||||
},
|
|
||||||
success(res){
|
|
||||||
console.log(res)
|
|
||||||
res = res.data
|
|
||||||
let user = new Friend(res.data.member_id,res.data.member_nickname,res.data.member_avatar)
|
|
||||||
that.$u.route({
|
|
||||||
url:"/pages/messages/privateChat",
|
|
||||||
params:{
|
|
||||||
id:JSON.stringify(user)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
// 退款单选
|
// 退款单选
|
||||||
radioGroupChange(e) {
|
radioGroupChange(e) {
|
||||||
|
@ -386,85 +386,7 @@ IMService.prototype.initialIMListeners = function () {
|
|||||||
// })
|
// })
|
||||||
};
|
};
|
||||||
|
|
||||||
IMService.prototype.sendMessagesSetStorage = function (friendId,message){
|
|
||||||
let friend = this.friends[friendId];
|
|
||||||
console.log(friend)
|
|
||||||
// return ;
|
|
||||||
let sorts = function (friends){
|
|
||||||
let paixu = function (a,b){
|
|
||||||
if(a.date > b.date){
|
|
||||||
return 0;
|
|
||||||
}else{
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
friends.sort(paixu)
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
let that = this
|
|
||||||
if(!friend && friend == undefined){
|
|
||||||
const token = uni.getStorageSync('token');
|
|
||||||
console.log(token)
|
|
||||||
uni.request({
|
|
||||||
url:"https://dmmall.sdbairui.com/api/Specialci/getAtwillUserInfo",
|
|
||||||
data:{
|
|
||||||
userId:friendId
|
|
||||||
},
|
|
||||||
method:"POST",
|
|
||||||
header:{
|
|
||||||
"Authorization" : 'Bearer' + " " + token
|
|
||||||
},
|
|
||||||
success(res){
|
|
||||||
console.log(res)
|
|
||||||
that.friends[friendId] = new Friend(res.data.data.member_id, res.data.data.member_nickname, res.data.data.member_avatar);
|
|
||||||
friend = that.friends[friendId];
|
|
||||||
console.log(friend)
|
|
||||||
friend.text = message
|
|
||||||
let time = new Date()
|
|
||||||
friend.date = time.getTime()
|
|
||||||
friend.time = time.getHours() + ":" + time.getMinutes() + ":" + time.getSeconds()
|
|
||||||
console.log(that.friends)
|
|
||||||
that.friendsarr = []
|
|
||||||
for(let i in that.friends){
|
|
||||||
console.log(i)
|
|
||||||
that.friendsarr.push(that.friends[i])
|
|
||||||
}
|
|
||||||
sorts(that.friendsarr)
|
|
||||||
let arr = []
|
|
||||||
for(let i in that.friends){
|
|
||||||
arr.push([that.friends[i].uuid,that.friends[i].time,that.friends[i].text,that.friends[i].date,0])
|
|
||||||
}
|
|
||||||
console.log(arr)
|
|
||||||
uni.setStorageSync('imlist',JSON.stringify(arr))
|
|
||||||
|
|
||||||
that.onFriendListChange(that.friends);
|
|
||||||
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}else{
|
|
||||||
console.log(friend)
|
|
||||||
friend.text = message
|
|
||||||
let time = new Date()
|
|
||||||
friend.date = time.getTime()
|
|
||||||
friend.time = time.getHours() + ":" + time.getMinutes() + ":" + time.getSeconds()
|
|
||||||
console.log(this.friends)
|
|
||||||
that.friendsarr = []
|
|
||||||
for(let i in this.friends){
|
|
||||||
that.friendsarr.push(this.friends[i])
|
|
||||||
}
|
|
||||||
sorts(that.friendsarr)
|
|
||||||
let arr = []
|
|
||||||
for(let i in that.friends){
|
|
||||||
arr.push([that.friends[i].uuid,that.friends[i].time,that.friends[i].text,that.friends[i].date,0])
|
|
||||||
}
|
|
||||||
console.log(arr)
|
|
||||||
uni.setStorageSync('imlist',JSON.stringify(arr))
|
|
||||||
this.onFriendListChange(this.friends);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//订阅群消息
|
//订阅群消息
|
||||||
IMService.prototype.subscribeGroupMessage = function (id) {
|
IMService.prototype.subscribeGroupMessage = function (id) {
|
||||||
this.im.subscribeGroup([id])
|
this.im.subscribeGroup([id])
|
||||||
@ -540,8 +462,6 @@ IMService.prototype.sendPrivateTextMessage = function (friendId, text) {
|
|||||||
text: text
|
text: text
|
||||||
});
|
});
|
||||||
this.sendPrivateMessage(friendId, textMessage);
|
this.sendPrivateMessage(friendId, textMessage);
|
||||||
this.sendMessagesSetStorage(friendId, text)
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//私聊图片消息
|
//私聊图片消息
|
||||||
@ -553,8 +473,6 @@ IMService.prototype.sendPrivateImageMessage = function (friendId, imageFile) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
this.sendPrivateMessage(friendId, imageMessage);
|
this.sendPrivateMessage(friendId, imageMessage);
|
||||||
this.sendMessagesSetStorage(friendId, '其他消息')
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//私聊视频消息
|
//私聊视频消息
|
||||||
@ -566,8 +484,6 @@ IMService.prototype.sendPrivateVideoMessage = function (friendId, videoFile) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
this.sendPrivateMessage(friendId, videoMessage);
|
this.sendPrivateMessage(friendId, videoMessage);
|
||||||
this.sendMessagesSetStorage(friendId, '其他消息')
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
IMService.prototype.sendPrivateAudioMessage = function (friendId, audiofile) {
|
IMService.prototype.sendPrivateAudioMessage = function (friendId, audiofile) {
|
||||||
@ -579,8 +495,6 @@ IMService.prototype.sendPrivateAudioMessage = function (friendId, audiofile) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
this.sendPrivateMessage(friendId, audioMessage);
|
this.sendPrivateMessage(friendId, audioMessage);
|
||||||
this.sendMessagesSetStorage(friendId, '其他消息')
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//发送私聊消息
|
//发送私聊消息
|
||||||
|
Loading…
x
Reference in New Issue
Block a user