Compare commits
No commits in common. "c8f10471247e0f4a7f68dd649c76e3e10c807851" and "21ff54642928021264e811122846bca1fd792420" have entirely different histories.
c8f1047124
...
21ff546429
|
@ -5,13 +5,13 @@ VITE_APP_TITLE = AIx数字平台
|
||||||
VITE_APP_ENV = 'production'
|
VITE_APP_ENV = 'production'
|
||||||
|
|
||||||
# AIx融合数字管理系统/生产环境
|
# AIx融合数字管理系统/生产环境
|
||||||
VITE_APP_BASE_API = 'https://file.ysaix.com:7868/prod-api'
|
VITE_APP_BASE_API = 'http://192.168.2.52:7863'
|
||||||
|
|
||||||
VITE_APP_UPLOAD_API = 'https://file.ysaix.com:7868/prod-api'
|
VITE_APP_UPLOAD_API = 'https://prev.ysaix.com:7868'
|
||||||
|
|
||||||
# 是否在打包时开启压缩,支持 gzip 和 brotli
|
# 是否在打包时开启压缩,支持 gzip 和 brotli
|
||||||
VITE_BUILD_COMPRESS = gzip
|
VITE_BUILD_COMPRESS = gzip
|
||||||
|
|
||||||
VITE_APP_RES_FILE_PATH = 'https://file.ysaix.com:7868/src/assets/textbook/booktxt/'
|
VITE_APP_RES_FILE_PATH = 'https://prev.ysaix.com:7868/src/assets/textbook/booktxt/'
|
||||||
|
|
||||||
VITE_APP_BUILD_BASE_PATH = 'https://file.ysaix.com:7868/'
|
VITE_APP_BUILD_BASE_PATH = 'https://prev.ysaix.com:7868/'
|
||||||
|
|
|
@ -30,7 +30,6 @@
|
||||||
"jsencrypt": "^3.3.2",
|
"jsencrypt": "^3.3.2",
|
||||||
"pinia": "^2.1.7",
|
"pinia": "^2.1.7",
|
||||||
"pinia-plugin-persistedstate": "^3.2.1",
|
"pinia-plugin-persistedstate": "^3.2.1",
|
||||||
"spark-md5": "^3.0.2",
|
|
||||||
"vue-cropper": "^1.0.3",
|
"vue-cropper": "^1.0.3",
|
||||||
"vue-router": "^4.4.0"
|
"vue-router": "^4.4.0"
|
||||||
},
|
},
|
||||||
|
|
220
src/main/file.js
|
@ -1,105 +1,16 @@
|
||||||
import SparkMD5 from 'spark-md5'
|
import CryptoJS from 'crypto-js'
|
||||||
|
|
||||||
const fs = require('fs')
|
const fs = require('fs')
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
import { ElectronDownloadManager } from 'electron-dl-manager'
|
import { ElectronDownloadManager } from 'electron-dl-manager'
|
||||||
import { dialog } from 'electron'
|
import { dialog } from 'electron'
|
||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
const uploadUrl = import.meta.env.VITE_APP_UPLOAD_API + '/smarttalk/file/upload'
|
const uploadUrl = import.meta.env.VITE_APP_UPLOAD_API + '/smarttalk/file/upload'
|
||||||
const asyncUploadUrl = import.meta.env.VITE_APP_UPLOAD_API + '/smarttalk/file/asyncUpload'
|
|
||||||
const manager = new ElectronDownloadManager()
|
const manager = new ElectronDownloadManager()
|
||||||
export default async function ({ app, shell, BrowserWindow, ipcMain }) {
|
export default async function ({ app, shell, BrowserWindow, ipcMain }) {
|
||||||
const userDataPath = app.getPath('userData')
|
const userDataPath = app.getPath('userData')
|
||||||
const appRootFilePath = userDataPath + '\\selfFile\\'
|
const appRootFilePath = userDataPath + '\\selfFile\\'
|
||||||
const appTempFilePath = userDataPath + '\\tempFile\\'
|
const appTempFilePath = userDataPath + '\\tempFile\\'
|
||||||
let Spark = new SparkMD5.ArrayBuffer()
|
|
||||||
|
|
||||||
ipcMain.on('upload-file-change', (e, { id, fileNewName, cookie, fileType }) => {
|
|
||||||
let filePath = appRootFilePath + fileNewName
|
|
||||||
//执行更新,上传文件
|
|
||||||
let formData = new FormData()
|
|
||||||
formData.append('id', id)
|
|
||||||
uploadFileByFS({
|
|
||||||
url: asyncUploadUrl,
|
|
||||||
path: filePath,
|
|
||||||
name: fileNewName,
|
|
||||||
cookie,
|
|
||||||
fileType,
|
|
||||||
formData,
|
|
||||||
success: (response) => {
|
|
||||||
e.reply('upload-file-change-success' + fileNewName, {
|
|
||||||
data: response.data,
|
|
||||||
md5: formData.md5
|
|
||||||
})
|
|
||||||
},
|
|
||||||
error: (err) => {
|
|
||||||
console.error('Error uploading file:', err)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
/*监听文件改变,如果有改变则返回触发*/
|
|
||||||
ipcMain.on('listen-file-change', (e, { id, fileNewName, md5, cookie, fileType }) => {
|
|
||||||
let filePath = appRootFilePath + fileNewName
|
|
||||||
let uploadId = null
|
|
||||||
let isOn = false
|
|
||||||
setInterval(() => {
|
|
||||||
getFileMD5(filePath).then((md5New) => {
|
|
||||||
if (md5New !== md5) {
|
|
||||||
md5 = md5New
|
|
||||||
if (uploadId) {
|
|
||||||
clearTimeout(uploadId)
|
|
||||||
}
|
|
||||||
if (isOn === false) {
|
|
||||||
e.reply('listen-file-change-on' + fileNewName)
|
|
||||||
isOn = true
|
|
||||||
}
|
|
||||||
//倒数十秒提交更改,十秒之内有继续修改则重置倒数
|
|
||||||
uploadId = setTimeout(() => {
|
|
||||||
//执行更新,上传文件
|
|
||||||
let formData = new FormData()
|
|
||||||
formData.append('id', id)
|
|
||||||
uploadFileByFS({
|
|
||||||
url: asyncUploadUrl,
|
|
||||||
path: filePath,
|
|
||||||
name: fileNewName,
|
|
||||||
cookie,
|
|
||||||
fileType,
|
|
||||||
formData,
|
|
||||||
success: (response) => {
|
|
||||||
e.reply('listen-file-change-success' + fileNewName, {
|
|
||||||
data: response.data,
|
|
||||||
md5: formData.md5
|
|
||||||
})
|
|
||||||
clearTimeout(uploadId)
|
|
||||||
isOn = false
|
|
||||||
},
|
|
||||||
error: (err) => {
|
|
||||||
console.error('Error uploading file:', err)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}, 5000)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}, 1000)
|
|
||||||
})
|
|
||||||
|
|
||||||
function getFileMD5(path) {
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
fs.readFile(path, (err, dataFile) => {
|
|
||||||
if (err) {
|
|
||||||
reject(err)
|
|
||||||
return console.error(err)
|
|
||||||
}
|
|
||||||
Spark.append(dataFile)
|
|
||||||
let md5 = Spark.end()
|
|
||||||
resolve(md5)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* 判断是否有本地文件
|
|
||||||
* */
|
|
||||||
ipcMain.on('is-have-local-file', (e, fileNewName) => {
|
ipcMain.on('is-have-local-file', (e, fileNewName) => {
|
||||||
let filePath = appRootFilePath + fileNewName
|
let filePath = appRootFilePath + fileNewName
|
||||||
fs.access(filePath, fs.constants.F_OK, (err) => {
|
fs.access(filePath, fs.constants.F_OK, (err) => {
|
||||||
|
@ -110,38 +21,10 @@ export default async function ({ app, shell, BrowserWindow, ipcMain }) {
|
||||||
e.reply('is-have-local-file-reply' + fileNewName, true)
|
e.reply('is-have-local-file-reply' + fileNewName, true)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
/*
|
|
||||||
* 判断是需要同步本地文件
|
|
||||||
* */
|
|
||||||
ipcMain.on('is-async-local-file', (e, { fileNewName, lastModifyTime, md5 }) => {
|
|
||||||
let filePath = appRootFilePath + fileNewName
|
|
||||||
fs.access(filePath, fs.constants.F_OK, (err) => {
|
|
||||||
if (err) {
|
|
||||||
e.reply('is-async-local-file-reply' + fileNewName, { isAsync: true, type: 'down' })
|
|
||||||
return
|
|
||||||
}
|
|
||||||
getFileMD5(filePath).then((localMd5) => {
|
|
||||||
if (localMd5 === md5) {
|
|
||||||
e.reply('is-async-local-file-reply' + fileNewName, { isAsync: false, type: '' })
|
|
||||||
} else {
|
|
||||||
const stats = fs.statSync(filePath)
|
|
||||||
//如果线上时间大于线下时间,就需要从线上下载,否则则需要上传
|
|
||||||
if (lastModifyTime > stats.mtime.getTime()) {
|
|
||||||
e.reply('is-async-local-file-reply' + fileNewName, { isAsync: true, type: 'down' })
|
|
||||||
} else if (lastModifyTime < stats.mtime.getTime()) {
|
|
||||||
e.reply('is-async-local-file-reply' + fileNewName, { isAsync: true, type: 'upload' })
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
//默认浏览器打开url
|
//默认浏览器打开url
|
||||||
ipcMain.on('open-url-browser', (e, url) => {
|
ipcMain.on('open-url-browser', (e, url) => {
|
||||||
shell.openPath(url)
|
shell.openPath(url)
|
||||||
})
|
})
|
||||||
|
|
||||||
//使用默认应用打开本地文件
|
//使用默认应用打开本地文件
|
||||||
ipcMain.on('open-path-app', (e, destination) => {
|
ipcMain.on('open-path-app', (e, destination) => {
|
||||||
let path = appRootFilePath + destination
|
let path = appRootFilePath + destination
|
||||||
|
@ -157,72 +40,65 @@ export default async function ({ app, shell, BrowserWindow, ipcMain }) {
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
//导出文件
|
//复制文件
|
||||||
ipcMain.on('export-file-default', (e, list) => {
|
ipcMain.on('export-file-default', (e, list) => {
|
||||||
exportFile(list, (res) => {
|
exportFile(list, (res) => {
|
||||||
e.reply('export-file-default-reply', res)
|
e.reply('export-file-default-reply', res)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
function uploadFileByFS({ url, path, name, cookie, fileType, formData, success, error }) {
|
function getFileMD5(file) {
|
||||||
fs.readFile(path, (err, data) => {
|
return new Promise((resolve, reject) => {
|
||||||
if (err) {
|
const fileReader = new FileReader()
|
||||||
return console.error(err)
|
fileReader.onload = (e) => {
|
||||||
|
const buffer = e.target.result
|
||||||
|
let md5 = CryptoJS.MD5(buffer).toString()
|
||||||
|
resolve(md5)
|
||||||
}
|
}
|
||||||
// 配置上传的请求
|
fileReader.readAsArrayBuffer(file)
|
||||||
const config = {
|
|
||||||
headers: {
|
|
||||||
'Content-Type': 'multipart/form-data', // 或者其他适合上传文件的Content-Type
|
|
||||||
Authorization: 'Bearer ' + cookie
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Spark.append(data)
|
|
||||||
let md5 = Spark.end()
|
|
||||||
// 使用axios上传文件
|
|
||||||
let file = new File([data], name, {
|
|
||||||
type: fileType
|
|
||||||
})
|
|
||||||
formData.append('file', file)
|
|
||||||
formData.append('md5', md5)
|
|
||||||
axios
|
|
||||||
.post(url, formData, config)
|
|
||||||
.then((response) => {
|
|
||||||
success(response)
|
|
||||||
})
|
|
||||||
.catch((errorMsg) => {
|
|
||||||
error(errorMsg)
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/*创建新的ppt文件*/
|
|
||||||
ipcMain.on('creat-file-default', (e, { name, uploadData, cookie }) => {
|
ipcMain.on('creat-file-default', (e, { name, uploadData, cookie }) => {
|
||||||
createFolder('tempFile').then(() => {
|
createFolder('tempFile').then(() => {
|
||||||
let path = appTempFilePath + name
|
let path = appTempFilePath + name
|
||||||
fs.writeFileSync(path, '', 'utf-8')
|
fs.writeFileSync(path, '', 'utf-8')
|
||||||
let fileType = 'application/vnd.openxmlformats-officedocument.presentationml.presentation'
|
// 读取文件
|
||||||
let formData = new FormData()
|
fs.readFile(path, (err, data) => {
|
||||||
for (let key in uploadData) {
|
if (err) {
|
||||||
if (Object.prototype.hasOwnProperty.call(uploadData, key)) {
|
return console.error(err)
|
||||||
// 检查是否是对象自身的属性
|
|
||||||
formData.append(key, uploadData[key])
|
|
||||||
}
|
}
|
||||||
}
|
// 配置上传的请求
|
||||||
formData.append('fileFlag', '教案')
|
const config = {
|
||||||
uploadFileByFS({
|
headers: {
|
||||||
url: uploadUrl,
|
'Content-Type': 'multipart/form-data', // 或者其他适合上传文件的Content-Type
|
||||||
path,
|
Authorization: 'Bearer ' + cookie
|
||||||
name,
|
}
|
||||||
cookie,
|
|
||||||
fileType,
|
|
||||||
formData,
|
|
||||||
success: (response) => {
|
|
||||||
e.reply('creat-file-default-reply', response.data)
|
|
||||||
console.log('File uploaded successfully:', response.data)
|
|
||||||
},
|
|
||||||
error: (err) => {
|
|
||||||
console.error('Error uploading file:', err)
|
|
||||||
}
|
}
|
||||||
|
let md5 = CryptoJS.MD5(data).toString()
|
||||||
|
let formData = new FormData()
|
||||||
|
// 使用axios上传文件
|
||||||
|
let file = new File([data], name, {
|
||||||
|
type: 'application/vnd.openxmlformats-officedocument.presentationml.presentation'
|
||||||
|
})
|
||||||
|
formData.append('file', file)
|
||||||
|
formData.append('md5',md5)
|
||||||
|
|
||||||
|
for (let key in uploadData) {
|
||||||
|
if (uploadData.hasOwnProperty(key)) { // 检查是否是对象自身的属性
|
||||||
|
formData.append(key,uploadData[key])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
formData.append("fileFlag","教案")
|
||||||
|
axios
|
||||||
|
.post(uploadUrl, formData, config)
|
||||||
|
.then((response) => {
|
||||||
|
e.reply('creat-file-default-reply', response.data)
|
||||||
|
console.log('File uploaded successfully:', response.data)
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
console.error('Error uploading file:', error)
|
||||||
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
@ -315,7 +191,6 @@ export default async function ({ app, shell, BrowserWindow, ipcMain }) {
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
/*导出文件*/
|
|
||||||
function exportFile(list, callback) {
|
function exportFile(list, callback) {
|
||||||
let win = BrowserWindow.getFocusedWindow()
|
let win = BrowserWindow.getFocusedWindow()
|
||||||
//通过扩展名识别文件类型
|
//通过扩展名识别文件类型
|
||||||
|
@ -345,12 +220,10 @@ export default async function ({ app, shell, BrowserWindow, ipcMain }) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/*文件是否已经存在*/
|
|
||||||
function isHaveFile(path) {
|
function isHaveFile(path) {
|
||||||
return fs.existsSync(path)
|
return fs.existsSync(path)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*判断是否已经存在这个名字的文件,如果已经存在则递增导出*/
|
|
||||||
function filterCopyFile(path, index = 0) {
|
function filterCopyFile(path, index = 0) {
|
||||||
if (isHaveFile(path) === true) {
|
if (isHaveFile(path) === true) {
|
||||||
index++
|
index++
|
||||||
|
@ -361,7 +234,6 @@ export default async function ({ app, shell, BrowserWindow, ipcMain }) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*复制文件*/
|
|
||||||
function copyRelFile(source, destination, callback) {
|
function copyRelFile(source, destination, callback) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
const readStream = fs.createReadStream(source)
|
const readStream = fs.createReadStream(source)
|
||||||
|
@ -384,7 +256,6 @@ export default async function ({ app, shell, BrowserWindow, ipcMain }) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/*复制文件*/
|
|
||||||
function copyFile(source, destination, callback) {
|
function copyFile(source, destination, callback) {
|
||||||
let path = appRootFilePath + destination
|
let path = appRootFilePath + destination
|
||||||
createFolder('selfFile').then(() => {
|
createFolder('selfFile').then(() => {
|
||||||
|
@ -405,7 +276,6 @@ export default async function ({ app, shell, BrowserWindow, ipcMain }) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/*创建文件夹*/
|
|
||||||
function createFolder(folderName) {
|
function createFolder(folderName) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
const folderPath = path.join(userDataPath, folderName)
|
const folderPath = path.join(userDataPath, folderName)
|
||||||
|
|
|
@ -1,17 +1,13 @@
|
||||||
import { app, shell, BrowserWindow, ipcMain, session } from 'electron'
|
import { app, shell, BrowserWindow, ipcMain } from 'electron'
|
||||||
import { join } from 'path'
|
import { join } from 'path'
|
||||||
import { electronApp, optimizer, is } from '@electron-toolkit/utils'
|
import { electronApp, optimizer, is } from '@electron-toolkit/utils'
|
||||||
import icon from '../../resources/icon.png?asset'
|
import icon from '../../resources/icon.png?asset'
|
||||||
import File from './file'
|
import File from './file'
|
||||||
|
|
||||||
File({ app, shell, BrowserWindow, ipcMain })
|
File({ app, shell, BrowserWindow, ipcMain })
|
||||||
|
function createWindow() {
|
||||||
let mainWindow, loginWindow
|
// Create the browser window.
|
||||||
|
const mainWindow = new BrowserWindow({
|
||||||
//登录窗口
|
|
||||||
function createLoginWindow() {
|
|
||||||
if (loginWindow) return
|
|
||||||
loginWindow = new BrowserWindow({
|
|
||||||
width: 888,
|
width: 888,
|
||||||
height: 520,
|
height: 520,
|
||||||
show: false,
|
show: false,
|
||||||
|
@ -24,153 +20,52 @@ function createLoginWindow() {
|
||||||
nodeIntegration: true
|
nodeIntegration: true
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
const loginURL = is.dev ? `http://localhost:5173/#/login` : `file://${__dirname}/index.html/login`
|
|
||||||
loginWindow.loadURL(loginURL)
|
|
||||||
|
|
||||||
loginWindow.once('ready-to-show', () => {
|
|
||||||
loginWindow.show()
|
|
||||||
})
|
|
||||||
|
|
||||||
loginWindow.on('closed', () => {
|
|
||||||
loginWindow = null
|
|
||||||
})
|
|
||||||
}
|
|
||||||
//主窗口
|
|
||||||
function createMainWindow() {
|
|
||||||
mainWindow = new BrowserWindow({
|
|
||||||
width: 1200,
|
|
||||||
height: 700,
|
|
||||||
show: false,
|
|
||||||
frame: false,
|
|
||||||
autoHideMenuBar: true,
|
|
||||||
...(process.platform === 'linux' ? { icon } : {}),
|
|
||||||
webPreferences: {
|
|
||||||
preload: join(__dirname, '../preload/index.js'),
|
|
||||||
sandbox: false,
|
|
||||||
nodeIntegration: true
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
mainWindow.on('ready-to-show', () => {
|
mainWindow.on('ready-to-show', () => {
|
||||||
mainWindow.show()
|
mainWindow.show()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
mainWindow.webContents.openDevTools()
|
||||||
|
|
||||||
mainWindow.webContents.setWindowOpenHandler((details) => {
|
mainWindow.webContents.setWindowOpenHandler((details) => {
|
||||||
shell.openExternal(details.url)
|
shell.openExternal(details.url)
|
||||||
return { action: 'deny' }
|
return { action: 'deny' }
|
||||||
})
|
})
|
||||||
mainWindow.webContents.openDevTools()
|
|
||||||
|
|
||||||
|
// HMR for renderer base on electron-vite cli.
|
||||||
|
// Load the remote URL for development or the local html file for production.
|
||||||
if (is.dev && process.env['ELECTRON_RENDERER_URL']) {
|
if (is.dev && process.env['ELECTRON_RENDERER_URL']) {
|
||||||
mainWindow.loadURL(process.env['ELECTRON_RENDERER_URL'])
|
mainWindow.loadURL(process.env['ELECTRON_RENDERER_URL'])
|
||||||
|
// mainWindow.loadURL('https://file.ysaix.com:7868/')
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
// mainWindow.loadURL('https://file.ysaix.com:7868/')
|
||||||
mainWindow.loadFile(join(__dirname, '../renderer/index.html'))
|
mainWindow.loadFile(join(__dirname, '../renderer/index.html'))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 作业窗口相关-开发中
|
// This method will be called when Electron has finished
|
||||||
let workWindow
|
// initialization and is ready to create browser windows.
|
||||||
function createWork(data) {
|
// Some APIs can only be used after this event occurs.
|
||||||
if (workWindow) return
|
app.whenReady().then(() => {
|
||||||
workWindow = new BrowserWindow({
|
// Set app user model id for windows
|
||||||
width: 650,
|
|
||||||
height: 500,
|
|
||||||
show: false,
|
|
||||||
frame: true,
|
|
||||||
|
|
||||||
autoHideMenuBar: true,
|
|
||||||
...(process.platform === 'linux' ? { icon } : {}),
|
|
||||||
webPreferences: {
|
|
||||||
sandbox: false,
|
|
||||||
nodeIntegration: true
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
workWindow.webContents.session.cookies.set(
|
|
||||||
{
|
|
||||||
url: 'https://file.ysaix.com:7868',
|
|
||||||
name: 'Admin-Token',
|
|
||||||
value: data
|
|
||||||
},
|
|
||||||
function (error) {
|
|
||||||
if (error) {
|
|
||||||
console.error('Set cookie failed:', error)
|
|
||||||
} else {
|
|
||||||
console.log('Cookie set successfully.')
|
|
||||||
}
|
|
||||||
}
|
|
||||||
)
|
|
||||||
workWindow.loadURL(
|
|
||||||
'https://file.ysaix.com:7868/teaching/classtaskassign?titleName=%E4%BD%9C%E4%B8%9A%E5%B8%83%E7%BD%AE'
|
|
||||||
)
|
|
||||||
|
|
||||||
workWindow.once('ready-to-show', () => {
|
|
||||||
workWindow.show()
|
|
||||||
})
|
|
||||||
workWindow.on('closed', () => {
|
|
||||||
workWindow = null
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// 初始化完成
|
|
||||||
app.on('ready', () => {
|
|
||||||
// 设置应用程序用户模型标识符
|
|
||||||
electronApp.setAppUserModelId('com.electron')
|
electronApp.setAppUserModelId('com.electron')
|
||||||
|
|
||||||
//一个新的browserWindow 被创建时触发
|
// Default open or close DevTools by F12 in development
|
||||||
|
// and ignore CommandOrControl + R in production.
|
||||||
|
// see https://github.com/alex8088/electron-toolkit/tree/master/packages/utils
|
||||||
app.on('browser-window-created', (_, window) => {
|
app.on('browser-window-created', (_, window) => {
|
||||||
optimizer.watchWindowShortcuts(window)
|
optimizer.watchWindowShortcuts(window)
|
||||||
})
|
})
|
||||||
|
|
||||||
//窗口 最大、最小、关闭
|
|
||||||
ipcMain.on('minimize-window', () => {
|
|
||||||
if (loginWindow) {
|
|
||||||
loginWindow.minimize()
|
|
||||||
}
|
|
||||||
if (mainWindow) {
|
|
||||||
mainWindow.minimize()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
ipcMain.on('maximize-window', () => {
|
|
||||||
mainWindow.isMaximized() ? mainWindow.unmaximize() : mainWindow.maximize()
|
|
||||||
})
|
|
||||||
|
|
||||||
ipcMain.on('close-window', () => {
|
createWindow()
|
||||||
if (loginWindow) {
|
|
||||||
loginWindow.destroy()
|
|
||||||
}
|
|
||||||
if (mainWindow) {
|
|
||||||
mainWindow.destroy()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
// 打开主窗口
|
|
||||||
ipcMain.on('openMainWindow', () => {
|
|
||||||
if (!mainWindow) {
|
|
||||||
createMainWindow()
|
|
||||||
}
|
|
||||||
|
|
||||||
loginWindow.destroy()
|
|
||||||
loginWindow = null
|
|
||||||
})
|
|
||||||
// 打开登录窗口
|
|
||||||
ipcMain.on('openLoginWindow', () => {
|
|
||||||
if (!loginWindow) {
|
|
||||||
createLoginWindow()
|
|
||||||
}
|
|
||||||
mainWindow.destroy()
|
|
||||||
loginWindow.show()
|
|
||||||
loginWindow.focus()
|
|
||||||
})
|
|
||||||
|
|
||||||
//打开作业窗口
|
|
||||||
ipcMain.on('openWork', (e, data) => {
|
|
||||||
createWork(data)
|
|
||||||
})
|
|
||||||
|
|
||||||
createLoginWindow()
|
|
||||||
app.on('activate', function () {
|
app.on('activate', function () {
|
||||||
if (BrowserWindow.getAllWindows().length === 0) createLoginWindow()
|
// On macOS it's common to re-create a window in the app when the
|
||||||
|
// dock icon is clicked and there are no other windows open.
|
||||||
|
if (BrowserWindow.getAllWindows().length === 0) createWindow()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -182,3 +77,35 @@ app.on('window-all-closed', () => {
|
||||||
app.quit()
|
app.quit()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
ipcMain.on('toggle-top', (event) => {
|
||||||
|
const win = BrowserWindow.getFocusedWindow();
|
||||||
|
const isAlwaysOnTop = win.isAlwaysOnTop();
|
||||||
|
win.setAlwaysOnTop(!isAlwaysOnTop);
|
||||||
|
event.sender.send('top-status-changed', !isAlwaysOnTop);
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
ipcMain.on('minimize-window', () => {
|
||||||
|
const win = BrowserWindow.getFocusedWindow();
|
||||||
|
win.minimize();
|
||||||
|
});
|
||||||
|
|
||||||
|
ipcMain.on('maximize-window', () => {
|
||||||
|
const win = BrowserWindow.getFocusedWindow();
|
||||||
|
if (win.isMaximized()) {
|
||||||
|
win.unmaximize();
|
||||||
|
} else {
|
||||||
|
win.maximize();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
ipcMain.on('close-window', () => {
|
||||||
|
const win = BrowserWindow.getFocusedWindow();
|
||||||
|
win.close();
|
||||||
|
});
|
||||||
|
ipcMain.on('set-winsize', (e, {x, y})=>{
|
||||||
|
const win = BrowserWindow.getFocusedWindow();
|
||||||
|
win.setSize(x,y);
|
||||||
|
win.center()
|
||||||
|
})
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
http-equiv="Content-Security-Policy"
|
http-equiv="Content-Security-Policy"
|
||||||
content="default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data:"
|
content="default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data:"
|
||||||
/> -->
|
/> -->
|
||||||
<meta http-equiv="Content-Security-Policy" content="connect-src *; default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src * 'self' data: blob:" />
|
<meta http-equiv="Content-Security-Policy" content="connect-src *; default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data: blob:" />
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
@font-face {
|
@font-face {
|
||||||
font-family: "iconfont"; /* Project id 2794390 */
|
font-family: "iconfont"; /* Project id 2794390 */
|
||||||
src: url('iconfont.woff2?t=1721698955462') format('woff2'),
|
src: url('iconfont.woff2?t=1721179711733') format('woff2'),
|
||||||
url('iconfont.woff?t=1721698955462') format('woff'),
|
url('iconfont.woff?t=1721179711733') format('woff'),
|
||||||
url('iconfont.ttf?t=1721698955462') format('truetype'),
|
url('iconfont.ttf?t=1721179711733') format('truetype'),
|
||||||
url('iconfont.svg?t=1721698955462#iconfont') format('svg');
|
url('iconfont.svg?t=1721179711733#iconfont') format('svg');
|
||||||
}
|
}
|
||||||
|
|
||||||
.iconfont {
|
.iconfont {
|
||||||
|
@ -14,10 +14,6 @@
|
||||||
-moz-osx-font-smoothing: grayscale;
|
-moz-osx-font-smoothing: grayscale;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon-lingdang:before {
|
|
||||||
content: "\e613";
|
|
||||||
}
|
|
||||||
|
|
||||||
.icon-yidongdaozu:before {
|
.icon-yidongdaozu:before {
|
||||||
content: "\e67d";
|
content: "\e67d";
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,13 +5,6 @@
|
||||||
"css_prefix_text": "icon-",
|
"css_prefix_text": "icon-",
|
||||||
"description": "",
|
"description": "",
|
||||||
"glyphs": [
|
"glyphs": [
|
||||||
{
|
|
||||||
"icon_id": "17990800",
|
|
||||||
"name": "铃铛",
|
|
||||||
"font_class": "lingdang",
|
|
||||||
"unicode": "e613",
|
|
||||||
"unicode_decimal": 58899
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"icon_id": "1207918",
|
"icon_id": "1207918",
|
||||||
"name": "移动到组",
|
"name": "移动到组",
|
||||||
|
|
|
@ -14,8 +14,6 @@
|
||||||
/>
|
/>
|
||||||
<missing-glyph />
|
<missing-glyph />
|
||||||
|
|
||||||
<glyph glyph-name="lingdang" unicode="" d="M257.7 243.70000000000005h510.6c17.9 0 32.5 14.5 32.5 32.5V480.9c0 143.2-104.6 261.9-241.5 284 2.1 5.5 3.3 11.6 3.3 17.8 0 27.4-22.2 49.6-49.6 49.6s-49.6-22.2-49.6-49.6c0-6.3 1.2-12.3 3.3-17.8-136.9-22.1-241.5-140.9-241.5-284v-204.7c0-17.9 14.6-32.5 32.5-32.5zM513-63.60000000000002c44.4 0 80.3 36 80.3 80.3H432.7c0-44.4 35.9-80.3 80.3-80.3zM911.7 115L895 148.29999999999995c-14.8 29.7-47.7 52.1-74.5 52.1h-615c-26.8 0-59.7-22.4-74.5-52.1L114.3 115c-17.5-35.1-6.6-65.9 25.9-65.9h745.6c32.5 0 43.5 30.8 25.9 65.9z" horiz-adv-x="1024" />
|
|
||||||
|
|
||||||
<glyph glyph-name="yidongdaozu" unicode="" d="M904.448 270.272 119.616 270.272c-23.68 0-44.736-14.656-52.48-36.48C65.024 227.968 64 221.952 64 216c0-16.32 7.616-32.192 21.184-42.688l293.248-225.728c24.128-18.56 59.008-14.464 78.016 9.088 18.944 23.552 14.848 57.664-9.28 76.224L288 156.544l616 0c30.72 0 56 29.44 56 59.456C960 246.016 935.168 270.272 904.448 270.272zM119.552 497.728l784.832 0c23.68 0 44.736 14.656 52.48 36.48C958.976 540.032 960 546.048 960 552c0 16.32-7.616 32.192-21.184 42.688l-293.248 225.728c-24.128 18.56-59.008 14.464-78.016-9.088C548.608 787.776 552.64 753.6 576.832 735.04L736 611.456 120 611.456C89.28 611.456 64 582.016 64 552 64 521.984 88.832 497.728 119.552 497.728z" horiz-adv-x="1024" />
|
<glyph glyph-name="yidongdaozu" unicode="" d="M904.448 270.272 119.616 270.272c-23.68 0-44.736-14.656-52.48-36.48C65.024 227.968 64 221.952 64 216c0-16.32 7.616-32.192 21.184-42.688l293.248-225.728c24.128-18.56 59.008-14.464 78.016 9.088 18.944 23.552 14.848 57.664-9.28 76.224L288 156.544l616 0c30.72 0 56 29.44 56 59.456C960 246.016 935.168 270.272 904.448 270.272zM119.552 497.728l784.832 0c23.68 0 44.736 14.656 52.48 36.48C958.976 540.032 960 546.048 960 552c0 16.32-7.616 32.192-21.184 42.688l-293.248 225.728c-24.128 18.56-59.008 14.464-78.016-9.088C548.608 787.776 552.64 753.6 576.832 735.04L736 611.456 120 611.456C89.28 611.456 64 582.016 64 552 64 521.984 88.832 497.728 119.552 497.728z" horiz-adv-x="1024" />
|
||||||
|
|
||||||
<glyph glyph-name="shanchu" unicode="" d="M736.653061-33.959184H287.346939c-45.97551 0-83.591837 37.616327-83.591837 83.591837V540.734694h616.489796v-491.102041c0-45.97551-37.616327-83.591837-83.591837-83.591837zM245.55102 498.938776v-449.306123c0-22.987755 18.808163-41.795918 41.795919-41.795918h449.306122c22.987755 0 41.795918 18.808163 41.795919 41.795918V498.938776H245.55102zM407.510204 101.877551c-11.493878 0-20.897959 9.404082-20.897959 20.897959V384c0 11.493878 9.404082 20.897959 20.897959 20.897959s20.897959-9.404082 20.897959-20.897959v-261.22449c0-11.493878-9.404082-20.897959-20.897959-20.897959zM616.489796 101.877551c-11.493878 0-20.897959 9.404082-20.897959 20.897959V384c0 11.493878 9.404082 20.897959 20.897959 20.897959s20.897959-9.404082 20.897959-20.897959v-261.22449c0-11.493878-9.404082-20.897959-20.897959-20.897959zM846.367347 498.938776H177.632653c-45.97551 0-83.591837 37.616327-83.591837 83.591836v31.346939c0 45.97551 37.616327 83.591837 83.591837 83.591837h668.734694c45.97551 0 83.591837-37.616327 83.591837-83.591837v-31.346939c0-45.97551-37.616327-83.591837-83.591837-83.591836zM177.632653 655.673469c-22.987755 0-41.795918-18.808163-41.795918-41.795918v-31.346939c0-22.987755 18.808163-41.795918 41.795918-41.795918h668.734694c22.987755 0 41.795918 18.808163 41.795918 41.795918v31.346939c0 22.987755-18.808163 41.795918-41.795918 41.795918H177.632653zM650.44898 655.673469h-276.89796c-28.734694 0-52.244898 23.510204-52.244898 52.244898v41.795919c0 28.734694 23.510204 52.244898 52.244898 52.244898h276.89796c28.734694 0 52.244898-23.510204 52.244898-52.244898v-41.795919c0-28.734694-23.510204-52.244898-52.244898-52.244898z m-276.89796 104.489796c-5.746939 0-10.44898-4.702041-10.448979-10.448979v-41.795919c0-5.746939 4.702041-10.44898 10.448979-10.448979h276.89796c5.746939 0 10.44898 4.702041 10.448979 10.448979v41.795919c0 5.746939-4.702041 10.44898-10.448979 10.448979h-276.89796z" horiz-adv-x="1024" />
|
<glyph glyph-name="shanchu" unicode="" d="M736.653061-33.959184H287.346939c-45.97551 0-83.591837 37.616327-83.591837 83.591837V540.734694h616.489796v-491.102041c0-45.97551-37.616327-83.591837-83.591837-83.591837zM245.55102 498.938776v-449.306123c0-22.987755 18.808163-41.795918 41.795919-41.795918h449.306122c22.987755 0 41.795918 18.808163 41.795919 41.795918V498.938776H245.55102zM407.510204 101.877551c-11.493878 0-20.897959 9.404082-20.897959 20.897959V384c0 11.493878 9.404082 20.897959 20.897959 20.897959s20.897959-9.404082 20.897959-20.897959v-261.22449c0-11.493878-9.404082-20.897959-20.897959-20.897959zM616.489796 101.877551c-11.493878 0-20.897959 9.404082-20.897959 20.897959V384c0 11.493878 9.404082 20.897959 20.897959 20.897959s20.897959-9.404082 20.897959-20.897959v-261.22449c0-11.493878-9.404082-20.897959-20.897959-20.897959zM846.367347 498.938776H177.632653c-45.97551 0-83.591837 37.616327-83.591837 83.591836v31.346939c0 45.97551 37.616327 83.591837 83.591837 83.591837h668.734694c45.97551 0 83.591837-37.616327 83.591837-83.591837v-31.346939c0-45.97551-37.616327-83.591837-83.591837-83.591836zM177.632653 655.673469c-22.987755 0-41.795918-18.808163-41.795918-41.795918v-31.346939c0-22.987755 18.808163-41.795918 41.795918-41.795918h668.734694c22.987755 0 41.795918 18.808163 41.795918 41.795918v31.346939c0 22.987755-18.808163 41.795918-41.795918 41.795918H177.632653zM650.44898 655.673469h-276.89796c-28.734694 0-52.244898 23.510204-52.244898 52.244898v41.795919c0 28.734694 23.510204 52.244898 52.244898 52.244898h276.89796c28.734694 0 52.244898-23.510204 52.244898-52.244898v-41.795919c0-28.734694-23.510204-52.244898-52.244898-52.244898z m-276.89796 104.489796c-5.746939 0-10.44898-4.702041-10.448979-10.448979v-41.795919c0-5.746939 4.702041-10.44898 10.448979-10.448979h276.89796c5.746939 0 10.44898 4.702041 10.448979 10.448979v41.795919c0 5.746939-4.702041 10.44898-10.448979 10.448979h-276.89796z" horiz-adv-x="1024" />
|
||||||
|
|
Before Width: | Height: | Size: 50 KiB After Width: | Height: | Size: 49 KiB |
After Width: | Height: | Size: 2.4 KiB |
After Width: | Height: | Size: 3.1 KiB |
After Width: | Height: | Size: 2.5 KiB |
After Width: | Height: | Size: 3.0 KiB |
After Width: | Height: | Size: 206 KiB |
After Width: | Height: | Size: 394 KiB |
After Width: | Height: | Size: 4.8 KiB |
After Width: | Height: | Size: 6.4 KiB |
After Width: | Height: | Size: 11 KiB |
After Width: | Height: | Size: 3.6 KiB |
After Width: | Height: | Size: 3.6 KiB |
After Width: | Height: | Size: 3.3 KiB |
After Width: | Height: | Size: 54 KiB |
After Width: | Height: | Size: 48 KiB |
After Width: | Height: | Size: 42 KiB |
After Width: | Height: | Size: 68 KiB |
After Width: | Height: | Size: 50 KiB |
After Width: | Height: | Size: 49 KiB |
After Width: | Height: | Size: 70 KiB |
After Width: | Height: | Size: 70 KiB |
After Width: | Height: | Size: 59 KiB |
After Width: | Height: | Size: 66 KiB |
After Width: | Height: | Size: 44 KiB |
After Width: | Height: | Size: 72 KiB |
After Width: | Height: | Size: 56 KiB |
After Width: | Height: | Size: 62 KiB |
After Width: | Height: | Size: 52 KiB |
After Width: | Height: | Size: 54 KiB |
After Width: | Height: | Size: 46 KiB |
After Width: | Height: | Size: 47 KiB |
After Width: | Height: | Size: 44 KiB |
After Width: | Height: | Size: 18 KiB |
After Width: | Height: | Size: 69 KiB |
After Width: | Height: | Size: 60 KiB |
After Width: | Height: | Size: 55 KiB |
After Width: | Height: | Size: 54 KiB |
After Width: | Height: | Size: 56 KiB |
After Width: | Height: | Size: 51 KiB |
After Width: | Height: | Size: 40 KiB |
After Width: | Height: | Size: 46 KiB |
After Width: | Height: | Size: 46 KiB |
After Width: | Height: | Size: 46 KiB |
After Width: | Height: | Size: 71 KiB |
After Width: | Height: | Size: 77 KiB |
After Width: | Height: | Size: 67 KiB |
After Width: | Height: | Size: 67 KiB |
After Width: | Height: | Size: 56 KiB |
After Width: | Height: | Size: 53 KiB |
After Width: | Height: | Size: 58 KiB |
After Width: | Height: | Size: 58 KiB |
After Width: | Height: | Size: 50 KiB |
After Width: | Height: | Size: 50 KiB |
After Width: | Height: | Size: 48 KiB |
After Width: | Height: | Size: 46 KiB |
After Width: | Height: | Size: 63 KiB |
After Width: | Height: | Size: 60 KiB |
After Width: | Height: | Size: 60 KiB |
After Width: | Height: | Size: 63 KiB |
After Width: | Height: | Size: 53 KiB |
After Width: | Height: | Size: 53 KiB |
After Width: | Height: | Size: 69 KiB |
After Width: | Height: | Size: 48 KiB |
After Width: | Height: | Size: 52 KiB |
After Width: | Height: | Size: 47 KiB |
After Width: | Height: | Size: 73 KiB |
After Width: | Height: | Size: 76 KiB |
After Width: | Height: | Size: 62 KiB |
After Width: | Height: | Size: 61 KiB |
After Width: | Height: | Size: 56 KiB |
After Width: | Height: | Size: 48 KiB |
After Width: | Height: | Size: 67 KiB |
After Width: | Height: | Size: 48 KiB |
After Width: | Height: | Size: 49 KiB |
After Width: | Height: | Size: 47 KiB |
After Width: | Height: | Size: 70 KiB |
After Width: | Height: | Size: 71 KiB |
After Width: | Height: | Size: 62 KiB |
After Width: | Height: | Size: 67 KiB |
After Width: | Height: | Size: 60 KiB |
After Width: | Height: | Size: 61 KiB |
After Width: | Height: | Size: 56 KiB |
After Width: | Height: | Size: 58 KiB |
After Width: | Height: | Size: 56 KiB |
After Width: | Height: | Size: 42 KiB |
After Width: | Height: | Size: 47 KiB |
After Width: | Height: | Size: 55 KiB |
After Width: | Height: | Size: 57 KiB |
After Width: | Height: | Size: 51 KiB |