commit
09914eb8f9
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "aix-win",
|
"name": "aix-win",
|
||||||
"version": "2.1.21",
|
"version": "2.1.27",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "./out/main/index.js",
|
"main": "./out/main/index.js",
|
||||||
"author": "上海交大重庆人工智能研究院",
|
"author": "上海交大重庆人工智能研究院",
|
||||||
|
|
|
@ -175,6 +175,7 @@ async function createLinkWin(data) {
|
||||||
data.fullPath += '?urlSource=smarttalk&t' + Date.now()
|
data.fullPath += '?urlSource=smarttalk&t' + Date.now()
|
||||||
}
|
}
|
||||||
linkWin[data.key].loadURL(data.fullPath)
|
linkWin[data.key].loadURL(data.fullPath)
|
||||||
|
if (import.meta.env.VITE_SHOW_DEV_TOOLS === 'true') linkWin[data.key].webContents.openDevTools()
|
||||||
|
|
||||||
linkWin[data.key].once('ready-to-show', () => {
|
linkWin[data.key].once('ready-to-show', () => {
|
||||||
linkWin[data.key].show()
|
linkWin[data.key].show()
|
||||||
|
|
|
@ -60,7 +60,7 @@ function stateSyncWatch(storeName, newState) {
|
||||||
const diffData = findDifferences(oldState, newState)
|
const diffData = findDifferences(oldState, newState)
|
||||||
if(!_.keys(diffData).length) return // 没有变化就终止执行
|
if(!_.keys(diffData).length) return // 没有变化就终止执行
|
||||||
// 数据处理: 找出差异
|
// 数据处理: 找出差异
|
||||||
console.log('state-change-diffData', diffData, newState)
|
// console.log('state-change-diffData', diffData, newState)
|
||||||
try {
|
try {
|
||||||
let pinaValue = {} // store pina状态管理需要的数据格式
|
let pinaValue = {} // store pina状态管理需要的数据格式
|
||||||
// 数据转换处理
|
// 数据转换处理
|
||||||
|
|
|
@ -200,6 +200,25 @@ export const createWindow = async (type, data) => {
|
||||||
eventHandles(type, winChild) // 事件监听处理
|
eventHandles(type, winChild) // 事件监听处理
|
||||||
return winChild
|
return winChild
|
||||||
}
|
}
|
||||||
|
case 'open-win': { // 创建-新窗口
|
||||||
|
const option = data.option||{}
|
||||||
|
const defOption = {
|
||||||
|
show: false,
|
||||||
|
frame: true, // 无边框
|
||||||
|
autoHideMenuBar: true,
|
||||||
|
maximizable: false,
|
||||||
|
}
|
||||||
|
data.isConsole = true // 是否开启控制台
|
||||||
|
data.option = {...defOption, ...option}
|
||||||
|
const win = await toolWindow(type, data)
|
||||||
|
win.type = type // 唯一标识
|
||||||
|
win.show()
|
||||||
|
win.maximize();
|
||||||
|
// win.setFullScreen(true) // 设置窗口为全屏
|
||||||
|
if (import.meta.env.VITE_SHOW_DEV_TOOLS === 'true') win.webContents.openDevTools() // 打开调试工具
|
||||||
|
eventHandles(type, win) // 事件监听处理
|
||||||
|
break
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
@ -360,6 +379,18 @@ const eventHandles = (type, win) => {
|
||||||
publicMethods(on) // 加载公共方法
|
publicMethods(on) // 加载公共方法
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case 'open-win': { // 打开新窗口
|
||||||
|
// 监听窗口关闭事件
|
||||||
|
win.on('closed', function () {
|
||||||
|
win&&win.destroy()
|
||||||
|
});
|
||||||
|
const on = {
|
||||||
|
onClosed: () => {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
publicMethods(on) // 加载公共方法
|
||||||
|
break
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,9 +18,10 @@ const loadPdfAnimation = (path) => {
|
||||||
},2000)
|
},2000)
|
||||||
}
|
}
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
console.log('路由参数====',route);
|
const pdfUrl1 = localStorage.getItem('PDF-TOOL-PATH')
|
||||||
const { pdfUrl } = route.query
|
const pdfUrl2 = localStorage.getItem('PDF-LOCAL-PATH')
|
||||||
const bookpath = !!pdfUrl ? pdfUrl : localStorage.getItem('PDF-LOCAL-PATH')
|
console.log('tool-pdf 地址: ',pdfUrl1, pdfUrl2)
|
||||||
|
const bookpath = pdfUrl1 || pdfUrl2
|
||||||
// const filepath = import.meta.env.VITE_APP_RES_FILE_PATH + bookpath
|
// const filepath = import.meta.env.VITE_APP_RES_FILE_PATH + bookpath
|
||||||
// const isDev = process.env.NODE_ENV == 'development'
|
// const isDev = process.env.NODE_ENV == 'development'
|
||||||
// if (isDev)
|
// if (isDev)
|
||||||
|
|
|
@ -36,7 +36,7 @@
|
||||||
<el-scrollbar height="300px">
|
<el-scrollbar height="300px">
|
||||||
<div class="item-content-item" v-for="item in cData">
|
<div class="item-content-item" v-for="item in cData">
|
||||||
<el-tag effect="dark">{{ item.tag }}</el-tag>
|
<el-tag effect="dark">{{ item.tag }}</el-tag>
|
||||||
<span>{{ curNode.bookName }}</span>
|
<span>{{ item.name }}</span>
|
||||||
<el-button :color="item.color||'#349d44'" size="small" @click="openFile(item)">打开</el-button>
|
<el-button :color="item.color||'#349d44'" size="small" @click="openFile(item)">打开</el-button>
|
||||||
</div>
|
</div>
|
||||||
</el-scrollbar>
|
</el-scrollbar>
|
||||||
|
@ -55,7 +55,7 @@ import { computed, defineProps, ref, reactive, watchEffect, onMounted} from 'vue
|
||||||
import { sessionStore } from '@/utils/store'
|
import { sessionStore } from '@/utils/store'
|
||||||
import homework from './homework.vue';
|
import homework from './homework.vue';
|
||||||
import { ElMessage } from 'element-plus';
|
import { ElMessage } from 'element-plus';
|
||||||
import { toRoter } from '@/utils/tool' // 相关工具
|
import { toRoter, createWindow } from '@/utils/tool' // 相关工具
|
||||||
|
|
||||||
// 功能说明:侧边-工具栏
|
// 功能说明:侧边-工具栏
|
||||||
const colors = ['#409EFF','#00f389', '#ff7f00', '#ffff00', '#00baff', '#13b189', '#F56C6C']
|
const colors = ['#409EFF','#00f389', '#ff7f00', '#ffff00', '#00baff', '#13b189', '#F56C6C']
|
||||||
|
@ -112,9 +112,9 @@ const getStyle = (style,index) => {
|
||||||
// 获取内容数据
|
// 获取内容数据
|
||||||
const getContent = o => {
|
const getContent = o => {
|
||||||
loading.value = true
|
loading.value = true
|
||||||
const { bookName } = curNode
|
const { roottitle, edustage, edusubject } = curNode
|
||||||
const textbook = { type: 'book', tag: '教材', name: bookName }
|
const textbook = { type: 'book', tag: '教材', name: roottitle }
|
||||||
const course = { type: 'course', tag: '课标', name: bookName }
|
const course = { type: 'course', tag: '课标', name: `${edustage}-${edusubject}-课标` }
|
||||||
cData.value = [textbook, course]
|
cData.value = [textbook, course]
|
||||||
loading.value = false
|
loading.value = false
|
||||||
}
|
}
|
||||||
|
@ -145,8 +145,14 @@ const openFile = item => {
|
||||||
if (item.type == 'book') path = (textBook.curBookPath||'').replace('.txt', '.pdf')
|
if (item.type == 'book') path = (textBook.curBookPath||'').replace('.txt', '.pdf')
|
||||||
else path = textBook.curBookPath.replace(/([^-]*)$/, '课标.pdf')
|
else path = textBook.curBookPath.replace(/([^-]*)$/, '课标.pdf')
|
||||||
const url = pdfBasePath + encodeURIComponent(`${fileBasePath}${path}`)
|
const url = pdfBasePath + encodeURIComponent(`${fileBasePath}${path}`)
|
||||||
|
console.log(url)
|
||||||
|
localStorage.setItem('PDF-TOOL-PATH', url)
|
||||||
// 打开新窗口
|
// 打开新窗口
|
||||||
toRoter(`${process.env['ELECTRON_RENDERER_URL']}/#/fullscreenpdf?pdfUrl=${url}`)
|
// toRoter(`${process.env['ELECTRON_RENDERER_URL']}/#/fullscreenpdf`)
|
||||||
|
console.log('pdf_old:' + localStorage.getItem('PDF-LOCAL-PATH'))
|
||||||
|
console.log('pdf_new:' + localStorage.getItem('PDF-TOOL-PATH'))
|
||||||
|
// emit('change', { prop: 'bookOpen' })
|
||||||
|
createWindow('open-win', {url: '/fullscreenpdf'})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 回调: 关闭事件
|
// 回调: 关闭事件
|
||||||
|
|
|
@ -207,6 +207,16 @@ const sideMouse = e => {
|
||||||
const sideChange = async o => {
|
const sideChange = async o => {
|
||||||
// console.log(o)
|
// console.log(o)
|
||||||
switch(o.prop) {
|
switch(o.prop) {
|
||||||
|
case 'bookOpen':
|
||||||
|
if(isOpenBook.value) {
|
||||||
|
isOpenBook.value = false
|
||||||
|
ElMessage.info('已经打开课本了哦')
|
||||||
|
}else {
|
||||||
|
// createWindow('fullScreen-PDF',{url: '/fullscreenpdf'})
|
||||||
|
toRoter(`${process.env['ELECTRON_RENDERER_URL']}/#/fullscreenpdf`)
|
||||||
|
isOpenBook.value = true
|
||||||
|
}
|
||||||
|
break
|
||||||
case 'book':
|
case 'book':
|
||||||
isMask.value = !isMask.value
|
isMask.value = !isMask.value
|
||||||
break
|
break
|
||||||
|
|
Loading…
Reference in New Issue