save
This commit is contained in:
parent
881eb98bc1
commit
1b3e7cf7a9
@ -192,3 +192,67 @@ p {
|
|||||||
position: relative;
|
position: relative;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.love-dbclick {
|
||||||
|
position: absolute;
|
||||||
|
@width: 90rem;
|
||||||
|
width: @width;
|
||||||
|
height: @width;
|
||||||
|
|
||||||
|
&.left {
|
||||||
|
animation: loveLeft 1.1s linear;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.right {
|
||||||
|
animation: loveRight 1.1s linear;
|
||||||
|
}
|
||||||
|
|
||||||
|
@scale: scale(1.2);
|
||||||
|
@start-scale: scale(2.2);
|
||||||
|
@rotate: 10deg;
|
||||||
|
|
||||||
|
@keyframes loveLeft {
|
||||||
|
0% {
|
||||||
|
opacity: 0;
|
||||||
|
transform: @start-scale rotate(0-@rotate);
|
||||||
|
}
|
||||||
|
10% {
|
||||||
|
opacity: 1;
|
||||||
|
transform: scale(1) rotate(0-@rotate);
|
||||||
|
}
|
||||||
|
15% {
|
||||||
|
opacity: 1;
|
||||||
|
transform: @scale rotate(0-@rotate);
|
||||||
|
}
|
||||||
|
40% {
|
||||||
|
opacity: 1;
|
||||||
|
transform: @scale rotate(0-@rotate);
|
||||||
|
}
|
||||||
|
100% {
|
||||||
|
transform: translateY(-12rem) scale(2) rotate(0-@rotate);
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@keyframes loveRight {
|
||||||
|
0% {
|
||||||
|
opacity: 0;
|
||||||
|
transform: @start-scale rotate(0+@rotate);
|
||||||
|
}
|
||||||
|
10% {
|
||||||
|
opacity: 1;
|
||||||
|
transform: scale(1) rotate(0+@rotate);
|
||||||
|
}
|
||||||
|
15% {
|
||||||
|
opacity: 1;
|
||||||
|
transform: @scale rotate(0+@rotate);
|
||||||
|
}
|
||||||
|
40% {
|
||||||
|
opacity: 1;
|
||||||
|
transform: @scale rotate(0+@rotate);
|
||||||
|
}
|
||||||
|
100% {
|
||||||
|
transform: translateY(-12rem) scale(2) rotate(0+@rotate);
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@ -51,7 +51,7 @@ export default {
|
|||||||
// },
|
// },
|
||||||
pause() {
|
pause() {
|
||||||
this.isStop = true
|
this.isStop = true
|
||||||
this.musicBg.css('webkitAnimationPlayState', 'paused')
|
this.musicBg.css('webkitAnimationPlayState', 'isZooming.value')
|
||||||
},
|
},
|
||||||
stop() {
|
stop() {
|
||||||
this.isStop = true
|
this.isStop = true
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="video-wrapper" ref="videoWrapper" :class="name">
|
<div class="video-wrapper" ref="videoWrapper" :class="name">
|
||||||
<Loading v-if="loading" style="position: absolute"/>
|
<Loading v-if="loading" style="position: absolute"/>
|
||||||
<!-- <video :src="video.video + '?v=123'"-->
|
<!-- <video :src="video.video + '?v=123'"-->
|
||||||
<video :src="video.video"
|
<video :src="video.video"
|
||||||
:poster="video.video + videoPoster"
|
:poster="video.video + videoPoster"
|
||||||
ref="video"
|
ref="video"
|
||||||
@ -13,70 +13,17 @@
|
|||||||
<img src="../../assets/img/icon/play-white.png" class="pause" v-if="paused">
|
<img src="../../assets/img/icon/play-white.png" class="pause" v-if="paused">
|
||||||
<div class="float" :style="{opacity: isUp?0:1}">
|
<div class="float" :style="{opacity: isUp?0:1}">
|
||||||
<div :style="{opacity:isMove ? 0:1}" class="normal">
|
<div :style="{opacity:isMove ? 0:1}" class="normal">
|
||||||
<div class="toolbar mb1r">
|
<ItemToolbar :item="video"
|
||||||
<div class="avatar-ctn mb4r">
|
:index="0"
|
||||||
<img class="avatar" :src="lVideo.author.avatar" alt=""
|
prefix="sadfa"
|
||||||
@click.stop="$emit('goUserInfo')">
|
|
||||||
<transition name="fade">
|
|
||||||
<div v-if="!isAttention" @click.stop="attention" class="options" ref="attention-option">
|
|
||||||
<img class="no" src="../../assets/img/icon/add-light.png" alt="">
|
|
||||||
<img class="yes" src="../../assets/img/icon/ok-red.png" alt="">
|
|
||||||
</div>
|
|
||||||
</transition>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<div class="love mb2r" @click.stop="loved($event)">
|
|
||||||
<div>
|
|
||||||
<img src="../../assets/img/icon/love.svg" class="love-image" v-if="!lVideo.isLoved">
|
|
||||||
<img src="../../assets/img/icon/loved.svg" class="love-image" v-if="lVideo.isLoved">
|
|
||||||
</div>
|
|
||||||
<span>{{ formatNumber(lVideo.digg_count) }}</span>
|
|
||||||
</div>
|
|
||||||
<div class="message mb2r" @click.stop="$emit('showComments')">
|
|
||||||
<!-- <div class="message mb15p" @click.stop="showComment">-->
|
|
||||||
<img src="../../assets/img/icon/message.svg" alt="" class="message-image">
|
|
||||||
<span>{{ formatNumber(lVideo.comment_count) }}</span>
|
|
||||||
</div>
|
|
||||||
<div v-if="!isMy" class="share mb4r" @click.stop="$emit('showShare')">
|
|
||||||
<img src="../../assets/img/icon/share-white-full.png" alt="" class="share-image">
|
|
||||||
<span>{{ formatNumber(lVideo.share_count) }}</span>
|
|
||||||
</div>
|
|
||||||
<div v-else class="share mb4r" @click.stop="$emit('showShare')">
|
|
||||||
<img src="../../assets/img/icon/share-white-full.png" alt="" class="share-image">
|
|
||||||
</div>
|
|
||||||
<BaseMusic
|
|
||||||
:cover="lVideo.music.cover"
|
|
||||||
:key="name"
|
|
||||||
:name="name"
|
|
||||||
:isPlay="isPlay"
|
|
||||||
@click.stop="$emit('goMusic')"
|
|
||||||
/>
|
/>
|
||||||
</div>
|
<ItemDesc
|
||||||
<div class="content ml1r mb1r" v-if="!isMy">
|
:item="video"
|
||||||
<div class="location-wrapper" v-if=" lVideo.city || lVideo.address">
|
:index="0"
|
||||||
<div class="location">
|
prefix="sadfa"
|
||||||
<img src="../../assets/img/icon/location.webp" alt="">
|
|
||||||
<span>{{ lVideo.city }}</span>
|
/>
|
||||||
<template v-if="lVideo.address && lVideo.address">
|
<div v-if="isMy" class="comment-status">
|
||||||
<div class="gang"></div>
|
|
||||||
</template>
|
|
||||||
<span>{{ lVideo.address }}</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="name mb1r fb" @click.stop="$emit('goUserInfo')">@{{ lVideo.author.nickname }}</div>
|
|
||||||
<div class="description mb1r">
|
|
||||||
{{ lVideo.desc }}
|
|
||||||
</div>
|
|
||||||
<div class="music" @click.stop="$nav('/music')">
|
|
||||||
<img src="../../assets/img/icon/music.svg" alt="" class="music-image">
|
|
||||||
<BaseMarquee :key="name"
|
|
||||||
:name="name"
|
|
||||||
:isPlay="isPlay"
|
|
||||||
:text="lVideo.music.title"
|
|
||||||
@click.stop="$emit('goMusic')"/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div v-else class="comment-status">
|
|
||||||
<div class="comment">
|
<div class="comment">
|
||||||
<div class="type-comment">
|
<div class="type-comment">
|
||||||
<img src="../../assets/img/icon/head-image.jpeg" alt="" class="avatar">
|
<img src="../../assets/img/icon/head-image.jpeg" alt="" class="avatar">
|
||||||
@ -98,36 +45,38 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="progress"
|
<div class="progress"
|
||||||
v-if="duration > 60"
|
|
||||||
:class="progressClass"
|
:class="progressClass"
|
||||||
@touchmove="move"
|
ref="progress"
|
||||||
@touchend="end"
|
@click="null"
|
||||||
|
@touchstart="touchstart"
|
||||||
|
@touchmove="touchmove"
|
||||||
|
@touchend="touchend"
|
||||||
>
|
>
|
||||||
<div class="time" v-if="isMove">
|
<div class="time" v-if="isMove">
|
||||||
<span class="currentTime">{{ $duration(currentTime) }}</span>
|
<span class="currentTime">{{ $duration(currentTime) }}</span>
|
||||||
<span class="duration"> / {{ $duration(duration) }}</span>
|
<span class="duration"> / {{ $duration(duration) }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="line" :style="durationStyle" ref="line"></div>
|
<div class="bg"></div>
|
||||||
<div class="point" :style="durationStyle" ref="point"></div>
|
<div class="progress-line" :style="durationStyle"></div>
|
||||||
|
<div class="point"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import globalMethods from '../../utils'
|
import Utils from '../../utils'
|
||||||
import BaseMarquee from "../BaseMarquee";
|
|
||||||
import Dom from "../../utils/dom";
|
import Dom from "../../utils/dom";
|
||||||
import BaseMusic from "../BaseMusic";
|
|
||||||
import {mapState} from "vuex";
|
|
||||||
import Loading from "../Loading";
|
import Loading from "../Loading";
|
||||||
|
import ItemToolbar from "./ItemToolbar";
|
||||||
|
import ItemDesc from "./ItemDesc";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "BVideo",
|
name: "BVideo",
|
||||||
components: {
|
components: {
|
||||||
BaseMarquee,
|
Loading,
|
||||||
BaseMusic,
|
ItemToolbar,
|
||||||
Loading
|
ItemDesc
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
video: {
|
video: {
|
||||||
@ -142,7 +91,7 @@ export default {
|
|||||||
return -1
|
return -1
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
prefix: {
|
tag: {
|
||||||
type: String,
|
type: String,
|
||||||
default: () => {
|
default: () => {
|
||||||
return ''
|
return ''
|
||||||
@ -170,11 +119,11 @@ export default {
|
|||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
durationStyle() {
|
durationStyle() {
|
||||||
return {left: this.pageX + 'px'}
|
return {width: this.pageX + 'px'}
|
||||||
},
|
},
|
||||||
progressClass() {
|
progressClass() {
|
||||||
if (this.isMove) {
|
if (this.isMove) {
|
||||||
return 'stop'
|
return 'move'
|
||||||
} else {
|
} else {
|
||||||
return this.isPlaying ? '' : 'stop'
|
return this.isPlaying ? '' : 'stop'
|
||||||
}
|
}
|
||||||
@ -184,22 +133,22 @@ export default {
|
|||||||
return {
|
return {
|
||||||
loading: false,
|
loading: false,
|
||||||
paused: false,
|
paused: false,
|
||||||
name: `v-${this.prefix}-${this.index}-video`,
|
name: `v-${this.tag}-item`,
|
||||||
globalMethods: globalMethods,
|
|
||||||
duration: 0,
|
duration: 0,
|
||||||
step: 0,
|
step: 0,
|
||||||
currentTime: -1,
|
currentTime: -1,
|
||||||
pageX: 0,
|
pageX: 0,
|
||||||
|
start: {x: 0},
|
||||||
|
last: {x: 0, time: 0},
|
||||||
height: 0,
|
height: 0,
|
||||||
width: 0,
|
width: 0,
|
||||||
isPlaying: this.isPlay,
|
isPlaying: this.isPlay,
|
||||||
isAttention: false,
|
isAttention: false,
|
||||||
line: null,
|
|
||||||
point: null,
|
|
||||||
isMove: false,
|
isMove: false,
|
||||||
isSingleClick: false,
|
isSingleClick: false,
|
||||||
test: [1, 2],
|
test: [1, 2],
|
||||||
lVideo: this.video,
|
lVideo: this.video,
|
||||||
|
progressBarRect: {},
|
||||||
|
|
||||||
videoScreenHeight: 0,
|
videoScreenHeight: 0,
|
||||||
videoPoster: `?vframe/jpg/offset/0/w/${document.body.clientWidth}`
|
videoPoster: `?vframe/jpg/offset/0/w/${document.body.clientWidth}`
|
||||||
@ -208,20 +157,19 @@ export default {
|
|||||||
mounted() {
|
mounted() {
|
||||||
this.height = document.body.clientHeight
|
this.height = document.body.clientHeight
|
||||||
this.width = document.body.clientWidth
|
this.width = document.body.clientWidth
|
||||||
this.line = this.$refs.line
|
|
||||||
this.point = this.$refs.point
|
|
||||||
let video = this.$refs.video
|
let video = this.$refs.video
|
||||||
video.currentTime = 0
|
video.currentTime = 0
|
||||||
let fun = e => {
|
let fun = e => {
|
||||||
this.currentTime = Math.ceil(e.target.currentTime)
|
this.currentTime = Math.ceil(e.target.currentTime)
|
||||||
this.pageX = this.currentTime * this.step
|
this.pageX = (this.currentTime - 1) * this.step
|
||||||
}
|
}
|
||||||
video.addEventListener('loadedmetadata', e => {
|
video.addEventListener('loadedmetadata', e => {
|
||||||
this.videoScreenHeight = video.videoHeight / (video.videoWidth / this.width)
|
this.videoScreenHeight = video.videoHeight / (video.videoWidth / this.width)
|
||||||
this.duration = video.duration
|
this.duration = video.duration
|
||||||
if (this.duration > 60) {
|
// if (this.duration > 60) {
|
||||||
// if (this.duration > 6) {
|
if (this.duration > 6) {
|
||||||
this.step = this.width / Math.floor(this.duration)
|
this.progressBarRect = this.$refs.progress.getBoundingClientRect()
|
||||||
|
this.step = this.progressBarRect.width / Math.floor(this.duration)
|
||||||
video.addEventListener('timeupdate', fun)
|
video.addEventListener('timeupdate', fun)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -311,10 +259,10 @@ export default {
|
|||||||
this.isPlaying = false
|
this.isPlaying = false
|
||||||
},
|
},
|
||||||
formatNumber(v) {
|
formatNumber(v) {
|
||||||
return globalMethods.formatNumber(v)
|
return Utils.formatNumber(v)
|
||||||
},
|
},
|
||||||
$duration(v) {
|
$duration(v) {
|
||||||
return globalMethods.$duration(v)
|
return Utils.$duration(v)
|
||||||
},
|
},
|
||||||
attention() {
|
attention() {
|
||||||
let option = this.$refs['attention-option']
|
let option = this.$refs['attention-option']
|
||||||
@ -327,28 +275,31 @@ export default {
|
|||||||
this.lVideo.isLoved = !this.lVideo.isLoved
|
this.lVideo.isLoved = !this.lVideo.isLoved
|
||||||
this.$emit('update:video', this.lVideo)
|
this.$emit('update:video', this.lVideo)
|
||||||
},
|
},
|
||||||
start(e) {
|
touchstart(e) {
|
||||||
this.pageX = e.touches[0].pageX
|
this.start.x = e.touches[0].pageX
|
||||||
|
this.last.x = this.pageX
|
||||||
|
this.last.time = this.currentTime
|
||||||
},
|
},
|
||||||
move(e) {
|
touchmove(e) {
|
||||||
// console.log('move',e)
|
// console.log('move',e)
|
||||||
// if (this.isPlaying) return
|
// if (this.isPlaying) return
|
||||||
this.isMove = true
|
this.isMove = true
|
||||||
this.pause()
|
this.pause()
|
||||||
this.pageX = e.touches[0].pageX
|
let dx = e.touches[0].pageX - this.start.x
|
||||||
// console.log(this.step)
|
this.pageX = this.last.x + dx
|
||||||
this.currentTime = Math.ceil(Math.ceil(e.touches[0].pageX) / this.step)
|
this.currentTime = this.last.time + Math.ceil(Math.ceil(dx) / this.step)
|
||||||
globalMethods.$stopPropagation(e)
|
if (this.currentTime <= 0) this.currentTime = 0
|
||||||
|
if (this.currentTime >= this.duration) this.currentTime = this.duration
|
||||||
|
Utils.$stopPropagation(e)
|
||||||
},
|
},
|
||||||
end(e) {
|
touchend(e) {
|
||||||
if (this.isPlaying) return
|
if (this.isPlaying) return
|
||||||
console.log('end', e)
|
// console.log('end', e)
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.isMove = false
|
this.isMove = false
|
||||||
}, 1000)
|
}, 1000)
|
||||||
this.currentTime = Math.ceil(Math.ceil(e.changedTouches[0].pageX) / this.step)
|
|
||||||
this.play()
|
this.play()
|
||||||
globalMethods.$stopPropagation(e)
|
Utils.$stopPropagation(e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -639,12 +590,16 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.progress {
|
.progress {
|
||||||
bottom: -1px;
|
z-index: 10;
|
||||||
|
@w: 90%;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
height: 7px;
|
bottom: -1rem;
|
||||||
width: 100vw;
|
height: 10rem;
|
||||||
background: black;
|
left: calc((100% - @w) / 2);
|
||||||
|
width: @w;
|
||||||
|
display: flex;
|
||||||
|
align-items: flex-end;
|
||||||
|
margin-bottom: 2rem;
|
||||||
|
|
||||||
.time {
|
.time {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
@ -661,53 +616,78 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&:before {
|
@radius: 10rem;
|
||||||
z-index: 9;
|
|
||||||
content: ' ';
|
@h: 1rem;
|
||||||
height: 1.5px;
|
@tr: height .3s;;
|
||||||
width: 100vw;
|
|
||||||
background: gray;
|
.bg {
|
||||||
|
transition: @tr;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 0;
|
width: 100%;
|
||||||
|
height: @h;
|
||||||
|
background: rgba(#000, .3);
|
||||||
|
border-radius: @radius;
|
||||||
}
|
}
|
||||||
|
|
||||||
.line {
|
@p: 50px;
|
||||||
z-index: 999;
|
|
||||||
content: '';
|
.progress-line {
|
||||||
position: absolute;
|
transition: @tr;
|
||||||
top: 0;
|
height: @h;
|
||||||
height: 1px;
|
width: @p;
|
||||||
width: 200vw;
|
border-radius: @radius 0 0 @radius;
|
||||||
transform: translate3d(-200vw, 0, 0);
|
background: rgba(#000, .8);
|
||||||
background: gray;
|
z-index: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
.point {
|
.point {
|
||||||
z-index: 10;
|
transition: all .2s;
|
||||||
position: absolute;
|
width: @h+2;
|
||||||
left: 10vw;
|
height: @h+2;
|
||||||
top: -1px;
|
|
||||||
height: 4px;
|
|
||||||
width: 4px;
|
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
background: gray;
|
background: gray;
|
||||||
|
z-index: 2;
|
||||||
|
transform: translate(-1rem, 1rem);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
& .move {
|
||||||
|
@h: 10rem;
|
||||||
|
|
||||||
|
.bg {
|
||||||
|
height: @h;
|
||||||
|
background: @active-main-bg;
|
||||||
|
}
|
||||||
|
|
||||||
|
.progress-line {
|
||||||
|
height: @h;
|
||||||
|
background: @second-text-color;
|
||||||
|
}
|
||||||
|
|
||||||
|
.point {
|
||||||
|
width: @h+2;
|
||||||
|
height: @h+2;
|
||||||
|
background: white;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
& .stop {
|
& .stop {
|
||||||
&:before {
|
@h: 4rem;
|
||||||
height: 3.5px;
|
|
||||||
|
.bg {
|
||||||
|
height: @h;
|
||||||
|
background: rgba(#000, .8);
|
||||||
}
|
}
|
||||||
|
|
||||||
.line {
|
.progress-line {
|
||||||
height: 3px;
|
height: @h;
|
||||||
background: white;
|
background: white;
|
||||||
}
|
}
|
||||||
|
|
||||||
.point {
|
.point {
|
||||||
top: -2px;
|
width: @h+2;
|
||||||
height: 8px;
|
height: @h+2;
|
||||||
width: 8px;
|
|
||||||
background: white;
|
background: white;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -99,7 +99,7 @@ function attention() {
|
|||||||
:cover="item.music.cover"
|
:cover="item.music.cover"
|
||||||
:key="state.name"
|
:key="state.name"
|
||||||
:name="state.name"
|
:name="state.name"
|
||||||
:isPlay="state.isPlay"
|
:isPlay="isPlay"
|
||||||
@click.stop="$emit('goMusic')"
|
@click.stop="$emit('goMusic')"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -468,6 +468,7 @@ function canNext(isNext, e) {
|
|||||||
@import "@/assets/less/index";
|
@import "@/assets/less/index";
|
||||||
|
|
||||||
#SlideAlbum {
|
#SlideAlbum {
|
||||||
|
transition: height .3s;
|
||||||
position: relative;
|
position: relative;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
|||||||
@ -292,69 +292,6 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.love-dbclick {
|
|
||||||
position: absolute;
|
|
||||||
@width: 8rem;
|
|
||||||
width: @width;
|
|
||||||
height: @width;
|
|
||||||
|
|
||||||
&.left {
|
|
||||||
animation: loveLeft 1.1s linear;
|
|
||||||
}
|
|
||||||
|
|
||||||
&.right {
|
|
||||||
animation: loveRight 1.1s linear;
|
|
||||||
}
|
|
||||||
|
|
||||||
@scale: scale(1.2);
|
|
||||||
@rotate: 10deg;
|
|
||||||
|
|
||||||
@keyframes loveLeft {
|
|
||||||
0% {
|
|
||||||
opacity: 0;
|
|
||||||
transform: scale(2) rotate(0-@rotate);
|
|
||||||
}
|
|
||||||
10% {
|
|
||||||
opacity: 1;
|
|
||||||
transform: scale(1) rotate(0-@rotate);
|
|
||||||
}
|
|
||||||
15% {
|
|
||||||
opacity: 1;
|
|
||||||
transform: @scale rotate(0-@rotate);
|
|
||||||
}
|
|
||||||
40% {
|
|
||||||
opacity: 1;
|
|
||||||
transform: @scale rotate(0-@rotate);
|
|
||||||
}
|
|
||||||
100% {
|
|
||||||
transform: translateY(-12rem) scale(2) rotate(0-@rotate);
|
|
||||||
opacity: 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@keyframes loveRight {
|
|
||||||
0% {
|
|
||||||
opacity: 0;
|
|
||||||
transform: scale(2) rotate(0+@rotate);
|
|
||||||
}
|
|
||||||
10% {
|
|
||||||
opacity: 1;
|
|
||||||
transform: scale(1) rotate(0+@rotate);
|
|
||||||
}
|
|
||||||
15% {
|
|
||||||
opacity: 1;
|
|
||||||
transform: @scale rotate(0+@rotate);
|
|
||||||
}
|
|
||||||
40% {
|
|
||||||
opacity: 1;
|
|
||||||
transform: @scale rotate(0+@rotate);
|
|
||||||
}
|
|
||||||
100% {
|
|
||||||
transform: translateY(-12rem) scale(2) rotate(0+@rotate);
|
|
||||||
opacity: 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.nav-one {
|
.nav-one {
|
||||||
height: 14rem;
|
height: 14rem;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
|
|||||||
@ -12,7 +12,7 @@ const props = defineProps({
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
prefix: {
|
tag: {
|
||||||
type: String,
|
type: String,
|
||||||
default: () => {
|
default: () => {
|
||||||
return ''
|
return ''
|
||||||
@ -106,11 +106,10 @@ function insertContent(list = props.list) {
|
|||||||
|
|
||||||
function getInsEl(item, index, play = false) {
|
function getInsEl(item, index, play = false) {
|
||||||
// console.log('index',index,play)
|
// console.log('index',index,play)
|
||||||
let slideVNode = props.render(item, index, play, props.prefix)
|
let slideVNode = props.render(item, index, play, props.tag)
|
||||||
const app = createApp({
|
const app = createApp({
|
||||||
render() {
|
render() {
|
||||||
return <SlideItem>{slideVNode}</SlideItem>
|
return <SlideItem>{slideVNode}</SlideItem>
|
||||||
// return slideVNode
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
const parent = document.createElement('div')
|
const parent = document.createElement('div')
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="test-slide-wrapper" id="slideHook">
|
<div class="test-slide-wrapper" id="slideHook" v-love="'slideHook'">
|
||||||
<H v-model:index="state.baseIndex">
|
<H v-model:index="state.baseIndex">
|
||||||
<SlideItem class=" gray">
|
<SlideItem class=" gray">
|
||||||
<H class="h" v-model:index="state.navIndex">
|
<H class="h" v-model:index="state.navIndex">
|
||||||
@ -20,10 +20,10 @@
|
|||||||
</SlideItem>
|
</SlideItem>
|
||||||
<SlideItem class="">
|
<SlideItem class="">
|
||||||
<VInfinite
|
<VInfinite
|
||||||
v-model:index="state.index"
|
v-model:index="state.itemIndex"
|
||||||
:render="render"
|
:render="render"
|
||||||
:list="state.recommendVideos"
|
:list="state.recommendVideos"
|
||||||
:prefix="state.videoPrefix[0]"
|
tag="0-5"
|
||||||
>
|
>
|
||||||
</VInfinite>
|
</VInfinite>
|
||||||
</SlideItem>
|
</SlideItem>
|
||||||
@ -58,22 +58,24 @@ import SlideImgs from "../../components/slide/SlideAlbum";
|
|||||||
import BVideo from "../../components/slide/BVideo";
|
import BVideo from "../../components/slide/BVideo";
|
||||||
|
|
||||||
import resource from "../../assets/data/resource.js";
|
import resource from "../../assets/data/resource.js";
|
||||||
import {reactive} from "vue";
|
import {onMounted, reactive} from "vue";
|
||||||
import enums from "../../utils/enums";
|
import enums from "../../utils/enums";
|
||||||
|
import bus from "../../utils/bus";
|
||||||
|
import Dom from "../../utils/dom";
|
||||||
|
|
||||||
const state = reactive({
|
const state = reactive({
|
||||||
baseIndex: 0,
|
baseIndex: 0,
|
||||||
navIndex: 5,
|
navIndex: 5,
|
||||||
index: 0,
|
itemIndex: 0,
|
||||||
recommendVideos: [
|
recommendVideos: [
|
||||||
// {
|
// {
|
||||||
// type: 'img',
|
// type: 'img',
|
||||||
// src: `http://douyin.ttentau.top/0.mp4?vframe/jpg/offset/0/w/${document.body.clientWidth}`
|
// src: `http://douyin.ttentau.top/0.mp4?vframe/jpg/offset/0/w/${document.body.clientWidth}`
|
||||||
// },
|
// },
|
||||||
{
|
// {
|
||||||
type: 'imgs',
|
// type: 'imgs',
|
||||||
src: `http://douyin.ttentau.top/0.mp4?vframe/jpg/offset/0/w/${document.body.clientWidth}`
|
// src: `http://douyin.ttentau.top/0.mp4?vframe/jpg/offset/0/w/${document.body.clientWidth}`
|
||||||
},
|
// },
|
||||||
{
|
{
|
||||||
type: 'recommend-video',
|
type: 'recommend-video',
|
||||||
"id": "034ae83b-ca0a-401a-b7c6-cf78361bae7b",
|
"id": "034ae83b-ca0a-401a-b7c6-cf78361bae7b",
|
||||||
@ -161,7 +163,6 @@ const state = reactive({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
videoPrefix: ['one', 'two', 'three'],
|
|
||||||
|
|
||||||
isCommenting: false,
|
isCommenting: false,
|
||||||
isSharing: false,
|
isSharing: false,
|
||||||
@ -181,7 +182,13 @@ const state = reactive({
|
|||||||
shareToFriend: false,
|
shareToFriend: false,
|
||||||
})
|
})
|
||||||
|
|
||||||
function render(item, itemIndex, play,prefix) {
|
onMounted(() => {
|
||||||
|
bus.on('singleClick', () => {
|
||||||
|
new Dom(`.v-${state.baseIndex}-${state.navIndex}-${state.itemIndex}-item`).trigger('singleClick')
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
function render(item, itemIndex, play, tag) {
|
||||||
let node
|
let node
|
||||||
if (item.type === 'img') {
|
if (item.type === 'img') {
|
||||||
node = <img src={item.src} style="height:100%;"/>
|
node = <img src={item.src} style="height:100%;"/>
|
||||||
@ -193,8 +200,7 @@ function render(item, itemIndex, play,prefix) {
|
|||||||
node = <BVideo
|
node = <BVideo
|
||||||
isPlay={play}
|
isPlay={play}
|
||||||
video={item}
|
video={item}
|
||||||
prefix={prefix}
|
tag={tag + '-' + itemIndex}
|
||||||
index={itemIndex}
|
|
||||||
onShowComments={e => state.isCommenting = true}
|
onShowComments={e => state.isCommenting = true}
|
||||||
onShowShare={e => state.isSharing = true}
|
onShowShare={e => state.isSharing = true}
|
||||||
onGoUserInfo={e => state.baseActiveIndex = 1}
|
onGoUserInfo={e => state.baseActiveIndex = 1}
|
||||||
|
|||||||
@ -400,69 +400,5 @@ if (import.meta.hot) {
|
|||||||
.content {
|
.content {
|
||||||
padding-top: 6rem;
|
padding-top: 6rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.love-dbclick {
|
|
||||||
position: absolute;
|
|
||||||
@width: 9rem;
|
|
||||||
width: @width;
|
|
||||||
height: @width;
|
|
||||||
|
|
||||||
&.left {
|
|
||||||
animation: loveLeft 1.1s linear;
|
|
||||||
}
|
|
||||||
|
|
||||||
&.right {
|
|
||||||
animation: loveRight 1.1s linear;
|
|
||||||
}
|
|
||||||
|
|
||||||
@scale: scale(1.2);
|
|
||||||
@rotate: 10deg;
|
|
||||||
|
|
||||||
@keyframes loveLeft {
|
|
||||||
0% {
|
|
||||||
opacity: 0;
|
|
||||||
transform: scale(2) rotate(0-@rotate);
|
|
||||||
}
|
|
||||||
10% {
|
|
||||||
opacity: 1;
|
|
||||||
transform: scale(1) rotate(0-@rotate);
|
|
||||||
}
|
|
||||||
15% {
|
|
||||||
opacity: 1;
|
|
||||||
transform: @scale rotate(0-@rotate);
|
|
||||||
}
|
|
||||||
40% {
|
|
||||||
opacity: 1;
|
|
||||||
transform: @scale rotate(0-@rotate);
|
|
||||||
}
|
|
||||||
100% {
|
|
||||||
transform: translateY(-12rem) scale(2) rotate(0-@rotate);
|
|
||||||
opacity: 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@keyframes loveRight {
|
|
||||||
0% {
|
|
||||||
opacity: 0;
|
|
||||||
transform: scale(2) rotate(0+@rotate);
|
|
||||||
}
|
|
||||||
10% {
|
|
||||||
opacity: 1;
|
|
||||||
transform: scale(1) rotate(0+@rotate);
|
|
||||||
}
|
|
||||||
15% {
|
|
||||||
opacity: 1;
|
|
||||||
transform: @scale rotate(0+@rotate);
|
|
||||||
}
|
|
||||||
40% {
|
|
||||||
opacity: 1;
|
|
||||||
transform: @scale rotate(0+@rotate);
|
|
||||||
}
|
|
||||||
100% {
|
|
||||||
transform: translateY(-12rem) scale(2) rotate(0+@rotate);
|
|
||||||
opacity: 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@ -331,7 +331,7 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
$duration(v) {
|
$duration(v) {
|
||||||
if (!v) return
|
if (!v) return '00:00'
|
||||||
let m = Math.floor(v / 60)
|
let m = Math.floor(v / 60)
|
||||||
// let s = v % 60
|
// let s = v % 60
|
||||||
let s = Math.round(v % 60)
|
let s = Math.round(v % 60)
|
||||||
|
|||||||
@ -16,6 +16,7 @@ import BaseButton from "../components/BaseButton";
|
|||||||
import CONST_VAR from "./const_var";
|
import CONST_VAR from "./const_var";
|
||||||
import Dom from "./dom";
|
import Dom from "./dom";
|
||||||
import bus from "./bus";
|
import bus from "./bus";
|
||||||
|
import {random} from "lodash";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
@ -118,59 +119,46 @@ export default {
|
|||||||
let clickTimer = null
|
let clickTimer = null
|
||||||
let dbClickTimer = null
|
let dbClickTimer = null
|
||||||
let lastClickTime = null
|
let lastClickTime = null
|
||||||
|
let checkTime = 200
|
||||||
|
let dbCheckCancelTime = 500
|
||||||
|
|
||||||
let dbClick = (e) => {
|
let dbClick = (e) => {
|
||||||
// console.log('dbClick')
|
// console.log('dbClick')
|
||||||
let id = 'a' + Date.now()
|
let id = 'a' + Date.now()
|
||||||
let elWidth = 80
|
let elWidth = 80
|
||||||
let rotate = randomNum(0, 1)
|
let rotate = random(1)
|
||||||
let template = `<img class="${rotate ? 'left love-dbclick' : 'right love-dbclick'}" id="${id}" src="${new URL('../assets/img/icon/loved.svg', import.meta.url).href}">`
|
let template = `<img class="${rotate ? 'left love-dbclick' : 'right love-dbclick'}" id="${id}" src="${new URL('../assets/img/icon/loved.svg', import.meta.url).href}">`
|
||||||
let el = new Dom().create(template)
|
let el = new Dom().create(template)
|
||||||
el.css({top: e.y - elWidth, left: e.x - elWidth / 2,})
|
el.css({top: e.y - elWidth - 40, left: e.x - elWidth / 2,})
|
||||||
new Dom(`#${binding.value}`).append(el)
|
new Dom(`#${binding.value}`).append(el)
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
new Dom(`#${id}`).remove()
|
new Dom(`#${id}`).remove()
|
||||||
}, 1000)
|
}, 1000)
|
||||||
}
|
}
|
||||||
let randomNum = (minNum, maxNum) => {
|
|
||||||
switch (arguments.length) {
|
|
||||||
case 1:
|
|
||||||
return parseInt(Math.random() * minNum + 1, 10);
|
|
||||||
case 2:
|
|
||||||
return parseInt(Math.random() * (maxNum - minNum + 1) + minNum, 10);
|
|
||||||
default:
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
let check = (e) => {
|
let check = (e) => {
|
||||||
let checkTime = 300
|
|
||||||
if (isDbClick) {
|
if (isDbClick) {
|
||||||
dbClick(e)
|
|
||||||
clearTimeout(dbClickTimer);
|
clearTimeout(dbClickTimer);
|
||||||
dbClickTimer = setTimeout(() => {
|
dbClick(e)
|
||||||
isDbClick = false
|
dbClickTimer = setTimeout(() => isDbClick = false, dbCheckCancelTime);
|
||||||
}, checkTime);
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
let nowTime = new Date().getTime();
|
let nowTime = new Date().getTime();
|
||||||
if (nowTime - lastClickTime < checkTime) {
|
if (nowTime - lastClickTime < checkTime) {
|
||||||
|
clearTimeout(clickTimer);
|
||||||
dbClick(e)
|
dbClick(e)
|
||||||
lastClickTime = 0;
|
|
||||||
clickTimer && clearTimeout(clickTimer);
|
|
||||||
isDbClick = true
|
isDbClick = true
|
||||||
dbClickTimer = setTimeout(() => {
|
dbClickTimer = setTimeout(() => isDbClick = false, dbCheckCancelTime);
|
||||||
isDbClick = false
|
|
||||||
}, checkTime);
|
|
||||||
} else {
|
} else {
|
||||||
lastClickTime = nowTime;
|
|
||||||
clickTimer = setTimeout(() => {
|
clickTimer = setTimeout(() => {
|
||||||
// console.log('单击')
|
console.log('单击')
|
||||||
bus.emit('singleClick')
|
bus.emit('singleClick')
|
||||||
}, checkTime);
|
}, checkTime);
|
||||||
}
|
}
|
||||||
|
lastClickTime = nowTime;
|
||||||
}
|
}
|
||||||
el.addEventListener('click', check)
|
el.addEventListener('click', check)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue
Block a user