123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168 |
- <template>
- <div class="editor-header">
- <div class="left">
- <Popover trigger="click" placement="bottom-start" v-model:value="mainMenuVisible">
- <template #content>
- <FileInput
- accept="application/vnd.openxmlformats-officedocument.presentationml.presentation"
- @change="
- files => {
- importPPTXFile(files)
- mainMenuVisible = false
- }
- "
- >
- <PopoverMenuItem>导入pptx</PopoverMenuItem>
- </FileInput>
- <PopoverMenuItem @click="setDialogForExport('pptx')">导出pptx</PopoverMenuItem>
- <PopoverMenuItem
- @click="
- () => {
- resetSlides()
- mainMenuVisible = false
- }
- "
- >重置幻灯片</PopoverMenuItem
- >
- <PopoverMenuItem
- @click="
- () => {
- mainMenuVisible = false
- hotkeyDrawerVisible = true
- }
- "
- >快捷操作</PopoverMenuItem
- >
- </template>
- <div class="menuCon" :class="{ menuVisible: mainMenuVisible }">
- <img class="icon" src="./imgs/file.png" />
- </div>
- </Popover>
- <div class="line"></div>
- <div class="title">
- <div class="title-text">{{ title }}</div>
- </div>
- </div>
- <div class="right">
- <div class="cancelBtn">取消</div>
- <div class="saveBtn">保存课件</div>
- </div>
- <Drawer :width="320" v-model:visible="hotkeyDrawerVisible" placement="right">
- <HotkeyDoc />
- <template v-slot:title>快捷操作</template>
- </Drawer>
- <FullscreenSpin :loading="exporting" tip="正在导入..." />
- </div>
- </template>
- <script lang="ts" setup>
- import { storeToRefs } from "pinia"
- import { useMainStore, useSlidesStore } from "@/store"
- import useImport from "@/hooks/useImport"
- import useSlideHandler from "@/hooks/useSlideHandler"
- import type { DialogForExportTypes } from "@/types/export"
- import HotkeyDoc from "./HotkeyDoc.vue"
- import FileInput from "@/components/FileInput.vue"
- import FullscreenSpin from "@/components/FullscreenSpin.vue"
- import Drawer from "@/components/Drawer.vue"
- import Popover from "@/components/Popover.vue"
- import PopoverMenuItem from "@/components/PopoverMenuItem.vue"
- import { ref } from "vue"
- const mainStore = useMainStore()
- const slidesStore = useSlidesStore()
- const { title } = storeToRefs(slidesStore)
- const { importPPTXFile, exporting } = useImport()
- const { resetSlides } = useSlideHandler()
- const mainMenuVisible = ref(false)
- const hotkeyDrawerVisible = ref(false)
- /* 导出老逻辑 */
- const setDialogForExport = (type: DialogForExportTypes) => {
- mainStore.setDialogForExport(type)
- mainMenuVisible.value = false
- }
- </script>
- <style lang="scss" scoped>
- .editor-header {
- background-color: #fff;
- user-select: none;
- border-bottom: 1px solid #dedede;
- display: flex;
- justify-content: space-between;
- padding: 0 24px;
- }
- .left,
- .right {
- display: flex;
- justify-content: center;
- align-items: center;
- }
- .menuCon {
- display: flex;
- justify-content: center;
- align-items: center;
- cursor: pointer;
- margin-right: 8px;
- width: 34px;
- height: 34px;
- border-radius: 6px;
- margin-left: -8px;
- &.menuVisible {
- background: rgba(34, 71, 133, 0.08);
- }
- & > img {
- width: 20px;
- height: 20px;
- }
- }
- .line {
- width: 1px;
- height: calc(100% - 26px);
- background-color: #dedede;
- }
- .title {
- margin-left: 16px;
- .title-text {
- font-weight: 600;
- font-size: 15px;
- color: #131415;
- }
- }
- .cancelBtn {
- width: 88px;
- height: 32px;
- background: #f1f2f6;
- border-radius: 6px;
- line-height: 32px;
- font-weight: 600;
- font-size: 14px;
- color: #1e2022;
- text-align: center;
- cursor: pointer;
- &:hover {
- opacity: 0.8;
- }
- }
- .saveBtn {
- margin-left: 16px;
- width: 88px;
- height: 32px;
- background: linear-gradient(312deg, #1b7af8 0%, #3cbbff 100%);
- border-radius: 6px;
- line-height: 32px;
- font-weight: 600;
- font-size: 14px;
- color: #ffffff;
- text-align: center;
- cursor: pointer;
- &:hover {
- opacity: 0.8;
- }
- }
- </style>
|