优化首页视频播放逻辑
我页面的一些子页面
66
src/App.vue
@ -1,10 +1,36 @@
|
|||||||
<template>
|
<template>
|
||||||
<router-view></router-view>
|
<router-view v-slot="{ Component }">
|
||||||
|
<transition :name="transitionName">
|
||||||
|
<component :is="Component"/>
|
||||||
|
</transition>
|
||||||
|
</router-view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
name: 'App',
|
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>
|
</script>
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
@ -18,51 +44,35 @@ export default {
|
|||||||
#app {
|
#app {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
position: relative;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.go-enter-from {
|
||||||
.go-enter {
|
transform: translate3d(100%, 0, 0);
|
||||||
left: 100%;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.go-enter-to {
|
//最终状态
|
||||||
left: 0;
|
.back-enter-to, .back-enter-from, .go-enter-to, .go-leave-from {
|
||||||
}
|
transform: translate3d(0, 0, 0);
|
||||||
|
|
||||||
.go-leave {
|
|
||||||
left: 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.go-leave-to {
|
.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;
|
transition: all .3s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.back-enter {
|
.back-enter-from {
|
||||||
left: -100%;
|
transform: translate3d(-100%, 0, 0);
|
||||||
}
|
|
||||||
|
|
||||||
.back-enter-to {
|
|
||||||
left: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.back-leave {
|
|
||||||
left: 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.back-leave-to {
|
.back-leave-to {
|
||||||
left: 100%;
|
transform: translate3d(100%, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
.back-enter-active, .back-leave-active {
|
|
||||||
transition: all .3s;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
.fade-enter-active,
|
.fade-enter-active,
|
||||||
.fade-leave-active {
|
.fade-leave-active {
|
||||||
transition: opacity 0.3s ease;
|
transition: opacity 0.3s ease;
|
||||||
|
|||||||
BIN
src/assets/img/icon/add.png
Normal file
|
After Width: | Height: | Size: 253 B |
BIN
src/assets/img/icon/back.png
Normal file
|
After Width: | Height: | Size: 561 B |
BIN
src/assets/img/icon/home/music1.png
Normal file
|
After Width: | Height: | Size: 786 B |
BIN
src/assets/img/icon/home/music2.png
Normal file
|
After Width: | Height: | Size: 642 B |
BIN
src/assets/img/icon/me/collection-black.png
Normal file
|
After Width: | Height: | Size: 994 B |
BIN
src/assets/img/icon/ok-red.png
Normal file
|
After Width: | Height: | Size: 297 B |
BIN
src/assets/img/icon/ok-white.png
Normal file
|
After Width: | Height: | Size: 909 B |
BIN
src/assets/img/poster/1.jpg
Normal file
|
After Width: | Height: | Size: 41 KiB |
BIN
src/assets/img/poster/10.jpg
Normal file
|
After Width: | Height: | Size: 69 KiB |
BIN
src/assets/img/poster/11.jpg
Normal file
|
After Width: | Height: | Size: 20 KiB |
BIN
src/assets/img/poster/2.jpg
Normal file
|
After Width: | Height: | Size: 30 KiB |
BIN
src/assets/img/poster/3.jpg
Normal file
|
After Width: | Height: | Size: 42 KiB |
BIN
src/assets/img/poster/4.jpg
Normal file
|
After Width: | Height: | Size: 98 KiB |
BIN
src/assets/img/poster/5.jpg
Normal file
|
After Width: | Height: | Size: 39 KiB |
BIN
src/assets/img/poster/6.jpg
Normal file
|
After Width: | Height: | Size: 17 KiB |
BIN
src/assets/img/poster/7.jpg
Normal file
|
After Width: | Height: | Size: 36 KiB |
BIN
src/assets/img/poster/8.jpg
Normal file
|
After Width: | Height: | Size: 20 KiB |
BIN
src/assets/img/poster/9.jpg
Normal file
|
After Width: | Height: | Size: 50 KiB |
BIN
src/assets/video/0.mp4
Normal file
BIN
src/assets/video/1.mp4
Normal file
BIN
src/assets/video/10.mp4
Normal file
BIN
src/assets/video/2.mp4
Normal file
BIN
src/assets/video/3.mp4
Normal file
BIN
src/assets/video/4.mp4
Normal file
BIN
src/assets/video/5.mp4
Normal file
BIN
src/assets/video/6.mp4
Normal file
BIN
src/assets/video/7.mp4
Normal file
BIN
src/assets/video/8.mp4
Normal file
BIN
src/assets/video/9.mp4
Normal file
@ -135,7 +135,7 @@ export default {
|
|||||||
isMy: {
|
isMy: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: () => {
|
default: () => {
|
||||||
return true
|
return false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@ -495,6 +495,11 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
created() {
|
||||||
|
if (process.env.NODE_ENV !== 'development') {
|
||||||
|
this.videos = this.$clone(this.videos1)
|
||||||
|
}
|
||||||
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.height = document.body.clientHeight
|
this.height = document.body.clientHeight
|
||||||
this.width = document.body.clientWidth
|
this.width = document.body.clientWidth
|
||||||
|
|||||||
@ -45,13 +45,19 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<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="left">生日</div>
|
||||||
<div class="right">
|
<div class="right">
|
||||||
<span>B</span>
|
<span>B</span>
|
||||||
<img src="../../assets/img/icon/back.png" alt="">
|
<img src="../../assets/img/icon/back.png" alt="">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row" @click="$nav('/editUserInfoItem')">
|
||||||
<div class="left">所在地</div>
|
<div class="left">所在地</div>
|
||||||
<div class="right">
|
<div class="right">
|
||||||
<span>B</span>
|
<span>B</span>
|
||||||
@ -104,6 +110,13 @@ export default {
|
|||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
@import "../../assets/scss/index";
|
@import "../../assets/scss/index";
|
||||||
|
|
||||||
|
.edit{
|
||||||
|
position: fixed;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
top: 0;
|
||||||
|
}
|
||||||
.title {
|
.title {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
|||||||
@ -64,6 +64,11 @@ export default {
|
|||||||
@import "../../assets/scss/index";
|
@import "../../assets/scss/index";
|
||||||
|
|
||||||
.edit-item {
|
.edit-item {
|
||||||
|
position: fixed;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
top: 0;
|
||||||
|
|
||||||
.save-yes {
|
.save-yes {
|
||||||
color: $primary-btn-color;
|
color: $primary-btn-color;
|
||||||
|
|||||||
@ -321,7 +321,6 @@ export default {
|
|||||||
height: 100%;
|
height: 100%;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|
||||||
|
|
||||||
.no-more {
|
.no-more {
|
||||||
font-size: 1.4rem;
|
font-size: 1.4rem;
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
|
|||||||
13
src/pages/me/School.vue
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
<template>
|
||||||
|
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: "School"
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
|
||||||
|
</style>
|
||||||
@ -1,9 +1,9 @@
|
|||||||
<template>
|
<template>
|
||||||
<div id="home-index">
|
<div id="video-detail">
|
||||||
<SlideList key1="父" style="width: 100vw;" v-model:can-move="canMove">
|
<SlideList key1="父" style="width: 100vw;" v-model:can-move="canMove">
|
||||||
<SlideItem>
|
<SlideItem>
|
||||||
<div class="search-ctn">
|
<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>
|
<Search></Search>
|
||||||
</div>
|
</div>
|
||||||
<SlideList key1="子" direction="column" v-model:active-index="videoActiveIndex">
|
<SlideList key1="子" direction="column" v-model:active-index="videoActiveIndex">
|
||||||
@ -221,6 +221,118 @@ export default {
|
|||||||
duration: 99
|
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,
|
addCount: 0,
|
||||||
total: 10,
|
total: 10,
|
||||||
baseActiveIndex: 0,
|
baseActiveIndex: 0,
|
||||||
@ -243,9 +355,10 @@ export default {
|
|||||||
// this.width = document.body.clientWidth
|
// this.width = document.body.clientWidth
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
|
if (process.env.NODE_ENV !== 'development') {
|
||||||
|
this.videos = this.$clone(this.videos1)
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@ -262,7 +375,12 @@ export default {
|
|||||||
transform: translate3d(0, 50vh, 0);
|
transform: translate3d(0, 50vh, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
#home-index {
|
#video-detail {
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,7 @@
|
|||||||
export default {
|
export default {
|
||||||
|
$back(){
|
||||||
|
window.history.back()
|
||||||
|
},
|
||||||
$stopPropagation(e) {
|
$stopPropagation(e) {
|
||||||
e.stopImmediatePropagation()
|
e.stopImmediatePropagation()
|
||||||
e.stopPropagation()
|
e.stopPropagation()
|
||||||
|
|||||||