feat: 全站编辑状态自动保存 — 每分钟自动保存 + 右下角立即保存 + 离开拦截

- composable/autosave.ts: 通用 DOM 快照(.tool-content 内 input/textarea/select/contenteditable)
  字段定位 name > tag:type:组内序号(不用动态 id, 实测 Naive UI id 每次刷新都变)
  60s 定时自动保存 + markDirty 变更检测 + 静默恢复(仅当页面基本为空)
- components/AutosaveBar.vue: 右下角状态条 未保存/立即保存/已保存 HH:MM/已恢复
- tool.layout.vue: 按路由挂载(仅 isTool 页), 切页自动 detach
- router.ts: confirmLeave 拦截站内导航 + beforeunload 拦截刷新关闭
  文案「当前内容还没保存,离开会丢失」确定=先保存再离开 取消=留在本页
- 用户开始编辑时「已恢复」提示立即让位给「未保存」
This commit is contained in:
jinghui committed 2026-11-15 01:56:28 +08:00
1 parent 7b6513c7de
commit f529d5e850
5 files changed
+456

No files matched your search

+2
View File
@@ -20,6 +20,7 @@ declare module '@vue/runtime-core' {
App: typeof import('./src/App.vue')['default']
AsciiTextDrawer: typeof import('./src/tools/ascii-text-drawer/ascii-text-drawer.vue')['default']
AudioTools: typeof import('./src/tools/audio-tools/audio-tools.vue')['default']
AutosaveBar: typeof import('./src/components/AutosaveBar.vue')['default']
BarcodeBatchGenerator: typeof import('./src/tools/batch-barcode-generator/barcode-batch-generator.vue')['default']
'Base.layout': typeof import('./src/layouts/base.layout.vue')['default']
Base64FileConverter: typeof import('./src/tools/base64-file-converter/base64-file-converter.vue')['default']
@@ -130,6 +131,7 @@ declare module '@vue/runtime-core' {
IconMdiVideo: typeof import('~icons/mdi/video')['default']
ImageOcr: typeof import('./src/tools/image-ocr/image-ocr.vue')['default']
ImageTools: typeof import('./src/tools/image-tools/image-tools.vue')['default']
ImgEditor: typeof import('./src/tools/ai-gen/img-editor.vue')['default']
ImgHist: typeof import('./src/tools/img-hist/ImgHist.vue')['default']
InputCopyable: typeof import('./src/components/InputCopyable.vue')['default']
IntegerBaseConverter: typeof import('./src/tools/integer-base-converter/integer-base-converter.vue')['default']