Commit 42ccbacc authored by mengcuiguang's avatar mengcuiguang

Merge branch 'dev_xuanmiduanju20240307_douyin' of...

Merge branch 'dev_xuanmiduanju20240307_douyin' of http://gitlab.mints-id.com/android/uniapp_vedio into dev_xuanmiduanju20240307_douyin
parents 3f1d9c59 54356fc9
...@@ -3,12 +3,12 @@ ...@@ -3,12 +3,12 @@
<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%;" @click="tapVideoHover()"> <view v-if="Math.abs(displayIndex-index)==0" style="height: 100%;" @click="tapVideoHover()">
<tt-video-player v-if="Math.abs(displayIndex-index)==0" :id="list.vedioId" class="tsvideo" <tt-video-player v-if="Math.abs(displayIndex-index)==0" :id="'remmend'+list.vedioId" class="tsvideo"
:album-id="list.douyinAlbumId" :cover-id="list.douyinCoverId" :episode-id="list.douyinEpisodeId" :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" :cloud-type="1" version="1" object-fit="cover" :controls="controls" :poster="data.coverImage"
:loop="!isplay" :autoplay="true" :enable-progress-gesture="false" :show-loading="true" :loop="!isplay" :autoplay="false" :enable-progress-gesture="false" :show-loading="true"
@play="startPlay" :show-fullscreen-btn="false" @controlstoggle="controlstoggle" :show-fullscreen-btn="false" @controlstoggle="controlstoggle" @timeupdate="timeUpdate"
@timeupdate="timeUpdate" @ended="ended"> @ended="ended">
</tt-video-player> </tt-video-player>
</view> </view>
<view v-if="!isqp" class="userInfo flex"> <view v-if="!isqp" class="userInfo flex">
...@@ -54,9 +54,8 @@ ...@@ -54,9 +54,8 @@
import common from '@/mixins/common'; import common from '@/mixins/common';
import ttVideoPlayer from '@/ttcomponents/tt-video-player/index.js' import ttVideoPlayer from '@/ttcomponents/tt-video-player/index.js'
import { import {
navigateTo, navigateTo,
message message
} from '@/utils/fun.js'; } from '@/utils/fun.js';
...@@ -92,19 +91,12 @@ ...@@ -92,19 +91,12 @@
this.windowHeight = uni.getSystemInfoSync().windowHeight this.windowHeight = uni.getSystemInfoSync().windowHeight
}, },
methods: { methods: {
hide() {
try {
this.$refs.recommendVideo.stop();
} catch {
}
},
reShare() { reShare() {
var href = '' var href = ''
// #ifdef H5 // #ifdef H5
uni.setClipboardData({ uni.setClipboardData({
data: href, data: href,
complete() { complete() {
message.notify("分享连接已复制到剪贴板") message.notify("分享连接已复制到剪贴板")
} }
}) })
...@@ -135,11 +127,13 @@ ...@@ -135,11 +127,13 @@
this.isFirstLoad = false this.isFirstLoad = false
this.queryList() this.queryList()
} else { } else {
tt.createVideoContext('' + this.originList[this.originIndex].vedioId, this).play(); this.videoContext.play()
} }
}, },
stop() { hide() {
tt.createVideoContext('' + this.originList[this.originIndex].vedioId, this).pause(); if (this.videoContext) {
this.videoContext.pause()
}
}, },
queryList() { queryList() {
// 推荐 // 推荐
...@@ -199,26 +193,19 @@ ...@@ -199,26 +193,19 @@
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)
tt.createVideoContext('' + this.originList[this.oid].vedioId, this).pause(); if (this.videoContext) {
this.videoContext.pause()
this.videoContext.stop()
}
setTimeout(() => { setTimeout(() => {
console.log('qqqqqq:', this.originList[originIndex].vedioId) console.log('qqqqqq:', this.originList[originIndex].vedioId)
tt.createVideoContext('' + this.originList[originIndex].vedioId, this).play(); this.videoContext = tt.createVideoContext('remmend' + this.originList[originIndex].vedioId)
// this.commitVideo() this.videoContext.play()
}, 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()
...@@ -273,8 +260,8 @@ ...@@ -273,8 +260,8 @@
showLoading: false, showLoading: false,
success: ({ success: ({
data data
}) => { }) => {
message.notify("收藏成功") message.notify("收藏成功")
} }
}); });
}, },
...@@ -289,8 +276,8 @@ ...@@ -289,8 +276,8 @@
showLoading: false, showLoading: false,
success: ({ success: ({
data data
}) => { }) => {
message.notify("取消收藏") message.notify("取消收藏")
} }
}); });
}, },
......
...@@ -155,6 +155,22 @@ ...@@ -155,6 +155,22 @@
// 渲染完成 初始化首页数据 // 渲染完成 初始化首页数据
this.loadComponentData(); this.loadComponentData();
}, },
onHide() {
try {
// 在子组件重写show()代替onShow()
if (this.currentPage == 0) {
this.$refs.index.hide();
} else if (this.currentPage == 1) {
this.$refs.recommend.hide();
} else if (this.currentPage == 2) {
this.$refs.follow.hide();
} else if (this.currentPage == 3) {
this.$refs.user.hide();
}
} catch (e) {
}
},
methods: { methods: {
tabChange(index) { tabChange(index) {
if (this.currentPage == index) return if (this.currentPage == index) return
......
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