-
+
@@ -12,9 +12,7 @@
-
- 查看
-
+ 查看
@@ -41,8 +39,10 @@
import { ref, onMounted, onUnmounted } from "vue";
import Mys from "../../plugins/Mys/index.js";
+import { parseLink } from "../../utils/linkParser.js";
import { createPost } from "../../utils/TGWindow.js";
import { stamp2LastTime } from "../../utils/toolFunc.js";
+import showSnackbar from "../func/snackbar.js";
import THomeCard from "./t-homecard.vue";
@@ -94,6 +94,19 @@ onMounted(async () => {
emits("success");
});
+async function openPosition(card: TGApp.Plugins.Mys.Position.RenderCard): Promise {
+ const res = await parseLink(card.link);
+ if (res === "post") await createPost(card.postId, card.title);
+ if (res === false) {
+ showSnackbar({
+ text: `未知链接:${card.link}`,
+ color: "error",
+ timeout: 3000,
+ });
+ return;
+ }
+}
+
onUnmounted(() => {
Object.keys(positionTimer.value).forEach((key) => {
clearInterval(positionTimer.value[Number(key)]);
diff --git a/src/plugins/Mys/types/Position.d.ts b/src/plugins/Mys/types/Position.d.ts
index 582037bf..cda46563 100644
--- a/src/plugins/Mys/types/Position.d.ts
+++ b/src/plugins/Mys/types/Position.d.ts
@@ -1,7 +1,7 @@
/**
* @file plugins/Mys/types/Position.d.ts
* @description Mys 插件热点追踪接口
- * @since Alpha v0.2.1
+ * @since Beta v0.5.3
*/
/**
@@ -74,10 +74,11 @@ declare namespace TGApp.Plugins.Mys.Position {
/**
* @description 渲染用的热点追踪信息
- * @since Alpha v0.2.1
+ * @since Beta v0.5.3
* @interface RenderCard
* @property {string} title 标题
* @property {number} postId 帖子ID
+ * @property {string} link 链接
* @property {string} icon 图标
* @property {string} abstract 摘要
* @property time 时间
@@ -90,6 +91,7 @@ declare namespace TGApp.Plugins.Mys.Position {
interface RenderCard {
title: string;
postId: number;
+ link: string;
icon: string;
abstract: string;
time: {
diff --git a/src/plugins/Mys/utils/getPositionCard.ts b/src/plugins/Mys/utils/getPositionCard.ts
index de064fd2..d6a8f872 100644
--- a/src/plugins/Mys/utils/getPositionCard.ts
+++ b/src/plugins/Mys/utils/getPositionCard.ts
@@ -1,12 +1,12 @@
/**
* @file plugins/Mys/utils/getPositionCard.ts
* @description Mys 插件热点追踪工具
- * @since Beta v0.5.0
+ * @since Beta v0.5.3
*/
/**
* @description 根据热点追踪信息转为渲染用的数据
- * @since Beta v0.5.0
+ * @since Beta v0.5.3
* @param {TGApp.Plugins.Mys.Position.Data[]} positionData 列表
* @returns {TGApp.Plugins.Mys.Position.RenderCard[]} 返回列表
*/
@@ -24,6 +24,7 @@ function getPositionCard(
const card: TGApp.Plugins.Mys.Position.RenderCard = {
title: position.title,
postId: Number(position.url.split("/").pop()),
+ link: position.url,
icon: position.icon,
abstract: position.abstract,
time: {