From c22e91296d532873b70cb51bf5510bf7738f3f1a Mon Sep 17 00:00:00 2001
From: peng <peng.com>
Date: 星期三, 09 七月 2025 18:01:36 +0800
Subject: [PATCH] 完成小程序商户端查看订单发货查看物流

---
 pages/tabbar/index/home.vue |  357 +++++++++++++++++++++++++++++++++++++---------------------
 1 files changed, 226 insertions(+), 131 deletions(-)

diff --git a/pages/tabbar/index/home.vue b/pages/tabbar/index/home.vue
index 1c56703..3f07dde 100644
--- a/pages/tabbar/index/home.vue
+++ b/pages/tabbar/index/home.vue
@@ -1,16 +1,20 @@
 <template>
   <view class="video-container">
+	<top-bar selectedTitleIndex="home" textColor="white" @changeTab="topBarChange" class="topBar"></top-bar>
+	<!-- 瑙嗛鍔犺浇 -->
+	<zero-loading v-show="videoLoading" type="circle" color="#0ebd57" text=""></zero-loading>
     <!-- 瑙嗛鍒楄〃 -->
     <swiper
       class="video-swiper"
       vertical
       :current="currentIndex"
       @change="onSwiperChange"
+	  :duration="250"
 	  easing-function="linear"
     >
       <swiper-item
 		v-for="(item, index) in videoList"
-		:key="item.id"
+		:key="item.updateKey"
 		@touchstart="handleSwiperStart"
 		@touchmove="handleSwiperMove"
 		@touchend="handleSwiperEnd(item)"
@@ -25,14 +29,16 @@
 				<image src="/static/video/play.png" style="width: 45px;height: 45px" mode="aspectFit"></image>
 			  </view>
 			  <video
+				v-if="index >= currentIndex - videoLiveOffset && index <= currentIndex + videoLiveOffset"
 				:id="'video'+index"
 				:ref="'video'+index"
 				:src="item.videoUrl"
-				:autoplay="false"
+				:autoplay="index === currentIndex"
 				:controls="false"
 				:loop="true"
-				:object-fit="item.objectFit"
+				:object-fit="item.videoFit"
 				:enable-progress-gesture="false"
+				:show-center-play-btn="false"
 				class="video-item"
 				@play="onPlay(item.id, index)"
 				@pause="onPause(index)"
@@ -40,12 +46,14 @@
 				@click="togglePlay(index)"
 				@timeupdate="onTimeUpdate($event)"
 				@loadedmetadata="onLoadedMetadata($event)"
+				@waiting="videoWaiting(index)"
 			  ></video>
 			  <!-- 鑷畾涔夋帶鍒舵潯 -->
 			  <view
-				@touchstart="handleTouchStart"
-				@touchmove="handleTouchMove"
-				@touchend="handleTouchEnd"
+				@touchstart.stop="handleTouchStart"
+				@touchmove.stop="handleTouchMove"
+				@touchend.stop="handleTouchEnd"
+				:style="{bottom: marginBottom + 'px'}"
 				class="container">
 				<!-- 杩涘害鏉� - 鏁翠釜鍖哄煙鍙嫋鍔� -->
 				<view class="process-warp" :style="{ opacity: showProcess ? 1 : 0 }">
@@ -111,39 +119,45 @@
 
 
         <!-- 瑙嗛淇℃伅灞� -->
-        <view class="video-info">
-		  <view>
+        <view class="video-info" :style="{bottom: marginBottom + 20 + 'px'}">
+		  <view style="width: 100%; position: relative;">
 			  <text class="video-author">@{{item.authorName}}</text>
+			  <text class="iconfont" @click="jumpToSearch" style="position: absolute;right: 45px;">&#xe64e;</text>
 		  </view>
           <view style="width: 100%;word-wrap: break-word;white-space: normal;overflow-wrap: break-word;">
 			  <text class="video-title">{{item.title}}</text>
 			  <text class="video-tag" v-for="(tag, index) in item.tagList" :key="tag.id">#{{tag.tagName}}</text>
 		  </view>
