mirror of
https://github.com/the1812/Bilibili-Evolved.git
synced 2025-11-04 21:22:45 +08:00
102 lines
2.4 KiB
Vue
102 lines
2.4 KiB
Vue
<template>
|
|
<span title="稍后再看" class="watchlater be-outer-watchlater" :class="{ on }" @click="toggle()">
|
|
<VIcon class="icon" :size="28" icon="mdi-timetable"></VIcon>
|
|
<span class="text">稍后再看</span>
|
|
<div class="tip" :class="{ show: tipShowing }">{{ tipText }}</div>
|
|
</span>
|
|
</template>
|
|
|
|
<script lang="ts">
|
|
import { VIcon } from '@/ui'
|
|
import { watchlaterList, toggleWatchlater } from '@/components/video/watchlater'
|
|
|
|
export default Vue.extend({
|
|
components: {
|
|
VIcon,
|
|
},
|
|
data() {
|
|
return {
|
|
watchlaterList,
|
|
aid: unsafeWindow.aid,
|
|
tipText: '',
|
|
tipShowing: false,
|
|
tipHandle: 0,
|
|
}
|
|
},
|
|
computed: {
|
|
on() {
|
|
console.log(this.watchlaterList, this.aid, this.watchlaterList.includes(parseInt(this.aid)))
|
|
return this.watchlaterList.includes(parseInt(this.aid))
|
|
},
|
|
},
|
|
methods: {
|
|
showTip(text: string) {
|
|
this.tipText = text
|
|
this.tipShowing = true
|
|
if (this.tipHandle) {
|
|
clearTimeout(this.tipHandle)
|
|
}
|
|
this.tipHandle = setTimeout(() => {
|
|
this.tipShowing = false
|
|
}, 2000)
|
|
},
|
|
async toggle() {
|
|
await toggleWatchlater(this.aid)
|
|
this.showTip(this.on ? '已添加至稍后再看' : '已从稍后再看移除')
|
|
},
|
|
},
|
|
})
|
|
</script>
|
|
|
|
<style lang="scss">
|
|
.video-toolbar .ops,
|
|
.video-toolbar-v1 .toolbar-left {
|
|
.watchlater {
|
|
font-size: 14px;
|
|
font-weight: normal;
|
|
margin-right: 28px !important;
|
|
position: relative;
|
|
width: auto !important;
|
|
@media screen and (max-width: 1340px), (max-height: 750px) {
|
|
margin-right: max(calc(min(11vw, 11vh) - 117.2px), 6px) !important;
|
|
.text {
|
|
display: none;
|
|
}
|
|
}
|
|
.tip {
|
|
position: absolute;
|
|
top: calc(100% + 8px);
|
|
left: 50%;
|
|
transform: translateX(-50%);
|
|
z-index: 1000;
|
|
background: #000d;
|
|
padding: 4px 8px;
|
|
border-radius: 4px;
|
|
color: #eee;
|
|
transition: all 0.2s ease-out;
|
|
opacity: 0;
|
|
pointer-events: none;
|
|
&.show {
|
|
opacity: 1;
|
|
pointer-events: initial;
|
|
}
|
|
}
|
|
.be-icon {
|
|
display: inline-flex;
|
|
@media (min-width: 1681px) {
|
|
--size: 36px !important;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
.video-toolbar-v1 .watchlater .be-icon {
|
|
transform: translateY(1px);
|
|
}
|
|
.more-ops-list > ul,
|
|
.van-popover .more_dropdown {
|
|
> li:nth-child(2) {
|
|
display: none !important;
|
|
}
|
|
}
|
|
</style>
|