Commit 4439fb98 authored by jyx's avatar jyx

代码优化

parent 7d3346d1
......@@ -22,8 +22,8 @@
<view style="position: relative;">
<view style="
position: absolute;
z-index: 10;
width: 50rpx;
z-index: 10;
width: 50rpx;
text-align: center;
margin-top: 8rpx;
font-size: 24rpx;
......@@ -310,21 +310,22 @@
}
});
},
handleBanner(item) {
// navigateTo(`/pagesC/video/newVideoDetail?data=` + encodeURIComponent(JSON.stringify(item)));
navigateTo(`/pagesC/ttvideo/ttVideoDetail?data=` + encodeURIComponent(JSON.stringify(item)));
},
handleInfo(item) {
// navigateTo(`/pagesC/video/newVideoDetail?data=` + encodeURIComponent(JSON.stringify(item)));
navigateTo(`/pagesC/ttvideo/ttVideoDetail?data=` + encodeURIComponent(JSON.stringify(item)));
},
handleTop(item) {
// navigateTo(`/pagesC/video/newVideoDetail?data=` + encodeURIComponent(JSON.stringify(item)));
navigateTo(`/pagesC/ttvideo/ttVideoDetail?data=` + encodeURIComponent(JSON.stringify(item)));
},
handleBottomPlay(item) {
// navigateTo(`/pagesC/video/newVideoDetail?data=` + encodeURIComponent(JSON.stringify(item)));
navigateTo(`/pagesC/ttvideo/ttVideoDetail?data=` + encodeURIComponent(JSON.stringify(item)));
handleBanner(item) {
// navigateTo(`/pagesC/video/newVideoDetail?data=` + encodeURIComponent(JSON.stringify(item)));
navigateTo(`/pagesC/ttvideo/ttVideoDetail?data=` + encodeURIComponent(JSON.stringify(item)));
},
handleInfo(item) {
// navigateTo(`/pagesC/video/newVideoDetail?data=` + encodeURIComponent(JSON.stringify(item)));
// navigateTo(`/pagesC/ttvideo/ttVideoDetail?data=` + encodeURIComponent(JSON.stringify(item)));
navigateTo(`/pagesC/test/test`);
},
handleTop(item) {
// navigateTo(`/pagesC/video/newVideoDetail?data=` + encodeURIComponent(JSON.stringify(item)));
navigateTo(`/pagesC/ttvideo/ttVideoDetail?data=` + encodeURIComponent(JSON.stringify(item)));
},
handleBottomPlay(item) {
// navigateTo(`/pagesC/video/newVideoDetail?data=` + encodeURIComponent(JSON.stringify(item)));
navigateTo(`/pagesC/ttvideo/ttVideoDetail?data=` + encodeURIComponent(JSON.stringify(item)));
},
handleBottomClose() {
this.newRecordBean = null;
......
{
"name": "vedio",
"lockfileVersion": 2,
"requires": true,
"lockfileVersion": 1,
"packages": {
"": {
"dependencies": {
"json-bignumber": "^1.1.1",
"uview": "^0.1.0"
}
},
"node_modules/async-validator": {
"version": "1.12.2",
"resolved": "https://registry.npmmirror.com/async-validator/-/async-validator-1.12.2.tgz",
"integrity": "sha512-57EETfCPFiB7M4QscvQzWSGNsmtkjjzZv318SK1CBlstk+hycV72ocjriMOOM48HjvmoAoJGpJNjC7Z76RlnZA=="
},
"node_modules/bignumber.js": {
"version": "9.1.2",
"resolved": "https://registry.npmmirror.com/bignumber.js/-/bignumber.js-9.1.2.tgz",
"integrity": "sha512-2/mKyZH9K85bzOEfhXDBFZTGd1CTs+5IHpeFQo9luiBG7hghdC851Pj2WAhb6E3R6b9tZj/XKhbg4fum+Kepug==",
"engines": {
"node": "*"
}
},
"node_modules/core-js": {
"version": "2.6.12",
"resolved": "https://registry.npmmirror.com/core-js/-/core-js-2.6.12.tgz",
"integrity": "sha512-Kb2wC0fvsWfQrgk8HU5lW6U/Lcs8+9aaYcy4ZFc6DDlo4nZ7n70dEgE5rtR0oG6ufKDUnrwfWL1mXR5ljDatrQ==",
"deprecated": "core-js@<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js.",
"hasInstallScript": true
},
"node_modules/deepmerge": {
"version": "1.5.2",
"resolved": "https://registry.npmmirror.com/deepmerge/-/deepmerge-1.5.2.tgz",
"integrity": "sha512-95k0GDqvBjZavkuvzx/YqVLv/6YYa17fz6ILMSf7neqQITCPbnfEnQvEgMPNjH4kgobe7+WIL0yJEHku+H3qtQ==",
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/json-bignumber": {
"version": "1.1.1",
"resolved": "https://registry.npmmirror.com/json-bignumber/-/json-bignumber-1.1.1.tgz",
"integrity": "sha512-RWC/dAB/vOVosewwvPIfWgI/061fXZ0PbZxXr8GJvw8sDr8OzDm8vt7CZUdelg3QtKRdH4TUjnb++CXlRFRnPg==",
"dependencies": {
"bignumber.js": "^9.0.0"
}
},
"node_modules/popper.js": {
"version": "0.6.4",
"resolved": "https://registry.npmmirror.com/popper.js/-/popper.js-0.6.4.tgz",
"integrity": "sha512-KGPaJaw9822VnignV8HuPdVv0C66d3iC5YbdPaty/57LPmBqmbZX39n2gqN/bDeOtGHzsOA2AA9f9DH2Y0z6AQ==",
"deprecated": "You can find the new Popper v2 at @popperjs/core, this package is dedicated to the legacy v1"
},
"node_modules/uview": {
"version": "0.1.0",
"resolved": "https://registry.npmmirror.com/uview/-/uview-0.1.0.tgz",
"integrity": "sha512-zvumg1++gN+GpeHVlQAIfMzfFUigKJXma7tgHOcfYgkBp89t6U1j3pgqp9xG9PLz+AmIth9PYk4w36PQ3XVBnA==",
"dependencies": {
"async-validator": "^1.7.1",
"core-js": "^2.4.1",
"deepmerge": "^1.5.0",
"popper.js": "^0.6.4"
},
"engines": {
"node": ">= 4.0.0",
"npm": ">= 3.0.0"
},
"peerDependencies": {
"vue": "^2.4.1"
}
}
},
"dependencies": {
"async-validator": {
"version": "1.12.2",
"resolved": "https://registry.npmmirror.com/async-validator/-/async-validator-1.12.2.tgz",
"integrity": "sha512-57EETfCPFiB7M4QscvQzWSGNsmtkjjzZv318SK1CBlstk+hycV72ocjriMOOM48HjvmoAoJGpJNjC7Z76RlnZA=="
},
"bignumber.js": {
"version": "9.1.2",
"resolved": "https://registry.npmmirror.com/bignumber.js/-/bignumber.js-9.1.2.tgz",
"integrity": "sha512-2/mKyZH9K85bzOEfhXDBFZTGd1CTs+5IHpeFQo9luiBG7hghdC851Pj2WAhb6E3R6b9tZj/XKhbg4fum+Kepug=="
},
"core-js": {
"version": "2.6.12",
"resolved": "https://registry.npmmirror.com/core-js/-/core-js-2.6.12.tgz",
......@@ -17,6 +91,14 @@
"resolved": "https://registry.npmmirror.com/deepmerge/-/deepmerge-1.5.2.tgz",
"integrity": "sha512-95k0GDqvBjZavkuvzx/YqVLv/6YYa17fz6ILMSf7neqQITCPbnfEnQvEgMPNjH4kgobe7+WIL0yJEHku+H3qtQ=="
},
"json-bignumber": {
"version": "1.1.1",
"resolved": "https://registry.npmmirror.com/json-bignumber/-/json-bignumber-1.1.1.tgz",
"integrity": "sha512-RWC/dAB/vOVosewwvPIfWgI/061fXZ0PbZxXr8GJvw8sDr8OzDm8vt7CZUdelg3QtKRdH4TUjnb++CXlRFRnPg==",
"requires": {
"bignumber.js": "^9.0.0"
}
},
"popper.js": {
"version": "0.6.4",
"resolved": "https://registry.npmmirror.com/popper.js/-/popper.js-0.6.4.tgz",
......
{
"uni-app": {
"scripts": {
"mp-dingtalk": {
"title": "钉钉小程序",
"env": {
"UNI_PLATFORM": "mp-alipay"
},
"define": {
"MP-DINGTALK": true
}
},
"mp-weixin-test": {
"title": "本地测试版本",
"env": {
"UNI_PLATFORM": "mp-weixin"
},
"define": {
"MP-APP-TEST": true
}
},
"mp-app-test": {
"title": "App 本地测试版本",
"env": {
"UNI_PLATFORM": "mp-weixin"
},
"define": {
"MP-APP-TEST": true
}
}
}
},
"dependencies": {
"uview": "^0.1.0"
}
}
{
"uni-app": {
"scripts": {
"mp-dingtalk": {
"title": "钉钉小程序",
"env": {
"UNI_PLATFORM": "mp-alipay"
},
"define": {
"MP-DINGTALK": true
}
},
"mp-weixin-test": {
"title": "本地测试版本",
"env": {
"UNI_PLATFORM": "mp-weixin"
},
"define": {
"MP-APP-TEST": true
}
},
"mp-app-test": {
"title": "App 本地测试版本",
"env": {
"UNI_PLATFORM": "mp-weixin"
},
"define": {
"MP-APP-TEST": true
}
}
}
},
"dependencies": {
"json-bignumber": "^1.1.1",
"uview": "^0.1.0"
}
}
\ No newline at end of file
......@@ -72,75 +72,93 @@
],
// 分包配置
"subPackages": [{
"root": "pagesA",
"pages": [{
"path": "vipPay/vipPay",
"style": {
"navigationStyle": "default",
"navigationBarBackgroundColor": "#2196f3",
"navigationBarTextStyle": "black"
}
}]
}, {
"root": "pagesC",
"pages": [{
"path": "ttvideo/ttVideoDetail",
"style": {
"navigationStyle": "default",
"navigationBarBackgroundColor": "#000000",
"navigationBarTextStyle": "#ffffff"
}
"root": "pagesA",
"pages": [{
"path": "vipPay/vipPay",
"style": {
"navigationStyle": "default",
"navigationBarBackgroundColor": "#2196f3",
"navigationBarTextStyle": "black"
}
}]
}, {
"path": "video/newVideoDetail",
"style": {
"navigationStyle": "default",
"navigationBarBackgroundColor": "#000000",
"navigationBarTextStyle": "#ffffff"
}
}]
}, {
"root": "pagesD",
"pages": [{
"path": "watchRecord/watchRecord",
"style": {
"navigationBarTitleText": "观看记录",
"navigationStyle": "default",
"navigationBarBackgroundColor": "#ffffff",
"navigationBarTextStyle": "black"
}
}, {
"path": "payRecord/payRecord",
"style": {
"navigationBarTitleText": "我的订单",
"navigationStyle": "default",
"navigationBarBackgroundColor": "#ffffff",
"navigationBarTextStyle": "black"
}
}, {
"path": "dotRecord/dotRecord",
"style": {
"navigationBarTitleText": "看点记录",
"navigationStyle": "default",
"navigationBarBackgroundColor": "#ffffff",
"navigationBarTextStyle": "black"
}
}, {
"path": "useDotRecord/useDotRecord",
"style": {
"navigationBarTitleText": "消费记录",
"navigationStyle": "default",
"navigationBarBackgroundColor": "#ffffff",
"navigationBarTextStyle": "black"
}
}]
}],
"root": "pagesC",
"pages": [{
"path": "ttvideo/ttVideoDetail",
"style": {
"navigationStyle": "default",
"navigationBarBackgroundColor": "#000000",
"navigationBarTextStyle": "#ffffff",
"usingComponents ": {
"video-player": "ext://industry/video-player"
}
}
},
{
"path": "test/test",
"style": {
"navigationStyle": "default",
"navigationBarBackgroundColor": "#000000",
"navigationBarTextStyle": "#ffffff",
"usingComponents ": {
"video-player": "ext://industry/video-player"
}
}
},
{
"path": "video/newVideoDetail",
"style": {
"navigationStyle": "default",
"navigationBarBackgroundColor": "#000000",
"navigationBarTextStyle": "#ffffff"
}
}
]
},
{
"root": "pagesD",
"pages": [{
"path": "watchRecord/watchRecord",
"style": {
"navigationBarTitleText": "观看记录",
"navigationStyle": "default",
"navigationBarBackgroundColor": "#ffffff",
"navigationBarTextStyle": "black"
}
}, {
"path": "payRecord/payRecord",
"style": {
"navigationBarTitleText": "我的订单",
"navigationStyle": "default",
"navigationBarBackgroundColor": "#ffffff",
"navigationBarTextStyle": "black"
}
}, {
"path": "dotRecord/dotRecord",
"style": {
"navigationBarTitleText": "看点记录",
"navigationStyle": "default",
"navigationBarBackgroundColor": "#ffffff",
"navigationBarTextStyle": "black"
}
}, {
"path": "useDotRecord/useDotRecord",
"style": {
"navigationBarTitleText": "消费记录",
"navigationStyle": "default",
"navigationBarBackgroundColor": "#ffffff",
"navigationBarTextStyle": "black"
}
}]
}
],
// 分包预载配置
"preloadRule": {
// 当我们进入了pages/home页面以后就会预下载pagesA分包
"pages/home": {
"network": "all", //在指定网络下预下载,可选值为:all(不限网络)、wifi(仅wifi下预下载)
"packages": ["pagesA","pagesC","pagesD"] //进入页面后预下载分包
}
"packages": ["pagesA", "pagesC", "pagesD"] //进入页面后预下载分包
}
// ,
// "pages/recommend/recommend": {
// "network": "all", //在指定网络下预下载,可选值为:all(不限网络)、wifi(仅wifi下预下载)
......
<template>
<view class="content">
<view>
<text class="title">{{ title }}</text>
</view>
<video-player id="myPlayer" class="player-content" :album-id="aid" :episode-id="eid" :cloud-type="type" autoplay
show-playback-rate-btn show-mute-btn enable-play-in-background @play="playHandler" @pause="pauseHandler"
@error="error" @ended="endedHandler" @timeupdate="timeUpdateHandler" @progress="progressHandler"
@fullscreenchange="fullscreenchange" @controlstoggle="controlstoggle" @waiting="waitingHandler"
@loadedmetadata="loadedmetadataHandler" @seekcomplete="seekcomplete"
@playbackratechange="playbackratechange" @mutechange="mutechange" @controltap="controltap"
@enterbackground="enterbackground" @closebackground="closebackground" @getsource="getsource">
</video-player>
<text @click="testPlay">播放</text>
</view>
</template>
<script>
export default {
name: "test",
data() {
return {
title: "uniapp - video-player 组件demo",
aid: "7312718809956090368",
eid: "7312656326428262953",
type: 1,
version: "1",
src: ""
};
},
onLoad() {
console.log('tt.canIUse video-player', uni.canIUse('video-player'))
console.log('tt.canIUse bindleavebackground', uni.canIUse('bindleavebackground'))
},
methods: {
testPlay() {
let videoContext = tt.createVideoContext('myPlayer', this)
videoContext.play();
},
// bindplay
playHandler() {
console.log('bindplay:当开始播放时触发play事件')
},
// bindpause
pauseHandler() {
console.log("bindpause:当暂停播放时触发pause事件")
},
// // bindended todo
endedHandler() {
console.log("bindended:当播放到末尾时触发ended事件")
},
// binderror
error(e) {
console.log("binderror:视频播放出错时触发error事件", e.detail)
},
// bindtimeupdate
timeUpdateHandler(e) {
const {
currentTime,
duration
} = e.detail;
console.log("bindtimeupdate:播放进度变化时触发", "当前播放时间点:" + currentTime, "视频总时长:" + duration)
},
// bindprogress todo
progressHandler(e) {
const {
buffered
} = e.detail;
console.log("bindprogress:视频缓冲进度更新时触发", "当前视频缓冲了" + buffered + "%")
},
//bindfullscreenchange todo
fullscreenchange(e) {
const {
fullScreen,
direction
} = e.detail;
console.log("bindfullscreenchange:视频进入和退出全屏时触发", "fullScreen:" + fullScreen, "全屏时视频的方向:" + direction, )
},
//bindcontrolstoggle todo
controlstoggle(e) {
const {
show
} = e.detail;
console.log("bindcontrolstoggle:切换播放控件显示/隐藏时触发", "show" + show)
},
//bindwaiting todo
waitingHandler() {
console.log("bindwaiting:视频出现缓冲时触发")
},
//bindloadedmetadata todo
loadedmetadataHandler(e) {
const {
width,
height,
duration
} = e.detail;
console.log("bindloadedmetadata:视频元数据加载完成时触发", "width:" + width, "height:" + height, "duration:" +
duration)
},
// bindseekcomplete todo
seekcomplete(e) {
const {
position
} = e.detail;
console.log("bindseekcomplete:seek 完成时触发", "position:" + position)
},
// bindplaybackratechange todo
playbackratechange(e) {
const {
playbackRate
} = e.detail;
console.log("bindplaybackratechange:视频倍速改变完成时触发", "playbackRate:" + playbackRate)
},
// bindmutechange todo
mutechange(e) {
const {
isMuted
} = e.detail;
console.log("bindmutechange:静音状态改变完成时触发", "当前是否静音:" + isMuted)
},
// bindcontroltap todo
controltap(e) {
const {
controlType
} = e.detail;
console.log("bindcontroltap:点击控件时触发", "controlType" + controlType)
},
// bindenterbackground todo
enterbackground() {
console.log("bindenterbackground:进入小窗播放时触发")
},
// bindclosebackground todo
closebackground() {
console.log("bindclosebackground:关闭小窗播放时触发")
},
//bindgetsource
getsource() {
console.log("bindgetsource:获取资源完成后触发")
}
},
};
</script>
<style>
.content {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.title {
font-size: 36rpx;
color: #8f8f94;
}
.player-content {
width: 370px;
height: 300px;
}
</style>
\ No newline at end of file
......@@ -4,18 +4,21 @@
<swiper class="swiper" circular @change="swiperChange" :current="current" :vertical="true" :duration="duration">
<swiper-item v-for="(list, index) in displaySwiperList" :key="index">
<block>
<video-player v-if="canUseTTPlayer" :id="list.vedioIndex" :album-id="list.vedioIndex"
:episode-id="list.vedioIndex" object-fit="contain" :controls="controls"
:poster="data.coverImage" :loop="!isplay" :autoplay="!list.lock"
:enable-progress-gesture="false" :show-loading="true" :show-fullscreen-btn="false"
@controlstoggle="controlstoggle" @timeupdate="timeUpdate" @ended="ended" @click="tapVides()"
version="1" />
<video v-else :id="list.vedioIndex" @ended="ended" :controls="controls" :loop="!isplay"
:enable-progress-gesture="false" :show-loading="true" :show-fullscreen-btn="false"
@controlstoggle="controlstoggle" :poster="data.coverImage" @click="tapVides()"
@timeupdate="timeupdate" :autoplay="!list.lock" :src="list.vedioUrl" class="tsvideo"
play-btn-position="center" object-fit="contain" />
<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"
object-fit="contain" :controls="controls" :poster="data.coverImage" :loop="!isplay"
@getsource="getsource" :enable-progress-gesture="false" :show-loading="true"
:show-fullscreen-btn="false" @controlstoggle="controlstoggle" @timeupdate="timeUpdate"
@ended="ended" @click="tapVides()" @error="error">
<cover-view>{{list.douyinAlbumId}}</cover-view>
<cover-view>{{list.douyinEpisodeId}}</cover-view>
</video-player>
<video v-if="!canUseTTPlayer && Math.abs(displayIndex-index)==0" :id="list.vedioIndex"
@ended="ended" :controls="controls" :loop="!isplay" :enable-progress-gesture="false"
:show-loading="true" :show-fullscreen-btn="false" @controlstoggle="controlstoggle"
:poster="data.coverImage" @click="tapVides()" @timeupdate="timeupdate" :autoplay="!list.lock"
:src="list.vedioUrl" class="tsvideo" play-btn-position="center" object-fit="contain" />
<view v-if="originList[originIndex].lock || !list.vedioUrl" class="videoHover tsimg"
@click.stop="tapVideoHover(index,list.pays)"
......@@ -86,19 +89,13 @@
import {
data
} from '../../uni_modules/uview-ui/libs/mixin/mixin';
import {
ref
} from "vue";
import videoPlayer from '@/ttcomponents/video-player'
export default {
name: "ttVideoDetail",
mixins: [common],
components: {
coinPopup,
episodePopup,
videoPlayer
episodePopup
},
data() {
return {
......@@ -141,7 +138,7 @@
})
// #ifdef MP-TOUTIAO
this.canUseTTPlayer = tt.canIUse('video-player')
// this.canUseTTPlayer = tt.canIUse('video-player')
if (this.canUseTTPlayer && tt.canIUse('preloadResourceVideo')) {
this.preloadplaylet()
}
......@@ -154,8 +151,8 @@
this.getData()
},
onShow() {
// 从VIP页面返回关闭弹框
this.$refs.episodePopup.down();
// 从VIP页面返回关闭弹框
// this.$refs.episodePopup.down();
},
// 分享
onShareAppMessage() {
......@@ -187,6 +184,12 @@
},
});
},
getsource(e) {
console.log('AAAAAAA ' + e)
},
error(e) {
console.log('BBBBBBB ' + e)
},
paySuccess(largeType) {
// largeType=vip 开通vip
// largeType=point 购买看点
......@@ -212,6 +215,8 @@
// return
// }
console.log('AAAAAAA')
this.$nextTick(() => {
// 延迟渲染,否则位置错乱
this.showCoinPop = true
......@@ -361,6 +366,7 @@
originIndex + 1 == originListLength ? 0 : originIndex + 1
];
this.displaySwiperList = displayList;
console.log(this.displaySwiperList)
if (this.oid >= this.originList.length) {
this.oid = 0
......
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