feat: 初始化船长·HeiXiu 桌面应用项目(错误是svg的问题)

Electron + React 19 + TypeScript + Ant Design 6 + Tailwind CSS 4

  【核心架构】
  - Electron 主进程(窗口管理、平台检测、图标适配)
  - Vite 构建链(双产物 dist/ + dist-electron/)
  - 共享层 shared/(类型、常量、工具函数)
  - IPC 通信框架 + 安全守卫

  【主题系统】
  - 蓝紫渐变主题(亮色/暗色双模式)
  - Ant Design ConfigProvider 适配(lightAlgorithm / darkAlgorithm)
  - Tailwind CSS 4 @theme 指令 + CSS 变量
  - 设计令牌三处同步(tokens.ts / globals.css / antd-theme.ts)

  【导航栏】
  - 自定义 H5 导航栏替代系统菜单
  - 个人版/企业版双布局
  - 未登录拦截 + 事件总线驱动登录弹窗

  【登录注册】
  - Modal 弹层(Portal)+ Tabs 切换
  - 登录/注册表单动态字段渲染
  - 记住密码 / 自动登录 / 用户协议

  【更新系统】
  - 自定义 API 版本检查(替代 electron-updater generic provider)
  - 手动下载 + SHA512 校验 + spawn NSIS 安装
  - 渲染进程更新状态机 Hook(useUpdater)
  - 检查更新按钮 + 下载进度展示

  【构建工具链】
  - build.mjs 构建总管(--win/--mac/--linux --personal/--enterprise --build/--clean/--sign/--upload/--publish)
  - scripts/ 自动化脚本(clean / generate-update-info / upload-oss / publish-release)
  - electron-builder NSIS 安装器(可选路径、多版本打包)
  - update-info.json 自动生成(fileSize/sha512/changelog/releaseDate)

  【代码质量】
  - ESLint + TypeScript strict + Prettier
  - husky + lint-staged(提交前自动检查)
  - commitlint(规范提交信息)
  - Playwright E2E + Vitest 单元测试框架
  - rollup-plugin-visualizer 打包体积分析

  【文档】
  - README.md(快速开始 + 目录结构 + 命令速查)
  - UpdateA.md(发布手册:API/签名/发版流程/数据库)
  - CHANGELOG.md(更新日志)
  - .env.example(构建环境变量模板)
This commit is contained in:
2026-06-03 15:00:51 +08:00
commit 767bb8b297
95 changed files with 20814 additions and 0 deletions

View File

@@ -0,0 +1,58 @@
// ============================================================
// 最小化系统菜单
//
// 策略:已全面采用 H5 自定义导航栏,系统菜单仅保留 macOS 必需的 Edit 菜单
// (否则 Cmd+C/V/A 等系统级快捷键会失效)。
//
// macOS → 仅 Edit 菜单undo/redo/cut/copy/paste/selectAll
// Windows → 完全移除系统菜单栏
// Linux → 完全移除系统菜单栏
// ============================================================
import { app, Menu, type MenuItemConstructorOptions } from 'electron';
import { isMacOS } from '../utils/platform';
import { APP_NAME } from '../../../shared/constants/app';
import { APP_VERSION } from '../../../shared/constants/version';
/**
* macOS 最小 Edit 菜单
* 必须保留,否则 Cmd+C / Cmd+V / Cmd+A / Cmd+Z 等快捷键全部失效
*/
function buildMinimalEditMenu(): MenuItemConstructorOptions {
return {
label: 'Edit',
submenu: [
{ label: '撤销', accelerator: 'Cmd+Z', role: 'undo' },
{ label: '重做', accelerator: 'Shift+Cmd+Z', role: 'redo' },
{ type: 'separator' },
{ label: '剪切', accelerator: 'Cmd+X', role: 'cut' },
{ label: '复制', accelerator: 'Cmd+C', role: 'copy' },
{ label: '粘贴', accelerator: 'Cmd+V', role: 'paste' },
{ label: '全选', accelerator: 'Cmd+A', role: 'selectAll' },
],
};
}
/**
* 设置应用菜单
* macOS → 最小 Edit 菜单
* Windows/Linux → 无菜单(导航栏由 H5 组件实现)
*/
export function setupAppMenu(): void {
if (isMacOS()) {
const template: MenuItemConstructorOptions[] = [buildMinimalEditMenu()];
const menu = Menu.buildFromTemplate(template);
Menu.setApplicationMenu(menu);
} else {
// Windows / Linux完全移除菜单栏
Menu.setApplicationMenu(null);
}
// 关于面板信息macOS 原生 About / Windows 自定义)
app.setAboutPanelOptions({
applicationName: APP_NAME,
applicationVersion: APP_VERSION,
version: '',
credits: 'Powered by Electron + React 19 + TypeScript',
});
}