Commit 29a1056d authored by jyx's avatar jyx

代码优化

parent fb0b06a1
...@@ -95,7 +95,7 @@ ...@@ -95,7 +95,7 @@
this.$emit("goRecommend") this.$emit("goRecommend")
}, },
click(detail) { click(detail) {
navigateTo(`/pagesC/video/newVideoDetail?data=` + encodeURIComponent(JSON.stringify(detail))) navigateTo(`/pagesC/video/ttVideoDetail?data=` + encodeURIComponent(JSON.stringify(detail)))
}, },
longClick(key) { longClick(key) {
this.isEditStyle = true this.isEditStyle = true
......
...@@ -311,19 +311,15 @@ ...@@ -311,19 +311,15 @@
}); });
}, },
handleBanner(item) { handleBanner(item) {
// navigateTo(`/pagesC/video/newVideoDetail?data=` + encodeURIComponent(JSON.stringify(item)));
navigateTo(`/pagesC/ttvideo/ttVideoDetail?data=` + encodeURIComponent(JSON.stringify(item))); navigateTo(`/pagesC/ttvideo/ttVideoDetail?data=` + encodeURIComponent(JSON.stringify(item)));
}, },
handleInfo(item) { handleInfo(item) {
// navigateTo(`/pagesC/video/newVideoDetail?data=` + encodeURIComponent(JSON.stringify(item)));
navigateTo(`/pagesC/ttvideo/ttVideoDetail?data=` + encodeURIComponent(JSON.stringify(item))); navigateTo(`/pagesC/ttvideo/ttVideoDetail?data=` + encodeURIComponent(JSON.stringify(item)));
}, },
handleTop(item) { handleTop(item) {
// navigateTo(`/pagesC/video/newVideoDetail?data=` + encodeURIComponent(JSON.stringify(item)));
navigateTo(`/pagesC/ttvideo/ttVideoDetail?data=` + encodeURIComponent(JSON.stringify(item))); navigateTo(`/pagesC/ttvideo/ttVideoDetail?data=` + encodeURIComponent(JSON.stringify(item)));
}, },
handleBottomPlay(item) { handleBottomPlay(item) {
// navigateTo(`/pagesC/video/newVideoDetail?data=` + encodeURIComponent(JSON.stringify(item)));
navigateTo(`/pagesC/ttvideo/ttVideoDetail?data=` + encodeURIComponent(JSON.stringify(item))); navigateTo(`/pagesC/ttvideo/ttVideoDetail?data=` + encodeURIComponent(JSON.stringify(item)));
}, },
handleBottomClose() { handleBottomClose() {
......
...@@ -236,7 +236,7 @@ ...@@ -236,7 +236,7 @@
this.isqp = e.detail.show this.isqp = e.detail.show
}, },
detail(detail) { detail(detail) {
navigateTo(`/pagesC/video/newVideoDetail?data=` + encodeURIComponent(JSON.stringify(detail)) + navigateTo(`/pagesC/video/ttVideoDetail?data=` + encodeURIComponent(JSON.stringify(detail)) +
`&playNext=1`) `&playNext=1`)
}, },
collect(vedioId, index) { collect(vedioId, index) {
......
...@@ -84,25 +84,16 @@ ...@@ -84,25 +84,16 @@
}, { }, {
"root": "pagesC", "root": "pagesC",
"pages": [{ "pages": [{
"path": "ttvideo/ttVideoDetail", "path": "ttvideo/ttVideoDetail",
"style": { "style": {
"navigationStyle": "default", "navigationStyle": "default",
"navigationBarBackgroundColor": "#000000", "navigationBarBackgroundColor": "#000000",
"navigationBarTextStyle": "#ffffff", "navigationBarTextStyle": "#ffffff",
"usingComponents ": { "usingComponents ": {
"video-player": "ext://industry/video-player" "video-player": "ext://industry/video-player"
}
}
},
{
"path": "video/newVideoDetail",
"style": {
"navigationStyle": "default",
"navigationBarBackgroundColor": "#000000",
"navigationBarTextStyle": "#ffffff"
} }
} }
] }]
}, },
{ {
"root": "pagesD", "root": "pagesD",
...@@ -147,19 +138,18 @@ ...@@ -147,19 +138,18 @@
"pages/home": { "pages/home": {
"network": "all", //在指定网络下预下载,可选值为:all(不限网络)、wifi(仅wifi下预下载) "network": "all", //在指定网络下预下载,可选值为:all(不限网络)、wifi(仅wifi下预下载)
"packages": ["pagesA", "pagesC", "pagesD"] //进入页面后预下载分包 "packages": ["pagesA", "pagesC", "pagesD"] //进入页面后预下载分包
},
"pages/recommend/recommend": {
"network": "all", //在指定网络下预下载,可选值为:all(不限网络)、wifi(仅wifi下预下载)
"packages": ["pagesC"] //进入页面后预下载分包
},
"pages/my/my": {
"network": "all", //在指定网络下预下载,可选值为:all(不限网络)、wifi(仅wifi下预下载)
"packages": ["pagesD"] //进入页面后预下载分包
} }
// ,
// "pages/recommend/recommend": {
// "network": "all", //在指定网络下预下载,可选值为:all(不限网络)、wifi(仅wifi下预下载)
// "packages": ["pagesC"] //进入页面后预下载分包
// },
// "pages/my/my": {
// "network": "all", //在指定网络下预下载,可选值为:all(不限网络)、wifi(仅wifi下预下载)
// "packages": ["pagesD"] //进入页面后预下载分包
// }
}, },
"globalStyle": { "globalStyle": {
"backgroundColor": "#232325", "backgroundColor": "#f5f5f5",
"navigationStyle": "default", "navigationStyle": "default",
"app-plus": { "app-plus": {
"bounce": "none", "bounce": "none",
......
...@@ -95,7 +95,7 @@ ...@@ -95,7 +95,7 @@
this.$emit("goRecommend") this.$emit("goRecommend")
}, },
click(detail) { click(detail) {
navigateTo(`/pagesC/video/newVideoDetail?data=` + encodeURIComponent(JSON.stringify(detail))) navigateTo(`/pagesC/video/ttVideoDetail?data=` + encodeURIComponent(JSON.stringify(detail)))
}, },
longClick(key) { longClick(key) {
this.isEditStyle = true this.isEditStyle = true
......
...@@ -236,7 +236,7 @@ ...@@ -236,7 +236,7 @@
this.isqp = e.detail.show this.isqp = e.detail.show
}, },
detail(detail) { detail(detail) {
navigateTo(`/pagesC/video/newVideoDetail?data=` + encodeURIComponent(JSON.stringify(detail)) + navigateTo(`/pagesC/video/ttVideoDetail?data=` + encodeURIComponent(JSON.stringify(detail)) +
`&playNext=1`) `&playNext=1`)
}, },
collect(vedioId, index) { collect(vedioId, index) {
......
...@@ -2,23 +2,20 @@ ...@@ -2,23 +2,20 @@
<view style="width: 100%;height: 100%;"> <view style="width: 100%;height: 100%;">
<!-- <status-title style="position: absolute;" iconColor="white" :showBack="true" /> --> <!-- <status-title style="position: absolute;" iconColor="white" :showBack="true" /> -->
<swiper class="swiper" circular @change="swiperChange" :current="current" :vertical="true" :duration="duration"> <swiper class="swiper" circular @change="swiperChange" :current="current" :vertical="true" :duration="duration">
<swiper-item v-for="(list, index) in displaySwiperList" :key="index"> <swiper-item v-for="(list, index) in displaySwiperList" :key="index" @click="tapVides()">
<block> <block>
<tt-video-player v-if="canUseTTPlayer && Math.abs(displayIndex-index)==0" :id="list.vedioIndex" <tt-video-player v-if="canUseTTPlayer && Math.abs(displayIndex-index)==0" :id="list.vedioIndex"
:album-id="list.douyinAlbumId" :episode-id="list.douyinEpisodeId" :cloud-type="1" version="1" :album-id="list.douyinAlbumId" :episode-id="list.douyinEpisodeId" :cloud-type="1" version="1"
object-fit="contain" :controls="controls" :poster="data.coverImage" :loop="!isplay" object-fit="contain" :controls="controls" :poster="data.coverImage" :loop="!isplay"
@getsource="getsource" :enable-progress-gesture="false" :show-loading="true" :autoplay="!list.lock" :enable-progress-gesture="false" :show-loading="true" @play="startPlay"
:show-fullscreen-btn="false" @controlstoggle="controlstoggle" @timeupdate="timeUpdate" :show-fullscreen-btn="false" @controlstoggle="controlstoggle" @timeupdate="timeUpdate"
@ended="ended" @click="tapVides()" @error="error"> @ended="ended" />
<cover-view>{{list.douyinAlbumId}}</cover-view>
<cover-view>{{list.douyinEpisodeId}}</cover-view>
</tt-video-player>
<video v-if="!canUseTTPlayer && Math.abs(displayIndex-index)==0" :id="list.vedioIndex" <video v-if="!canUseTTPlayer && Math.abs(displayIndex-index)==0" :id="list.vedioIndex"
@ended="ended" :controls="controls" :loop="!isplay" :enable-progress-gesture="false" @ended="ended" :controls="controls" :loop="!isplay" :enable-progress-gesture="false"
:show-loading="true" :show-fullscreen-btn="false" @controlstoggle="controlstoggle" :show-loading="true" :show-fullscreen-btn="false" @controlstoggle="controlstoggle"
:poster="data.coverImage" @click="tapVides()" @timeupdate="timeupdate" :autoplay="!list.lock" :poster="data.coverImage" @timeupdate="timeupdate" :autoplay="!list.lock" :src="list.vedioUrl"
:src="list.vedioUrl" class="tsvideo" play-btn-position="center" object-fit="contain" /> class="tsvideo" play-btn-position="center" object-fit="contain" />
<view v-if="originList[originIndex].lock || !list.vedioUrl" class="videoHover tsimg" <view v-if="originList[originIndex].lock || !list.vedioUrl" class="videoHover tsimg"
@click.stop="tapVideoHover(index,list.pays)" @click.stop="tapVideoHover(index,list.pays)"
...@@ -125,8 +122,6 @@ ...@@ -125,8 +122,6 @@
showCoinPop: false, showCoinPop: false,
vipBackPage: '', vipBackPage: '',
canUseTTPlayer: true, canUseTTPlayer: true,
ttPreloadAlbumId: '',
ttPreloadEpisodeId: '',
}; };
}, },
onLoad(options) { onLoad(options) {
...@@ -142,9 +137,6 @@ ...@@ -142,9 +137,6 @@
// #ifdef MP-TOUTIAO // #ifdef MP-TOUTIAO
this.canUseTTPlayer = tt.canIUse('video-player') this.canUseTTPlayer = tt.canIUse('video-player')
if (this.canUseTTPlayer && tt.canIUse('preloadResourceVideo')) {
this.preloadplaylet()
}
this.ttuop = 64 this.ttuop = 64
// #endif // #endif
...@@ -167,27 +159,32 @@ ...@@ -167,27 +159,32 @@
return result; return result;
}, },
methods: { methods: {
startPlay() {
if (tt.canIUse('preloadResourceVideo')) {
this.preloadplaylet()
}
},
preloadplaylet() { preloadplaylet() {
var preIndex = 0
if (this.displayIndex < 2) {
preIndex = this.displayIndex + 1
} else {
preIndex = 0
}
// 抖音预加载 // 抖音预加载
tt.preloadResourceVideo({ tt.preloadResourceVideo({
albumId: '7312714531850388019', albumId: this.displaySwiperList[preIndex].douyinAlbumId,
episodeId: '7312719321847529984', episodeId: this.displaySwiperList[preIndex].douyinEpisodeId,
cloudType: 1, cloudType: 1,
version: 1, version: 1,
success: () => { success: () => {
console.log("短剧预加载成功", ); console.log("短剧预加载成功" + this.displaySwiperList[preIndex].douyinEpisodeId);
}, },
fail: (error) => { fail: (error) => {
console.log("短剧预加载失败", error); console.log("短剧预加载失败", error);
}, },
}); });
}, },
getsource(e) {
console.log('AAAAAAA ' + e)
},
error(e) {
console.log('BBBBBBB ' + e)
},
paySuccess(largeType) { paySuccess(largeType) {
// largeType=vip 开通vip // largeType=vip 开通vip
// largeType=point 购买看点 // largeType=point 购买看点
...@@ -213,8 +210,6 @@ ...@@ -213,8 +210,6 @@
// return // return
// } // }
console.log('AAAAAAA')
this.$nextTick(() => { this.$nextTick(() => {
// 延迟渲染,否则位置错乱 // 延迟渲染,否则位置错乱
this.showCoinPop = true this.showCoinPop = true
......
This diff is collapsed.
...@@ -83,7 +83,7 @@ ...@@ -83,7 +83,7 @@
}); });
}, },
handleInfo(item) { handleInfo(item) {
navigateTo(`/pagesC/video/newVideoDetail?data=` + encodeURIComponent(JSON.stringify(item))); navigateTo(`/pagesC/video/ttVideoDetail?data=` + encodeURIComponent(JSON.stringify(item)));
}, },
handleXing(item) { handleXing(item) {
var that = this; var that = this;
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
$main-color: #03E7C9; $main-color: #03E7C9;
$second-color: #413F48; $second-color: #413F48;
/* 背景颜色 */ /* 背景颜色 */
$bg-color: #232325; $bg-color: #f5f5f5;
$bg-color-gray: #f8f8f8; $bg-color-gray: #f8f8f8;
$bg-color-hover: #f1f1f1; //点击状态颜色 $bg-color-hover: #f1f1f1; //点击状态颜色
$bg-color-mask: rgba(0, 0, 0, 0.5); //遮罩颜色 $bg-color-mask: rgba(0, 0, 0, 0.5); //遮罩颜色
......
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