直播
This commit is contained in:
		
							parent
							
								
									b146783790
								
							
						
					
					
						commit
						b070a559dc
					
				@ -336,10 +336,13 @@ export default {
 | 
				
			|||||||
    };
 | 
					    };
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  onLoad(a) {
 | 
					  onLoad(a) {
 | 
				
			||||||
 | 
					  
 | 
				
			||||||
    this.url = a.url;
 | 
					    this.url = a.url;
 | 
				
			||||||
    this.id = a.id
 | 
					    this.id = a.id
 | 
				
			||||||
    console.log(this.url);
 | 
					    console.log(this.url);
 | 
				
			||||||
    let that = this;
 | 
					    let that = this;
 | 
				
			||||||
 | 
					   
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    uni.getSystemInfo({
 | 
					    uni.getSystemInfo({
 | 
				
			||||||
      success(a) {
 | 
					      success(a) {
 | 
				
			||||||
        console.log(a.windowHeight);
 | 
					        console.log(a.windowHeight);
 | 
				
			||||||
@ -401,7 +404,8 @@ export default {
 | 
				
			|||||||
      }
 | 
					      }
 | 
				
			||||||
    })
 | 
					    })
 | 
				
			||||||
    //当前用户
 | 
					    //当前用户
 | 
				
			||||||
     uni.request({
 | 
					    try {
 | 
				
			||||||
 | 
					         uni.request({
 | 
				
			||||||
        url:"https://dmmall.sdbairui.com/api/Member/MemberInfo",
 | 
					        url:"https://dmmall.sdbairui.com/api/Member/MemberInfo",
 | 
				
			||||||
        method:"POST",
 | 
					        method:"POST",
 | 
				
			||||||
        header:{
 | 
					        header:{
 | 
				
			||||||
@ -409,28 +413,54 @@ export default {
 | 
				
			|||||||
        },
 | 
					        },
 | 
				
			||||||
        success(res){
 | 
					        success(res){
 | 
				
			||||||
          console.log(res,111)
 | 
					          console.log(res,111)
 | 
				
			||||||
          var currentUser = {
 | 
					             var currentUser = {
 | 
				
			||||||
            id : "12",
 | 
					            id : res.data.data.MemberArray.member_mobile + "",
 | 
				
			||||||
            nickname :"123",
 | 
					            nickname : res.data.data.MemberArray.member_nickname,
 | 
				
			||||||
            avatar: "1223"
 | 
					            avatar: res.data.data.MemberArray.member_avatar 
 | 
				
			||||||
          };
 | 
					          };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
          var room = {
 | 
					          var room = {
 | 
				
			||||||
              id : "123",
 | 
					              id : a.id + "",
 | 
				
			||||||
              name : "123"
 | 
					              name : a.id + ""
 | 
				
			||||||
          };
 | 
					          };
 | 
				
			||||||
          console.log(room,currentUser)
 | 
					          console.log(room,currentUser)
 | 
				
			||||||
          //构造chatRoomService
 | 
					          //构造chatRoomService
 | 
				
			||||||
			      that.chatRoomService = new ChatRoomService(room, currentUser);
 | 
					            that.chatRoomService = new ChatRoomService(room, currentUser);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            that.chatRoomService.initialWhenNewMessage(that.whenNewMessage);
 | 
					            that.chatRoomService.initialWhenNewMessage(that.whenNewMessage);
 | 
				
			||||||
            that.chatRoomService.connectGoEasyIM();
 | 
					            that.chatRoomService.connectGoEasyIM();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			//获取当前聊天室数据
 | 
								//获取当前聊天室数据
 | 
				
			||||||
            that.room = that.chatRoomService.room;
 | 
					            that.room = that.chatRoomService.room;
 | 
				
			||||||
 | 
					            setTimeout(function() {
 | 
				
			||||||
 | 
					              that.chatRoomService.quitRoom();
 | 
				
			||||||
 | 
					              that.chatRoomService = {}
 | 
				
			||||||
 | 
					               
 | 
				
			||||||
 | 
					            }, 1000);
 | 
				
			||||||
 | 
					            setTimeout(function(){
 | 
				
			||||||
 | 
					              that.chatRoomService = new ChatRoomService(room, currentUser);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            that.chatRoomService.initialWhenNewMessage(that.whenNewMessage);
 | 
				
			||||||
 | 
					            that.chatRoomService.connectGoEasyIM();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								//获取当前聊天室数据
 | 
				
			||||||
 | 
					            that.room = that.chatRoomService.room;
 | 
				
			||||||
 | 
					            }, 2000);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
      })
 | 
					      })
 | 
				
			||||||
 | 
					    } catch (error) {
 | 
				
			||||||
 | 
					      console.log("错误")
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					  
 | 
				
			||||||
     
 | 
					     
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
 | 
					  	onBackPress () {//返回取消订阅
 | 
				
			||||||
 | 
								//断开连接
 | 
				
			||||||
 | 
								this.chatRoomService.quitRoom();
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
 | 
							beforeDestroy () {
 | 
				
			||||||
 | 
								this.chatRoomService.quitRoom();
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
  methods:{
 | 
					  methods:{
 | 
				
			||||||
    sendMessage (messageType, content) {//发送消息
 | 
					    sendMessage (messageType, content) {//发送消息
 | 
				
			||||||
    console.log(123)
 | 
					    console.log(123)
 | 
				
			||||||
@ -452,6 +482,7 @@ export default {
 | 
				
			|||||||
              // }, 300)
 | 
					              // }, 300)
 | 
				
			||||||
      console.log(message)
 | 
					      console.log(message)
 | 
				
			||||||
              this.danmulist.push(message)
 | 
					              this.danmulist.push(message)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
              if(this.danmulist.length > 7){
 | 
					              if(this.danmulist.length > 7){
 | 
				
			||||||
                  this.danmulist = this.danmulist.slice(this.danmulist.length - 7)
 | 
					                  this.danmulist = this.danmulist.slice(this.danmulist.length - 7)
 | 
				
			||||||
              }
 | 
					              }
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user