修复pptx
This commit is contained in:
parent
a10d3b078b
commit
c555de5fe5
|
@ -26,6 +26,7 @@ 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 状态管理
|
||||
|
||||
const loading = ref(true)
|
||||
const _isPC = isPC()
|
||||
|
@ -68,11 +69,17 @@ 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)
|
||||
// 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)
|
||||
// 缓存当前资源信息
|
||||
const resource = sessionStore.get('curr.resource')
|
||||
if (!!resource) { // 有ppt 资源数据缓存
|
||||
slidesStore.setTitle(resource.title)
|
||||
return PPTApi.getSlideList(resource.id)
|
||||
}
|
||||
return Promise.resolve()
|
||||
}
|
||||
|
||||
|
|
|
@ -216,7 +216,11 @@ export const createWindow = async (type, data) => {
|
|||
win.maximize();
|
||||
// win.setFullScreen(true) // 设置窗口为全屏
|
||||
if (import.meta.env.VITE_SHOW_DEV_TOOLS === 'true') win.webContents.openDevTools() // 打开调试工具
|
||||
eventHandles(type, win) // 事件监听处理
|
||||
let events = {} // 事件处理函数对象
|
||||
Object.keys(data)
|
||||
.filter(k => typeof data[k] === 'function')
|
||||
.forEach(k => events[k] = data[k])
|
||||
eventHandles(type, win, events) // 事件监听处理
|
||||
break
|
||||
}
|
||||
default:
|
||||
|
@ -286,17 +290,20 @@ export function toolWindow(type, {url, isConsole, isWeb=true, option={}}) {
|
|||
* 窗口创建-事件处理
|
||||
* @param {*} type 事件类型
|
||||
* @param {*} win 窗口对象
|
||||
* @param {*} events 事件对象
|
||||
*/
|
||||
const eventHandles = (type, win) => {
|
||||
const eventHandles = (type, win, events) => {
|
||||
const toolState = useToolState() // 获取store状态
|
||||
const winAll = Remote.BrowserWindow.getAllWindows()
|
||||
const mainWin = winAll.find(o => o.type == 'main') // 主窗口对象
|
||||
// 公共方法
|
||||
const publicMethods = ({onClosed}={}) => {
|
||||
const publicMethods = ({onClosed, closed, close}={}) => {
|
||||
// 监听主窗口-关闭事件
|
||||
mainWin.once('close', () => {winPdf=null;win.destroy();})
|
||||
win.on('closed', () => {
|
||||
if(onClosed) onClosed() // 自定义关闭事件
|
||||
if(!!onClosed) onClosed() // 自定义关闭事件
|
||||
if(!!closed) closed() // 自定义关闭事件
|
||||
if(!!close) close() // 自定义关闭事件
|
||||
win = null
|
||||
wins_tool = null
|
||||
winChild=null
|
||||
|
@ -385,8 +392,7 @@ const eventHandles = (type, win) => {
|
|||
win&&win.destroy()
|
||||
});
|
||||
const on = {
|
||||
onClosed: () => {
|
||||
}
|
||||
...events
|
||||
}
|
||||
publicMethods(on) // 加载公共方法
|
||||
break
|
||||
|
|
|
@ -255,13 +255,14 @@ const handleAll = async(type, row) =>{
|
|||
break;
|
||||
}
|
||||
case 'open': { // 打开资源-pptist
|
||||
// console.log(row)
|
||||
if (row.filetype != 'aptist') return msgUtils.msgWarning('暂不支持该类型文件!')
|
||||
sessionStore.set('curr.resource', row) // 缓存当前资源信息
|
||||
const query = { id: row.id }
|
||||
const queryUrl = new URLSearchParams(query).toString()
|
||||
console.log('打开资源 ', queryUrl)
|
||||
createWindow('open-win', { url: `/pptist?${queryUrl}` })
|
||||
// 缓存当前资源信息
|
||||
sessionStore.set('curr.resource', row)
|
||||
createWindow('open-win', {
|
||||
url: '/pptist',
|
||||
// 窗口关闭时,清除缓存
|
||||
close: () => {sessionStore.set('curr.resource', null)}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue