mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2026-05-21 05:25:45 +08:00
🚸 调整UI显示
This commit is contained in:
@@ -196,7 +196,7 @@ async function handleImport(): Promise<void> {
|
|||||||
await new Promise<void>((resolve) => setTimeout(resolve, 1000));
|
await new Promise<void>((resolve) => setTimeout(resolve, 1000));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
await TSUserGacha.mergeUIGF4(dataFind);
|
await TSUserGacha.mergeUIGF4(dataFind, true);
|
||||||
}
|
}
|
||||||
await showLoading.end();
|
await showLoading.end();
|
||||||
showSnackbar.success("导入成功!");
|
showSnackbar.success("导入成功!");
|
||||||
|
|||||||
@@ -298,7 +298,7 @@ async function importUigf(): Promise<void> {
|
|||||||
showSnackbar.error("导入的祈愿数据为空");
|
showSnackbar.error("导入的祈愿数据为空");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
await TSUserGacha.mergeUIGF(remoteData.info.uid, remoteData.list);
|
await TSUserGacha.mergeUIGF(remoteData.info.uid, remoteData.list, true);
|
||||||
await showLoading.end();
|
await showLoading.end();
|
||||||
showSnackbar.success(`成功导入 ${remoteData.list.length} 条祈愿数据,即将刷新页面`);
|
showSnackbar.success(`成功导入 ${remoteData.list.length} 条祈愿数据,即将刷新页面`);
|
||||||
await TGLogger.Info(
|
await TGLogger.Info(
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* 用户祈愿模块
|
* 用户祈愿模块
|
||||||
* @since Beta v0.8.6
|
* @since Beta v0.8.7
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import showLoading from "@comp/func/loading.js";
|
import showLoading from "@comp/func/loading.js";
|
||||||
@@ -199,12 +199,17 @@ async function cleanGachaRecords(
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 合并祈愿数据
|
* 合并祈愿数据
|
||||||
* @since Beta v0.8.6
|
* @since Beta v0.8.7
|
||||||
* @param {string} uid - UID
|
* @param {string} uid - UID
|
||||||
* @param {TGApp.Plugins.UIGF.GachaItem[]} data - UIGF数据
|
* @param {Array<TGApp.Plugins.UIGF.GachaItem>} data - UIGF数据
|
||||||
|
* @param {boolean} showProgress - 是否显示进度
|
||||||
* @return {Promise<void>}
|
* @return {Promise<void>}
|
||||||
*/
|
*/
|
||||||
async function mergeUIGF(uid: string, data: TGApp.Plugins.UIGF.GachaItem[]): Promise<void> {
|
async function mergeUIGF(
|
||||||
|
uid: string,
|
||||||
|
data: Array<TGApp.Plugins.UIGF.GachaItem>,
|
||||||
|
showProgress: boolean = false,
|
||||||
|
): Promise<void> {
|
||||||
const db = await TGSqlite.getDB();
|
const db = await TGSqlite.getDB();
|
||||||
let cnt = 0;
|
let cnt = 0;
|
||||||
const len = data.length;
|
const len = data.length;
|
||||||
@@ -213,9 +218,11 @@ async function mergeUIGF(uid: string, data: TGApp.Plugins.UIGF.GachaItem[]): Pro
|
|||||||
const trans = transGacha(gacha);
|
const trans = transGacha(gacha);
|
||||||
if (cnt % 20 === 0) {
|
if (cnt % 20 === 0) {
|
||||||
progress = Math.round((cnt / len) * 100 * 100) / 100;
|
progress = Math.round((cnt / len) * 100 * 100) / 100;
|
||||||
await showLoading.update(
|
if (showProgress) {
|
||||||
`[${progress}%][${trans.time}] ${"⭐".repeat(Number(trans.rank_type))}-${trans.name}`,
|
await showLoading.update(
|
||||||
);
|
`[${progress}%][${trans.time}] ${"⭐".repeat(Number(trans.rank_type))}-${trans.name}`,
|
||||||
|
);
|
||||||
|
}
|
||||||
cnt++;
|
cnt++;
|
||||||
}
|
}
|
||||||
const sql = getInsertSql(uid, trans);
|
const sql = getInsertSql(uid, trans);
|
||||||
@@ -225,11 +232,15 @@ async function mergeUIGF(uid: string, data: TGApp.Plugins.UIGF.GachaItem[]): Pro
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 合并祈愿数据(v4.0)
|
* 合并祈愿数据(v4.0)
|
||||||
* @since Beta v0.8.6
|
* @since Beta v0.8.7
|
||||||
* @param {TGApp.Plugins.UIGF.GachaHk4e} data - UIGF数据
|
* @param {TGApp.Plugins.UIGF.GachaHk4e} data - UIGF数据
|
||||||
|
* @param {boolean} showProgress - 是否显示进度
|
||||||
* @return {Promise<void>}
|
* @return {Promise<void>}
|
||||||
*/
|
*/
|
||||||
async function mergeUIGF4(data: TGApp.Plugins.UIGF.GachaHk4e): Promise<void> {
|
async function mergeUIGF4(
|
||||||
|
data: TGApp.Plugins.UIGF.GachaHk4e,
|
||||||
|
showProgress: boolean = false,
|
||||||
|
): Promise<void> {
|
||||||
const db = await TGSqlite.getDB();
|
const db = await TGSqlite.getDB();
|
||||||
let cnt: number = 0;
|
let cnt: number = 0;
|
||||||
const len = data.list.length;
|
const len = data.list.length;
|
||||||
@@ -238,9 +249,11 @@ async function mergeUIGF4(data: TGApp.Plugins.UIGF.GachaHk4e): Promise<void> {
|
|||||||
const trans = transGacha(gacha, data.timezone);
|
const trans = transGacha(gacha, data.timezone);
|
||||||
if (cnt % 20 === 0) {
|
if (cnt % 20 === 0) {
|
||||||
progress = Math.round((cnt / len) * 100 * 100) / 100;
|
progress = Math.round((cnt / len) * 100 * 100) / 100;
|
||||||
await showLoading.update(
|
if (showProgress) {
|
||||||
`[${progress}%][${trans.time}] ${"⭐".repeat(Number(trans.rank_type))}-${trans.name}`,
|
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);
|
||||||
|
|||||||
70
src/types/BBS/Geetest.d.ts
vendored
70
src/types/BBS/Geetest.d.ts
vendored
@@ -5,11 +5,8 @@
|
|||||||
|
|
||||||
declare namespace TGApp.BBS.Geetest {
|
declare namespace TGApp.BBS.Geetest {
|
||||||
/**
|
/**
|
||||||
* @description 创建验证的响应
|
* 创建验证的响应
|
||||||
* @since Beta v0.7.1
|
* @since Beta v0.7.1
|
||||||
* @interface CreateResp
|
|
||||||
* @extends TGApp.BBS.Response.BaseWithData
|
|
||||||
* @property {CreateRes} data - 极验验证数据
|
|
||||||
*/
|
*/
|
||||||
type CreateResp = TGApp.BBS.Response.BaseWithData<CreateRes>;
|
type CreateResp = TGApp.BBS.Response.BaseWithData<CreateRes>;
|
||||||
|
|
||||||
@@ -54,45 +51,45 @@ declare namespace TGApp.BBS.Geetest {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description 验证极验验证的响应
|
* 验证极验验证的响应
|
||||||
* @since Beta v0.7.1
|
* @since Beta v0.7.1
|
||||||
* @interface VerifyResp
|
|
||||||
* @extends TGApp.BBS.Response.Base
|
|
||||||
* @property {VerifyRes} data - 极验验证数据
|
|
||||||
*/
|
*/
|
||||||
type VerifyResp = TGApp.BBS.Response.BaseWithData<VerifyRes>;
|
type VerifyResp = TGApp.BBS.Response.BaseWithData<VerifyRes>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description 极验验证的请求数据
|
* 极验验证的请求数据
|
||||||
* @since Beta v0.7.1
|
* @since Beta v0.7.1
|
||||||
* @interface VerifyRes
|
|
||||||
* @property {string} challenge - 极验验证 challenge
|
|
||||||
* @property {string} validate - 极验验证 validate
|
|
||||||
*/
|
*/
|
||||||
type VerifyRes = { challenge: string };
|
type VerifyRes = {
|
||||||
|
/* 极验验证 challenge */
|
||||||
|
challenge: string;
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description 极验验证的请求方法-请求参数
|
* 极验验证的请求方法-请求参数
|
||||||
* @since Beta v0.7.1
|
* @since Beta v0.7.1
|
||||||
* @interface InitGeetestParams
|
|
||||||
* @property {string} gt - 极验验证 gt
|
|
||||||
* @property {string} challenge - 极验验证 challenge
|
|
||||||
* @property {boolean} offline - 极验验证 offline
|
|
||||||
* @property {boolean} new_captcha - 极验验证 new_captcha
|
|
||||||
* @property {string} product - 极验验证 product
|
|
||||||
* @property {string} width - 极验验证 width
|
|
||||||
* @property {string} area - 极验验证 area
|
|
||||||
*/
|
*/
|
||||||
type InitGeetestParams = {
|
type InitGeetestParams = {
|
||||||
|
/* gt */
|
||||||
gt: string;
|
gt: string;
|
||||||
|
/* challenge */
|
||||||
challenge: string;
|
challenge: string;
|
||||||
|
/* 是否离线 */
|
||||||
offline: boolean;
|
offline: boolean;
|
||||||
|
/* 是否是新验证码 */
|
||||||
new_captcha: boolean;
|
new_captcha: boolean;
|
||||||
|
/* 验证形式 */
|
||||||
product: string;
|
product: string;
|
||||||
|
/* 宽度 */
|
||||||
width: string;
|
width: string;
|
||||||
|
/* 覆盖区域 */
|
||||||
area: string;
|
area: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 初始化 Gt4 验证的请求参数
|
||||||
|
* @since Beta v0.8.7
|
||||||
|
*/
|
||||||
type InitGeetest4Params = {
|
type InitGeetest4Params = {
|
||||||
/* 验证ID */
|
/* 验证ID */
|
||||||
captchaId: string;
|
captchaId: string;
|
||||||
@@ -109,33 +106,26 @@ declare namespace TGApp.BBS.Geetest {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description Geetest 插件 captchaObj
|
* GeetestCaptcha 对象
|
||||||
* @since Beta v0.8.3
|
* @since Beta v0.8.7
|
||||||
* @interface GeetestCaptcha
|
|
||||||
* @property {Function} appendTo
|
|
||||||
* @property {Function} getValidate
|
|
||||||
* @property {Function} onClose
|
|
||||||
* @property {Function} onReady
|
|
||||||
*/
|
*/
|
||||||
type GeetestCaptcha = {
|
type GeetestCaptcha = {
|
||||||
|
/* 将验证码添加到指定的选择器中 */
|
||||||
appendTo: (selector: string) => void;
|
appendTo: (selector: string) => void;
|
||||||
|
/* 获取验证结果 */
|
||||||
getValidate: () => Promise<GeetestVerifyRes>;
|
getValidate: () => Promise<GeetestVerifyRes>;
|
||||||
|
/* 关闭回调 */
|
||||||
onClose: (callback: () => void) => boolean;
|
onClose: (callback: () => void) => boolean;
|
||||||
|
/* 准备就绪回调 */
|
||||||
onReady: (callback: () => void) => void;
|
onReady: (callback: () => void) => void;
|
||||||
|
/* 成功回调 */
|
||||||
onSuccess: (callback: () => void) => void;
|
onSuccess: (callback: () => void) => void;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description Geetest 插件 validate
|
* 验证成功返回数据
|
||||||
* @since Beta v0.7.1
|
* @since Beta v0.8.7
|
||||||
* @interface GeetestVerifyRes
|
* @remarks 由于目前都是直接转 base64 字符串返回,故类型定义为 unknown
|
||||||
* @property {string} geetest_challenge
|
|
||||||
* @property {string} geetest_validate
|
|
||||||
* @property {string} geetest_seccode
|
|
||||||
*/
|
*/
|
||||||
type GeetestVerifyRes = {
|
type GeetestVerifyRes = unknown;
|
||||||
geetest_challenge: string;
|
|
||||||
geetest_validate: string;
|
|
||||||
geetest_seccode: string;
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user