From a71d5664cbbbc44cf59cd6f82b25db60994cd011 Mon Sep 17 00:00:00 2001 From: BTMuli Date: Fri, 19 Dec 2025 16:12:45 +0800 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20=E7=A5=88=E6=84=BF?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=A4=87=E4=BB=BD=E8=BF=AD=E4=BB=A3=EF=BC=8C?= =?UTF-8?q?=E9=87=87=E7=94=A8UIGF4=EF=BC=8C=E8=B0=83=E6=95=B4=E5=AF=BC?= =?UTF-8?q?=E5=85=A5=E8=BF=9B=E5=BA=A6=E6=9B=B4=E6=96=B0=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/userGacha/ugo-uid.vue | 36 +++---- src/plugins/Sqlite/modules/userGacha.ts | 131 +++++++++++++++--------- src/utils/UIGF.ts | 53 ++++++---- src/utils/dataBS.ts | 14 +-- 4 files changed, 139 insertions(+), 95 deletions(-) diff --git a/src/components/userGacha/ugo-uid.vue b/src/components/userGacha/ugo-uid.vue index b26902da..d5b4eef1 100644 --- a/src/components/userGacha/ugo-uid.vue +++ b/src/components/userGacha/ugo-uid.vue @@ -5,7 +5,7 @@
{{ title }}
文件路径:{{ fp }}
-
+
应用信息:
{{ dataRaw.info.export_app }} {{ dataRaw.info.export_app_version }}
@@ -19,7 +19,7 @@
{{ timestampToDate(Number(dataRaw.info.export_timestamp) * 1000) }}
- +
- 取消 - 确定 + 取消 + 确定
@@ -53,10 +53,9 @@ import showSnackbar from "@comp/func/snackbar.js"; import TSUserGacha from "@Sqlm/userGacha.js"; import { path } from "@tauri-apps/api"; import { open } from "@tauri-apps/plugin-dialog"; -import { writeTextFile } from "@tauri-apps/plugin-fs"; import TGLogger from "@utils/TGLogger.js"; import { timestampToDate } from "@utils/toolFunc.js"; -import { getUigf4Header, getUigf4Item, readUigf4Data, verifyUigfData } from "@utils/UIGF.js"; +import { exportUigf4Data, readUigf4Data, verifyUigfData } from "@utils/UIGF.js"; import { computed, onMounted, ref, shallowRef, watch } from "vue"; type UgoUidProps = { mode: "import" | "export" }; @@ -77,14 +76,14 @@ onMounted(async () => { }); watch( - () => visible.value, + () => [visible.value, props.mode], async () => { if (visible.value) await refreshData(); }, ); async function getDefaultSavePath(): Promise { - const tsNow = new Date().getTime(); + const tsNow = Math.floor(Date.now() / 1000); return `${await path.downloadDir()}${path.sep()}UIGFv4.1_${tsNow}.json`; } @@ -208,22 +207,21 @@ async function handleExport(): Promise { showSnackbar.warn("请至少选择一个!"); return; } - await showLoading.start("正在导出数据...", "正在生成文件头"); - const header = await getUigf4Header(); - const data: TGApp.Plugins.UIGF.GachaHk4e[] = []; - for (const item of selectedData.value) { - await showLoading.update(`正在导出UID: ${item.uid}`); - const dataItem = await getUigf4Item(item.uid); - data.push(dataItem); - } - await showLoading.update("正在写入文件..."); - await writeTextFile(fp.value, JSON.stringify({ info: header, hk4e: data })); + const totalCnt = selectedData.value.map((s) => s.length).reduce((a, b) => a + b, 0); + await showLoading.start( + "正在导出数据...", + `${selectedData.value.length}条UID - ${totalCnt}条记录`, + ); + await exportUigf4Data( + selectedData.value.map((s) => s.uid.toString()), + fp.value, + ); await showLoading.end(); showSnackbar.success(`导出成功! 文件路径: ${fp.value}`); fp.value = await getDefaultSavePath(); } -