yangjie #47

Merged
yangqiang merged 49 commits from yangjie into master 2025-01-24 13:43:09 +08:00
1 changed files with 11 additions and 2 deletions
Showing only changes of commit fb05838a68 - Show all commits

13
main.js
View File

@ -29,6 +29,7 @@ let regKey;
let connection = null; let connection = null;
let envStr; let envStr;
let startNumber = 0; let startNumber = 0;
let buildStatus = false; //true 打包开发版本 false 本地开发
powerSaveBlocker.start('prevent-display-sleep') powerSaveBlocker.start('prevent-display-sleep')
const id = powerSaveBlocker.start('prevent-display-sleep') const id = powerSaveBlocker.start('prevent-display-sleep')
powerSaveBlocker.stop(id) powerSaveBlocker.stop(id)
@ -53,7 +54,11 @@ class AppWindow extends BrowserWindow {
super(finalConfig); super(finalConfig);
if (env === 'development') { if (env === 'development') {
// 开发 // 开发
this.loadURL('http://localhost:3000'); if (buildStatus) {
this.loadFile(path.resolve(__dirname, './dist/index.html'));
} else {
this.loadURL('http://localhost:3000');
}
} else { } else {
// 测试 | 生产 // 测试 | 生产
this.loadFile(path.resolve(__dirname, './dist/index.html')); this.loadFile(path.resolve(__dirname, './dist/index.html'));
@ -584,7 +589,11 @@ app.on('ready', () => {
}) })
if (envStr === 'development') { if (envStr === 'development') {
// 开发 // 开发
child.loadURL(config.url) if (buildStatus) {
child.loadURL(`file://${path.join(__dirname, './dist/index.html')}#/${config.key}`);
} else {
child.loadURL(config.url)
}
} else { } else {
// 测试 | 生产 // 测试 | 生产
child.loadURL(`file://${path.join(__dirname, './dist/index.html')}#/${config.key}`); child.loadURL(`file://${path.join(__dirname, './dist/index.html')}#/${config.key}`);