Przeglądaj źródła

视频播放页优化

pansl 1 rok temu
rodzic
commit
b677f8904a
2 zmienionych plików z 13 dodań i 5 usunięć
  1. 2 2
      common/config.js
  2. 11 3
      pages/video/index.nvue

+ 2 - 2
common/config.js

@@ -18,7 +18,7 @@ if (__wxConfig.envVersion == 'develop') {
 } else if (__wxConfig.envVersion == 'trial') {
 	//体验版
 	config = {
-		apiUrl: "https://api.duanju.dududus.com",
+		apiUrl: "https://api.dududus.com",
 		staticUrl: 'https://xjc.demo.hongcd.com/img/', //静态图片地址https://xjc.demo.hongcd.com
 		zystaticUrl: "",
 		TabbarIndex: 2
@@ -26,7 +26,7 @@ if (__wxConfig.envVersion == 'develop') {
 } else if (__wxConfig.envVersion == 'release') {
 	//正式版
 	config = {
-		apiUrl: "https://api.duanju.dududus.com",
+		apiUrl: "https://api.dududus.com",
 		staticUrl: 'https://xjc.demo.hongcd.com/img/', //静态图片地址https://xjc.demo.hongcd.com
 		zystaticUrl: "",
 		TabbarIndex: 2

+ 11 - 3
pages/video/index.nvue

@@ -8,7 +8,7 @@
 				:circular='false' @change="swiperChange" :current="swiperCurrent" :vertical="true" duration="200">
 				<block v-for="content in swiperList" :key="content">
 					<swiper-item>
-						<view :style="'width: '+ windowWidth +'px; height:'+heightxw+'vh;'">
+						<view :style="'width: '+ windowWidth +'px; height:'+heightxw+'vh;'" v-if="isShowVideo(content)">
 							<!-- @controlstoggle="controlstoggle" -->
 							<video v-if="isShowVideo(content)" autoplay :key="content" id="myVideo" :controls="controls"
 								:loop="!isplay" preload="auto" :enable-progress-gesture="true"
@@ -17,8 +17,7 @@
 								:style="'width: '+ windowWidth +'px; height:'+heightxw+'vh;'"
 								:src="currentVideoInfo.video_url" class="tsvideo">
 							</video>
-							<image v-else :style="'width: '+ windowWidth +'px; height:'+heightxw+'vh;'"
-								:src="videoInfo.cover_image"></image>
+
 							<view v-if="isqp" class="userInfo">
 								<!-- 2.点赞 -->
 								<view style="opacity: 0.9; margin-top: 17px;">
@@ -67,6 +66,9 @@
 								<text class="userName">选集</text>
 							</view>
 						</view>
+						<image v-if="shouldRender(content)"
+							:style="'width: '+ windowWidth +'px; height:'+heightxw+'vh;'" :src="videoInfo.cover_image">
+						</image>
 					</swiper-item>
 				</block>
 			</swiper>
@@ -273,6 +275,12 @@
 			};
 		},
 		computed: {
+			shouldRender(index) {
+				return (index) => {
+					// 判断是否应该渲染当前索引的前后各一个索引的swiper item
+					return Math.abs(index - this.swiperCurrent) <= 1;
+				}
+			},
 			swiperList() {
 				return Number(this.videoInfo.updated_episode_num) + 1
 			},