Skip to content

Commit

Permalink
🐛 修复搜索bug
Browse files Browse the repository at this point in the history
  • Loading branch information
BTMuli committed Apr 4, 2024
1 parent 96aec27 commit 8f322ea
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 14 deletions.
29 changes: 15 additions & 14 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -184,20 +184,11 @@ async function getDeepLink(): Promise<UnlistenFn> {
}
await TGLogger.Info(`[App][getDeepLink] ${e.payload}`);
if (e.payload === "") return;
// 导入格式: teyvatguide://import_uigf?app=appName
// 跳转格式: localhost:4000/achievements/?app=appName
// todo 后续更改路径&参数名称
if (e.payload.startsWith("teyvatguide://import_uigf")) {
const param = (<string>e.payload).split("teyvatguide://import_uigf/?")[1];
let appName = "";
if (param) {
appName = param.split("app=")[1];
}
if (appName === "") {
await router.push("/achievements");
} else {
await router.push("/achievements/?app=" + appName);
}
if (
e.payload.startsWith("teyvatguide://import_uigf") ||
e.payload.startsWith("teyvatguide://import_uiaf")
) {
await toUIAF(e.payload);
} else {
showSnackbar({
text: "无效的 deep link!",
Expand All @@ -208,6 +199,16 @@ async function getDeepLink(): Promise<UnlistenFn> {
});
}
async function toUIAF(link: string) {
const url = new URL(link);
const app = url.searchParams.get("app");
if (app === null) {
await router.push("/achievements");
} else {
await router.push("/achievements/?app=" + app);
}
}
// 检测更新
async function checkUpdate(): Promise<void> {
const isProdEnv = import.meta.env.MODE === "production";
Expand Down
5 changes: 5 additions & 0 deletions src/components/post/to-postSearch.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ interface ToPostSearchProps {
interface ToPostSearchEmits {
(e: "update:modelValue", value: boolean): void;
(e: "cancel"): void;
}
Expand Down Expand Up @@ -94,6 +95,7 @@ watch(
results.value = [];
lastId.value = "";
isLast.value = false;
await searchPosts();
}
},
);
Expand Down Expand Up @@ -143,6 +145,9 @@ async function searchPosts() {
lastId.value = res.last_id;
isLast.value = res.is_last;
load.value = false;
if (!visible.value) {
visible.value = true;
}
}
function getGidLabel(): string {
Expand Down

0 comments on commit 8f322ea

Please sign in to comment.