mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2025-12-06 08:32:51 +08:00
🌱 千星奇域抽卡记录页面
This commit is contained in:
BIN
public/icon/nation/千星奇域.webp
Normal file
BIN
public/icon/nation/千星奇域.webp
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 12 KiB |
@@ -12,6 +12,12 @@
|
|||||||
variant="outlined"
|
variant="outlined"
|
||||||
label="游戏UID"
|
label="游戏UID"
|
||||||
/>
|
/>
|
||||||
|
<img
|
||||||
|
title="查看千星奇域祈愿记录"
|
||||||
|
src="/icon/nation/千星奇域.webp"
|
||||||
|
alt="beyond"
|
||||||
|
@click="toGachaB()"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<template #extension>
|
<template #extension>
|
||||||
@@ -77,10 +83,13 @@ import TGLogger from "@utils/TGLogger.js";
|
|||||||
import { exportUigfData, readUigfData, verifyUigfData } from "@utils/UIGF.js";
|
import { exportUigfData, readUigfData, verifyUigfData } from "@utils/UIGF.js";
|
||||||
import { storeToRefs } from "pinia";
|
import { storeToRefs } from "pinia";
|
||||||
import { onMounted, ref, shallowRef, watch } from "vue";
|
import { onMounted, ref, shallowRef, watch } from "vue";
|
||||||
|
import { useRouter } from "vue-router";
|
||||||
|
|
||||||
import { AppCharacterData, AppWeaponData } from "@/data/index.js";
|
import { AppCharacterData, AppWeaponData } from "@/data/index.js";
|
||||||
|
|
||||||
const { account, cookie } = storeToRefs(useUserStore());
|
const { account, cookie } = storeToRefs(useUserStore());
|
||||||
|
const router = useRouter();
|
||||||
|
|
||||||
const authkey = ref<string>("");
|
const authkey = ref<string>("");
|
||||||
const uidCur = ref<string>();
|
const uidCur = ref<string>();
|
||||||
const tab = ref<string>("overview");
|
const tab = ref<string>("overview");
|
||||||
@@ -364,6 +373,14 @@ async function deleteGacha(): Promise<void> {
|
|||||||
await new Promise<void>((resolve) => setTimeout(resolve, 1500));
|
await new Promise<void>((resolve) => setTimeout(resolve, 1500));
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function toGachaB(): Promise<void> {
|
||||||
|
if (!account.value || !cookie.value) {
|
||||||
|
showSnackbar.error("请先登录账号");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
await router.push({ name: "千星奇域祈愿记录" });
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
<style lang="css" scoped>
|
<style lang="css" scoped>
|
||||||
.gacha-top-title {
|
.gacha-top-title {
|
||||||
@@ -376,6 +393,10 @@ async function deleteGacha(): Promise<void> {
|
|||||||
img {
|
img {
|
||||||
width: 32px;
|
width: 32px;
|
||||||
height: 32px;
|
height: 32px;
|
||||||
|
|
||||||
|
&:last-child {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
span {
|
span {
|
||||||
|
|||||||
56
src/pages/User/GachaB.vue
Normal file
56
src/pages/User/GachaB.vue
Normal 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>
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* @file router modules user.ts
|
* @file router/modules/user.ts
|
||||||
* @description user 路由模块
|
* @description user 路由模块
|
||||||
* @since Beta v0.8.0
|
* @since Beta v0.8.4
|
||||||
*/
|
*/
|
||||||
import type { RouteRecordRaw } from "vue-router";
|
import type { RouteRecordRaw } from "vue-router";
|
||||||
|
|
||||||
@@ -31,6 +31,11 @@ const userRoutes = (<const>[
|
|||||||
name: "祈愿记录",
|
name: "祈愿记录",
|
||||||
component: async () => await import("@/pages/User/Gacha.vue"),
|
component: async () => await import("@/pages/User/Gacha.vue"),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: "/user/gachaB",
|
||||||
|
name: "千星奇域祈愿记录",
|
||||||
|
component: async () => await import("@/pages/User/GachaB.vue"),
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: "/user/record",
|
path: "/user/record",
|
||||||
name: "原神战绩",
|
name: "原神战绩",
|
||||||
|
|||||||
Reference in New Issue
Block a user