+		  
         </view>
 
-        <!-- 鍙充晶浜掑姩鎸夐挳 -->
+       <!-- 鍙充晶浜掑姩鎸夐挳 -->
        <view class="action-buttons">
 		   <view class="avatar-container">
-			   <image class="avatar" @click="jumpToHomePage(item.authorId)" :src="item.authorAvatar" mode="aspectFill"></image>
+			   <image class="avatar" @click="jumpToHomePage(item.authorId)" @touchend.stop :src="item.authorAvatar" mode="aspectFill"></image>
 			   <!-- 鍏虫敞鍥炬爣 - 浣跨敤缁濆瀹氫綅 -->
-			   <view v-if="!item.subscribeThisAuthor" class="follow-icon" @click="subscribeAuth(index, item.authorId)">
+			   <view v-if="!item.subscribeThisAuthor" class="follow-icon" @click="subscribeAuth(index, item.authorId)" @touchend.stop>
 				 <text class="iconfont">&#xe629;</text>
 			   </view>
 		   </view>
-          <view class="action-item" @click="toggleCollect(item, index)">
-			<text class="iconfont" v-if="item.collected">&#xe605;</text>
+          <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.collectNum}}</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>
 
@@ -235,13 +249,26 @@
 </template>
 
 <script>
-import { getRecommendVideos, savePlayRecord, subscribe, getVideoComments, addVideoComment, thubmsUpComment, cancelThubmsUpComment } from "@/api/video.js";
+import { 
+	getRecommendVideos,
+	savePlayRecord,
+	subscribe,
+	getVideoComments,
+	addVideoComment, 
+	thubmsUpComment, 
+	cancelThubmsUpComment,
+	changeThumbsUp,
+	getGoodsSimilarlyVideos
+} from "@/api/video.js";
 import { changeCollect } from "@/api/collect.js";
 import { saveShare, saveShareClickRecord } from "@/api/share.js";
 import { silentLogin } from "@/api/connect.js";
 import { getUserInfo } from "@/api/members";
 import storage from "@/utils/storage.js";
