Files
2026-06-11 09:53:11 +08:00

2 lines
2.5 KiB
JavaScript

"use strict";const t=require("../../../common/vendor.js"),e=require("../../../utils/store.js");Math||a();const a=()=>"../../../components/SectionCard.js",n={__name:"index",setup(a){const n=e.useAppStore(),o=t.ref(""),s=t.computed((()=>"dark"===n.state.settings.theme?"theme-dark":""));function i(){!function(e){const a=(new Date).toLocaleString();if(void 0!==t.wx$1&&t.wx$1.getFileSystemManager){const o=`${t.wx$1.env.USER_DATA_PATH}/bill-helper-backup.json`;t.wx$1.getFileSystemManager().writeFile({filePath:o,data:e,encoding:"utf8",success:()=>{n.markBackup(a),t.index.showModal({title:"备份成功",content:`文件已生成:${o}`,showCancel:!1})},fail:()=>{t.index.setClipboardData({data:e})}})}else n.markBackup(a),t.index.setClipboardData({data:e})}(n.exportBackup())}function l(){if(o.value.trim())try{n.importBackup(o.value),o.value="",t.index.showToast({title:"备份恢复成功",icon:"none"})}catch(e){t.index.showToast({title:"备份内容无效",icon:"none"})}else t.index.showToast({title:"请先粘贴备份内容",icon:"none"})}function c(){t.index.setClipboardData({data:n.exportBackup()})}function r(){t.index.showModal({title:"清空全部数据",content:"确认删除当前设备中的账单、预算和设置吗?此操作不可撤销。",success:({confirm:e})=>{e&&(n.resetAll(),t.index.showToast({title:"本地数据已清空",icon:"none"}))}})}return t.onShow((()=>{!function(){let e=null;t.wx$1.createInterstitialAd&&(e=t.wx$1.createInterstitialAd({adUnitId:"adunit-0abc32053b19a4e9"}),e.onLoad((()=>{})),e.onError((t=>{console.error("插屏广告加载失败",t)})),e.onClose((()=>{})));setTimeout((()=>{e&&e.show().catch((t=>{console.error("插屏广告显示失败",t)}))}),2280)}()})),(e,a)=>t.e({a:t.t(t.unref(n).state.settings.lastBackupAt?"最近已备份":"尚未备份"),b:t.t(t.unref(n).state.settings.lastBackupAt?"可继续备份":"建议先备份"),c:t.o(i),d:t.unref(n).state.settings.lastBackupAt},t.unref(n).state.settings.lastBackupAt?{e:t.t(t.unref(n).state.settings.lastBackupAt)}:{},{f:t.p({title:"导出备份",subtitle:"将账单、预算和设置导出为 JSON 文件,便于迁移设备或手动保存"}),g:o.value,h:t.o((t=>o.value=t.detail.value)),i:t.o((t=>o.value="")),j:t.o(l),k:t.p({title:"恢复备份",subtitle:"粘贴之前导出的 JSON 内容,恢复后将覆盖当前设备数据"}),l:t.o(c),m:t.o(r),n:t.p({title:"数据操作",subtitle:"谨慎执行不可撤销的本地清理操作"}),o:t.n(s.value)})}},o=t._export_sfc(n,[["__scopeId","data-v-15765fe6"]]);wx.createPage(o);