优化首页视频播放逻辑

我页面的一些子页面
This commit is contained in:
zyronon 2021-07-11 21:15:03 +08:00
parent 0adffcc8a1
commit 32dbb2b953
38 changed files with 202 additions and 36 deletions

View File

@ -1,10 +1,36 @@
<template>
<router-view></router-view>
<router-view v-slot="{ Component }">
<transition :name="transitionName">
<component :is="Component"/>
</transition>
</router-view>
</template>
<script>
export default {
name: 'App',
data() {
return {
transitionName: 'go'
}
},
// watch $route 使
watch: {
'$route'(to, from) {
let noAnimation = ['/', '/home', '/me', '/attention', '/message']
if (noAnimation.indexOf(from.path) !== -1 && noAnimation.indexOf(to.path) !== -1) {
return this.transitionName = ''
}
const routeDeep = ['/message', '/attention', '/home', '/me',
'/editUserInfo',
'/editUserInfoItem',
'/VideoDetail',
];
const toDepth = routeDeep.indexOf(to.path)
const fromDepth = routeDeep.indexOf(from.path)
this.transitionName = toDepth > fromDepth ? 'go' : 'back'
}
},
}
</script>
<style lang="scss">
@ -18,51 +44,35 @@ export default {
#app {
height: 100%;
width: 100%;
position: relative;
}
.go-enter {
left: 100%;
.go-enter-from {
transform: translate3d(100%, 0, 0);
}
.go-enter-to {
left: 0;
}
.go-leave {
left: 0;
//
.back-enter-to, .back-enter-from, .go-enter-to, .go-leave-from {
transform: translate3d(0, 0, 0);
}
.go-leave-to {
left: -100%;
transform: translate3d(-100%, 0, 0);
}
.go-enter-active, .go-leave-active {
.go-enter-active, .go-leave-active, .back-enter-active, .back-leave-active {
transition: all .3s;
}
.back-enter {
left: -100%;
}
.back-enter-to {
left: 0;
}
.back-leave {
left: 0;
.back-enter-from {
transform: translate3d(-100%, 0, 0);
}
.back-leave-to {
left: 100%;
transform: translate3d(100%, 0, 0);
}
.back-enter-active, .back-leave-active {
transition: all .3s;
}
.fade-enter-active,
.fade-leave-active {
transition: opacity 0.3s ease;

BIN
src/assets/img/icon/add.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 253 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 561 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 786 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 642 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 994 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 297 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 909 B

BIN
src/assets/img/poster/1.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 69 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

BIN
src/assets/img/poster/2.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

BIN
src/assets/img/poster/3.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

BIN
src/assets/img/poster/4.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 98 KiB

BIN
src/assets/img/poster/5.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

BIN
src/assets/img/poster/6.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

BIN
src/assets/img/poster/7.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

BIN
src/assets/img/poster/8.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

BIN
src/assets/img/poster/9.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

BIN
src/assets/video/0.mp4 Normal file

Binary file not shown.

BIN
src/assets/video/1.mp4 Normal file

Binary file not shown.

BIN
src/assets/video/10.mp4 Normal file

Binary file not shown.

BIN
src/assets/video/2.mp4 Normal file

Binary file not shown.

BIN
src/assets/video/3.mp4 Normal file

Binary file not shown.

BIN
src/assets/video/4.mp4 Normal file

Binary file not shown.

BIN
src/assets/video/5.mp4 Normal file

Binary file not shown.

BIN
src/assets/video/6.mp4 Normal file

Binary file not shown.

BIN
src/assets/video/7.mp4 Normal file

Binary file not shown.

BIN
src/assets/video/8.mp4 Normal file

Binary file not shown.

BIN
src/assets/video/9.mp4 Normal file

Binary file not shown.

View File

@ -135,7 +135,7 @@ export default {
isMy: {
type: Boolean,
default: () => {
return true
return false
}
}
},

View File

@ -495,6 +495,11 @@ export default {
}
}
},
created() {
if (process.env.NODE_ENV !== 'development') {
this.videos = this.$clone(this.videos1)
}
},
mounted() {
this.height = document.body.clientHeight
this.width = document.body.clientWidth

View File

@ -45,13 +45,19 @@
</div>
</div>
<div class="row">
<input type="date" style="opacity: 0;left: 0;
position: absolute;
right: 0;
width: 98%;
height: 50px;"/>
<div class="left">生日</div>
<div class="right">
<span>B</span>
<img src="../../assets/img/icon/back.png" alt="">
</div>
</div>
<div class="row">
<div class="row" @click="$nav('/editUserInfoItem')">
<div class="left">所在地</div>
<div class="right">
<span>B</span>
@ -104,6 +110,13 @@ export default {
<style scoped lang="scss">
@import "../../assets/scss/index";
.edit{
position: fixed;
left: 0;
right: 0;
bottom: 0;
top: 0;
}
.title {
display: flex;
flex-direction: column;

View File

@ -64,6 +64,11 @@ export default {
@import "../../assets/scss/index";
.edit-item {
position: fixed;
left: 0;
right: 0;
bottom: 0;
top: 0;
.save-yes {
color: $primary-btn-color;

View File

@ -321,7 +321,6 @@ export default {
height: 100%;
width: 100%;
.no-more {
font-size: 1.4rem;
padding: 10px;

13
src/pages/me/School.vue Normal file
View File

@ -0,0 +1,13 @@
<template>
</template>
<script>
export default {
name: "School"
}
</script>
<style scoped>
</style>

View File

@ -1,9 +1,9 @@
<template>
<div id="home-index">
<div id="video-detail">
<SlideList key1="父" style="width: 100vw;" v-model:can-move="canMove">
<SlideItem>
<div class="search-ctn">
<img src="../../assets/img/icon/back.png" alt="" class="back">
<img src="../../assets/img/icon/back.png" alt="" class="back" @click="$back">
<Search></Search>
</div>
<SlideList key1="子" direction="column" v-model:active-index="videoActiveIndex">
@ -221,6 +221,118 @@ export default {
duration: 99
},
],
videos1: [
{
// videoUrl: mp40,
videoUrl: 'http://qvutp218u.hn-bkt.clouddn.com/0.mp4',
videoPoster: src1Bg,
isLoved: true,
loves: 1234,
comments: 666,
shared: 999,
duration: 99
},
{
// videoUrl: mp41,
videoUrl: 'http://qvutp218u.hn-bkt.clouddn.com/1.mp4',
videoPoster: src1Bg,
isLoved: true,
loves: 1234,
comments: 666,
shared: 999,
duration: 99
},
{
// videoUrl: mp42,
videoUrl: 'http://qvutp218u.hn-bkt.clouddn.com/2.mp4',
videoPoster: src1Bg,
isLoved: false,
loves: 1234,
comments: 666,
shared: 999,
duration: 99
},
{
// videoUrl: mp43,
videoUrl: 'http://qvutp218u.hn-bkt.clouddn.com/3.mp4',
videoPoster: src1Bg,
isLoved: false,
loves: 1234,
comments: 666,
shared: 999,
duration: 99
},
{
// videoUrl: mp44,
videoUrl: 'http://qvutp218u.hn-bkt.clouddn.com/4.mp4',
videoPoster: src1Bg,
isLoved: false,
loves: 1234,
comments: 666,
shared: 999,
duration: 99
},
{
// videoUrl: mp45,
videoUrl: 'http://qvutp218u.hn-bkt.clouddn.com/5.mp4',
videoPoster: src1Bg,
isLoved: false,
loves: 1234,
comments: 666,
shared: 999,
duration: 99
},
{
// videoUrl: mp46,
videoUrl: 'http://qvutp218u.hn-bkt.clouddn.com/6.mp4',
videoPoster: src1Bg,
isLoved: false,
loves: 1234,
comments: 666,
shared: 999,
duration: 99
},
{
// videoUrl: mp47,
videoUrl: 'http://qvutp218u.hn-bkt.clouddn.com/7.mp4',
videoPoster: src1Bg,
isLoved: false,
loves: 1234,
comments: 666,
shared: 999,
duration: 99
},
{
// videoUrl: mp48,
videoUrl: 'http://qvutp218u.hn-bkt.clouddn.com/8.mp4',
videoPoster: src1Bg,
isLoved: false,
loves: 1234,
comments: 666,
shared: 999,
duration: 99
},
{
// videoUrl: mp49,
videoUrl: 'http://qvutp218u.hn-bkt.clouddn.com/9.mp4',
videoPoster: src1Bg,
isLoved: false,
loves: 1234,
comments: 666,
shared: 999,
duration: 99
},
{
// videoUrl: mp410,
videoUrl: 'http://qvutp218u.hn-bkt.clouddn.com/10.mp4',
videoPoster: src1Bg,
isLoved: false,
loves: 1234,
comments: 666,
shared: 999,
duration: 99
},
],
addCount: 0,
total: 10,
baseActiveIndex: 0,
@ -243,9 +355,10 @@ export default {
// this.width = document.body.clientWidth
},
created() {
if (process.env.NODE_ENV !== 'development') {
this.videos = this.$clone(this.videos1)
}
},
}
</script>
@ -262,7 +375,12 @@ export default {
transform: translate3d(0, 50vh, 0);
}
#home-index {
#video-detail {
position: fixed;
top: 0;
bottom: 0;
left: 0;
right: 0;
height: 100%;
width: 100%;

View File

@ -1,4 +1,7 @@
export default {
$back(){
window.history.back()
},
$stopPropagation(e) {
e.stopImmediatePropagation()
e.stopPropagation()