mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2025-12-11 09:08:14 +08:00
♻️ 对于部分点击外部事件进行特殊处理
This commit is contained in:
@@ -236,16 +236,16 @@ async function checkUpdate(): Promise<void> {
|
||||
title: "检测到版本更新",
|
||||
text: "请到设置页手动更新版本,即将弹出更新说明子页面",
|
||||
});
|
||||
if (confirm) {
|
||||
appStore.buildTime = getBuildTime();
|
||||
window.open("https://app.btmuli.ink/docs/Changelogs.html");
|
||||
} else {
|
||||
if (!confirm) {
|
||||
showSnackbar({
|
||||
text: "请到设置页手动更新版本!",
|
||||
color: "error",
|
||||
timeout: 3000,
|
||||
});
|
||||
return;
|
||||
}
|
||||
appStore.buildTime = getBuildTime();
|
||||
window.open("https://app.btmuli.ink/docs/Changelogs.html");
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -9,6 +9,7 @@ import { toRaw } from "vue";
|
||||
|
||||
import TGClient from "../../utils/TGClient";
|
||||
import showConfirm from "../func/confirm";
|
||||
import showSnackbar from "../func/snackbar";
|
||||
|
||||
interface TpMention {
|
||||
insert: {
|
||||
@@ -28,18 +29,26 @@ const props = defineProps<TpMentionProps>();
|
||||
console.log("tpMention", props.data.insert.mention.uid, toRaw(props.data).insert.mention);
|
||||
|
||||
async function toLink(): Promise<void> {
|
||||
let prefix = "";
|
||||
const uid = props.data.insert.mention.uid;
|
||||
const confirm = await showConfirm({
|
||||
title: "跳转提示",
|
||||
text: "是否采用内置 JSBridge 跳转?",
|
||||
});
|
||||
if (confirm) {
|
||||
const prefix = "https://m.miyoushe.com/ys/#/accountCenter/0?id=";
|
||||
await TGClient.open("mention", `${prefix}${uid}`);
|
||||
} else {
|
||||
const prefix = "https://www.miyoushe.com/ys/accountCenter/postList?id=";
|
||||
window.open(`${prefix}${uid}`);
|
||||
if (confirm === undefined) {
|
||||
showSnackbar({
|
||||
text: "已取消跳转",
|
||||
color: "info",
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (confirm === true) {
|
||||
prefix = "https://m.miyoushe.com/ys/#/accountCenter/0?id=";
|
||||
await TGClient.open("mention", `${prefix}${uid}`);
|
||||
return;
|
||||
}
|
||||
prefix = "https://www.miyoushe.com/ys/accountCenter/postList?id=";
|
||||
window.open(`${prefix}${uid}`);
|
||||
}
|
||||
</script>
|
||||
<style lang="css" scoped>
|
||||
|
||||
@@ -383,7 +383,7 @@ async function deleteGacha(): Promise<void> {
|
||||
return;
|
||||
}
|
||||
const uidList = await TGSqlite.getUidList();
|
||||
let secondConfirm: string | boolean = "";
|
||||
let secondConfirm: string | boolean | undefined;
|
||||
if (uidList.length <= 1) {
|
||||
secondConfirm = await showConfirm({
|
||||
title: "删除后数据库将为空,确定删除?",
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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: "已取消",
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* @file utils/TGShare.ts
|
||||
* @description 生成分享截图并保存到本地
|
||||
* @since Beta v0.3.8
|
||||
* @since Beta v0.3.9
|
||||
*/
|
||||
|
||||
import { dialog, fs, http, path } from "@tauri-apps/api";
|
||||
@@ -72,7 +72,7 @@ function getShareImgBgColor(): string {
|
||||
|
||||
/**
|
||||
* @description 生成分享截图
|
||||
* @since Beta v0.3.8
|
||||
* @since Beta v0.3.9
|
||||
* @param {string} fileName - 文件名
|
||||
* @param {HTMLElement} element - 元素
|
||||
* @param {number} scale - 缩放比例
|
||||
@@ -122,15 +122,14 @@ export async function generateShareImg(
|
||||
title: "图像过大",
|
||||
text: `图像大小为 ${sizeStr},是否保存到文件?`,
|
||||
});
|
||||
if (!saveFile) {
|
||||
showSnackbar({
|
||||
color: "warn",
|
||||
text: "将尝试保存到剪贴板",
|
||||
});
|
||||
} else {
|
||||
if (saveFile === true) {
|
||||
await saveCanvasImg(buffer, fileName);
|
||||
return;
|
||||
}
|
||||
showSnackbar({
|
||||
color: "warn",
|
||||
text: "将尝试保存到剪贴板",
|
||||
});
|
||||
}
|
||||
try {
|
||||
await copyToClipboard(buffer);
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
import TGClient from "./TGClient";
|
||||
import { createPost } from "./TGWindow";
|
||||
import showConfirm from "../components/func/confirm";
|
||||
import showSnackbar from "../components/func/snackbar";
|
||||
|
||||
/**
|
||||
* @function parsePost
|
||||
@@ -115,16 +116,20 @@ export async function parseLink(
|
||||
title: "采用内置 JSBridge?",
|
||||
text: "取消则使用外部浏览器打开",
|
||||
});
|
||||
if (openCheck === undefined) {
|
||||
showSnackbar({
|
||||
text: "已取消打开",
|
||||
color: "warn",
|
||||
});
|
||||
return true;
|
||||
}
|
||||
if (!openCheck) return url.href;
|
||||
const typeCheck = await showConfirm({
|
||||
title: "采用宽屏模式?",
|
||||
text: "取消则使用默认竖屏",
|
||||
});
|
||||
if (typeCheck) {
|
||||
await TGClient.open("web_act", link);
|
||||
} else {
|
||||
await TGClient.open("web_act_thin", link);
|
||||
}
|
||||
if (!typeCheck) await TGClient.open("web_act_thin", link);
|
||||
else await TGClient.open("web_act", link);
|
||||
return true;
|
||||
}
|
||||
return url.href.toString();
|
||||
|
||||
Reference in New Issue
Block a user