diff --git a/src/api/request.js b/src/api/request.js index f84f21b..8e67580 100644 --- a/src/api/request.js +++ b/src/api/request.js @@ -18,14 +18,14 @@ class Request { // 文件上传请求,将apiKey添加到URL参数中 config.url = `${config.url}${config.url.includes("?") ? "&" : "?" }apiKey=${apiKey}`; - } else if (config.method === "get"||config.method === "put") { + } else if (config.method === "get" || config.method === "put") { // GET 请求将 apiKey 添加到 URL 参数中 config.params = { ...config.params, apiKey: apiKey, }; - } + } else { // 其他 POST 请求将 apiKey 添加到请求体中 config.data = { @@ -51,6 +51,15 @@ class Request { if (res.code === -1) { if (res.msg === "Invalid API Key" || res.msg.includes("API Key")) { this.clearApiKey(); + // 显示确认提示 + alert(`API Key 无效或已过期,将返回登录页重新登录`); + + setTimeout(() => { + utools.dbStorage.removeItem("fishpi_user_info"); + // 跳转到登录页 + window.location.hash = "#/login"; + }, 1000); + // 触发登录失效事件 window.dispatchEvent(new CustomEvent("fishpi:login-invalid")); } diff --git a/src/views/Games.vue b/src/views/Games.vue index 929560d..5db6241 100644 --- a/src/views/Games.vue +++ b/src/views/Games.vue @@ -51,6 +51,7 @@ import { ref } from "vue"; import { ArrowRight } from "@element-plus/icons-vue"; const games = ref([ + { name: "《进化-Evolve》", url: "https://fishpi.cn/games/evolve/", @@ -79,6 +80,13 @@ const games = ref([ "游戏规则十分简单,游戏开始会随机生成一个迷宫,但每次只显示你所在当下位置周围 3 × 3 的迷宫,你只需要凭直觉找到出口即可。通过游戏右上角 Login 按钮使用摸鱼派账号登录后,每次通关将会奖励关卡数 × 10的积分。", logo: "https://file.fishpi.cn/2023/05/icon-4d115aa0.png", }, + { + name: "WJU 谜题", + url: "https://wju.adventext.fun/", + description: + "游戏开始会随机生成 WJU 三个字母组成的字符串,你需要通过 5 种字符串的操作,来生成最终的目标字符串。使用摸鱼派账号登录后,每次通关将会随机奖励 128 ~ 1024 的积分。连续通关奖励可以叠加!", + logo: "https://wju.adventext.fun/images/logo.png", + }, { name: "《Fight》", url: "https://fishpi.cn/games/fight/index.html",