diff --git a/src/components/main/t-gamenav.vue b/src/components/main/t-gamenav.vue index 00d25c3e..96488d7e 100644 --- a/src/components/main/t-gamenav.vue +++ b/src/components/main/t-gamenav.vue @@ -4,19 +4,25 @@ navIcon {{ navItem.name }} +
+ +
+ + diff --git a/src/pages/common/Test.vue b/src/pages/common/Test.vue index 64798c68..d47da50f 100644 --- a/src/pages/common/Test.vue +++ b/src/pages/common/Test.vue @@ -13,65 +13,9 @@ -

数据请求测试

-
- 获取角色列表 - 获取角色详情 -
-
- -
- + diff --git a/src/types/BBS/Navigator.d.ts b/src/types/BBS/Navigator.d.ts index 48a59c99..91fa9b75 100644 --- a/src/types/BBS/Navigator.d.ts +++ b/src/types/BBS/Navigator.d.ts @@ -264,4 +264,35 @@ declare namespace TGApp.BBS.Navigator { user_status: unknown; }; } + + /** + * @description 兑换码接口返回数据 + * @interface CodeResponse + * @since Beta v0.5.3 + * @extends TGApp.BBS.Response.BaseWithData + * @property {CodeData[]} data.code_list - 兑换码数据 + * @return CodeResponse + */ + interface CodeResponse extends TGApp.BBS.Response.BaseWithData { + data: { + code_list: CodeData[]; + }; + } + + /** + * @description 兑换码数据 + * @interface CodeData + * @since Beta v0.5.3 + * @property {string} title - 兑换码标题,为html字符串 + * @property {string} code - 兑换码 + * @property {string} img - 兑换码图片 + * @property {string} to_get_time - 过期时间,时间戳(单位:秒) + * @return CodeData + */ + interface CodeData { + title: string; + code: string; + img: string; + to_get_time: string; + } } diff --git a/src/web/request/TGRequest.ts b/src/web/request/TGRequest.ts index 84fb19fd..52a58f36 100644 --- a/src/web/request/TGRequest.ts +++ b/src/web/request/TGRequest.ts @@ -9,6 +9,7 @@ import { getAbyss } from "./getAbyss.js"; import { getActionTicketBySToken } from "./getActionTicket.js"; import { getAnnoContent, getAnnoList } from "./getAnno.js"; import { getAvatarList, getAvatarDetail } from "./getAvatarDetail.js"; +import getCode from "./getCode.js"; import { getCookieTokenByGameToken, getCookieTokenBySToken } from "./getCookieToken.js"; import { getDeviceFp } from "./getDeviceFp.js"; import { getGachaLog } from "./getGachaLog.js"; @@ -64,6 +65,9 @@ const TGRequest = { getSyncAvatarDetail, }, }, + Nav: { + getCode, + }, }; export default TGRequest; diff --git a/src/web/request/getCode.ts b/src/web/request/getCode.ts new file mode 100644 index 00000000..98e3301f --- /dev/null +++ b/src/web/request/getCode.ts @@ -0,0 +1,28 @@ +/** + * @file web/request/getCode.ts + * @description 获取兑换码相关请求 + * @since Beta v0.5.3 + */ + +import TGHttp from "../../utils/TGHttp.js"; + +/** + * @description 获取兑换码请求 + * @since Beta v0.5.3 + * @param {string} act_id - 活动 id + * @return {Promise} + */ +async function getCode( + act_id: string, +): Promise { + const url = "https://api-takumi-static.mihoyo.com/event/miyolive/refreshCode"; + const header = { "x-rpc-act_id": act_id }; + const res = await TGHttp(url, { + method: "GET", + headers: header, + }); + if (res.retcode !== 0) return res; + return res.data.code_list; +} + +export default getCode;