Compare commits
No commits in common. "d30b4a230ad6b191bbf843d8c6f0ffb35a3710d4" and "04a03b0c433b881400425c9a97f010341befa4a0" have entirely different histories.
d30b4a230a
...
04a03b0c43
|
@ -100,17 +100,12 @@ const renderPage = async (canvasobj) => {
|
|||
})
|
||||
}
|
||||
// 保存数据
|
||||
const savaDataStore = (type) => {
|
||||
const savaDataStore = () => {
|
||||
if(!toolState.isToolWin){
|
||||
toolState.isPdfWin=false
|
||||
toolState.showBoardAll=true //恢复默认值
|
||||
if(type=='rest'){
|
||||
ipcRenderer.invoke('tool-sphere:reset') //重置tool状态
|
||||
ipcRenderer.send('open-PDF:close')
|
||||
}else{
|
||||
ipcRenderer.invoke('open-PDF:minimize')
|
||||
}
|
||||
|
||||
ipcRenderer.invoke('tool-sphere:reset') //重置tool状态
|
||||
ipcRenderer.send('open-PDF:minimize')
|
||||
return
|
||||
}
|
||||
imgarr.value.forEach((a) => {
|
||||
|
@ -144,15 +139,8 @@ const savaDataStore = (type) => {
|
|||
Promise.all(promises).then(res=>{
|
||||
toolState.isPdfWin=false
|
||||
toolState.showBoardAll=true //恢复默认值
|
||||
// ipcRenderer.send('open-PDF:minimize')
|
||||
if(type=='rest'){
|
||||
ipcRenderer.invoke('tool-sphere:reset') //重置tool状态
|
||||
ipcRenderer.send('open-PDF:close')
|
||||
}else{
|
||||
ipcRenderer.send('open-PDF:minimize')
|
||||
}
|
||||
// ipcRenderer.send('open-PDF:close')
|
||||
|
||||
ipcRenderer.invoke('tool-sphere:reset') //重置tool状态
|
||||
ipcRenderer.send('open-PDF:minimize')
|
||||
})
|
||||
}
|
||||
const updatePage = (canvasobj) => {
|
||||
|
|
|
@ -115,16 +115,6 @@ export const createWindow = async (type, data) => {
|
|||
return wins_tool
|
||||
}
|
||||
case 'open-PDF': { //课本展示-pdf
|
||||
if(winPdf){ //判断是否已经打开
|
||||
if (winPdf.isMinimized()){
|
||||
winPdf.restore();
|
||||
} else{
|
||||
winPdf.focus();
|
||||
toolState.isPdfWin=true
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
const option = data.option||{}
|
||||
const defOption = {
|
||||
frame: false, // 要创建无边框窗口
|
||||
|
@ -133,6 +123,12 @@ export const createWindow = async (type, data) => {
|
|||
}
|
||||
data.isConsole = true // 是否开启控制台
|
||||
data.option = {...defOption, ...option}
|
||||
if(winPdf){ //判断是否已经打开
|
||||
// if (winPdf.isMinimized()) winPdf.restore();
|
||||
winPdf.focus();
|
||||
// toolState.isPdfWin=true
|
||||
return
|
||||
}
|
||||
const win = await toolWindow(data)
|
||||
win.type = type // 唯一标识
|
||||
win.show()
|
||||
|
@ -244,22 +240,12 @@ const eventHandles = (type, win) => {
|
|||
break}
|
||||
case 'open-PDF': {
|
||||
// 最小化窗口 minimize()
|
||||
Remote.ipcMain.handle('open-PDF:minimize', () => {
|
||||
// winPdf=null
|
||||
// win&&win.destroy()
|
||||
win&&win.minimize(); //缩小功能
|
||||
})
|
||||
// 关闭窗口
|
||||
Remote.ipcMain.once('open-PDF:close', () => {
|
||||
Remote.ipcMain.once('open-PDF:minimize', () => {
|
||||
winPdf=null
|
||||
win&&win.destroy()
|
||||
// win&&win.minimize(); //缩小功能
|
||||
})
|
||||
const on = {
|
||||
onClosed: () => {
|
||||
Remote.ipcMain.removeHandler('open-PDF:minimize')
|
||||
}
|
||||
}
|
||||
publicMethods(on) // 加载公共方法
|
||||
publicMethods() // 加载公共方法
|
||||
break}
|
||||
default:
|
||||
break
|
||||
|
|
|
@ -26,10 +26,7 @@
|
|||
<i class="iconfont icon-xiayiye"></i>
|
||||
<span class="texts">下一页</span>
|
||||
</el-button>
|
||||
</div>
|
||||
<div class="pdf-btn-right">
|
||||
<el-button @click="minimize" >最小化</el-button>
|
||||
<el-button @click="minimize('rest')" >关闭</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
@ -75,10 +72,9 @@ const navtopage = (type) => {
|
|||
pdfCanvaslist.value.initPdf('rest')
|
||||
}
|
||||
// 关闭窗口
|
||||
const minimize = async (type='minimize') => {
|
||||
await pdfCanvaslist.value.savaDataStore(type)
|
||||
const minimize = async () => {
|
||||
await pdfCanvaslist.value.savaDataStore()
|
||||
}
|
||||
|
||||
const handleUpdate = (data) => {
|
||||
numPagesTotal.value = data
|
||||
if (numPagesTotal.value == 1) {
|
||||
|
@ -105,8 +101,8 @@ const switchPageMode = () => {
|
|||
}
|
||||
onMounted(async () => {
|
||||
toolState.isPdfWin=true //设置打开pdf窗口
|
||||
// pdfObj.pdfUrl = getStaticUrl(route.query.path, 'user', 'selfFile', true) //线上
|
||||
pdfObj.pdfUrl = getStaticUrl('aaa.pdf', 'user', 'selfFile', true) //本地
|
||||
pdfObj.pdfUrl = getStaticUrl(route.query.path, 'user', 'selfFile', true) //线上
|
||||
// pdfObj.pdfUrl = getStaticUrl('aaa.pdf', 'user', 'selfFile', true) //本地
|
||||
textbookId.value = route.query.textbookId
|
||||
pdfObj.bookId=textbookId.value
|
||||
//初始化获取接口数据
|
||||
|
@ -142,8 +138,7 @@ const getUniqueArrayByLastOccurrence=(array)=> {
|
|||
flex-wrap: wrap;
|
||||
.pdf-btn {
|
||||
position: absolute;
|
||||
// right: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.5);
|
||||
border-radius: 5px 0 0 0;
|
||||
|
@ -168,28 +163,5 @@ const getUniqueArrayByLastOccurrence=(array)=> {
|
|||
}
|
||||
}
|
||||
}
|
||||
.pdf-btn-right{
|
||||
position: absolute;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.5);
|
||||
border-radius: 5px 0 0 0;
|
||||
button {
|
||||
margin-left: 0;
|
||||
border: none;
|
||||
font-size: 16px;
|
||||
// padding: 4px 7px;
|
||||
border-radius: 0;
|
||||
width: 80px;
|
||||
height: 70px;
|
||||
:deep(> span) {
|
||||
display: block !important;
|
||||
}
|
||||
.iconfont {
|
||||
font-size: 26px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -493,7 +493,7 @@ export default {
|
|||
|
||||
// 打开PDF-课件
|
||||
async navtoPdf() {
|
||||
// if (toolStore.isPdfWin) return this.$message.error('您当前已打开课本,请勿重复操作')
|
||||
if (toolStore.isPdfWin) return this.$message.error('您当前已打开课本,请勿重复操作')
|
||||
let path = await this.getBookPathFromServer()
|
||||
createWindow('open-PDF', {
|
||||
url: '/classBegins/index?textbookId=' + this.uploadData.textbookId + '&path=' + path
|
||||
|
|
Loading…
Reference in New Issue