| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150 |
- <template>
- <div class="export-pptx-dialog">
- <div class="configs" :style="{ width: lang.lang === 'en' ? '475px' : '350px' }">
- <div class="row">
- <div class="title">{{ lang.ssExpRange }}</div>
- <RadioGroup
- class="config-item"
- v-model:value="rangeType"
- >
- <RadioButton style="width: 33.33%;" value="all">{{ lang.ssShowAll }}</RadioButton>
- <RadioButton style="width: 33.33%;" value="current">{{ lang.ssCurPage }}</RadioButton>
- <RadioButton style="width: 33.33%;" value="custom">{{ lang.ssCustom }}</RadioButton>
- </RadioGroup>
- </div>
- <div class="row" v-if="rangeType === 'custom'">
- <div class="title" :data-range="`(${range[0]} ~ ${range[1]})`">{{ lang.ssCustomRange }}</div>
- <Slider
- class="config-item"
- range
- :min="1"
- :max="slides.length"
- :step="1"
- v-model:value="range"
- />
- </div>
- <div class="row">
- <div class="title">{{ lang.ssIgnoreMedia }}</div>
- <div class="config-item">
- <Switch v-model:value="ignoreMedia" v-tooltip="lang.ssIgnoreMediaTip" />
- </div>
- </div>
- <div class="row">
- <div class="title">{{ lang.ssMastOver }}</div>
- <div class="config-item">
- <Switch v-model:value="masterOverwrite" />
- </div>
- </div>
- <div class="tip" v-if="!ignoreMedia">
- {{ lang.ssPptxTip }}
- </div>
- </div>
- <div class="btns">
- <Button class="btn export" type="primary" @click="exportPPTX(selectedSlides, masterOverwrite, ignoreMedia)">{{ lang.ssExportPptx }}</Button>
- <Button class="btn close" @click="emit('close')">{{ lang.ssClose }}</Button>
- </div>
- <FullscreenSpin :loading="exporting" :tip="lang.ssExporting" />
- </div>
- </template>
- <script lang="ts" setup>
- import { computed, ref } from 'vue'
- import { storeToRefs } from 'pinia'
- import { useSlidesStore } from '@/store'
- import useExport from '@/hooks/useExport'
- import { lang } from '@/main'
- import FullscreenSpin from '@/components/FullscreenSpin.vue'
- import Switch from '@/components/Switch.vue'
- import Slider from '@/components/Slider.vue'
- import Button from '@/components/Button.vue'
- import RadioButton from '@/components/RadioButton.vue'
- import RadioGroup from '@/components/RadioGroup.vue'
- const emit = defineEmits<{
- (event: 'close'): void
- }>()
- const { slides, currentSlide } = storeToRefs(useSlidesStore())
- const { exportPPTX, exporting } = useExport()
- const rangeType = ref<'all' | 'current' | 'custom'>('all')
- const range = ref<[number, number]>([1, slides.value.length])
- const masterOverwrite = ref(true)
- const ignoreMedia = ref(true)
- const selectedSlides = computed(() => {
- if (rangeType.value === 'all') return slides.value
- if (rangeType.value === 'current') return [currentSlide.value]
- return slides.value.filter((item, index) => {
- const [min, max] = range.value
- return index >= min - 1 && index <= max - 1
- })
- })
- </script>
- <style lang="scss" scoped>
- .export-pptx-dialog {
- height: 100%;
- display: flex;
- justify-content: center;
- align-items: center;
- flex-direction: column;
- position: relative;
- overflow: hidden;
- }
- .configs {
- width: 350px;
- height: calc(100% - 80px);
- display: flex;
- flex-direction: column;
- justify-content: center;
- .row {
- display: flex;
- justify-content: center;
- align-items: center;
- margin-bottom: 25px;
- }
- .title {
- width: 110px;
- position: relative;
- &::after {
- content: attr(data-range);
- position: absolute;
- top: 20px;
- left: 0;
- }
- }
- .config-item {
- flex: 1;
- }
- .tip {
- font-size: 12px;
- color: #aaa;
- line-height: 1.8;
- margin-top: 10px;
- }
- }
- .btns {
- width: 300px;
- height: 80px;
- display: flex;
- justify-content: center;
- align-items: center;
- .export {
- flex: 1;
- }
- .close {
- width: 100px;
- margin-left: 10px;
- }
- }
- </style>
|