mine concerns 8.15
This commit is contained in:
		
						commit
						b86b1c8245
					
				@ -440,6 +440,10 @@ export default {
 | 
			
		||||
			// 设置里的帮助
 | 
			
		||||
			getSettingHelpList() {
 | 
			
		||||
				return vm.$u.post('document/help');
 | 
			
		||||
			},
 | 
			
		||||
			//获取默认头像
 | 
			
		||||
			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,7 +282,16 @@
 | 
			
		||||
				// console.log(user)
 | 
			
		||||
				this.imService.login(user.member.member_id,user.member.member_nickname,user.member.member_avatar)
 | 
			
		||||
				this.imService.connectIM()
 | 
			
		||||
				let that = this
 | 
			
		||||
				
 | 
			
		||||
			}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()
 | 
			
		||||
					// console.log("guanbi")
 | 
			
		||||
@ -289,8 +299,7 @@
 | 
			
		||||
				setTimeout(function(){
 | 
			
		||||
					// console.log("lianjie")
 | 
			
		||||
					that.imService.connectIM()
 | 
			
		||||
				},2000)
 | 
			
		||||
			}
 | 
			
		||||
			},2000)
 | 
			
		||||
		},
 | 
			
		||||
		onPullDownRefresh() {
 | 
			
		||||
            this.page = 1;
 | 
			
		||||
 | 
			
		||||
@ -418,40 +418,37 @@ 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 room = {
 | 
			
		||||
              id : a.rid + "",
 | 
			
		||||
              name : a.rid + ""
 | 
			
		||||
          };
 | 
			
		||||
           that.chatRoomService = getApp().globalData.im
 | 
			
		||||
          console.log(room,currentUser)
 | 
			
		||||
          //构造chatRoomService
 | 
			
		||||
          that.chatRoomService.subscribeRoomMessage(room,currentUser)
 | 
			
		||||
          //获取当前聊天室数据
 | 
			
		||||
          that.room = that.chatRoomService.room;
 | 
			
		||||
          that.chatRoomService.initialWhenOnlineUserChange(that.newpeople)
 | 
			
		||||
          that.chatRoomService.initialWhenNewMessage(that.whenNewMessage);
 | 
			
		||||
          console.log(that.room)
 | 
			
		||||
        }
 | 
			
		||||
      })
 | 
			
		||||
    } catch (error) {
 | 
			
		||||
      console.log("错误")
 | 
			
		||||
     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 + "",
 | 
			
		||||
        name : a.rid + ""
 | 
			
		||||
    };
 | 
			
		||||
      that.chatRoomService = getApp().globalData.im
 | 
			
		||||
    console.log(room,currentUser)
 | 
			
		||||
    //构造chatRoomService
 | 
			
		||||
    that.chatRoomService.subscribeRoomMessage(room,currentUser)
 | 
			
		||||
    //获取当前聊天室数据
 | 
			
		||||
    that.room = that.chatRoomService.room;
 | 
			
		||||
    that.chatRoomService.initialWhenOnlineUserChange(that.newpeople)
 | 
			
		||||
    that.chatRoomService.initialWhenNewMessage(that.whenNewMessage);
 | 
			
		||||
    this.$forceUpdate();
 | 
			
		||||
    console.log(that.room)
 | 
			
		||||
     
 | 
			
		||||
  },
 | 
			
		||||
  	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…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user