Commit f44c16c0 authored by jyx's avatar jyx

代码优化

parent e8b53bdd
...@@ -534,7 +534,7 @@ ...@@ -534,7 +534,7 @@
height: 100rpx; height: 100rpx;
width: 120rpx; width: 120rpx;
right: 20rpx; right: 20rpx;
bottom: 160rpx; bottom: 200rpx;
position: absolute; position: absolute;
z-index: 999; z-index: 999;
......
...@@ -3,12 +3,23 @@ ...@@ -3,12 +3,23 @@
<swiper class="swiper" circular @change="swiperChange" :current="current" :vertical="true" duration="300"> <swiper class="swiper" circular @change="swiperChange" :current="current" :vertical="true" duration="300">
<swiper-item v-for="(list, index) in displaySwiperList" :key="index"> <swiper-item v-for="(list, index) in displaySwiperList" :key="index">
<view v-if="Math.abs(displayIndex-index)==0" style="height: 100%;"> <view v-if="Math.abs(displayIndex-index)==0" style="height: 100%;background-color: aqua;"
<video v-if="Math.abs(displayIndex-index)==0" :id="''+list.vedioId" :controls="controls" @click="tapVideoHover()">
<!-- <video v-if="Math.abs(displayIndex-index)==0" :id="''+list.vedioId" :controls="controls"
:autoplay="true" :isplay="true" play-btn-position="center" :loop="!isplay" @ended="ended" :autoplay="true" :isplay="true" play-btn-position="center" :loop="!isplay" @ended="ended"
@controlstoggle="controlstoggle" :show-fullscreen-btn="false" :poster="list.coverImage" @controlstoggle="controlstoggle" :show-fullscreen-btn="false" :poster="list.coverImage"
:show-loading="true" @click="tapVideoHover()" :enable-progress-gesture="false" class="tsvideo" :show-loading="true" @click="tapVideoHover()" :enable-progress-gesture="false" class="tsvideo"
:src="list.recommendUrl" object-fit="cover" /> :src="list.recommendUrl" object-fit="cover" /> -->
<tt-video-player v-if="Math.abs(displayIndex-index)==0" :id="list.vedioId" class="tsvideo"
:album-id="list.douyinAlbumId" :cover-id="list.douyinCoverId" :episode-id="list.douyinEpisodeId"
:cloud-type="1" version="1" object-fit="cover" :controls="controls" :poster="data.coverImage"
:loop="!isplay" :autoplay="true" :enable-progress-gesture="false" :show-loading="true"
@play="startPlay" :show-fullscreen-btn="false" @controlstoggle="controlstoggle"
@timeupdate="timeUpdate" @ended="ended">
<view>{{index + '-------' + displayIndex}}</view>
</tt-video-player>
</view> </view>
<view v-if="!isqp" class="userInfo flex"> <view v-if="!isqp" class="userInfo flex">
<!-- 点赞 --> <!-- 点赞 -->
...@@ -50,7 +61,9 @@ ...@@ -50,7 +61,9 @@
</template> </template>
<script> <script>
import common from '@/mixins/common'; import common from '@/mixins/common';
import ttVideoPlayer from '@/ttcomponents/tt-video-player/index.js'
import { import {
navigateTo, navigateTo,
...@@ -60,7 +73,10 @@ ...@@ -60,7 +73,10 @@
export default { export default {
name: "recommendVideo", name: "recommendVideo",
mixins: [common], mixins: [common],
components:{
ttVideoPlayer
},
data() { data() {
return { return {
controls: false, // 控制按钮 controls: false, // 控制按钮
...@@ -130,12 +146,11 @@ ...@@ -130,12 +146,11 @@
this.isFirstLoad = false this.isFirstLoad = false
this.queryList() this.queryList()
} else { } else {
this.videoContext?.play() tt.createVideoContext('' + this.originList[this.originIndex].vedioId, this).play();
} }
}, },
stop() { stop() {
// audo.pause() tt.createVideoContext('' + this.originList[this.originIndex].vedioId, this).pause();
this.videoContext?.pause()
}, },
queryList() { queryList() {
// 推荐 // 推荐
...@@ -194,16 +209,26 @@ ...@@ -194,16 +209,26 @@
if (this.oid < 0) { if (this.oid < 0) {
this.oid = this.originList.length - 1 this.oid = this.originList.length - 1
} }
// console.log('++++++++++++上一条播放数据 Index:', this.oid)
// // audo.pause()
// this.videoContext = uni.createVideoContext("" + this.originList[this.oid].vedioId, this)
// this.videoContext.pause()
// this.videoContext.stop()
console.log('++++++++++++上一条播放数据 Index:', this.oid) console.log('++++++++++++上一条播放数据 Index:', this.oid)
// audo.pause() tt.createVideoContext('' + this.originList[this.oid].vedioId, this).pause();
this.videoContext = uni.createVideoContext("" + this.originList[this.oid].vedioId, this)
this.videoContext.pause()
this.videoContext.stop()
setTimeout(() => { setTimeout(() => {
console.log('qqqqqq:', this.originList[originIndex].vedioId) console.log('qqqqqq:', this.originList[originIndex].vedioId)
this.videoContext = uni.createVideoContext("" + this.originList[originIndex].vedioId, this) tt.createVideoContext('' + this.originList[originIndex].vedioId, this).play();
this.videoContext.play() // this.commitVideo()
}, 500) }, 500)
// setTimeout(() => {
// console.log('qqqqqq:', this.originList[originIndex].vedioId)
// this.videoContext = uni.createVideoContext("" + this.originList[originIndex].vedioId, this)
// this.videoContext.play()
// }, 500)
var pCount = this.originList.length - this.playCount var pCount = this.originList.length - this.playCount
if (originIndex == pCount) { if (originIndex == pCount) {
this.queryList() this.queryList()
...@@ -405,6 +430,7 @@ ...@@ -405,6 +430,7 @@
} }
.tsvideo { .tsvideo {
background-color: salmon;
width: 100%; width: 100%;
height: 100%; height: 100%;
animation: showDivAni 1s 1; animation: showDivAni 1s 1;
......
...@@ -125,15 +125,8 @@ ...@@ -125,15 +125,8 @@
this.currentPage = index this.currentPage = index
} }
// #ifdef MP-TOUTIAO if (tt.setVisualEffectOnCapture) {
tt.setNavigationBarColor({ tt.setVisualEffectOnCapture({
frontColor: '#000000',
backgroundColor: '#ffffff'
})
// #endif
if (wx.setVisualEffectOnCapture) {
wx.setVisualEffectOnCapture({
visualEffect: 'hidden', visualEffect: 'hidden',
success: (res) => { success: (res) => {
...@@ -147,9 +140,8 @@ ...@@ -147,9 +140,8 @@
// 在子组件重写show()代替onShow() // 在子组件重写show()代替onShow()
if (this.currentPage == 0) { if (this.currentPage == 0) {
this.$refs.index.show(); this.$refs.index.show();
} else if (this.currentPage == 1) { } else if (this.currentPage == 1) {
// this.$refs.recommend.show(); this.$refs.recommend.show();
} else if (this.currentPage == 2) { } else if (this.currentPage == 2) {
this.$refs.follow.show(); this.$refs.follow.show();
}else if (this.currentPage == 3) { }else if (this.currentPage == 3) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment