Files
daywork/intern-log/README.md
T

43 lines
2.0 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# intern-log 客户端
实习工作日志的多端客户端(网页 / Electron 桌面 / Capacitor 安卓共用同一套源码)。
整体架构、部署与安全设计见仓库根目录 [README](../README.md);设计方案见 [docs/实习工作日志系统-设计方案.md](../docs/实习工作日志系统-设计方案.md)。
## 运行
pnpm install
pnpm dev # 开发模式,默认 http://localhost:5173
pnpm build # 构建产物到 dist/(服务端容器托管的就是它)
pnpm preview # 预览构建产物,默认 http://localhost:4173
## 数据模型(重要)
- **服务器是唯一数据权威**,本地 Dexie(IndexedDB)只是实时缓存:
每次写操作立即推送差异到服务器,并以服务器返回的快照全量重建缓存
- 同步引擎:`src/sync/engine.ts`(差异推送 + 快照重建 + SSE 实时通知 + 60s 兜底)
- 本地库按云端用户隔离:`intern_worklog_<云端userId>`
## 目录速览
src/
├─ views/ 页面(日历/详情/统计/总结/记账/备忘录/密码库/设置/用户管理)
├─ components/ 通用组件与自绘 SVG 图标(icons.ts)
├─ db/ schema(Dexie)/ repo(数据仓库,写后即推)/ auth(云端登录)/ vault(加密密码库)
├─ sync/ 同步引擎
├─ domain/ 考勤计算 / AI 润色
└─ lib/ 日期、加密、下载、toast、错误浮层、服务器基址
## 打包
- 桌面:`pnpm dist` → release/InternLog-Setup-*.exe(NSIS)与 win-unpacked/
- 安卓:`pnpm build && npx cap sync android` → android/gradlew.bat assembleDebug
(需 JDK 17:set JAVA_HOME=C:\Program Files\Java\jdk-17)
## 验证脚本(repro/)
开发期回归工具,不参与构建:
- `protocol-audit.mjs` / `admin-audit.mjs`:对本地同步服务(127.0.0.1:3780)的协议级审计
- `two-device.ts` / `engine-realtime.ts` / `unit-tests.ts`:引擎级与单元测试(用 esbuild 打包后 node 运行,命令见文件头注释)