add: base module

This commit is contained in:
2025-03-10 16:29:47 +08:00
parent 8b59a8e21a
commit 3a583a3619
40 changed files with 2698 additions and 218 deletions

View File

@@ -1,10 +1,11 @@
import { createEnterPage } from '../window/page/enter';
import { createEnterPage } from '../window/page/enter.ts';
import { BrowserWindow, Menu, app } from 'electron';
import path from 'path';
import { getLogPath, log } from '../logger';
import { createAppPackagesPage } from '../window/page/app-packages';
import { relunch } from '../window/relunch';
import { getLogPath, log } from '../logger.ts';
import { createAppPackagesPage } from '../window/page/app-packages.ts';
import { relunch } from '../window/relunch.ts';
import { checkShowPage } from '../window/page/index.ts';
export const loadMenu = () => {
const template = [
{
@@ -32,11 +33,40 @@ export const loadMenu = () => {
// },
],
},
{
label: '打开应用',
submenu: [
{
label: '首页',
click: () => {
// 获取当前window
const mainWindow = BrowserWindow.getFocusedWindow();
if (mainWindow) {
checkShowPage(mainWindow);
}
},
},
{
label: '打开配置',
click: async () => {
createEnterPage();
},
},
{
label: '打开应用市场',
click: async () => {
createAppPackagesPage();
},
},
],
},
{
label: '编辑',
submenu: [
{ label: '复制', accelerator: 'CmdOrCtrl+C', selector: 'copy:' },
{ label: '粘贴', accelerator: 'CmdOrCtrl+V', selector: 'paste:' },
{ label: '撤销', accelerator: 'CmdOrCtrl+Z', selector: 'undo:' },
{ label: '全选', accelerator: 'CmdOrCtrl+A', selector: 'selectAll:' },
],
},
{
@@ -72,13 +102,6 @@ export const loadMenu = () => {
label: '帮助',
role: 'help',
submenu: [
{
label: '文档',
click: async () => {
const { shell } = require('electron');
// shell.openExternal('http://adstudio.nisar.ai/docs/');
},
},
{
label: '打开日志',
click: async () => {
@@ -87,18 +110,6 @@ export const loadMenu = () => {
shell.openExternal('file://' + path.join(getLogPath()));
},
},
{
label: '打开配置',
click: async () => {
createEnterPage();
},
},
{
label: '打开应用市场',
click: async () => {
createAppPackagesPage();
},
},
],
},
];