+import TopBar from "@/components/TopBar.vue";
+
 export default {
+  components: {TopBar},
   computed: {
 	    hasPlayTime() {
 	      return this.sliderFormatTime(this.progress > 0 ? this.duration * this.progress / 100 : 0);
@@ -300,13 +327,11 @@
 			startPlayTime: 0 // 杩欎釜瑙嗛浠庝粈涔堟椂鍊欏紑濮嬫挱鏀剧殑
 		},
 		currentVideoIsPlaying: true, // 褰撳墠瑙嗛鏄惁姝e湪鎾斁
-		isFullScreen: false,
-		windowHeight: 0,
 		currentIndex: 0, // 褰撳墠鎾斁鐨勮棰戠储寮�
+		videoLoading: false, // 瑙嗛缂撳啿涓�
 		videoList: [],   // 瑙嗛鍒楄〃鏁版嵁
-		videoContexts: [], // 瑙嗛涓婁笅鏂囧璞¢泦鍚�
 		videoBufferOffset: 0.1 ,// 瑙嗛棰勫姞杞藉弬鏁�
-		videoLiveOffset: 5, // 淇濈暀褰撳墠瑙嗛鍓嶅悗鍚勫灏戜釜瑙嗛涓婁笅鏂�
+		videoLiveOffset: 2, // 淇濈暀褰撳墠瑙嗛鍓嶅悗鍚勫灏戜釜瑙嗛涓婁笅鏂�
 		touchXY: {  // 鐩戝惉宸︽粦鍙虫粦
 			startX: 0,
 			endX: 0,
@@ -318,7 +343,19 @@
 			pageNumber: 1,
 			pageSize: 10,
 			videoFrom: 'recommend'
-		}
+		},
+		goodsSimilarlyQuery: { // 鐩镐技瑙嗛鏌ヨ
+			pageNumber: 1,
+			pageSize: 10,
+			videoFrom: 'goodsSimilarly',
+			goodsIds: [],
+			currentVideoId: ''
+		},
+		similarlyVideoList: [], // 鐩镐技瑙嗛
+		similarlyNomore: false, // 鏄惁杩樻湁鏇村鐩镐技瑙嗛
+		similaryVideoIndex: 0, // 鐩镐技瑙嗛鐨勬挱鏀句綅缃�
+		similarlyLoading: false, // 鐩镐技瑙嗛鍔犺浇
+		marginBottom: 0 // 搴曢儴瀹夊叏鍖哄煙
     }
   },
   onShow() {
@@ -340,6 +377,7 @@
   	this.startHidenTime = Date.now()
   },
   onLoad(option) {
+	  this.marginBottom = uni.getSystemInfoSync().safeAreaInsets.bottom
 	  const token = storage.getAccessToken();
 	  if (! token) {
 		  this.wxSilentLogin(() => {
@@ -375,6 +413,53 @@
   	}
   },
   methods: {
+	  // 鏌ヨ褰撳墠瑙嗛鐨勫叧鑱旇棰戯紙鎸備簡鍚屼竴鍟嗗搧鐨勶級
+	  async getGoodsSimilarly() {
+		  if (this.similarlyLoading || this.similarlyNomore) return Promise.resolve();;
+		  const video = this.videoList[this.currentIndex];
+		  if (video.goodsList && video.goodsList.length > 0) {
+			  this.goodsSimilarlyQuery.goodsIds = video.goodsList.map(goods => goods.goodsId);
+			  this.goodsSimilarlyQuery.currentVideoId = video.id;
+			  if (this.similarlyVideoList.length < 1) {
+				  this.similarlyVideoList.push(video); // 纭繚鍘熻棰戞槸妯悜瑙嗛鐨勭涓�涓厓绱�
+			  }
+			  this.similarlyLoading = true;
+			  return getGoodsSimilarlyVideos(this.goodsSimilarlyQuery).then(res => {
+			  			  
+			  			  this.similarlyVideoList = [
+			  			    ...this.similarlyVideoList,
+			  			    ...res.data.data.filter(
+			  				  (newItem) => !this.similarlyVideoList.some((oldItem) => oldItem.id === newItem.id)
+			  			    ),
+			  			  ];
+			  			  
+			  			  this.similarlyLoading = false;
+			  			  if(res.data.data.length < this.goodsSimilarlyQuery.pageSize) {
+			  				  this.similarlyNomore = true;
+			  				  return;
+			  			  }
+			  			  this.goodsSimilarlyQuery.pageNumber++;
+			  })
+		  }
+	  },
+	  // 璺宠浆鍒版悳绱㈤〉
+	  jumpToSearch() {
+		  uni.navigateTo({
+		  	url: '/pages/video/video-search'
+		  });
+	  },
+	  // 鍒囨崲椤堕儴瀵艰埅鏍�
+	  topBarChange(titleObj) {
+		if (titleObj.index === 'home') {
+			uni.switchTab({
+				url: titleObj.pagePath
+			});
+		} else {
+			uni.redirectTo({
+				url: titleObj.pagePath
+			});
+		}
+	  },
 	  // 闈欓粯鐧诲綍
 	  wxSilentLogin(callback) {
 		  //鑾峰彇code
@@ -426,6 +511,7 @@
 	  },
 		// 璺宠浆涓汉涓婚〉
 		jumpToHomePage(authorId) {
+			console.log("浣滆�卛d", authorId);
 			uni.navigateTo({
 				url: "/pages/video/home-page?authorId=" + authorId
 			})
@@ -662,56 +748,6 @@
 			}
 		})
 	  },
