From cce59229aa0a01a52359ada7d3297cfbf7c3c1be Mon Sep 17 00:00:00 2001 From: pipipi-pikachu <1171051090@qq.com> Date: Sat, 16 Jan 2021 16:45:06 +0800 Subject: [PATCH] =?UTF-8?q?UI=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/hooks/useScreening.ts | 22 ++++++++++++ src/mocks/index.ts | 18 ---------- src/plugins/iconPark.ts | 6 +++- src/views/Editor/EditorHeader/index.vue | 34 ++++++++++++------- src/views/Editor/Thumbnails/index.vue | 2 +- .../Editor/Toolbar/ElementAnimationPanel.vue | 10 +++--- src/views/Editor/useHotkey.ts | 8 ++--- src/views/Screen/index.vue | 9 +++-- 8 files changed, 63 insertions(+), 46 deletions(-) create mode 100644 src/hooks/useScreening.ts diff --git a/src/hooks/useScreening.ts b/src/hooks/useScreening.ts new file mode 100644 index 0000000..a8b2f6d --- /dev/null +++ b/src/hooks/useScreening.ts @@ -0,0 +1,22 @@ +import { useStore } from 'vuex' +import { State, MutationTypes } from '@/store' +import { enterFullscreen, exitFullscreen, isFullscreen } from '@/utils/fullscreen' + +export default () => { + const store = useStore() + + const enterScreening = () => { + enterFullscreen() + store.commit(MutationTypes.SET_SCREENING, true) + } + + const exitScreening = () => { + store.commit(MutationTypes.SET_SCREENING, false) + if(isFullscreen()) exitFullscreen() + } + + return { + enterScreening, + exitScreening, + } +} \ No newline at end of file diff --git a/src/mocks/index.ts b/src/mocks/index.ts index 09f98ca..af02eb5 100644 --- a/src/mocks/index.ts +++ b/src/mocks/index.ts @@ -4,24 +4,6 @@ export const slides: Slide[] = [ { id: 'xsxa123', elements: [ - { - id: 'sdasaxsxs', - type: 'chart', - left: 100, - top: 100, - width: 400, - height: 400, - chartType: 'pie', - data: { - labels: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri'], - series: [ - [5, 2, 4, 2, 10], - ], - }, - options: { - donut: true, - }, - }, { id: 'sdasaxs', type: 'chart', diff --git a/src/plugins/iconPark.ts b/src/plugins/iconPark.ts index 0468144..f27ef88 100644 --- a/src/plugins/iconPark.ts +++ b/src/plugins/iconPark.ts @@ -94,6 +94,8 @@ import { Platte, UpOne, DownOne, + SeoFolder, + CloseSmall, } from '@icon-park/vue-next' export default { @@ -169,7 +171,6 @@ export default { app.component('IconTextItalic', TextItalic) app.component('IconTextUnderline', TextUnderline) app.component('IconStrikethrough', Strikethrough) - app.component('IconEdit', Edit) app.component('IconQuote', Quote) app.component('IconList', List) app.component('IconOrderedList', OrderedList) @@ -188,6 +189,7 @@ export default { app.component('IconMinus', Minus) app.component('IconCheck', Check) app.component('IconClose', Close) + app.component('IconCloseSmall', CloseSmall) // 图表 app.component('IconChartRing', ChartRing) @@ -221,5 +223,7 @@ export default { app.component('IconNewlybuild', Newlybuild) app.component('IconEffects', Effects) app.component('IconRotate', Rotate) + app.component('IconEdit', Edit) + app.component('IconSeoFolder', SeoFolder) } } \ No newline at end of file diff --git a/src/views/Editor/EditorHeader/index.vue b/src/views/Editor/EditorHeader/index.vue index 63feade..e8bbb4f 100644 --- a/src/views/Editor/EditorHeader/index.vue +++ b/src/views/Editor/EditorHeader/index.vue @@ -1,26 +1,39 @@ @@ -42,10 +55,5 @@ export default defineComponent({ font-size: 13px; margin: 0 10px; cursor: pointer; - - &.icon { - font-size: 20px; - color: #666; - } } \ No newline at end of file diff --git a/src/views/Editor/Thumbnails/index.vue b/src/views/Editor/Thumbnails/index.vue index 3be21fb..61933c2 100644 --- a/src/views/Editor/Thumbnails/index.vue +++ b/src/views/Editor/Thumbnails/index.vue @@ -4,7 +4,7 @@ @mousedown="() => setThumbnailsFocus(true)" v-click-outside="() => setThumbnailsFocus(false)" > -
+ 添加幻灯片
+
添加幻灯片
- + @@ -48,7 +50,7 @@ - + @@ -230,13 +232,13 @@ export default defineComponent({ } .sequence-item { - height: 32px; + height: 36px; display: flex; align-items: center; border: 1px solid $borderColor; padding: 6px; border-radius: $borderRadius; - margin-bottom: 5px; + margin-bottom: 8px; &.active { border-color: $themeColor; diff --git a/src/views/Editor/useHotkey.ts b/src/views/Editor/useHotkey.ts index 905cc75..63a93d7 100644 --- a/src/views/Editor/useHotkey.ts +++ b/src/views/Editor/useHotkey.ts @@ -2,7 +2,6 @@ import { computed, onMounted, onUnmounted } from 'vue' import { useStore } from 'vuex' import { State, MutationTypes } from '@/store' import { KEYS } from '@/configs/hotkey' -import { enterFullscreen } from '@/utils/fullscreen' import useSlideHandler from '@/hooks/useSlideHandler' import useLockElement from '@/hooks/useLockElement' @@ -12,6 +11,7 @@ import useCopyAndPasteElement from '@/hooks/useCopyAndPasteElement' import useSelectAllElement from '@/hooks/useSelectAllElement' import useMoveElement from '@/hooks/useMoveElement' import useHistorySnapshot from '@/hooks/useHistorySnapshot' +import useScreening from '@/hooks/useScreening' export default () => { const store = useStore() @@ -39,6 +39,7 @@ export default () => { const { selectAllElement } = useSelectAllElement() const { moveElement } = useMoveElement() const { redo, undo } = useHistorySnapshot() + const { enterScreening } = useScreening() const copy = () => { if(activeElementIdList.value.length) copyElement() @@ -85,11 +86,6 @@ export default () => { createSlide() } - const enterScreening = () => { - enterFullscreen() - store.commit(MutationTypes.SET_SCREENING, true) - } - const keydownListener = (e: KeyboardEvent) => { const { ctrlKey, shiftKey } = e const key = e.key.toUpperCase() diff --git a/src/views/Screen/index.vue b/src/views/Screen/index.vue index c6e6a54..c025045 100644 --- a/src/views/Screen/index.vue +++ b/src/views/Screen/index.vue @@ -64,10 +64,11 @@ import { useStore } from 'vuex' import throttle from 'lodash/throttle' import { MutationTypes, State } from '@/store' import { Slide } from '@/types/slides' -import { exitFullscreen, isFullscreen } from '@/utils/fullscreen' import { VIEWPORT_ASPECT_RATIO, VIEWPORT_SIZE } from '@/configs/canvas' import { KEYS } from '@/configs/hotkey' import { ContextmenuItem } from '@/components/Contextmenu/types' +import { isFullscreen } from '@/utils/fullscreen' +import useScreening from '@/hooks/useScreening' import ScreenSlide from './ScreenSlide.vue' import SlideThumbnails from './SlideThumbnails.vue' @@ -116,9 +117,11 @@ export default defineComponent({ slideHeight.value = height } + const { exitScreening } = useScreening() + const windowResizeListener = () => { setSlideContentSize() - if(!isFullscreen()) store.commit(MutationTypes.SET_SCREENING, false) + if(!isFullscreen()) exitScreening() } const animationIndex = ref(0) @@ -212,7 +215,7 @@ export default defineComponent({ { text: '结束放映', subText: 'ESC', - handler: exitFullscreen, + handler: exitScreening, }, ] }