diff --git a/package.json b/package.json index 5867aac..5034c80 100644 --- a/package.json +++ b/package.json @@ -130,7 +130,6 @@ "typescript": "~5.3.0", "vite": "^5.3.1", "vite-plugin-windicss": "^1.9.3", - "vue": "^3.4.30", "vue-tsc": "^1.8.25", "windicss": "^3.5.6" } diff --git a/src/renderer/src/AixPPTist/src/App.vue b/src/renderer/src/AixPPTist/src/App.vue index 2d58652..62045fc 100644 --- a/src/renderer/src/AixPPTist/src/App.vue +++ b/src/renderer/src/AixPPTist/src/App.vue @@ -26,6 +26,8 @@ import Mobile from './views/Mobile/index.vue' import msgUtils from '@/plugins/modal' // 消息工具 import * as API_entpcoursefile from '@/api/education/entpcoursefile' // 相关api import { PPTApi } from './api' +import { sessionStore } from '@/utils/store' // electron-store 状态管理 +import './api/watcher' // 监听 const loading = ref(true) const _isPC = isPC() @@ -68,19 +70,20 @@ interface Result { } // 获取参数 const initLoad: Function = () => { - const urlSearch = location.href.split('?')[1] - const query = Object.fromEntries(new URLSearchParams(urlSearch)) - const id: String = query.id - // 如果存在就获取pptx幻灯片内容 - if (!!id) return PPTApi.getSlideList(id) + // 获取缓存的ppt 资源数据 + const resource = sessionStore.get('curr.resource') + if (!!resource) { // 有ppt 资源数据缓存 + slidesStore.setTitle(resource.title) + if (!!resource.parentContent) { // 有全局配置项 + const opt = JSON.parse(resource.parentContent) + !!(opt.width??null) && slidesStore.setViewportSize(opt.width) // 有宽度配置项 + !!(opt.ratio??null) && slidesStore.setViewportRatio(opt.ratio)// 有比例配置项 + } + return PPTApi.getSlideList(resource.id) + } return Promise.resolve() } -// 监听幻灯片内容变化 -watch(() => slidesStore.slides, (newVal, oldVal) => { - // 更新幻灯片内容 - PPTApi.updateSlides(newVal, oldVal) -},{ deep: true })