增加新手引导

git push
This commit is contained in:
muwoo
2023-08-02 14:03:07 +08:00
parent 6cbd5fe15b
commit e3b10d53e2
29 changed files with 171 additions and 57 deletions

View File

@@ -1,22 +1,23 @@
import { dialog, Menu, Tray, app, shell, BrowserWindow } from "electron";
import path from "path";
import pkg from "../../../package.json";
import os from "os";
import API from "../common/api";
import commonConst from "@/common/utils/commonConst";
import { dialog, Menu, Tray, app, shell, BrowserWindow } from 'electron';
import path from 'path';
import pkg from '../../../package.json';
import os from 'os';
import API from '../common/api';
import commonConst from '@/common/utils/commonConst';
import { guide } from '../browsers';
function createTray(window: BrowserWindow): Promise<Tray> {
return new Promise(resolve => {
return new Promise((resolve) => {
let icon;
if (commonConst.macOS()) {
icon = "./icons/icon@3x.png";
icon = './icons/icon@3x.png';
} else if (commonConst.windows()) {
icon =
parseInt(os.release()) < 10
? "./icons/icon@2x.png"
: "./icons/icon.ico";
? './icons/icon@2x.png'
: './icons/icon.ico';
} else {
icon = "./icons/icon@2x.png";
icon = './icons/icon@2x.png';
}
const appIcon = new Tray(path.join(__static, icon));
@@ -35,61 +36,67 @@ function createTray(window: BrowserWindow): Promise<Tray> {
const createContextMenu = () =>
Menu.buildFromTemplate([
{
label: "帮助文档",
label: '帮助文档',
click: () => {
process.nextTick(() => {
shell.openExternal("https://github.com/clouDr-f2e/rubick");
shell.openExternal('https://github.com/clouDr-f2e/rubick');
});
}
},
},
{
label: "意见反馈",
label: '引导教学',
click: () => {
guide().init();
},
},
{
label: '意见反馈',
click: () => {
process.nextTick(() => {
shell.openExternal("https://github.com/clouDr-f2e/rubick/issues");
shell.openExternal('https://github.com/clouDr-f2e/rubick/issues');
});
}
},
},
{ type: "separator" },
{ type: 'separator' },
{
label: "显示窗口",
label: '显示窗口',
accelerator: getShowAndHiddenHotKey(),
click() {
window.show();
}
},
},
{
label: "系统设置",
label: '系统设置',
click() {
openSettings();
}
},
},
{ type: "separator" },
{ type: 'separator' },
{
role: "quit",
label: "退出"
role: 'quit',
label: '退出',
},
{
label: "重启",
label: '重启',
click() {
app.relaunch();
app.quit();
}
},
},
{ type: "separator" },
{ type: 'separator' },
{
label: "关于",
label: '关于',
click() {
dialog.showMessageBox({
title: "拉比克",
message: "极简、插件化的现代桌面软件",
detail: `Version: ${pkg.version}\nAuthor: muwoo`
title: '拉比克',
message: '极简、插件化的现代桌面软件',
detail: `Version: ${pkg.version}\nAuthor: muwoo`,
});
}
}
},
},
]);
appIcon.on("click", () => {
appIcon.on('click', () => {
appIcon.setContextMenu(createContextMenu());
appIcon.popUpContextMenu();
});