From be80b22a4a0fcd33e1b17ebdb86eba91cc7de4d2 Mon Sep 17 00:00:00 2001
From: peng <peng.com>
Date: 星期三, 02 七月 2025 18:59:06 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/dev' into dev

---
 pages/video/video-play.vue |  121 +++++++++++++++++++++++++++++-----------
 1 files changed, 87 insertions(+), 34 deletions(-)

diff --git a/pages/video/video-play.vue b/pages/video/video-play.vue
index a1eb904..cb2bb48 100644
--- a/pages/video/video-play.vue
+++ b/pages/video/video-play.vue
@@ -18,7 +18,7 @@
 		@touchmove="handleSwiperMove"
 		@touchend="handleSwiperEnd(item)"
 		 >
-      	<view style="width: 100%;height: 100%;" v-if="item.videoContentType === 'video'">
+      	<view :style="{width: '100%', height: windowHeight - marginBottom + 'px'}" v-if="item.videoContentType === 'video'">
       		  <!-- 鎾斁鎸夐挳锛堜粎褰撹棰戞殏鍋滄椂鏄剧ず锛� -->
       		  <view 
       			class="play-icon" 
@@ -127,31 +127,35 @@
       	  </view>
           </view>
           
-          <!-- 鍙充晶浜掑姩鎸夐挳 -->
-         <view class="action-buttons">
-      	   <view class="avatar-container">
-      		   <image class="avatar" @click="jumpToHomePage(item.authorId)" :src="item.authorAvatar" mode="aspectFill"></image>
-      		   <!-- 鍏虫敞鍥炬爣 - 浣跨敤缁濆瀹氫綅 -->
-      		   <view v-if="!item.subscribeThisAuthor" class="follow-icon" @click="subscribeAuth(index, item.authorId)">
-      			 <text class="iconfont">&#xe629;</text>
-      		   </view>
-      	   </view>
-            <view class="action-item" @click="toggleCollect(item, index)">
-      		<text class="iconfont" v-if="item.collected">&#xe605;</text>
-      		<text class="iconfont" v-else>&#xe601;</text>
-      		<text style="font-size: 10px;font-weight: lighter;">{{item.collectNum}}</text>
-            </view>
-           <view class="action-item" @click="showComments(item)">
-              <text class="iconfont">&#xe7f7;</text>
-              <text style="font-size: 10px;font-weight: lighter;">{{item.commentNum}}</text>
-            </view>
-      	  <view class="action-item">
-      		  <button open-type="share" class="custom-share-btn" :data-obj="item">
-      		        <text class="iconfont">&#xe602;</text>
-      		      </button>
-      	     
-      	  </view>
-          </view>
+        <!-- 鍙充晶浜掑姩鎸夐挳 -->
+        <view class="action-buttons">
+		   <view class="avatar-container">
+			   <image class="avatar" @click="jumpToHomePage(item.authorId)" :src="item.authorAvatar" mode="aspectFill"></image>
+			   <!-- 鍏虫敞鍥炬爣 - 浣跨敤缁濆瀹氫綅 -->
+			   <view v-if="!item.subscribeThisAuthor" class="follow-icon" @click="subscribeAuth(index, item.authorId)">
+				 <text class="iconfont">&#xe629;</text>
+			   </view>
+		   </view>
+           <view class="action-item" @click="toggleThumbsUp(item, index)">
+        			<text class="iconfont" v-if="item.thumbsUp">&#xe605;</text>
+        			<text class="iconfont" v-else>&#xe601;</text>
+        			<text style="font-size: 10px;font-weight: lighter;">{{item.thumbsUpNum}}</text>
+           </view>
+          <view class="action-item" @click="showComments(item)">
+             <text class="iconfont">&#xe7f7;</text>
+             <text style="font-size: 10px;font-weight: lighter;">{{item.commentNum}}</text>
+           </view>
+			  <view class="action-item" @click="toggleCollect(item, index)">
+				 <text class="iconfont" v-if="item.collected">&#xeb9d;</text>
+				 <text class="iconfont" v-else>&#xe603;</text>
+				 <text style="font-size: 10px;font-weight: lighter;">{{item.collectNum}}</text>
+			   </view>
+			  <view class="action-item">
+				  <button open-type="share" class="custom-share-btn" :data-obj="item">
+					<text class="iconfont">&#xe602;</text>
+				  </button>
+			  </view>
+         </view>
       	
         </swiper-item>
       </swiper>
@@ -239,7 +243,16 @@
 </template>
 
 <script>
-import { getRecommendVideos, savePlayRecord, subscribe, getVideoComments, addVideoComment, thubmsUpComment, cancelThubmsUpComment } from "@/api/video.js";
+import { 
+	getRecommendVideos,
+	savePlayRecord,
+	subscribe,
+	getVideoComments,
+	addVideoComment, 
+	thubmsUpComment, 
+	cancelThubmsUpComment,
+	changeThumbsUp,
+} from "@/api/video.js";
 import { changeCollect } from "@/api/collect.js";
 import { saveShare } from "@/api/share.js";
 import storage from "@/utils/storage.js";
