Эх сурвалжийг харах

Merge branch 'master' of http://git.jihengcc.cn/liubaiyan/qjd-user-uniapp

able99 4 жил өмнө
parent
commit
e53276eea4

+ 6 - 2
jhlive/jhlive.nvue

@@ -4,12 +4,12 @@
 		 :isAuthor="isAuthor" :linkMic="linkMic" @onError="onError" @onRemoteUserEnterRoom="onRemoteUserEnterRoom"
 		 @onRemoteUserLeaveRoom="onRemoteUserLeaveRoom" />
 		<view class="top_left_box">
-			<image class="top_left_box_img" :src="avatar"></image>
+			<image class="top_left_box_img" :src="avatar" mode="aspectFill"></image>
 			<view class="top_left_box_text">
 				<text class="top_left_box_text1">{{title}}</text>
 				<text class="top_left_box_text2">{{subtitle}}</text>
 			</view>
-			<view v-if="showFav" class="top_left_box_collect">
+			<view v-if="showFav" class="top_left_box_collect" @click="onLiveFav">
 				<text class="top_left_box_collect_text">{{isFav?textFav:textNotFav}}</text>
 			</view>
 			<!-- <image v-if="showFav" class="top_left_box_collect" :src="isFav?collect:notCollect" @click="$emit('onFav', isFav)"></image> -->
@@ -206,6 +206,10 @@
 			},
 			clickBtns(index, item) {
 				this.$emit("onBtnClick", index, item);
+			},
+			// 关注点击事件
+			onLiveFav() {
+				this.$emit("onLiveFav");
 			}
 		}
 	};

+ 26 - 3
pagesGood/liveDetail.nvue

@@ -5,7 +5,7 @@
 			:sdkAppID="sdkAppID" :secretKey="secretKey" :userId="userId" :roomId="roomId"
 			:isAuthor="isAuthor" :linkMic="linkMic" 
 			:avatar="avatar" :subtitle="subtitle" :title="title" 
-			:showFav="true" :isFav="isLiveFav" @onLiveFav="" 
+			:showFav="showFav" :isFav="isLiveFav" @onLiveFav="onLiveFav" 
 			:btns="btns" @onBtnClick="onBtnClick"
 			:showIm="true" :imStatus="imStatus" :imMsgs="imMsgs" @onImSend="onImSend" />
 		<uni-popup ref="popup" animation type="bottom">
@@ -81,6 +81,12 @@
 				isLiveFav: false,
 				imStatus: '',
 				imMsgs: [],
+				// #ifdef MP-WEIXIN
+				showFav: true, // 是否展示收藏,app中不展示,小程序中 展示
+				// #endif
+				// #ifdef APP-PLUS
+				showFav: false,
+				// #endif
 			}
 		},
 		onLoad(options) {
@@ -93,6 +99,7 @@
 			let info = uni.getSystemInfoSync();
 			this.windowWidth = info.windowWidth;
 			this.windowHeight = info.windowHeight;
+			console.log('宽高',this.windowWidth,this.windowHeight)
 		},
 		onReady() {
 			// this.isAuthor = false;
@@ -130,6 +137,16 @@
 				this.avatar = uni.getStorageSync("liveImgUrl");
 				this.title = uni.getStorageSync("liveName");
 				this.$nextTick(() => this.enterRoom());
+				// 查询是否关注
+				NET.request(API.isSubscribed + this.liveId, {}, 'GET').then(res => {
+					if(res.data==false){
+						this.isLiveFav=false
+					}else{
+						this.isLiveFav=true
+					}
+				}).catch(res => {
+					console.log(res)
+				})
 			},
 			enterRoom() {
 				this.jhim = Jhim.getInstance(this.userId, this.sdkAppID, this.secretKey);
@@ -175,8 +192,14 @@
 					this.$refs.jhlive && this.$refs.jhlive.cleanImInput();
 				});
 			},
-			onLiveFav(isFav) {
-			
+			onLiveFav() {
+				let data = {liveId: this.liveId}
+				data.isDelete = this.isLiveFav ? 1 : 0
+			    NET.request(API.subscribeLive, data, 'POST').then(res => {
+					this.isLiveFav = !this.isLiveFav
+			    }).catch(res => {
+			    	console.log(res)
+			    })
 			},
 			exitRoom() {
 				this.jhimgroup.off(this.onImText);