mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2026-03-31 06:29:46 +08:00
♻️ 部分跳转改为外部浏览器打开
This commit is contained in:
@@ -36,7 +36,7 @@ import TMiImg from "@comp/app/t-mi-img.vue";
|
||||
import showSnackbar from "@comp/func/snackbar.js";
|
||||
import { openUrl } from "@tauri-apps/plugin-opener";
|
||||
import { parseLink } from "@utils/linkParser.js";
|
||||
import { createObc, createPost } from "@utils/TGWindow.js";
|
||||
import { toObcPage, createPost } from "@utils/TGWindow.js";
|
||||
import { stamp2LastTime, timestampToDate } from "@utils/toolFunc.js";
|
||||
import { computed, onMounted, onUnmounted, ref } from "vue";
|
||||
|
||||
@@ -72,7 +72,7 @@ function handlePosition(): void {
|
||||
|
||||
async function openPosition(): Promise<void> {
|
||||
if (props.pos.url === "" && props.pos.content_id !== 0) {
|
||||
await createObc(props.pos.content_id, props.pos.title);
|
||||
await toObcPage(props.pos.content_id);
|
||||
return;
|
||||
}
|
||||
const res = await parseLink(props.pos.url);
|
||||
|
||||
@@ -107,7 +107,7 @@ import TItembox, { type TItemBoxData } from "@comp/app/t-itemBox.vue";
|
||||
import ToNameCard from "@comp/app/to-nameCard.vue";
|
||||
import TopNameCard from "@comp/app/top-nameCard.vue";
|
||||
import showSnackbar from "@comp/func/snackbar.js";
|
||||
import { createObc } from "@utils/TGWindow.js";
|
||||
import { toObcPage } from "@utils/TGWindow.js";
|
||||
import { parseHtmlText } from "@utils/toolFunc.js";
|
||||
import { computed, onMounted, ref, shallowRef, watch } from "vue";
|
||||
import { useRouter } from "vue-router";
|
||||
@@ -165,7 +165,7 @@ async function toWiki(): Promise<void> {
|
||||
showSnackbar.warn(`角色 ${props.item.name} 暂无详情`);
|
||||
return;
|
||||
}
|
||||
await createObc(props.item.contentId, props.item.name);
|
||||
await toObcPage(props.item.contentId);
|
||||
}
|
||||
|
||||
async function toBirth(date: string): Promise<void> {
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
<script lang="ts" setup>
|
||||
import TItemBox, { type TItemBoxData } from "@comp/app/t-itemBox.vue";
|
||||
import showSnackbar from "@comp/func/snackbar.js";
|
||||
import { createObc } from "@utils/TGWindow.js";
|
||||
import { toObcPage } from "@utils/TGWindow.js";
|
||||
import { parseHtmlText } from "@utils/toolFunc.js";
|
||||
import { computed, onMounted, ref, shallowRef, watch } from "vue";
|
||||
|
||||
@@ -108,7 +108,7 @@ async function toWiki(): Promise<void> {
|
||||
showSnackbar.warn(`武器 ${props.item.name} 暂无详情`);
|
||||
return;
|
||||
}
|
||||
await createObc(props.item.contentId, props.item.name);
|
||||
await toObcPage(props.item.contentId);
|
||||
}
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { openPath } from "@tauri-apps/plugin-opener";
|
||||
import { openUrl } from "@tauri-apps/plugin-opener";
|
||||
|
||||
type TpGameCard = {
|
||||
insert: {
|
||||
@@ -55,7 +55,7 @@ type TpGameCardProps = { data: TpGameCard };
|
||||
const props = defineProps<TpGameCardProps>();
|
||||
|
||||
async function toGame(): Promise<void> {
|
||||
await openPath(`https://www.miyoushe.com/ys/gameCenter/${props.data.insert.reception_card.id}`);
|
||||
await openUrl(`https://www.miyoushe.com/ys/gameCenter/${props.data.insert.reception_card.id}`);
|
||||
}
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
|
||||
@@ -28,7 +28,7 @@ import showSnackbar from "@comp/func/snackbar.js";
|
||||
import TwcCharacter from "@comp/pageWiki/twc-character.vue";
|
||||
import TwcListItem from "@comp/pageWiki/twc-list-item.vue";
|
||||
import TwoSelectC, { type SelectedCValue } from "@comp/pageWiki/two-select-c.vue";
|
||||
import { createObc } from "@utils/TGWindow.js";
|
||||
import { toObcPage } from "@utils/TGWindow.js";
|
||||
import { onBeforeMount, ref, shallowRef, watch } from "vue";
|
||||
import { useRoute } from "vue-router";
|
||||
|
||||
@@ -104,7 +104,7 @@ async function toOuter(item?: TGApp.App.Character.WikiBriefInfo): Promise<void>
|
||||
showSnackbar.cancel("已取消打开观测枢页面");
|
||||
return;
|
||||
}
|
||||
await createObc(item.contentId, item.name);
|
||||
await toObcPage(item.contentId);
|
||||
}
|
||||
</script>
|
||||
<style scoped>
|
||||
|
||||
@@ -28,7 +28,7 @@ import showSnackbar from "@comp/func/snackbar.js";
|
||||
import TwcListItem from "@comp/pageWiki/twc-list-item.vue";
|
||||
import TwcWeapon from "@comp/pageWiki/twc-weapon.vue";
|
||||
import TwoSelectW, { type SelectedWValue } from "@comp/pageWiki/two-select-w.vue";
|
||||
import { createObc } from "@utils/TGWindow.js";
|
||||
import { toObcPage } from "@utils/TGWindow.js";
|
||||
import { onBeforeMount, ref, shallowRef } from "vue";
|
||||
import { useRoute } from "vue-router";
|
||||
|
||||
@@ -89,7 +89,7 @@ async function toOuter(item?: TGApp.App.Weapon.WikiBriefInfo): Promise<void> {
|
||||
showSnackbar.cancel("已取消打开观测枢页面");
|
||||
return;
|
||||
}
|
||||
await createObc(item.contentId, item.name);
|
||||
await toObcPage(item.contentId);
|
||||
}
|
||||
</script>
|
||||
<style lang="css" scoped>
|
||||
|
||||
@@ -345,7 +345,7 @@ class Client {
|
||||
break;
|
||||
}
|
||||
case "teyvat_open_webview":
|
||||
window.open(arg.payload);
|
||||
await openUrl(arg.payload);
|
||||
break;
|
||||
default:
|
||||
console.warn(`[customCallback] ${arg.method}`);
|
||||
|
||||
@@ -9,6 +9,7 @@ import showSnackbar from "@comp/func/snackbar.js";
|
||||
import { core, webviewWindow, window as TauriWindow } from "@tauri-apps/api";
|
||||
import { PhysicalSize } from "@tauri-apps/api/dpi";
|
||||
import { currentMonitor, WindowOptions } from "@tauri-apps/api/window";
|
||||
import { openUrl } from "@tauri-apps/plugin-opener";
|
||||
import { type } from "@tauri-apps/plugin-os";
|
||||
|
||||
import TGLogger from "./TGLogger.js";
|
||||
@@ -73,15 +74,13 @@ export async function createPost(
|
||||
|
||||
/**
|
||||
* @description 打开观测枢
|
||||
* @since Beta 0.6.2
|
||||
* @deprecated 该方法已弃用,使用 openPath 替代
|
||||
* @since Beta 0.7.6
|
||||
* @param {string} contentId
|
||||
* @param {string} label
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
export async function createObc(contentId: number, label: string): Promise<void> {
|
||||
export async function toObcPage(contentId: number): Promise<void> {
|
||||
const obcUrl = `https://bbs.mihoyo.com/ys/obc/content/${contentId}/detail?bbs_presentation_style=no_header`;
|
||||
await createTGWindow(obcUrl, "Sub_window", `Content_${contentId}_${label}`, 1200, 800, true);
|
||||
await openUrl(obcUrl);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user