-    // 鍒濆鍖栬棰戜笂涓嬫枃
-    initVideoContexts() {
-	  const start = Math.max(0, this.currentIndex - this.videoLiveOffset);
-	  const end = Math.min(this.currentIndex + this.videoLiveOffset, this.videoList.length - 1);
-	  let contextsLength = this.videoContexts.length;
-	  if (contextsLength === 0) {
-		  // 绗竴娆″垵濮嬪寲
-		  for (let i = 0; i < this.videoList.length; i++) {
-			if (i < start || i > end) {
-				this.videoContexts.push(null)
-			} else {
-				let videoContent = uni.createVideoContext(`video${i}`, this);
-				videoContent.seek(this.videoBufferOffset);
-				videoContent.pause();
-				this.videoContexts.push(videoContent);
-			}
-		  }
-	  } else {
-		 for (let i = 0; i < this.videoList.length; i++) {
-		 	contextsLength = this.videoContexts.length
-			if (contextsLength - 1 >= i) {
-				// 濡傛灉宸茬粡鏄痭ull浜嗗氨涓嶇敤绠★紝鍥犱负瑙嗛鍔犺浇鍙細鍦ㄥ悗闈ush锛屽墠闈㈠凡缁忚缃负null鍒欐棤闇�澶勭悊
-				if (this.videoContexts[i] == null) {
-					continue
-				}
-				// 瓒呭嚭鍙鍖栬寖鍥寸殑瑙嗛鐩存帴閲婃斁璧勬簮锛屽苟缃负null
-				if (i < start || i > end) {
-					if (this.videoContexts[i]) {
-						this.videoContexts[i].stop();
-						this.videoContexts[i] = null
-					}
-				}
-			} else {
-				if (i < start || i > end) {
-					this.videoContexts.push(null);
-				} else {
-					let videoContent = uni.createVideoContext(`video${i}`, this);
-					videoContent.seek(this.videoBufferOffset);
-					videoContent.pause();
-					this.videoContexts.push(videoContent);
-				}
-			}
-		 }
-	  }
-	  // 灏嗗綋鍓嶈棰戣缃负鎾斁
-	  if (this.videoContexts[this.currentIndex]) {
-		  this.videoContexts[this.currentIndex].play()
-	  }
-
-    },
 
     // 鍔犺浇瑙嗛鏁版嵁
     async loadVideos() {
@@ -719,20 +755,24 @@
       this.loading = true;
 
 	  getRecommendVideos(this.videoQuery).then(res => {
-		  console.log(res, "瑙嗛鏁版嵁");
+		  // 鏂板涓�涓瓧娈电敤浜庡惊鐜椂鐨刱ey
+		  const data = res.data.data.map(item => {
+		  	return {
+		  		...item,
+		  		updateKey: item.id
+		  	}
+		  })
 		  if (this.videoQuery.pageNumber === 1) {
-		    this.videoList = res.data.data;
+		    this.videoList = data;
 		  } else {
 			this.videoList = [
 			  ...this.videoList,
-			  ...res.data.data.filter(
+			  ...data.filter(
 			    (newItem) => !this.videoList.some((oldItem) => oldItem.id === newItem.id)
 			  ),
 			];
+			
 		  }
-		  this.$nextTick(() => {
-		    this.initVideoContexts();
-		  });
 		  this.loading = false;
 		  if(res.data.data.length < this.videoQuery.pageSize) {
 			  this.videoNoMore = true;
@@ -745,6 +785,7 @@
 
     // 婊戝姩鍒囨崲瑙嗛
     onSwiperChange(e) {
+		this.videoLoading = false
 		// 濡傛灉瑙嗛澶勪簬鏆傚仠鐘舵�佸線涓嬪埛瑙嗛锛岄偅涔堥渶瑕佸啀璁$畻涓�娆℃殏鍋滄椂闂�
 		if(!this.currentVideoIsPlaying) {
 			if(this.startPauseTime !== 0) {
@@ -756,49 +797,41 @@
 		this.savePlayRecord()
 		const oldIndex = this.currentIndex;
 		this.currentIndex = e.detail.current;
-
+		const videoContext = uni.createVideoContext(`video${oldIndex}`, this);
 		// 鏆傚仠涓婁竴涓棰�
-		if (this.videoContexts[oldIndex]) {
-			this.videoContexts[oldIndex].pause();
-		}
-
+		videoContext.pause();
 		this.startPauseTime = 0;
 
 		// 璁剧疆褰撳墠鎾斁瑙嗛鐨勬�绘椂闀�
 		this.duration = this.videoList[this.currentIndex].videoDuration;
 		this.formartDuration = this.sliderFormatTime(this.duration);
-		// 鎾斁褰撳墠瑙嗛
-		if (this.videoContexts[this.currentIndex]) {
-			this.videoContexts[this.currentIndex].play();
-		}
-		this.clearVideoContext()
-    },
 
-	// 娓呴櫎瓒呭嚭瑙嗛鍙鍖栧尯鍩熺殑瑙嗛涓婁笅鏂�
-    async clearVideoContext() {
-		// 瀵硅秴鍑哄彲瑙嗗寲鍖哄煙鐨勮棰戜笂涓嬫枃鍋氶攢姣佸鐞�
-		const start = Math.max(0, this.currentIndex - this.videoLiveOffset);
-		const end = Math.min(this.currentIndex + this.videoLiveOffset, this.videoList.length - 1);
-		for (let i = 0; i < this.videoContexts.length; i++) {
-			if (i < start || i > end) {
-				if (this.videoContexts[i]) {
-					this.videoContexts[i].stop();
-					this.videoContexts[i] = null
-				}
-			} else {
-				if (this.videoContexts[i] == null) {
-					let videoContent = uni.createVideoContext(`video${i}`, this);
-					videoContent.seek(this.videoBufferOffset);
-					videoContent.pause();
-					this.videoContexts[i] = videoContent;
-				}
-			}
+		// 鎾斁褰撳墠瑙嗛
+		const videoContext1 = uni.createVideoContext(`video${this.currentIndex}`, this);
+		videoContext1.play()
+		
+		// 涓嬫粦鏃讹紝闇�瑕佸皢涓婁竴涓棰戦噸缃负鍘熷瑙嗛(濡傛灉妯悜婊戝姩浜嗙浉鍏宠棰�)
+		if (this.similaryVideoIndex !== 0) {
+			this.videoList[oldIndex] = this.similarlyVideoList[0]
 		}
+		this.similarlyVideoList = [];
+		this.similaryVideoIndex = 0;
+		this.similarlyNomore = false;
+		this.similarlyLoading = false;
+		this.goodsSimilarlyQuery = {
+			pageNumber: 1,
+			pageSize: 6,
+			videoFrom: 'goodsSimilarly',
+			goodsIds: [],
+			currentVideoId: ''
+		}
+		
 		// 濡傛灉鍓╀綑瑙嗛涓嶈冻锛岃Е鍙戣姹傝幏鍙栨洿澶氳棰�
 		if (this.videoList.length - 1 < this.currentIndex + this.videoLiveOffset) {
 			this.loadVideos()
 		}
-	},
+		
+    },
 
 	// 寮�濮嬭Е鎽�
 	handleSwiperStart(e) {
@@ -808,12 +841,15 @@
 	},
 	// 瑙︽懜涓�
 	handleSwiperMove(e) {
-		console.log("瑙︽懜涓�", e);
 	    this.touchXY.endX = e.touches[0].pageX
 	    this.touchXY.endY = e.touches[0].pageY
 	},
 	// 缁撴潫瑙︽懜
-	handleSwiperEnd(item) {
+	async handleSwiperEnd(item) {
+		// 闃叉婊戝姩婊氬姩鏉′篃瑙﹀彂璺宠浆
+		if (this.showProcess) {
+			return
+		}
 	    const diffX = this.touchXY.endX - this.touchXY.startX
 	    const diffY = this.touchXY.endY - this.touchXY.startY
 
@@ -821,11 +857,37 @@
 	    if (Math.abs(diffX) > Math.abs(diffY)) {
 	      if (diffX > 0) {
 	        console.log('鍙虫粦')
-			if (item.goodsList && item.goodsList.length > 0) {
+			if (this.similaryVideoIndex !== 0) {
+				// 濡傛灉婊戝姩浜嗘í鍚戣棰戯紝閭d箞鍙虫粦灏卞仛瑙嗛鍒囨崲鑰屼笉鏄烦杞晢鍝侀〉
+				// 鍒囨崲涓嬩竴涓棰�
+				const oldIndex = this.similaryVideoIndex;
+				this.similaryVideoIndex = Math.max(this.similaryVideoIndex - 1, 0);
+				if (this.similaryVideoIndex < oldIndex) {
+					// 鎶婄珫鍚戣棰戠殑褰撳墠鎾斁浣嶇疆鏇挎崲涓烘í鍚戣棰戠殑褰撳墠绱㈠紩鍏冪礌
+					const video = this.similarlyVideoList[this.similaryVideoIndex];
+					video["updateKey"] = video.id + this.similaryVideoIndex
+					this.videoList.splice(this.currentIndex, 1, video);
+					// this.videoList[this.currentIndex] = video
+				}
+			}
+			else if (item.goodsList && item.goodsList.length > 0) {
 				this.jumpToPay(item.id)
 			}
 	      } else {
 	        console.log('宸︽粦')
+			if (this.similarlyVideoList.length < 1 || this.similarlyVideoList.length - this.similaryVideoIndex - 1 <= 3) {
+				// 鐩稿叧瑙嗛涓虹┖鎴栬�呭墿浣欒棰戜笉瓒筹紝瑙﹀彂鍔犺浇鐩稿叧瑙嗛
+				await this.getGoodsSimilarly()
+			}
+			// 鍒囨崲涓嬩竴涓棰�
+			const oldIndex = this.similaryVideoIndex;
+			this.similaryVideoIndex = Math.min(this.similaryVideoIndex + 1, this.similarlyVideoList.length - 1);
+			if (this.similaryVideoIndex > oldIndex) {
+				// 鎶婄珫鍚戣棰戠殑褰撳墠鎾斁浣嶇疆鏇挎崲涓烘í鍚戣棰戠殑褰撳墠绱㈠紩鍏冪礌
+				const video = this.similarlyVideoList[this.similaryVideoIndex];
+				video["updateKey"] = video.id + this.similaryVideoIndex
+				this.videoList.splice(this.currentIndex, 1, video);
+			}
 	      }
 	    }
 	    // 閲嶇疆鍧愭爣
@@ -859,20 +921,40 @@
 		  }
 	  })
     },
+	// 鐐硅禐/鍙栨秷鐐硅禐
+	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, this.videoContexts);
+		console.log("鍗曞嚮瑙嗛", index);
+		const videoContext = uni.createVideoContext(`video${index}`, this);
 		if(this.currentVideoIsPlaying) {
-			this.videoContexts[index].pause();
+			videoContext.pause();
 		} else {
-			this.videoContexts[index].play();
+			videoContext.play();
 		}
 	},
     // 瑙嗛鎾斁浜嬩欢
     onPlay(id, index) {
-		this.getBarRect()
-		this.progress = 0
-		console.log(id, index, "瑙﹀彂鎾斁");
 		if(index === this.currentIndex) {
 			this.currentVideoIsPlaying = true;
 			if(! this.duration) {
@@ -881,9 +963,11 @@
 				this.formartDuration = this.sliderFormatTime(this.duration);
 			}
 		} else {
-			this.currentVideoIsPlaying = false;
 			return
 		}
+		this.getBarRect()
+		this.progress = 0
+		console.log(id, index, "瑙﹀彂鎾斁");
 		this.playRecord.videoId = id;
 		// 娌″垵濮嬪寲鎵嶈祴鍊硷紝鍥犱负涓�涓棰戦噸澶嶆挱鏀緊nPlay浼氶噸澶嶈Е鍙�
 		if(this.playRecord.startPlayTime === 0) {
@@ -893,7 +977,7 @@
 			const duration = Date.now() - this.startPauseTime
 			this.totalPauseTime += duration
 		}
-
+		this.videoLoading = false
     },
 
     // 瑙嗛鏆傚仠浜嬩欢
@@ -901,11 +985,8 @@
 		console.log(index, "瑙﹀彂鏆傚仠");
 		if(index === this.currentIndex) {
 			this.currentVideoIsPlaying = false;
-		} else {
-			this.currentVideoIsPlaying = true;
-			return
+			this.startPauseTime = Date.now()
 		}
-	  this.startPauseTime = Date.now()
     },
     // 瑙嗛缁撴潫浜嬩欢
     onEnded(index) {
@@ -914,6 +995,7 @@
 
 	// 璁板綍鎾斁鏃堕暱
 	onTimeUpdate(e) {
+		this.videoLoading = false
 		this.playRecord.playAt = e.detail.currentTime;
 
 		this.currentTime = e.detail.currentTime;
@@ -926,7 +1008,8 @@
 	  this.startProgress = this.progress; // 璁板綍寮�濮嬫椂鐨勮繘搴�
 	  this.startX = e.touches[0].pageX;
 	  console.log("璁板綍寮�濮嬫椂鐨勮繘搴�", this.startProgress);
-	  this.videoContexts[this.currentIndex].pause()
+	  const videoContext = uni.createVideoContext(`video${this.currentIndex}`, this);
+	  videoContext.pause()
 	  // this.updateProgress(e);
 	},
 
@@ -934,7 +1017,6 @@
 	handleTouchMove(e) {
 	  if (!this.isDragging || !this.barWidth) return;
 	  clearTimeout(this.processHidenTimer)
-	  this.videoContexts[this.currentIndex].pause()
 	  this.updateProgress(e);
 	},
 
@@ -942,8 +1024,9 @@
 	handleTouchEnd() {
 	  this.isDragging = false;
 	  console.log("婊戝姩缁撴潫", this.duration * this.progress);
-	  this.videoContexts[this.currentIndex].seek(this.duration * this.progress / 100)
-	  this.videoContexts[this.currentIndex].play()
+	  const videoContext = uni.createVideoContext(`video${this.currentIndex}`, this);
+	  videoContext.seek(this.duration * this.progress / 100)
+	  videoContext.play()
 	  this.processHidenTimer = setTimeout(() => {
 		  this.showProcess = false;
 		}, 1000);
@@ -959,7 +1042,6 @@
 
 		// 灏嗗儚绱犺窛绂昏浆鎹负杩涘害澧為噺
 		const deltaProgress = (deltaX / this.barWidth) * 100;
-		console.log("杩涘害澧為噺", deltaProgress);
 		// 璁$畻鏂拌繘搴� = 寮�濮嬫椂鐨勮繘搴� + 婊戝姩澧為噺
 		let newProgress = this.startProgress + deltaProgress;
 
@@ -967,6 +1049,13 @@
 		newProgress = Math.max(0, Math.min(100, newProgress));
 
 		this.progress = newProgress;
+	},
+	// 瑙嗛缂撳啿
+	videoWaiting(index) {
+		if (index === this.currentIndex) {
+			console.log("瑙嗛缂撳啿涓�傘�傘��");
+			this.videoLoading = true;
+		}
 	},
 	// 鑾峰彇瑙嗛鎬绘椂闀�
 	onLoadedMetadata(e) {
@@ -1015,7 +1104,7 @@
 	.video-item {
 	  width: 100%;
 	  height: 100%;
-	  object-fit: cover;
+	  /* object-fit: cover; */
 	}
 	.play-icon {
 	  position: absolute;
@@ -1029,7 +1118,7 @@
 	}
 
 	.video-info {
-	  width: 70%;
+	  width: 100%;
 	  position: absolute;
 	  bottom: 20px;
 	  left: 20px;
@@ -1403,7 +1492,7 @@
 	.progress-text {
 	  margin-top: 10px;
 	  font-size: 14px;
-	  color: #666;
+	  color: #fff;
 	}
 	.swiper-box {
 	  width: 100%;
@@ -1427,4 +1516,10 @@
 	.custom-share-btn::after {
 	  border: none;
 	}
+	.topBar {
+		position: fixed;
+		top: 20rpx;
+		left: 20rpx;
+		z-index: 1000
+	}
 </style>

--
Gitblit v1.8.0