pdf展示
This commit is contained in:
parent
beca8c21b6
commit
1004567103
|
@ -3,6 +3,8 @@
|
|||
*/
|
||||
// const { ipcRenderer } = window.electron || {}
|
||||
// import { ipcRenderer } from 'electron' // 渲染器里面可以使用ipcRenderer
|
||||
|
||||
|
||||
// const path = require('path')
|
||||
const Remote = require('@electron/remote')
|
||||
|
||||
|
@ -61,6 +63,21 @@ export const createWindow = async (type, data) => {
|
|||
eventHandles(type, win) // 事件监听处理
|
||||
return win
|
||||
}
|
||||
case 'open-PDF': { //课本展示-pdf
|
||||
const option = data.option||{}
|
||||
const defOption = {
|
||||
frame: false, // 要创建无边框窗口
|
||||
resizable: true, // 禁止窗口大小缩放
|
||||
alwaysOnTop: false, // 窗口是否总是显示在其他窗口之前
|
||||
}
|
||||
data.option = {...defOption, ...option}
|
||||
const win = await toolWindow(data)
|
||||
|
||||
win.show()
|
||||
win.setFullScreen(true) // 设置窗口为全屏
|
||||
eventHandles(type, win) // 事件监听处理
|
||||
break
|
||||
}
|
||||
default:
|
||||
break
|
||||
}
|
||||
|
@ -140,6 +157,10 @@ const eventHandles = (type, win) => {
|
|||
}
|
||||
publicMethods(on) // 加载公共方法
|
||||
break}
|
||||
case 'open-PDF': {
|
||||
// 最小化窗口
|
||||
Remote.ipcMain.once('open-PDF:minimize', () => {win.minimize()})
|
||||
break}
|
||||
default:
|
||||
break
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
<i class="iconfont icon-xiayiye"></i>
|
||||
<span class="texts">下一页</span>
|
||||
</el-button>
|
||||
<el-button @click="minimize" >最小化</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
@ -35,7 +36,7 @@ import { ref, onMounted, watch, reactive } from 'vue'
|
|||
import * as pdfjsLib from 'pdfjs-dist/legacy/build/pdf'
|
||||
pdfjsLib.GlobalWorkerOptions.workerSrc = '/lib/build/pdf.worker.mjs'
|
||||
import pdfCanvas from '@/components/pdf/index.vue'
|
||||
|
||||
const { ipcRenderer } = require('electron')
|
||||
// 传过去的参数
|
||||
const pdfObj = reactive({
|
||||
numberOfPdf: 2, //显示几页
|
||||
|
@ -58,7 +59,10 @@ const navtopage = (type) => {
|
|||
if (pdfObj.numPages > numPagesTotal.value) return
|
||||
pdfCanvaslist.value.initPdf()
|
||||
}
|
||||
|
||||
// 最小化窗口
|
||||
const minimize = () => {
|
||||
ipcRenderer.send('open-PDF:minimize')
|
||||
}
|
||||
const handleUpdate = (data) => {
|
||||
numPagesTotal.value = data
|
||||
if (numPagesTotal.value == 1) {
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
</div>
|
||||
<div class="top-item">
|
||||
<el-button class="btn" @click="handleOutLink('standard')">课标研读</el-button>
|
||||
<el-button class="btn" >电子课本</el-button>
|
||||
<el-button class="btn" @click="navtoPdf">电子课本</el-button>
|
||||
<el-button class="btn" @click="handleOutLink('gk')">高考研读</el-button>
|
||||
<el-button class="btn" @click="handleOutLink('aiModel')">教学大模型</el-button>
|
||||
</div>
|
||||
|
@ -74,7 +74,7 @@ import { ElMessage } from 'element-plus'
|
|||
import { parseCataByNode, creatPPT, asyncLocalFile } from '@/utils/talkFile'
|
||||
import FileOperBatch from '@/views/prepare/container/file-oper-batch.vue'
|
||||
import outLink from '@/utils/linkConfig'
|
||||
|
||||
import { createWindow } from '@/utils/tool'
|
||||
const { ipcRenderer } = window.electron || {}
|
||||
|
||||
export default {
|
||||
|
@ -260,6 +260,11 @@ export default {
|
|||
cookieData: {...(configObj.data)}
|
||||
})
|
||||
},
|
||||
navtoPdf() {
|
||||
const params = { url: '/classBegins/index' }
|
||||
createWindow('open-PDF', params)
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
Loading…
Reference in New Issue