🌱 千星奇域抽卡记录页面

This commit is contained in:
BTMuli
2025-10-23 23:56:23 +08:00
parent 01e355b0d6
commit d3902d6e31
4 changed files with 84 additions and 2 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

View File

@@ -12,6 +12,12 @@
variant="outlined"
label="游戏UID"
/>
<img
title="查看千星奇域祈愿记录"
src="/icon/nation/千星奇域.webp"
alt="beyond"
@click="toGachaB()"
/>
</div>
</template>
<template #extension>
@@ -77,10 +83,13 @@ import TGLogger from "@utils/TGLogger.js";
import { exportUigfData, readUigfData, verifyUigfData } from "@utils/UIGF.js";
import { storeToRefs } from "pinia";
import { onMounted, ref, shallowRef, watch } from "vue";
import { useRouter } from "vue-router";
import { AppCharacterData, AppWeaponData } from "@/data/index.js";
const { account, cookie } = storeToRefs(useUserStore());
const router = useRouter();
const authkey = ref<string>("");
const uidCur = ref<string>();
const tab = ref<string>("overview");
@@ -364,6 +373,14 @@ async function deleteGacha(): Promise<void> {
await new Promise<void>((resolve) => setTimeout(resolve, 1500));
window.location.reload();
}
async function toGachaB(): Promise<void> {
if (!account.value || !cookie.value) {
showSnackbar.error("请先登录账号");
return;
}
await router.push({ name: "千星奇域祈愿记录" });
}
</script>
<style lang="css" scoped>
.gacha-top-title {
@@ -376,6 +393,10 @@ async function deleteGacha(): Promise<void> {
img {
width: 32px;
height: 32px;
&:last-child {
cursor: pointer;
}
}
span {

56
src/pages/User/GachaB.vue Normal file
View File

@@ -0,0 +1,56 @@
<!-- 千星奇域祈愿记录 todo:后续改成正式页面 -->
<template>
<iframe ref="htmlRef" :src="link" style="width: 100%; height: 100%; border: none" />
</template>
<script lang="ts" setup>
import showSnackbar from "@comp/func/snackbar.js";
import takumiReq from "@req/takumiReq.js";
import useUserStore from "@store/user.js";
import { storeToRefs } from "pinia";
import { onMounted, ref } from "vue";
const { cookie, account } = storeToRefs(useUserStore());
const authkey = ref<string>("");
const link = ref<string>("");
onMounted(async () => {
link.value = await getUrl();
});
async function refreshAuthkey(): Promise<void> {
if (!cookie.value || !account.value) {
return;
}
const authkeyRes = await takumiReq.bind.authKey(cookie.value, account.value);
if (typeof authkeyRes === "string") {
authkey.value = authkeyRes;
} else {
showSnackbar.error("获取authkey失败");
return;
}
}
async function getUrl(): Promise<string> {
const path = "https://webstatic.mihoyo.com/hk4e/event/e20250716gacha/index.html";
if (authkey.value === "") await refreshAuthkey();
const param: Record<string, string> = {
win_mode: "fullscreen",
no_joypad_close: "1",
authkey_ver: "1",
sign_type: "2",
auth_appid: "webview_gacha",
gacha_id: "57016dec6b768231ba1342c01935417a799b",
timestamp: Math.floor(Date.now() / 1000).toString(),
lang: "zh-cn",
device_type: "pc",
region: account.value.region,
authkey: authkey.value,
game_biz: account.value.gameBiz,
};
const targetLink = new URL(path);
for (const key in param) {
targetLink.searchParams.append(key, param[key]);
}
return targetLink.toString();
}
</script>

View File

@@ -1,7 +1,7 @@
/**
* @file router modules user.ts
* @file router/modules/user.ts
* @description user 路由模块
* @since Beta v0.8.0
* @since Beta v0.8.4
*/
import type { RouteRecordRaw } from "vue-router";
@@ -31,6 +31,11 @@ const userRoutes = (<const>[
name: "祈愿记录",
component: async () => await import("@/pages/User/Gacha.vue"),
},
{
path: "/user/gachaB",
name: "千星奇域祈愿记录",
component: async () => await import("@/pages/User/GachaB.vue"),
},
{
path: "/user/record",
name: "原神战绩",