mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2025-12-12 09:18:14 +08:00
✨ 帖子话题内容解析跳转
This commit is contained in:
@@ -104,21 +104,13 @@ interface TwoSelectCEmits {
|
|||||||
const props = defineProps<TwoSelectCProps>();
|
const props = defineProps<TwoSelectCProps>();
|
||||||
const emits = defineEmits<TwoSelectCEmits>();
|
const emits = defineEmits<TwoSelectCEmits>();
|
||||||
|
|
||||||
const visible = computed({
|
const visible = computed<boolean>({
|
||||||
get() {
|
get: () => props.modelValue,
|
||||||
return props.modelValue;
|
set: (v: boolean) => emits("update:modelValue", v),
|
||||||
},
|
|
||||||
set(value) {
|
|
||||||
emits("update:modelValue", value);
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
const reset = computed({
|
const reset = computed<boolean>({
|
||||||
get() {
|
get: () => props.reset,
|
||||||
return props.reset;
|
set: (v: boolean) => emits("update:reset", v),
|
||||||
},
|
|
||||||
set(value) {
|
|
||||||
emits("update:reset", value);
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
|
|||||||
@@ -80,6 +80,7 @@
|
|||||||
</template>
|
</template>
|
||||||
<v-list-item-title @click="confirmUpdateDevice()">刷新设备信息</v-list-item-title>
|
<v-list-item-title @click="confirmUpdateDevice()">刷新设备信息</v-list-item-title>
|
||||||
<v-list-item-subtitle>
|
<v-list-item-subtitle>
|
||||||
|
<!-- @ts-expect-error-next-line Deprecated symbol used -->
|
||||||
{{ appStore.deviceInfo.device_name }}({{ appStore.deviceInfo.product }}) -
|
{{ appStore.deviceInfo.device_name }}({{ appStore.deviceInfo.product }}) -
|
||||||
{{ appStore.deviceInfo.device_fp }}
|
{{ appStore.deviceInfo.device_fp }}
|
||||||
</v-list-item-subtitle>
|
</v-list-item-subtitle>
|
||||||
|
|||||||
@@ -1,13 +1,14 @@
|
|||||||
/**
|
/**
|
||||||
* @file src/utils/linkParser.ts
|
* @file src/utils/linkParser.ts
|
||||||
* @description 处理链接
|
* @description 处理链接
|
||||||
* @since Beta v0.6.3
|
* @since Beta v0.6.5
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { emit } from "@tauri-apps/api/event";
|
import { emit } from "@tauri-apps/api/event";
|
||||||
|
|
||||||
import showDialog from "../components/func/dialog.js";
|
import showDialog from "../components/func/dialog.js";
|
||||||
import showSnackbar from "../components/func/snackbar.js";
|
import showSnackbar from "../components/func/snackbar.js";
|
||||||
|
import { getGameId } from "../web/utils/tools.js";
|
||||||
|
|
||||||
import TGClient from "./TGClient.js";
|
import TGClient from "./TGClient.js";
|
||||||
import { createPost } from "./TGWindow.js";
|
import { createPost } from "./TGWindow.js";
|
||||||
@@ -56,7 +57,7 @@ export async function parsePost(link: string): Promise<false | string> {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @function parseLink
|
* @function parseLink
|
||||||
* @since Beta v0.6.3
|
* @since Beta v0.6.5
|
||||||
* @description 处理链接
|
* @description 处理链接
|
||||||
* @param {string} link - 链接
|
* @param {string} link - 链接
|
||||||
* @param {boolean} useInner - 是否采用内置 JSBridge 打开
|
* @param {boolean} useInner - 是否采用内置 JSBridge 打开
|
||||||
@@ -118,6 +119,14 @@ export async function parseLink(
|
|||||||
}
|
}
|
||||||
await createPost(postId);
|
await createPost(postId);
|
||||||
return true;
|
return true;
|
||||||
|
} else if (url.pathname.includes("/topicDetail/")) {
|
||||||
|
const regex = /\/(\w+)\/topicDetail\/(\d+)/;
|
||||||
|
const result = url.pathname.match(regex);
|
||||||
|
if (!result) return false;
|
||||||
|
const [, game, topicId] = result;
|
||||||
|
const id = getGameId(game);
|
||||||
|
await emit("active_deep_link", `router?path=/posts/topic/${id}/${topicId}`);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (url.hostname === "webstatic.mihoyo.com") {
|
if (url.hostname === "webstatic.mihoyo.com") {
|
||||||
|
|||||||
@@ -24,24 +24,24 @@ export const BBS_SALT = {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @description 频道列表
|
* @description 频道列表
|
||||||
* @version 2.72.2
|
* @since Beta v0.6.5
|
||||||
* @since Beta v0.5.1
|
|
||||||
* @interface ToChannelItem
|
* @interface ToChannelItem
|
||||||
* @property {string} title - 频道名称
|
* @property {string} title - 频道名称
|
||||||
* @property {string} icon - 频道图标
|
* @property {string} icon - 频道图标
|
||||||
* @property {string} gid - 频道 gid
|
* @property {string} gid - 频道 gid
|
||||||
|
* @property {string} mini - 频道简称
|
||||||
* @return ToChannelItem
|
* @return ToChannelItem
|
||||||
*/
|
*/
|
||||||
export interface ToChannelItem {
|
export interface ToChannelItem {
|
||||||
title: string;
|
title: string;
|
||||||
icon: string;
|
icon: string;
|
||||||
gid: string;
|
gid: string;
|
||||||
|
mini: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description 渠道列表
|
* @description 渠道列表
|
||||||
* @version 2.72.2
|
* @since Beta v0.6.5
|
||||||
* @since Beta v0.5.1
|
|
||||||
* @type {Array<ToChannelItem>}
|
* @type {Array<ToChannelItem>}
|
||||||
*/
|
*/
|
||||||
export const CHANNEL_LIST: ToChannelItem[] = [
|
export const CHANNEL_LIST: ToChannelItem[] = [
|
||||||
@@ -49,35 +49,42 @@ export const CHANNEL_LIST: ToChannelItem[] = [
|
|||||||
title: "原神",
|
title: "原神",
|
||||||
icon: "/platforms/mhy/ys.webp",
|
icon: "/platforms/mhy/ys.webp",
|
||||||
gid: "2",
|
gid: "2",
|
||||||
|
mini: "ys",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "崩坏:星穹铁道",
|
title: "崩坏:星穹铁道",
|
||||||
icon: "/platforms/mhy/sr.webp",
|
icon: "/platforms/mhy/sr.webp",
|
||||||
gid: "6",
|
gid: "6",
|
||||||
|
mini: "sr",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "绝区零",
|
title: "绝区零",
|
||||||
icon: "/platforms/mhy/zzz.webp",
|
icon: "/platforms/mhy/zzz.webp",
|
||||||
gid: "8",
|
gid: "8",
|
||||||
|
mini: "zzz",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "崩坏3",
|
title: "崩坏3",
|
||||||
icon: "/platforms/mhy/bh3.webp",
|
icon: "/platforms/mhy/bh3.webp",
|
||||||
gid: "1",
|
gid: "1",
|
||||||
|
mini: "bh3",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "崩坏2",
|
title: "崩坏2",
|
||||||
icon: "/platforms/mhy/bh2.webp",
|
icon: "/platforms/mhy/bh2.webp",
|
||||||
gid: "3",
|
gid: "3",
|
||||||
|
mini: "bh2",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "未定事件簿",
|
title: "未定事件簿",
|
||||||
icon: "/platforms/mhy/wd.webp",
|
icon: "/platforms/mhy/wd.webp",
|
||||||
gid: "4",
|
gid: "4",
|
||||||
|
mini: "wd",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "大别野",
|
title: "大别野",
|
||||||
icon: "/platforms/mhy/dby.webp",
|
icon: "/platforms/mhy/dby.webp",
|
||||||
gid: "5",
|
gid: "5",
|
||||||
|
mini: "dby",
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -64,3 +64,13 @@ export function getGameName(gid: number): string {
|
|||||||
const game = TGConstant.BBS.CHANNELS.find((item) => item.gid === gid.toString());
|
const game = TGConstant.BBS.CHANNELS.find((item) => item.gid === gid.toString());
|
||||||
return game ? game.title : "未知游戏";
|
return game ? game.title : "未知游戏";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description 获取游戏id
|
||||||
|
* @param {string} mini
|
||||||
|
* @returns {string}
|
||||||
|
*/
|
||||||
|
export function getGameId(mini: string): string {
|
||||||
|
const game = TGConstant.BBS.CHANNELS.find((item) => item.mini === mini);
|
||||||
|
return game ? game.gid : "0";
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user