zdg #72

Merged
zhangxuelin merged 21 commits from zdg into main 2024-07-26 14:39:20 +08:00
3 changed files with 34 additions and 4 deletions
Showing only changes of commit 1004567103 - Show all commits

View File

@ -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
}

View File

@ -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) {

View File

@ -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>