♻️ 对于部分点击外部事件进行特殊处理

This commit is contained in:
BTMuli
2023-12-29 23:02:01 +08:00
parent 65e3fd2019
commit 147719ad36
8 changed files with 75 additions and 55 deletions

View File

@@ -156,7 +156,7 @@ async function switchHideFin() {
title: "是否切换显示已完成?",
text,
});
if (res === false) {
if (!res) {
showSnackbar({
color: "warn",
text: "已取消切换",
@@ -352,37 +352,37 @@ async function handleImportOuter(app: string): Promise<void> {
title: "是否导入祈愿数据?",
text: `来源APP${app}`,
});
if (confirm) {
// 读取 剪贴板
const clipboard = await window.navigator.clipboard.readText();
let data: TGApp.Plugins.UIAF.Achievement[];
// 里面是完整的 uiaf 数据
try {
data = JSON.parse(clipboard).list;
loadingTitle.value = "正在导入数据";
loading.value = true;
await TGSqlite.mergeUIAF(data);
loading.value = false;
showSnackbar({
color: "success",
text: "导入成功,即将刷新页面",
});
} catch (e) {
console.error(e);
showSnackbar({
color: "error",
text: "读取 UIAF 数据失败,请检查文件是否符合规范",
});
} finally {
setTimeout(async () => {
await router.push("/achievements");
}, 1500);
}
} else {
if (!confirm) {
showSnackbar({
color: "warn",
text: "已取消导入",
});
return;
}
// 读取 剪贴板
const clipboard = await window.navigator.clipboard.readText();
let data: TGApp.Plugins.UIAF.Achievement[];
// 里面是完整的 uiaf 数据
try {
data = JSON.parse(clipboard).list;
loadingTitle.value = "正在导入数据";
loading.value = true;
await TGSqlite.mergeUIAF(data);
loading.value = false;
showSnackbar({
color: "success",
text: "导入成功,即将刷新页面",
});
} catch (e) {
console.error(e);
showSnackbar({
color: "error",
text: "读取 UIAF 数据失败,请检查文件是否符合规范",
});
} finally {
setTimeout(async () => {
await router.push("/achievements");
}, 1500);
}
}

View File

@@ -467,7 +467,7 @@ async function confirmUpdateDevice(): Promise<void> {
title: "确认更新设备信息吗?",
text: `DeviceFp:${localFp}`,
});
if (res === false) {
if (!res) {
showSnackbar({
text: "已取消更新设备信息",
color: "cancel",
@@ -508,7 +508,7 @@ async function confirmDelCache(): Promise<void> {
title: "确认清除缓存吗?",
text: `当前缓存大小为 ${cacheSize},耗时 ${timeEnd - timeStart} 毫秒`,
});
if (res === false) {
if (!res) {
showSnackbar({
color: "grey",
text: "已取消清除缓存",
@@ -556,7 +556,7 @@ async function tryShowReset(): Promise<void> {
text: "请联系开发者获取",
mode: "input",
});
if (res === false) {
if (!res) {
showSnackbar({
color: "grey",
text: "已取消",

View File

@@ -274,6 +274,13 @@ async function toNav(path: string): Promise<void> {
title: "是否采用宽屏模式打开?",
text: "取消则采用竖屏模式打开",
});
if (modeConfirm === undefined) {
showSnackbar({
text: "已取消打开",
color: "cancel",
});
return;
}
if (modeConfirm) await TGClient.open("web_act", path);
else await TGClient.open("web_act_thin", path);
}