Skip to content

Commit

Permalink
app ready
Browse files Browse the repository at this point in the history
1
  • Loading branch information
NeserCode committed Jun 4, 2022
1 parent a77f77c commit ef9bb3f
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 77 deletions.
16 changes: 10 additions & 6 deletions src/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,16 +55,15 @@ async function createWindow() {
}, {
label: 'Exit',
click: () => {
loadingWindow.close()
mainWindow.close()
},
}];
// 创建托盘实例
if (process.env.WEBPACK_DEV_SERVER_URL)
const iconPath = nativeImage.createFromPath(path.join(__dirname, '../src/assets/', 'logo.png'))
appTray = new Tray(path.join(__dirname, '../src/assets/', 'logo.png'));
else
const iconPath = nativeImage.createFromPath(path.join('app://./icon.png'))
appTray = new Tray(iconPath);
appTray = new Tray(path.join(app.getAppPath(), '/icon.png'));

// 图标的上下文菜单
const contextMenu = Menu.buildFromTemplate(trayMenuTemplate);

Expand All @@ -81,7 +80,6 @@ async function createWindow() {

// Load the url of the dev server if in development mode

createProtocol('app')
if (process.env.WEBPACK_DEV_SERVER_URL)
mainWindow.loadURL(process.env.WEBPACK_DEV_SERVER_URL)
else mainWindow.loadURL("app://./index.html")
Expand Down Expand Up @@ -113,6 +111,7 @@ async function createWindow() {
mainWindow.maximize();
}
})

// 主进程监听打开托盘事件
ipcMain.on('hide-in-bar', () => {
mainWindow.hide()
Expand Down Expand Up @@ -176,12 +175,17 @@ async function createLoadingWindow() {
webSecurity: false,
}
})
loadingWindow.loadFile(path.join(__dirname, '../public/', 'cover.html'))
createProtocol('app')
if (process.env.WEBPACK_DEV_SERVER_URL)
loadingWindow.loadURL(path.join(__dirname, '../public/', 'cover.html'))
else loadingWindow.loadURL("app://./cover.html")

loadingWindow.show()
loadingWindow.focus()
createWindow()
loadingWindow.setAlwaysOnTop(!loadingWindow.isAlwaysOnTop())
mainWindow.hide()

ipcMain.on('loading-finish', () => {
setTimeout(() => {
mainWindow.show()
Expand Down
35 changes: 0 additions & 35 deletions src/user/appConfig copy.json

This file was deleted.

35 changes: 0 additions & 35 deletions src/user/appConfig.json

This file was deleted.

1 change: 0 additions & 1 deletion src/views/Home.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ export default {
<style scoped lang="postcss">
.home {
@apply w-full h-full relative;
min-height: calc(100vh -);
}
.topContainer {
Expand Down

0 comments on commit ef9bb3f

Please sign in to comment.