IYUUPlus-Windows/menu/menu.js

93 lines
2.7 KiB
JavaScript
Raw Normal View History

2024-06-27 18:27:45 +08:00
const { Menu, BrowserWindow } = require("electron")
2024-07-01 16:50:17 +08:00
const path = require('node:path')
2024-06-27 18:27:45 +08:00
const server = require('../server/server');
2024-07-01 14:08:06 +08:00
const mainWin = require('../windows/app');
2024-06-27 18:27:45 +08:00
2024-07-01 16:50:17 +08:00
const iconPath = path.join(__dirname, '..', 'iyuu.ico')
2024-06-27 18:27:45 +08:00
let template = [
{
label: "IYUU",
submenu: [
2024-06-29 00:41:06 +08:00
{
label: "刷新",
click: () => {
2024-07-01 14:08:06 +08:00
mainWin.refreshUrl()
2024-06-29 00:41:06 +08:00
}
},
2024-06-27 18:27:45 +08:00
{
label: "重启服务",
click: () => {
server.restartServer()
}
},
{
label: "文档中心",
click: () => {
let win = new BrowserWindow({
width: 800,
height: 600,
2024-07-01 16:50:17 +08:00
icon: iconPath,
2024-06-27 18:27:45 +08:00
webPreferences: {
nodeIntegration: true,
contextIsolation: false,
}
});
win.loadURL("https://doc.iyuu.cn/");
win.on("closed", () => {
win = null;
});
}
},
]
},
{
label: "帮助",
submenu: [
{
2024-06-29 00:41:06 +08:00
label: "问题反馈",
2024-06-27 18:27:45 +08:00
click: () => {
let win = new BrowserWindow({
width: 800,
height: 600,
2024-07-01 16:50:17 +08:00
icon: iconPath,
2024-06-27 18:27:45 +08:00
webPreferences: {
nodeIntegration: true,
contextIsolation: false,
}
});
2024-06-29 00:41:06 +08:00
win.loadURL("https://gitee.com/qyg2297248353/iyuuplus-windows/issues");
2024-06-27 18:27:45 +08:00
win.on("closed", () => {
win = null;
});
}
},
{
2024-06-29 00:41:06 +08:00
label: "新疆萌森软件开发工作室提供技术支持",
2024-06-27 18:27:45 +08:00
click: () => {
let win = new BrowserWindow({
width: 800,
height: 600,
2024-07-01 16:50:17 +08:00
icon: iconPath,
2024-06-27 18:27:45 +08:00
webPreferences: {
nodeIntegration: true,
contextIsolation: false,
}
});
2024-06-29 00:41:06 +08:00
win.loadURL("https://lifebus.top/");
2024-06-27 18:27:45 +08:00
win.on("closed", () => {
win = null;
});
}
2024-06-29 00:41:06 +08:00
},
{
label: "关于"
2024-06-27 18:27:45 +08:00
}
]
}
]
const m = Menu.buildFromTemplate(template)
Menu.setApplicationMenu(m)