45 lines
900 B
JavaScript
45 lines
900 B
JavaScript
const { app, BrowserWindow } = require('electron');
|
|
const path = require('path');
|
|
|
|
// 远程服务器地址(数据与此服务器同步)
|
|
const SERVER_URL = 'http://47.104.244.29:3001';
|
|
|
|
let mainWindow;
|
|
|
|
function createWindow() {
|
|
mainWindow = new BrowserWindow({
|
|
width: 1400,
|
|
height: 900,
|
|
minWidth: 1024,
|
|
minHeight: 680,
|
|
title: '影视星河设备管理系统',
|
|
icon: path.join(__dirname, 'icon.png'),
|
|
webPreferences: {
|
|
nodeIntegration: false,
|
|
contextIsolation: true
|
|
},
|
|
autoHideMenuBar: true
|
|
});
|
|
|
|
// 加载远程服务器页面
|
|
mainWindow.loadURL(SERVER_URL);
|
|
|
|
mainWindow.on('closed', () => {
|
|
mainWindow = null;
|
|
});
|
|
}
|
|
|
|
app.whenReady().then(() => {
|
|
createWindow();
|
|
});
|
|
|
|
app.on('window-all-closed', () => {
|
|
app.quit();
|
|
});
|
|
|
|
app.on('activate', () => {
|
|
if (BrowserWindow.getAllWindows().length === 0) {
|
|
createWindow();
|
|
}
|
|
});
|