+
mdi-share-variant
{{ postData?.stat?.forward_num }}
@@ -109,6 +109,7 @@ import { useRoute } from "vue-router";
import { useAppStore } from "@/store/modules/app.js";
import { useUserStore } from "@/store/modules/user.js";
import TGBbs from "@/utils/TGBbs.js";
+import TGClient from "@/utils/TGClient.js";
import TGLogger from "@/utils/TGLogger.js";
import { createTGWindow } from "@/utils/TGWindow.js";
import apiHubReq from "@/web/request/apiHubReq.js";
@@ -275,13 +276,30 @@ async function tryLike(): Promise
{
showSnackbar.success(isLike.value ? "点赞成功" : "取消点赞成功");
}
-function toPost(): void {
- const channel = TGBbs.channels.find((item) => item.gid === postData.value?.post.game_id);
- if (channel) {
- window.open(`https://miyoushe.com/${channel.mini}/#/article/${postId}`);
- } else {
- window.open(`https://miyoushe.com/ys/#/article/${postId}`);
+async function tryShare(): Promise {
+ if (!cookie.value) {
+ showSnackbar.error("请先登录");
+ return;
}
+ if (!postData.value) {
+ showSnackbar.error("数据未加载");
+ return;
+ }
+ const ck = { stoken: cookie.value.stoken, stuid: cookie.value.stuid, mid: cookie.value.mid };
+ const resp = await apiHubReq.post.share(postData.value.post.post_id, ck);
+ if (resp.retcode !== 0) {
+ showSnackbar.error(`[${resp.retcode}] ${resp.message}`);
+ return;
+ }
+ console.log("share success", resp);
+}
+
+async function toPost(): Promise {
+ const channel = TGBbs.channels.find((item) => item.gid === postData.value?.post.game_id);
+ const link = channel
+ ? `https://m.miyoushe.com/${channel.mini}/#/article/${postId}`
+ : `https://m.miyoushe.com/ys/#/article/${postId}`;
+ await TGClient.open("web_thin", link);
}
async function toTopic(topic: TGApp.Plugins.Mys.Topic.Info): Promise {
diff --git a/src/web/request/apiHubReq.ts b/src/web/request/apiHubReq.ts
index 80c26b6d..5f1c1d83 100644
--- a/src/web/request/apiHubReq.ts
+++ b/src/web/request/apiHubReq.ts
@@ -56,6 +56,7 @@ async function getMissions(cookie: Record): Promise} cookie 用户 Cookie
* @return {Promise}
@@ -126,6 +127,33 @@ async function homeNew(gid: number = 2): Promise} cookie 用户 Cookie
+ * @param {string} gid
+ * @return {Promise}
+ */
+async function signIn(
+ cookie: Record,
+ gid: number = 2,
+): Promise {
+ const data = { gids: gid.toString() };
+ const header = {
+ ...getRequestHeader(cookie, "POST", JSON.stringify(data), "X6"),
+ "x-rpc-client_type": "2",
+ referer: "https://app.mihoyo.com",
+ };
+ if ("x-requested-with" in header) delete header["x-requested-with"];
+ console.log(header);
+ return await TGHttp(`${Mahbu}app/api/signIn`, {
+ method: "POST",
+ headers: header,
+ body: JSON.stringify(data),
+ });
+}
+
/**
* @description 点赞
* @since Beta v0.6.10/v0.7.0
@@ -157,6 +185,7 @@ const apiHubReq = {
forum: getAllGamesForums,
game: getGameList,
mission: getMissions,
+ sign: signIn,
post: { like: upVotePost, share: getShareConf },
};