Merge pull request 'xbx' (#210) from xbx into master
Reviewed-on: http://git.luyuan.tk/luyuan/deming/pulls/210
This commit is contained in:
commit
718e3ff45d
@ -437,6 +437,10 @@ export default {
|
||||
friend_tomid:id
|
||||
});
|
||||
},
|
||||
//获取默认头像
|
||||
getDefaultAvatar(){
|
||||
return vm.$u.post("member/getDefaultAvatar")
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -222,6 +222,7 @@
|
||||
import zhiboItem from "@/components/index/zhibo-item/index"
|
||||
import indexad from "@/components/index/ad/index"
|
||||
import darenItem from "@/components/index/daren-item/index"
|
||||
import chatVue from '../../pageD/chat/chat.vue'
|
||||
|
||||
export default {
|
||||
name: "index",
|
||||
@ -281,6 +282,15 @@
|
||||
// console.log(user)
|
||||
this.imService.login(user.member.member_id,user.member.member_nickname,user.member.member_avatar)
|
||||
this.imService.connectIM()
|
||||
|
||||
}else{
|
||||
this.$u.api.getDefaultAvatar().then((res)=>{
|
||||
console.log(res)
|
||||
uni.setStorageSync("morenimg",res.data.avatar)
|
||||
this.imService.login(new Date().getTime(),"123",res.data.avatar)
|
||||
this.imService.connectIM()
|
||||
})
|
||||
}
|
||||
let that = this
|
||||
setTimeout(function(){
|
||||
that.imService.disconnect()
|
||||
@ -290,7 +300,6 @@
|
||||
// console.log("lianjie")
|
||||
that.imService.connectIM()
|
||||
},2000)
|
||||
}
|
||||
},
|
||||
onPullDownRefresh() {
|
||||
this.page = 1;
|
||||
|
@ -418,20 +418,22 @@ export default {
|
||||
}
|
||||
})
|
||||
//当前用户
|
||||
try {
|
||||
uni.request({
|
||||
url:"https://dmmall.sdbairui.com/api/Member/MemberInfo",
|
||||
method:"POST",
|
||||
header:{
|
||||
'Authorization' : 'Bearer' + " " + token
|
||||
},
|
||||
success(res){
|
||||
console.log(res,111)
|
||||
var currentUser = {
|
||||
id : res.data.data.MemberArray.member_mobile + "",
|
||||
nickname : res.data.data.MemberArray.member_nickname,
|
||||
avatar: res.data.data.MemberArray.member_avatar
|
||||
var currentUser = {}
|
||||
if(this.$store.state.hasLogin){
|
||||
const user = uni.getStorageSync('user_info');
|
||||
currentUser = {
|
||||
id : user.member.member_id,
|
||||
nickname : user.member.member_nickname,
|
||||
avatar: user.member.member_avatar
|
||||
};
|
||||
}else{
|
||||
const user = uni.getStorageSync('morenimg');
|
||||
currentUser = {
|
||||
id : new Date().getTime(),
|
||||
nickname : "123",
|
||||
avatar: user
|
||||
};
|
||||
}
|
||||
|
||||
var room = {
|
||||
id : a.rid + "",
|
||||
@ -445,13 +447,8 @@ export default {
|
||||
that.room = that.chatRoomService.room;
|
||||
that.chatRoomService.initialWhenOnlineUserChange(that.newpeople)
|
||||
that.chatRoomService.initialWhenNewMessage(that.whenNewMessage);
|
||||
this.$forceUpdate();
|
||||
console.log(that.room)
|
||||
}
|
||||
})
|
||||
} catch (error) {
|
||||
console.log("错误")
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
onBackPress () {//返回取消订阅
|
||||
@ -467,6 +464,7 @@ export default {
|
||||
},
|
||||
newpeople(list){
|
||||
this.room.onlineUsers = list
|
||||
console.log(list.users.length)
|
||||
this.$forceUpdate();
|
||||
},
|
||||
sendMessage (messageType, content) {//发送消息
|
||||
|
@ -800,7 +800,6 @@ IMService.prototype.listenerGroupPresence = function () {
|
||||
this.im.on(GoEasyIM.EVENT.GROUP_PRESENCE, (event) => {
|
||||
//更新在线用户数
|
||||
this.room.onlineUsers.count = event.groupOnlineCount;
|
||||
|
||||
if (event.action == 'join' || event.action == 'online') {
|
||||
let userData = JSON.parse(event.userData);
|
||||
//添加新用户
|
||||
@ -887,6 +886,7 @@ IMService.prototype.subscribeRoomMessage = function (room, user) {
|
||||
this.subscribePresence(this.room.id);
|
||||
//订阅聊天室消息
|
||||
// this.subscribeRoomMessage(this.room.id);
|
||||
this.initialOnlineUsers(this.room.id)
|
||||
this.im.subscribeGroup([this.room.id])
|
||||
.then(result => {
|
||||
console.log('消息订阅成功')
|
||||
|
Loading…
Reference in New Issue
Block a user