diff --git a/public/source/UI/toolbox.webp b/public/source/UI/toolbox.webp new file mode 100644 index 00000000..e0747e30 Binary files /dev/null and b/public/source/UI/toolbox.webp differ diff --git a/src/components/app/t-sidebar.vue b/src/components/app/t-sidebar.vue index 2c1c9cec..d9c8346e 100644 --- a/src/components/app/t-sidebar.vue +++ b/src/components/app/t-sidebar.vue @@ -56,12 +56,18 @@ abyss - + + + + + +
+ + + diff --git a/src/router/modules/user.ts b/src/router/modules/user.ts index de6feb13..142ebfb6 100644 --- a/src/router/modules/user.ts +++ b/src/router/modules/user.ts @@ -1,7 +1,7 @@ /** * @file router modules user.ts * @description user 路由模块 - * @since Beta v0.6.3 + * @since Beta v0.6.10/v0.7.0 */ import type { RouteRecordRaw } from "vue-router"; @@ -31,6 +31,11 @@ const userRoutes = ([ name: "原神战绩", component: async () => await import("@/pages/User/Record.vue"), }, + { + path: "/user/scripts", + name: "实用脚本", + component: async () => await import("@/pages/User/Scripts.vue"), + }, ]) satisfies Array; export default userRoutes; diff --git a/src/views/t-post.vue b/src/views/t-post.vue index 5e91c4a0..d1e426a6 100644 --- a/src/views/t-post.vue +++ b/src/views/t-post.vue @@ -36,7 +36,7 @@ mdi-thumb-up {{ postData?.stat?.like_num }} -
+
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 }, };