feat: 初始化项目

This commit is contained in:
DEV_DSW
2025-09-22 17:05:21 +08:00
parent 1347e31f83
commit 329fc3eb0e
21 changed files with 9462 additions and 1 deletions

31
controller/tray.js Normal file
View File

@@ -0,0 +1,31 @@
// 创建系统托盘
const { Tray, Menu } = require("electron");
const path = require("path");
function createTray(app, win) {
let tray = new Tray(path.join(__dirname, "../public/favicon.ico"));
tray.setToolTip("示例平台"); // 鼠标放在托盘图标上的提示信息
tray.on("click", (e) => {
if (e.shiftKey) {
app.quit();
} else {
win.show();
}
});
tray.setContextMenu(
Menu.buildFromTemplate([
{
label: "退出",
click: () => {
// 先把用户的登录状态和用户的登录信息给清楚掉,再退出
app.quit();
},
},
])
);
}
module.exports = createTray;