Browse Source

直播修改自助采摘

zhangli 4 years ago
parent
commit
94e224ba98
1 changed files with 14 additions and 11 deletions
  1. 14 11
      pagesGood/pickVideo.vue

+ 14 - 11
pagesGood/pickVideo.vue

@@ -165,18 +165,21 @@
 				const TRTC_EVENT = this.trtcComponent.EVENT;
 				this.timestamp = []; // 初始化事件订阅
 				this.trtcComponent.on(TRTC_EVENT.LOCAL_JOIN, event => {
-					var userId=this.trtcComponent.getRemoteUserList()[0].userID;
-					NET.request(API.getMerchantsMainInfo + userId, {}, 'GET').then(res => {
-						this.setData({
-							head_img:res.data.merchantImg,
-							title:res.data.merchantNickname
-						})
-					}).catch(error => {
-						this.$refs.uTips.show({
-							title: '获取个人信息失败',
-							type: 'warning',
+					if(this.trtcComponent.getRemoteUserList().length>0){
+						var userId=this.trtcComponent.getRemoteUserList()[0].userID;
+						NET.request(API.getMerchantsMainInfo + userId, {}, 'GET').then(res => {
+							this.setData({
+								head_img:res.data.merchantImg,
+								title:res.data.merchantNickname
+							})
+						}).catch(error => {
+							this.$refs.uTips.show({
+								title: '获取个人信息失败',
+								type: 'warning',
+							})
 						})
-					})
+					}
+					
 					console.log('* room LOCAL_JOIN', event); // 进房成功,触发该事件后可以对本地视频和音频进行设置
 
 					if (this.options.localVideo === true || this.options.template === '1v1') {