mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2026-05-21 05:25:45 +08:00
🚸 调整导入浮窗ui,显示导入进度
This commit is contained in:
@@ -234,6 +234,7 @@ async function handleExport(): Promise<void> {
|
|||||||
position: relative;
|
position: relative;
|
||||||
display: flex;
|
display: flex;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
flex-wrap: wrap;
|
||||||
align-items: flex-end;
|
align-items: flex-end;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
column-gap: 10px;
|
column-gap: 10px;
|
||||||
@@ -249,6 +250,7 @@ async function handleExport(): Promise<void> {
|
|||||||
color: var(--tgc-od-white);
|
color: var(--tgc-od-white);
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
|
word-break: break-all;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ugo-header {
|
.ugo-header {
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
/**
|
/**
|
||||||
* @file plugins/Sqlite/modules/userGacha.ts
|
* 用户祈愿模块
|
||||||
* @description 用户祈愿模块
|
* @since Beta v0.8.6
|
||||||
* @since Beta v0.7.5
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import showLoading from "@comp/func/loading.js";
|
||||||
import showSnackbar from "@comp/func/snackbar.js";
|
import showSnackbar from "@comp/func/snackbar.js";
|
||||||
import { path } from "@tauri-apps/api";
|
import { path } from "@tauri-apps/api";
|
||||||
import { exists, mkdir, readDir } from "@tauri-apps/plugin-fs";
|
import { exists, mkdir, readDir } from "@tauri-apps/plugin-fs";
|
||||||
@@ -198,33 +198,53 @@ async function cleanGachaRecords(
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description 合并祈愿数据
|
* 合并祈愿数据
|
||||||
* @since Beta v0.4.7
|
* @since Beta v0.8.6
|
||||||
* @param {string} uid - UID
|
* @param {string} uid - UID
|
||||||
* @param {TGApp.Plugins.UIGF.GachaItem[]} data - UIGF数据
|
* @param {TGApp.Plugins.UIGF.GachaItem[]} data - UIGF数据
|
||||||
* @return {Promise<void>}
|
* @return {Promise<void>}
|
||||||
*/
|
*/
|
||||||
async function mergeUIGF(uid: string, data: TGApp.Plugins.UIGF.GachaItem[]): Promise<void> {
|
async function mergeUIGF(uid: string, data: TGApp.Plugins.UIGF.GachaItem[]): Promise<void> {
|
||||||
const db = await TGSqlite.getDB();
|
const db = await TGSqlite.getDB();
|
||||||
|
let cnt = 0;
|
||||||
|
const len = data.length;
|
||||||
|
let progress = 0;
|
||||||
for (const gacha of data) {
|
for (const gacha of data) {
|
||||||
const trans = transGacha(gacha);
|
const trans = transGacha(gacha);
|
||||||
|
if (cnt % 20 === 0) {
|
||||||
|
progress = Math.round((cnt / len) * 100 * 100) / 100;
|
||||||
|
await showLoading.update(
|
||||||
|
`[${progress}%][${trans.time}] ${"⭐".repeat(Number(trans.rank_type))}-${trans.name}`,
|
||||||
|
);
|
||||||
|
cnt++;
|
||||||
|
}
|
||||||
const sql = getInsertSql(uid, trans);
|
const sql = getInsertSql(uid, trans);
|
||||||
await db.execute(sql);
|
await db.execute(sql);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description 合并祈愿数据(v4.0)
|
* 合并祈愿数据(v4.0)
|
||||||
* @since Beta v0.5.0
|
* @since Beta v0.8.6
|
||||||
* @param {TGApp.Plugins.UIGF.GachaHk4e} data - UIGF数据
|
* @param {TGApp.Plugins.UIGF.GachaHk4e} data - UIGF数据
|
||||||
* @return {Promise<void>}
|
* @return {Promise<void>}
|
||||||
*/
|
*/
|
||||||
async function mergeUIGF4(data: TGApp.Plugins.UIGF.GachaHk4e): Promise<void> {
|
async function mergeUIGF4(data: TGApp.Plugins.UIGF.GachaHk4e): Promise<void> {
|
||||||
const db = await TGSqlite.getDB();
|
const db = await TGSqlite.getDB();
|
||||||
|
let cnt: number = 0;
|
||||||
|
const len = data.list.length;
|
||||||
|
let progress: number = 0;
|
||||||
for (const gacha of data.list) {
|
for (const gacha of data.list) {
|
||||||
const trans = transGacha(gacha, data.timezone);
|
const trans = transGacha(gacha, data.timezone);
|
||||||
|
if (cnt % 20 === 0) {
|
||||||
|
progress = Math.round((cnt / len) * 100 * 100) / 100;
|
||||||
|
await showLoading.update(
|
||||||
|
`[${progress}%][${trans.time}] ${"⭐".repeat(Number(trans.rank_type))}-${trans.name}`,
|
||||||
|
);
|
||||||
|
}
|
||||||
const sql = getInsertSql(data.uid.toString(), trans);
|
const sql = getInsertSql(data.uid.toString(), trans);
|
||||||
await db.execute(sql);
|
await db.execute(sql);
|
||||||
|
cnt++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user