diff --git a/frontend/src/api/info/index.ts b/frontend/src/api/info/index.ts index 4aa2d21b..48a5dca2 100644 --- a/frontend/src/api/info/index.ts +++ b/frontend/src/api/info/index.ts @@ -1,5 +1,5 @@ import { defineRequest } from '../common' -import type { IAdventureInfo, ICharacterInfo, ISkillInfo } from './type' +import type { IAdventureInfo, ICharacterInfo, IHelperInfo, ISkillInfo } from './type' export default defineRequest((request) => { return { @@ -31,5 +31,10 @@ export default defineRequest((request) => { const res = await request.get(`/info/oath/${suitId}/${skillId}`, { params: { rarity, lv } }) return res.data }, + async getHelperList(id: string) { + const res = await request.get(`/dnfhelper/${id}/list`) + await new Promise((resolve) => setTimeout(resolve, 30000)) + return res.data + }, } }) diff --git a/frontend/src/api/info/type.ts b/frontend/src/api/info/type.ts index 73aca316..a76ffb79 100644 --- a/frontend/src/api/info/type.ts +++ b/frontend/src/api/info/type.ts @@ -215,3 +215,16 @@ export interface Attribute { optionValue: Record<`value${string}`, string> detail: string } + +export interface IHelperInfo { + id: string + avatar: string + name: string + roleList: { + roleId: string + roleName: string + roleJob: string + avatarLink: string + fame: number + }[] +} diff --git a/frontend/src/pages/Dnfhelper/bind.vue b/frontend/src/pages/Dnfhelper/bind.vue new file mode 100644 index 00000000..79962213 --- /dev/null +++ b/frontend/src/pages/Dnfhelper/bind.vue @@ -0,0 +1,37 @@ + + diff --git a/frontend/src/pages/Dnfhelper/index.vue b/frontend/src/pages/Dnfhelper/index.vue new file mode 100644 index 00000000..69f48294 --- /dev/null +++ b/frontend/src/pages/Dnfhelper/index.vue @@ -0,0 +1,34 @@ + + diff --git a/frontend/src/pages/Dnfhelper/list.vue b/frontend/src/pages/Dnfhelper/list.vue new file mode 100644 index 00000000..fa1923c1 --- /dev/null +++ b/frontend/src/pages/Dnfhelper/list.vue @@ -0,0 +1,76 @@ + + diff --git a/frontend/src/pages/Dnfhelper/processing.vue b/frontend/src/pages/Dnfhelper/processing.vue new file mode 100644 index 00000000..06dfc280 --- /dev/null +++ b/frontend/src/pages/Dnfhelper/processing.vue @@ -0,0 +1,2 @@ + + diff --git a/frontend/src/router/index.ts b/frontend/src/router/index.ts index 1e783d8e..16ba4c0a 100644 --- a/frontend/src/router/index.ts +++ b/frontend/src/router/index.ts @@ -9,6 +9,11 @@ const routes: RouteRecordRaw[] = [ name: 'home', component: () => import('@/pages/Home/Index.vue'), }, + { + path: '/dnfhelper', + name: 'dnfhelper', + component: () => import('@/pages/Dnfhelper/index.vue'), + }, { path: '/character/:alter', redirect: (to) => { diff --git a/frontend/src/stores/dnfhelper.ts b/frontend/src/stores/dnfhelper.ts new file mode 100644 index 00000000..ca65e07c --- /dev/null +++ b/frontend/src/stores/dnfhelper.ts @@ -0,0 +1,51 @@ +import { defineStore } from "pinia"; +import api from "@/api"; +import type { IHelperInfo } from "@/api/info/type"; + +export const useDnfHelperStore = defineStore("dnfHelperStore", () => { + const helperInfo = useLocalStorage("dnfHelperInfo", null, { + serializer: { + read: (v) => (v ? JSON.parse(v) : null), + write: (v) => JSON.stringify(v), + }, + }); + + const loading = ref(false); + const errorMessage = ref(""); + + const refleshHelperInfo = async (uid?: string) => { + if (!uid) return; + loading.value = true; + errorMessage.value = ""; + try { + const data = await api.getHelperList(uid); + if (data) { + helperInfo.value = data; + } + + } catch (error) { + errorMessage.value = error instanceof Error ? error.message : "同步助手数据失败"; + throw error; + } finally { + loading.value = false; + } + }; + + const refreshHelperInfo = async (uid?: string) => { + await refleshHelperInfo(uid); + }; + + const logout = () => { + helperInfo.value = null; + errorMessage.value = ""; + }; + + return { + helperInfo, + loading, + errorMessage, + refleshHelperInfo, + refreshHelperInfo, + logout, + }; +});