perf: 播放器样式优化

This commit is contained in:
pipipi-pikachu 2021-02-06 22:38:18 +08:00
parent 3fae84609f
commit b101fd5113
3 changed files with 65 additions and 26 deletions

View File

@ -100,6 +100,7 @@ import {
Click, Click,
Theme, Theme,
Symbol, Symbol,
ArrowCircleLeft,
} from '@icon-park/vue-next' } from '@icon-park/vue-next'
export default { export default {
@ -233,5 +234,6 @@ export default {
app.component('IconTransform', Transform) app.component('IconTransform', Transform)
app.component('IconClick', Click) app.component('IconClick', Click)
app.component('IconTheme', Theme) app.component('IconTheme', Theme)
app.component('IconArrowCircleLeft', ArrowCircleLeft)
} }
} }

View File

@ -1,13 +1,18 @@
<template> <template>
<div class="slide-thumbnails"> <div class="slide-thumbnails">
<div <div class="return-button">
class="thumbnail" <IconArrowCircleLeft class="icon" @click="close()" />
:class="{ 'active': index === slideIndex }" </div>
v-for="(slide, index) in slides" <div class="slide-thumbnails-content">
:key="slide.id" <div
@click="turnSlideToIndex(index)" class="thumbnail"
> :class="{ 'active': index === slideIndex }"
<ThumbnailSlide :slide="slide" :size="150" /> v-for="(slide, index) in slides"
:key="slide.id"
@click="turnSlideToIndex(index)"
>
<ThumbnailSlide :slide="slide" :size="150" />
</div>
</div> </div>
</div> </div>
</template> </template>
@ -28,14 +33,17 @@ export default defineComponent({
type: Function as PropType<(index: number) => void>, type: Function as PropType<(index: number) => void>,
}, },
}, },
setup() { setup(props, { emit }) {
const store = useStore() const store = useStore()
const slides = computed(() => store.state.slides) const slides = computed(() => store.state.slides)
const slideIndex = computed(() => store.state.slideIndex) const slideIndex = computed(() => store.state.slideIndex)
const close = () => emit('close')
return { return {
slides, slides,
slideIndex, slideIndex,
close,
} }
}, },
}) })
@ -43,8 +51,31 @@ export default defineComponent({
<style lang="scss" scoped> <style lang="scss" scoped>
.slide-thumbnails { .slide-thumbnails {
height: 600px; width: 100%;
padding: 5px 10px; height: 100%;
position: fixed;
top: 0;
left: 0;
background-color: #1a1a1a;
z-index: 99;
}
.return-button {
height: 60px;
padding: 20px 30px 0;
.icon {
color: #fff;
font-size: 36px;
cursor: pointer;
&:hover {
color: $themeColor;
}
}
}
.slide-thumbnails-content {
height: calc(100% - 100px);
padding: 20px 30px 30px 30px;
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
align-content: flex-start; align-content: flex-start;
@ -52,15 +83,17 @@ export default defineComponent({
.thumbnail { .thumbnail {
width: 150px; width: 150px;
outline: 2px solid #aaa;
margin-right: 12px;
margin-bottom: 12px; margin-bottom: 12px;
outline: 1px solid rgba($color: $themeColor, $alpha: .1);
&.active { &:hover {
outline-color: $themeColor; outline-color: $themeColor;
} }
&:not(:nth-child(6n)) { &.active {
margin-right: 12px; outline-width: 3px;
outline-color: $themeColor;
} }
} }
} }

View File

@ -35,15 +35,11 @@
</div> </div>
</div> </div>
<Modal <SlideThumbnails
v-model:visible="slideThumbnailModelVisible" v-if="slideThumbnailModelVisible"
:footer="null" :turnSlideToIndex="turnSlideToIndex"
centered @close="slideThumbnailModelVisible = false"
:width="1020" />
:bodyStyle="{ padding: '50px 20px 20px 20px' }"
>
<SlideThumbnails :turnSlideToIndex="turnSlideToIndex" />
</Modal>
<div class="tools"> <div class="tools">
<IconLeftC class="tool-btn" @click="execPrev()" /> <IconLeftC class="tool-btn" @click="execPrev()" />
@ -207,15 +203,23 @@ export default defineComponent({
const contextmenus = (): ContextmenuItem[] => { const contextmenus = (): ContextmenuItem[] => {
return [ return [
{ {
text: '上一页', text: '上一张',
subText: '↑、←',
disable: slideIndex.value <= 0, disable: slideIndex.value <= 0,
handler: () => turnPrevSlide(), handler: () => turnPrevSlide(),
}, },
{ {
text: '下一页', text: '下一张',
subText: '↓、→',
disable: slideIndex.value >= slides.value.length - 1, disable: slideIndex.value >= slides.value.length - 1,
handler: () => turnNextSlide(), handler: () => turnNextSlide(),
}, },
{ divider: true },
{
text: '查看所有幻灯片',
handler: () => slideThumbnailModelVisible.value = true,
},
{ divider: true },
{ {
text: '结束放映', text: '结束放映',
subText: 'ESC', subText: 'ESC',