🌱 新页面

This commit is contained in:
目棃
2025-02-24 17:56:49 +08:00
parent 798c4bd7d5
commit 5b390d3ad1
6 changed files with 72 additions and 9 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

View File

@@ -56,12 +56,18 @@
<img src="/source/UI/userAbyss.webp" alt="abyss" class="side-icon" />
</template>
</v-list-item>
<v-list-item :title.attr="'祈愿记录'" :link="true" href="/user/gacha">
<v-list-item title.attr="祈愿记录" :link="true" href="/user/gacha" v-show="isDevEnv">
<template #title>祈愿记录</template>
<template #prepend>
<img src="/source/UI/userGacha.webp" alt="gacha" class="side-icon" />
</template>
</v-list-item>
<v-list-item :title.attr="'实用脚本'" :link="true" href="/user/scripts">
<template #title>实用脚本</template>
<template #prepend>
<img src="/source/UI/toolbox.webp" alt="scripts" class="side-icon" />
</template>
</v-list-item>
<v-divider />
<v-list-item
v-show="isDevEnv"

View File

@@ -0,0 +1,5 @@
<template>
<div class="user-scripts-page"></div>
</template>
<script lang="ts" setup></script>
<style lang="scss" scoped></style>

View File

@@ -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 = (<const>[
name: "原神战绩",
component: async () => await import("@/pages/User/Record.vue"),
},
{
path: "/user/scripts",
name: "实用脚本",
component: async () => await import("@/pages/User/Scripts.vue"),
},
]) satisfies Array<RouteRecordRaw>;
export default userRoutes;

View File

@@ -36,7 +36,7 @@
<v-icon>mdi-thumb-up</v-icon>
<span>{{ postData?.stat?.like_num }}</span>
</div>
<div class="mpm-item" :title="`转发数:${postData?.stat?.forward_num}`">
<div class="mpm-item" :title="`转发数:${postData?.stat?.forward_num}`" @click="tryShare()">
<v-icon>mdi-share-variant</v-icon>
<span>{{ postData?.stat?.forward_num }}</span>
</div>
@@ -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<void> {
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<void> {
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<void> {
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<void> {

View File

@@ -56,6 +56,7 @@ async function getMissions(cookie: Record<string, string>): Promise<TGApp.BBS.Mi
/**
* @description 获取分享配置
* @since Beta v0.6.10/v0.7.0
* @todo 服务器正确返回数据但是米社没有记录
* @param {string} postId 帖子 ID
* @param {Record<string,string>} cookie 用户 Cookie
* @return {Promise<TGApp.BBS.Response.Base>}
@@ -126,6 +127,33 @@ async function homeNew(gid: number = 2): Promise<TGApp.BBS.Navigator.Navigator[]
).data.navigator;
}
/**
* @description 签到
* @since Beta v0.6.10/v0.7.0
* @todo -100
* @param {Record<string,string>} cookie 用户 Cookie
* @param {string} gid
* @return {Promise<TGApp.BBS.Response.Base>}
*/
async function signIn(
cookie: Record<string, string>,
gid: number = 2,
): Promise<TGApp.BBS.Response.Base> {
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<TGApp.BBS.Response.Base>(`${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 },
};