Browse Source

视频优化

pansl 1 year ago
parent
commit
9502f19d2b
1 changed files with 18 additions and 18 deletions
  1. 18 18
      pages/video/index.nvue

+ 18 - 18
pages/video/index.nvue

@@ -4,7 +4,7 @@
 			:autoBack="false">
 			:autoBack="false">
 		</u-navbar>
 		</u-navbar>
 		<swiper :style="'width: '+ windowWidth +'px; height:100vh; background-color: #000;'" class="swiper"
 		<swiper :style="'width: '+ windowWidth +'px; height:100vh; background-color: #000;'" class="swiper"
-			:circular='false' @change="swiperChange" :current="swiperCurrent" :vertical="true" duration="300">
+			:circular='false' @change="swiperChange" :current="swiperCurrent" :vertical="true" duration="200">
 			<block v-for="content in videoInfo.updated_episode_num">
 			<block v-for="content in videoInfo.updated_episode_num">
 				<swiper-item :key="content">
 				<swiper-item :key="content">
 					<view :style="'width: '+ windowWidth +'px; height:'+heightxw+'vh;'">
 					<view :style="'width: '+ windowWidth +'px; height:'+heightxw+'vh;'">
@@ -72,7 +72,7 @@
 								<view class="utabs-top">
 								<view class="utabs-top">
 									<u-tabs v-if="fenji==1" :activeStyle="activeStyle" lineColor="none"
 									<u-tabs v-if="fenji==1" :activeStyle="activeStyle" lineColor="none"
 										:inactiveStyle="inactiveStyle" class="utabs-top" :list="list1"
 										:inactiveStyle="inactiveStyle" class="utabs-top" :list="list1"
-										:current="current" @click="click"></u-tabs>
+										:current="current"></u-tabs>
 								</view>
 								</view>
 								<view class="ju-top-title">
 								<view class="ju-top-title">
 									{{videoInfo.name}}
 									{{videoInfo.name}}
@@ -80,8 +80,8 @@
 								<view class="ju-top-update"> 已更新至{{videoInfo.updated_episode_num}}集 </view>
 								<view class="ju-top-update"> 已更新至{{videoInfo.updated_episode_num}}集 </view>
 							</view>
 							</view>
 							<u-tabs v-if="fenji==1" :activeStyle="activeStyle" lineColor="none"
 							<u-tabs v-if="fenji==1" :activeStyle="activeStyle" lineColor="none"
-								:inactiveStyle="inactiveStyle" :list="labelList" @click="click"></u-tabs>
-							{{labelList}}
+								:inactiveStyle="inactiveStyle" :current="tabcurrent" :list="labelList"
+								@click="labelListClick"></u-tabs>
 						</view>
 						</view>
 						<view class="down" @click="down">
 						<view class="down" @click="down">
 							<text class="down-text">收起</text>
 							<text class="down-text">收起</text>
@@ -145,6 +145,7 @@
 	export default {
 	export default {
 		data() {
 		data() {
 			return {
 			return {
+				limitPage: 15,
 				top_height: 0,
 				top_height: 0,
 				episode: 1,
 				episode: 1,
 				swiperCurrent: 0,
 				swiperCurrent: 0,
@@ -159,16 +160,9 @@
 					color: '#606266',
 					color: '#606266',
 					transform: 'scale(1)'
 					transform: 'scale(1)'
 				},
 				},
-				activeIndex: 0,
+				activeIndex: 1,
 				tabcurrent: 0,
 				tabcurrent: 0,
-				videoInfo: {
-					"name": "test1-112",
-					"charge_sequence": 24,
-					"charge_coin": 125,
-					"total_episode_num": 98,
-					"updated_episode_num": 24,
-					"update_type": 1
-				},
+				videoInfo: {},
 				labelList: [],
 				labelList: [],
 				list1: [{
 				list1: [{
 					name: '当前剧集',
 					name: '当前剧集',
@@ -223,13 +217,13 @@
 			this.videoContext = uni.createVideoContext('myVideo')
 			this.videoContext = uni.createVideoContext('myVideo')
 		},
 		},
 		mounted() {
 		mounted() {
-			this.initTabs();
 			this.initSwiperData(this.swiperCurrent + 1)
 			this.initSwiperData(this.swiperCurrent + 1)
 			getVideoInfo({
 			getVideoInfo({
 				video_id: this.video_id
 				video_id: this.video_id
 			}).then(res => {
 			}).then(res => {
 				// console.log(res, 'getVideoInfogetVideoInfogetVideoInfo')
 				// console.log(res, 'getVideoInfogetVideoInfogetVideoInfo')
 				this.videoInfo = res.data
 				this.videoInfo = res.data
+				this.initTabs();
 			})
 			})
 		},
 		},
 		onLoad(e) {
 		onLoad(e) {
@@ -282,6 +276,12 @@
 			return obj
 			return obj
 			// #endif
 			// #endif
 		},
 		},
+		watch: {
+			activeIndex(newVal, oldVal) {
+				let index = this.labelList.findIndex(el => el.content.includes(newVal))
+				this.tabcurrent = index
+			}
+		},
 		onBackPress() {},
 		onBackPress() {},
 		methods: {
 		methods: {
 			bingewatch() {
 			bingewatch() {
@@ -351,7 +351,7 @@
 					}
 					}
 					return arr
 					return arr
 				}
 				}
-				const pageSize = 15;
+				const pageSize = this.limitPage;
 				const total = this.videoInfo.total_episode_num;
 				const total = this.videoInfo.total_episode_num;
 				const pageCount = Math.ceil(total / pageSize);
 				const pageCount = Math.ceil(total / pageSize);
 				for (let i = 0; i < pageCount; i++) {
 				for (let i = 0; i < pageCount; i++) {
@@ -401,9 +401,9 @@
 					this.down();
 					this.down();
 				}
 				}
 			},
 			},
-			click(item) {
+			labelListClick(item) {
 				this.tabcurrent = item.index
 				this.tabcurrent = item.index
-				console.log('item', item);
+				console.log('itemitemitemitemitem', item);
 			},
 			},
 			share() {
 			share() {
 				var href = '/pages/video/index?video_id=' + this.video_id
 				var href = '/pages/video/index?video_id=' + this.video_id
@@ -469,7 +469,7 @@
 			},
 			},
 			initSwiperData(originIndex) {
 			initSwiperData(originIndex) {
 				this.episode = originIndex;
 				this.episode = originIndex;
-				this.isqp = false
+				this.isqp = true
 				videoEpisodePlay({
 				videoEpisodePlay({
 					video_id: this.video_id,
 					video_id: this.video_id,
 					sequence: originIndex
 					sequence: originIndex