diff --git a/package.json b/package.json
index 99c4ada..c92e305 100644
--- a/package.json
+++ b/package.json
@@ -28,6 +28,7 @@
"element-plus": "^2.7.6",
"js-cookie": "^3.0.5",
"jsencrypt": "^3.3.2",
+ "lodash": "^4.17.21",
"pinia": "^2.1.7",
"pinia-plugin-persistedstate": "^3.2.1",
"spark-md5": "^3.0.2",
diff --git a/src/main/index.js b/src/main/index.js
index 56a0833..92cbb87 100644
--- a/src/main/index.js
+++ b/src/main/index.js
@@ -4,8 +4,10 @@ import { electronApp, optimizer, is } from '@electron-toolkit/utils'
import icon from '../../resources/icon.png?asset'
import File from './file'
-File({ app, shell, BrowserWindow, ipcMain })
+// const handleUpdate = require("./handleUpdate");
+File({ app, shell, BrowserWindow, ipcMain })
+process.env['ELECTRON_DISABLE_SECURITY_WARNINGS'] = 'true'
let mainWindow, loginWindow
//登录窗口
@@ -24,9 +26,13 @@ function createLoginWindow() {
nodeIntegration: true
}
})
- const loginURL = is.dev ? `http://localhost:5173/#/login` : `file://${__dirname}/index.html/login`
+ // handleUpdate(loginWindow,ipcMain)
+ const loginURL = is.dev ? `http://localhost:5173/#/login` : join(__dirname, '../renderer/index.html')
loginWindow.loadURL(loginURL)
+
+
+ loginWindow.webContents.openDevTools()
loginWindow.once('ready-to-show', () => {
loginWindow.show()
})
@@ -41,7 +47,7 @@ function createMainWindow() {
width: 1200,
height: 700,
show: false,
- frame: false,// 无边框
+ frame: false, // 无边框
autoHideMenuBar: true,
...(process.platform === 'linux' ? { icon } : {}),
webPreferences: {
@@ -61,17 +67,18 @@ function createMainWindow() {
mainWindow.webContents.openDevTools()
if (is.dev && process.env['ELECTRON_RENDERER_URL']) {
- mainWindow.loadURL(process.env['ELECTRON_RENDERER_URL'])
+ mainWindow.loadURL(process.env['ELECTRON_RENDERER_URL'] )
} else {
mainWindow.loadFile(join(__dirname, '../renderer/index.html'))
}
}
+
// 作业窗口相关-开发中
-let openWindow
-function createOpenWin(data) {
- if (openWindow) return
- openWindow = new BrowserWindow({
+let linkWindow
+async function createLinkWin(data) {
+ if (linkWindow) return
+ linkWindow = new BrowserWindow({
width: 650,
height: 500,
show: false,
@@ -81,23 +88,26 @@ function createOpenWin(data) {
...(process.platform === 'linux' ? { icon } : {}),
webPreferences: {
sandbox: false,
- nodeIntegration: true
+ nodeIntegration: true,
+ worldSafeExecuteJavaScript: true,
+ contextIsolation: true
}
})
- let cookieDetails = {...data.cookieData}
- openWindow.webContents.session.cookies.set(cookieDetails).then(()=>{
- console.log('Cookie set successfully.')
- }).catch(err =>{
- console.error('Set cookie failed:', error)
+ let cookieDetails = { ...data.cookieData }
+ await linkWindow.webContents.session.cookies.set(cookieDetails).then(()=>{
+ console.log('Cookie is successful');
+ }).catch( error =>{
+ console.error('Cookie is error', error);
})
-
- openWindow.loadURL(data.fullPath)
- openWindow.once('ready-to-show', () => {
- openWindow.show()
+ linkWindow.loadURL(data.fullPath)
+
+ linkWindow.once('ready-to-show', () => {
+ linkWindow.show()
+ linkWindow.maximize()
})
- openWindow.on('closed', () => {
- openWindow = null
+ linkWindow.on('closed', () => {
+ linkWindow = null
})
}
@@ -149,13 +159,14 @@ app.on('ready', () => {
createLoginWindow()
}
mainWindow.destroy()
+ mainWindow = null
loginWindow.show()
loginWindow.focus()
})
//打开作业窗口
- ipcMain.on('openWork', (e, data) => {
- createOpenWin(data)
+ ipcMain.on('openWindow', (e, data) => {
+ createLinkWin(data)
})
createLoginWindow()
diff --git a/src/renderer/src/components/select-subject/index.vue b/src/renderer/src/components/select-subject/index.vue
index d70c423..649337a 100644
--- a/src/renderer/src/components/select-subject/index.vue
+++ b/src/renderer/src/components/select-subject/index.vue
@@ -79,10 +79,6 @@ const subjectList = ref([])
const allSubject = ref([])
const dialogVisible = ref(false)
-watch(() => props.modelValue, (newVal) => {
- dialogVisible.value = newVal
-})
-
//切换年级
const changeGrade = ()=>{
// 切换年级 过滤出对应学科数据
@@ -120,8 +116,13 @@ const editUserInfo = async () =>{
emit('onSuccess')
}
+watch(() => props.modelValue, (newVal) => {
+ dialogVisible.value = newVal
+ if(newVal){
+ getSubject()
+ }
+})
-onMounted(getSubject)
diff --git a/src/renderer/src/views/prepare/index.vue b/src/renderer/src/views/prepare/index.vue
index 9a04fdc..7d1954f 100644
--- a/src/renderer/src/views/prepare/index.vue
+++ b/src/renderer/src/views/prepare/index.vue
@@ -7,9 +7,9 @@