@@ -318,8 +331,11 @@
 			pageNumber: 1,
 			pageSize: 10,
 			authorId: '',
-			videoFrom: ''
-		}
+			videoFrom: '',
+			keyword: ''
+		},
+		marginBottom: 0, // 搴曢儴瀹夊叏鍖哄煙
+		windowHeight: 0 // 鍙娇鐢ㄥ睆骞曢珮搴�
     }
   },
   onShow() {
@@ -335,16 +351,19 @@
   },
   onUnload() {
 	  uni.removeStorageSync("playInfo");
+	  uni.removeStorageSync("searchPlayInfo");
   },
   onReady() {
   	
   },
   onLoad(option) {
-	  const playInfo = uni.getStorageSync("playInfo", playInfo);
+	  this.marginBottom = uni.getSystemInfoSync().safeAreaInsets.bottom
+	  this.windowHeight = uni.getSystemInfoSync().windowHeight
+	  const playInfo = uni.getStorageSync("playInfo");
+	  const searchPlayInfo = uni.getStorageSync("searchPlayInfo");
 	  if(playInfo) {
 		  this.currentIndex = playInfo.playIndex;
 		  this.videoList = playInfo.videoList;
-		  console.log("鎷垮埌鏁版嵁浜�",playInfo);
 		  this.videoQuery.pageNumber = playInfo.pageNumber;
 		  this.videoNoMore = playInfo.nomore;
 		  this.videoQuery.authorId = option.authorId;
@@ -353,6 +372,18 @@
 		  this.$nextTick(() => {
 			  const videoContext = uni.createVideoContext(`video${this.currentIndex}`, this);
 			  videoContext.play()
+		  })
+	  } else if (searchPlayInfo) { // 鎼滅储椤佃烦杞繃鏉ョ殑鏁版嵁鐣ユ湁涓嶅悓
+		  this.currentIndex = searchPlayInfo.playIndex;
+		  this.videoList = searchPlayInfo.videoList;
+		  this.videoQuery.pageNumber = searchPlayInfo.pageNumber;
+		  this.videoNoMore = searchPlayInfo.nomore;
+		  this.videoQuery.keyword = searchPlayInfo.keyword;
+		  this.videoQuery.videoFrom = option.videoFrom;
+		  this.currentVideoIsPlaying = true;
+		  this.$nextTick(() => {
+		  			  const videoContext = uni.createVideoContext(`video${this.currentIndex}`, this);
+		  			  videoContext.play()
 		  })
 	  } else {
 		  this.videoQuery.videoFrom = 'recommend';
@@ -823,6 +854,28 @@
 		  }
 	  })
     },
+	// 鐐硅禐/鍙栨秷鐐硅禐
+	toggleThumbsUp(item, index) {
+	  let data = {
+	  		  refId: item.id,
+	  		  thumbsUpType: 'video'
+	  }
+	  const beforeThumbsUp = item.thumbsUp
+	  const beforeThumbsUpNum = item.thumbsUpNum
+	  if(item.thumbsUp) {
+	  		  this.videoList[index].thumbsUp = false
+	  		  this.videoList[index].thumbsUpNum -= 1
+	  } else {
+	  		  this.videoList[index].thumbsUp = true
+	  		  this.videoList[index].thumbsUpNum += 1
+	  }
+	  changeThumbsUp(data).then(res => {
+	  		  if(res.data.code !== 200) {
+	  			  this.videoList[index].thumbsUp = beforeThumbsUp
+	  			  this.videoList[index].thumbsUpNum = beforeThumbsUpNum
+	  		  }
+	  })
+	},
     // 鍗曞嚮灞忓箷锛氭殏鍋滄垨缁х画鎾斁
 	togglePlay(index) {
 		console.log("鍗曞嚮瑙嗛", index);
@@ -951,7 +1004,7 @@
 	.video-info {
 	  width: 70%;
 	  position: absolute;
-	  bottom: 20px;
+	  bottom: 40px;
 	  left: 20px;
 	  color: #f8f8f8;
 	  z-index: 10;
@@ -1294,7 +1347,7 @@
 	  flex-direction: column;
 	  align-items: center;
 	  position: absolute;
-	  bottom: 0;
+	  bottom: 20px;
 	  width: 100%;
 	}
 	
@@ -1323,7 +1376,7 @@
 	.progress-text {
 	  margin-top: 10px;
 	  font-size: 14px;
-	  color: #666;
+	  color: #fff;
 	}
 	.swiper-box {
 	  width: 100%;

--
Gitblit v1.8.0