Browse Source

优化首页视频播放逻辑

我页面的一些子页面
pull/19/head
zyronon 4 years ago
parent
commit
32dbb2b953
  1. 66
      src/App.vue
  2. BIN
      src/assets/img/icon/add.png
  3. BIN
      src/assets/img/icon/back.png
  4. BIN
      src/assets/img/icon/home/music1.png
  5. BIN
      src/assets/img/icon/home/music2.png
  6. BIN
      src/assets/img/icon/me/collection-black.png
  7. BIN
      src/assets/img/icon/ok-red.png
  8. BIN
      src/assets/img/icon/ok-white.png
  9. BIN
      src/assets/img/poster/1.jpg
  10. BIN
      src/assets/img/poster/10.jpg
  11. BIN
      src/assets/img/poster/11.jpg
  12. BIN
      src/assets/img/poster/2.jpg
  13. BIN
      src/assets/img/poster/3.jpg
  14. BIN
      src/assets/img/poster/4.jpg
  15. BIN
      src/assets/img/poster/5.jpg
  16. BIN
      src/assets/img/poster/6.jpg
  17. BIN
      src/assets/img/poster/7.jpg
  18. BIN
      src/assets/img/poster/8.jpg
  19. BIN
      src/assets/img/poster/9.jpg
  20. BIN
      src/assets/video/0.mp4
  21. BIN
      src/assets/video/1.mp4
  22. BIN
      src/assets/video/10.mp4
  23. BIN
      src/assets/video/2.mp4
  24. BIN
      src/assets/video/3.mp4
  25. BIN
      src/assets/video/4.mp4
  26. BIN
      src/assets/video/5.mp4
  27. BIN
      src/assets/video/6.mp4
  28. BIN
      src/assets/video/7.mp4
  29. BIN
      src/assets/video/8.mp4
  30. BIN
      src/assets/video/9.mp4
  31. 2
      src/components/Video.vue
  32. 5
      src/pages/home/Index2.vue
  33. 15
      src/pages/me/EditUserInfo.vue
  34. 5
      src/pages/me/EditUserInfoItem.vue
  35. 1
      src/pages/me/Me.vue
  36. 13
      src/pages/me/School.vue
  37. 128
      src/pages/me/VideoDetail.vue
  38. 3
      src/utils/global-methods.js

66
src/App.vue

@ -1,10 +1,36 @@ @@ -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 { @@ -18,51 +44,35 @@ export default {
#app {
height: 100%;
width: 100%;
position: relative;
}
.go-enter {
left: 100%;
}
.go-enter-to {
left: 0;
.go-enter-from {
transform: translate3d(100%, 0, 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%;
}
.back-enter-active, .back-leave-active {
transition: all .3s;
transform: translate3d(100%, 0, 0);
}
.fade-enter-active,
.fade-leave-active {
transition: opacity 0.3s ease;

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 253 B

BIN
src/assets/img/icon/back.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 561 B

BIN
src/assets/img/icon/home/music1.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 786 B

BIN
src/assets/img/icon/home/music2.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 642 B

BIN
src/assets/img/icon/me/collection-black.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 994 B

BIN
src/assets/img/icon/ok-red.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 297 B

BIN
src/assets/img/icon/ok-white.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 909 B

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

BIN
src/assets/img/poster/10.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 69 KiB

BIN
src/assets/img/poster/11.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 98 KiB

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

BIN
src/assets/video/0.mp4

Binary file not shown.

BIN
src/assets/video/1.mp4

Binary file not shown.

BIN
src/assets/video/10.mp4

Binary file not shown.

BIN
src/assets/video/2.mp4

Binary file not shown.

BIN
src/assets/video/3.mp4

Binary file not shown.

BIN
src/assets/video/4.mp4

Binary file not shown.

BIN
src/assets/video/5.mp4

Binary file not shown.

BIN
src/assets/video/6.mp4

Binary file not shown.

BIN
src/assets/video/7.mp4

Binary file not shown.

BIN
src/assets/video/8.mp4

Binary file not shown.

BIN
src/assets/video/9.mp4

Binary file not shown.

2
src/components/Video.vue

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

5
src/pages/home/Index2.vue

@ -495,6 +495,11 @@ export default { @@ -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

15
src/pages/me/EditUserInfo.vue

@ -45,13 +45,19 @@ @@ -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 { @@ -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;

5
src/pages/me/EditUserInfoItem.vue

@ -64,6 +64,11 @@ export default { @@ -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;

1
src/pages/me/Me.vue

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

13
src/pages/me/School.vue

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

128
src/pages/me/VideoDetail.vue

@ -1,9 +1,9 @@ @@ -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 { @@ -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 { @@ -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 { @@ -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%;

3
src/utils/global-methods.js

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

Loading…
Cancel
Save