Commit f44c16c0 authored by jyx's avatar jyx

代码优化

parent e8b53bdd
......@@ -534,7 +534,7 @@
height: 100rpx;
width: 120rpx;
right: 20rpx;
bottom: 160rpx;
bottom: 200rpx;
position: absolute;
z-index: 999;
......
......@@ -3,12 +3,23 @@
<swiper class="swiper" circular @change="swiperChange" :current="current" :vertical="true" duration="300">
<swiper-item v-for="(list, index) in displaySwiperList" :key="index">
<view v-if="Math.abs(displayIndex-index)==0" style="height: 100%;">
<video v-if="Math.abs(displayIndex-index)==0" :id="''+list.vedioId" :controls="controls"
<view v-if="Math.abs(displayIndex-index)==0" style="height: 100%;background-color: aqua;"
@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"
@controlstoggle="controlstoggle" :show-fullscreen-btn="false" :poster="list.coverImage"
: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 v-if="!isqp" class="userInfo flex">
<!-- 点赞 -->
......@@ -50,7 +61,9 @@
</template>
<script>
import common from '@/mixins/common';
import common from '@/mixins/common';
import ttVideoPlayer from '@/ttcomponents/tt-video-player/index.js'
import {
navigateTo,
......@@ -60,7 +73,10 @@
export default {
name: "recommendVideo",
mixins: [common],
mixins: [common],
components:{
ttVideoPlayer
},
data() {
return {
controls: false, // 控制按钮
......@@ -130,12 +146,11 @@
this.isFirstLoad = false
this.queryList()
} else {
this.videoContext?.play()
tt.createVideoContext('' + this.originList[this.originIndex].vedioId, this).play();
}
},
stop() {
// audo.pause()
this.videoContext?.pause()
tt.createVideoContext('' + this.originList[this.originIndex].vedioId, this).pause();
},
queryList() {
// 推荐
......@@ -194,16 +209,26 @@
if (this.oid < 0) {
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)
// audo.pause()
this.videoContext = uni.createVideoContext("" + this.originList[this.oid].vedioId, this)
this.videoContext.pause()
this.videoContext.stop()
tt.createVideoContext('' + this.originList[this.oid].vedioId, this).pause();
setTimeout(() => {
console.log('qqqqqq:', this.originList[originIndex].vedioId)
this.videoContext = uni.createVideoContext("" + this.originList[originIndex].vedioId, this)
this.videoContext.play()
tt.createVideoContext('' + this.originList[originIndex].vedioId, this).play();
// this.commitVideo()
}, 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
if (originIndex == pCount) {
this.queryList()
......@@ -405,6 +430,7 @@
}
.tsvideo {
background-color: salmon;
width: 100%;
height: 100%;
animation: showDivAni 1s 1;
......
......@@ -125,15 +125,8 @@
this.currentPage = index
}
// #ifdef MP-TOUTIAO
tt.setNavigationBarColor({
frontColor: '#000000',
backgroundColor: '#ffffff'
})
// #endif
if (wx.setVisualEffectOnCapture) {
wx.setVisualEffectOnCapture({
if (tt.setVisualEffectOnCapture) {
tt.setVisualEffectOnCapture({
visualEffect: 'hidden',
success: (res) => {
......@@ -147,9 +140,8 @@
// 在子组件重写show()代替onShow()
if (this.currentPage == 0) {
this.$refs.index.show();
} else if (this.currentPage == 1) {
// this.$refs.recommend.show();
this.$refs.recommend.show();
} else if (this.currentPage == 2) {
this.$refs.follow.show();
}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