Răsfoiți Sursa

直播问题修改

unknown 4 ani în urmă
părinte
comite
6b74f3a6f1
2 a modificat fișierele cu 58 adăugiri și 16 ștergeri
  1. 37 16
      pagesGood/pickVideo.vue
  2. 21 0
      pagesGood/videoList.vue

+ 37 - 16
pagesGood/pickVideo.vue

@@ -89,8 +89,8 @@
 				orderId: options.orderId
 			}, 'GET').then(res => {
 				this.setData({
-					head_img:res.data.liveProducResVO[0].imgPath,
-					title:res.data.liveProducResVO[0].productName
+					head_img:res.data.headImg,
+					title:res.data.tenantName
 				})
 				this.liveId = res.data.liveId
 				this.roomId = res.data.roomId
@@ -167,22 +167,43 @@
 			},
 			bindTRTCRoomEvent: function() {
 				const TRTC_EVENT = this.trtcComponent.EVENT;
+				var that=this;
 				this.timestamp = []; // 初始化事件订阅
 				this.trtcComponent.on(TRTC_EVENT.LOCAL_JOIN, event => {
-					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',
-							})
-						}) */
-					}
+					setTimeout(function(){
+						if(that.trtcComponent.getRemoteUserList().length>0){
+							var userId=that.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',
+								})
+							}) */
+						}else{
+							uni.showModal({ 
+								title: '提示',
+								content: '商户暂时不在,请联系后进行自助采摘', 
+								success: function (res) { 
+									if (res.confirm) {
+										 wx.navigateBack({
+										 	delta: 1
+										 });
+									} else if (res.cancel) { 
+										 wx.navigateBack({
+											delta: 1
+										 }); 
+									 } 
+								} ,
+							 });
+						}
+					},1000)
+					
+					
 					
 					console.log('* room LOCAL_JOIN', event); // 进房成功,触发该事件后可以对本地视频和音频进行设置
 

+ 21 - 0
pagesGood/videoList.vue

@@ -126,6 +126,27 @@
 							title: '直播未开始',
 							type: 'warning',
 						})
+						wx.requestSubscribeMessage({
+						  tmplIds: ['y0X1cZfbEMg7HdTGN_bW8v7TKeI3M0CHSVTY1zStIXM'],
+						  success(res) {
+							if(res.y0X1cZfbEMg7HdTGN_bW8v7TKeI3M0CHSVTY1zStIXM=="accept"){
+								var post_data={liveId:item.liveId,mid:uni.getStorageSync("userData").userId}
+								post_data.isDelete=0;
+								NET.request(API.subscribeLive, post_data, 'POST').then(res => {
+									
+								//this.goodsList = res.data
+								}).catch(res => {
+									
+								})
+							}else{
+								console.log('444', res);
+							}
+						    //console.log('1111', res);
+						  },
+						  fail(res) {
+						    console.log('2222', res);
+						  }
+						})
 						return false;
 					}
 					if(uni.getStorageSync("firstTimeLiveUser")==""){