feat: 去除构建时版控变量 + 窗口标题动态版控 + 退出登录保留缓存 (0.0.24)
版控体系重构(13 文件):
- 移除 build.mjs --personal/--enterprise 参数和 EDITION 环境变量
- 统一安装包文件名:船长-HeiXiu-{os}-{版本号}-Setup.{ext}
- 简化 package.json 构建脚本,移除 :enterprise 变体
- scripts/*.mjs 不再接受 edition 参数
- 移除 shared/constants/app.ts 的 parseEdition()
窗口标题动态版控:
- 新格式:船长-HeiXiu-{os}-{版本号}(登录前)/ ·{版控} 后缀(登录后)
- 链路:AppProvider(account_type) → useEffect → appRuntime IPC → main process
- 移除 updater.ts 更新检查 API 的 edition 查询参数
本地存储生命周期修正:
- 退出登录不再自动清空缓存(user_id 隔离,重新登录命中缓存)
- clearUserStorage 添加 isOpen() 竞态守卫
- 移除 closeDatabase() 避免退出→重新登录后数据库不可用
- 手动「清理缓存」按钮保留
文档:
- CHANGELOG.md 新增 0.0.24 条目
- TODO.md 新增已完成项
This commit is contained in:
@@ -1,16 +1,41 @@
|
||||
// ============================================================
|
||||
// display — 显示格式化工具(金额、日期等)
|
||||
// 各页面共用的纯函数,避免重复定义
|
||||
// display — 展示/格式化工具(金额、日期、Logo 资产、类型别名)
|
||||
// 合并自 display.ts + logo.ts + type.ts
|
||||
// ============================================================
|
||||
|
||||
/** 将分转为元,保留两位小数 */
|
||||
import { isMacOS, isWindows } from './env';
|
||||
|
||||
// ========== 金额 & 日期格式化(原 display.ts)==========
|
||||
|
||||
export function centToYuan(cent: number): string {
|
||||
return (cent / 100).toFixed(2);
|
||||
}
|
||||
|
||||
/** 格式化日期为 zh-CN 本地字符串 */
|
||||
export function formatDate(date: Date | string | undefined): string {
|
||||
if (!date) return '—';
|
||||
const d = typeof date === 'string' ? new Date(date) : date;
|
||||
return d.toLocaleDateString('zh-CN', { year: 'numeric', month: '2-digit', day: '2-digit' });
|
||||
}
|
||||
|
||||
// ========== Logo 资产(原 logo.ts)==========
|
||||
|
||||
import hxPng from '../assets/logo/HX.png';
|
||||
import hx2Png from '../assets/logo/HX2.png';
|
||||
|
||||
export function getMainLogoUrl(): string { return hxPng; }
|
||||
export function getAltLogoUrl(): string { return hx2Png; }
|
||||
|
||||
export function getFaviconPath(): string {
|
||||
if (isWindows()) return '/src/assets/logo/heixiu.ico';
|
||||
return hxPng;
|
||||
}
|
||||
|
||||
export function getPlatformIconFormatInfo(): string {
|
||||
if (isMacOS()) return '.icns(当前使用 .png 回退)';
|
||||
if (isWindows()) return '.ico';
|
||||
return '.png';
|
||||
}
|
||||
|
||||
// ========== 类型别名(原 type.ts)==========
|
||||
|
||||
export type Nullable<T> = T | null;
|
||||
|
||||
Reference in New Issue
Block a user