云·企业官网 软件版
This commit is contained in:
42
main.js
Normal file
42
main.js
Normal file
@@ -0,0 +1,42 @@
|
||||
const { app, BrowserWindow, ipcMain } = require('electron/main')
|
||||
const path = require('path')
|
||||
const fs = require('fs')
|
||||
|
||||
const createWindow = () => {
|
||||
const saveFile = (_, data) => {
|
||||
console.log(data)
|
||||
fs.writeFileSync("/Users/gxwebsoft/Documents/uploads/data.txt", data)
|
||||
}
|
||||
const readFile = (_, data) => {
|
||||
console.log(data)
|
||||
return fs.readFileSync("/Users/gxwebsoft/Documents/uploads/data.txt", "utf-8").toString();
|
||||
}
|
||||
const win = new BrowserWindow({
|
||||
width: 1400,
|
||||
height: 800,
|
||||
autoHideMenuBar: true,
|
||||
webPreferences: {
|
||||
preload: path.resolve(__dirname, './preload.js'),
|
||||
}
|
||||
})
|
||||
ipcMain.on('save-file', saveFile)
|
||||
// ipcMain.handled('read-file', readFile)
|
||||
// win.loadFile('./pages/index.html')
|
||||
win.loadURL('https://oa.gxwebsoft.com')
|
||||
}
|
||||
|
||||
app.whenReady().then(() => {
|
||||
createWindow()
|
||||
|
||||
app.on('activate', () => {
|
||||
if (BrowserWindow.getAllWindows().length === 0) {
|
||||
createWindow()
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
app.on('window-all-closed', () => {
|
||||
if (process.platform !== 'darwin') {
|
||||
app.quit()
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user