This commit is contained in:
2025-04-01 10:52:20 +08:00
parent cd0bc1da73
commit 361ad952ca
3 changed files with 96 additions and 39 deletions
+28 -14
View File
@@ -1,27 +1,41 @@
import api from "@/api"
import type { ICharacterInfo } from "@/api/info/type"
import { defineStore } from "pinia"
import api from '@/api'
import type { ICharacterInfo } from '@/api/info/type'
import { defineStore } from 'pinia'
export const useInfoStore = defineStore("infoStore", ()=>{
const alter_token = ref<string>("")
export const useInfoStore = defineStore('infoStore', () => {
const alter_token = ref<string>('')
const infos = ref<ICharacterInfo | null>(null)
const skills = computed(()=>infos.value?.skills ?? [])
const skills = computed(() => infos.value?.skills ?? [])
const equips = computed(()=>infos.value?.equips ?? [])
const equips = computed(() => infos.value?.equips ?? [])
const suits = computed(()=>infos.value?.suits ?? [])
const suits = computed(() => infos.value?.suits ?? [])
const enchants = computed(()=>infos.value?.enchants ?? [])
const enchants = computed(() => infos.value?.enchants ?? [])
const emblems = computed(()=>infos.value?.emblems?? [])
const emblems = computed(() => infos.value?.emblems ?? [])
const parts = ['上衣', '头肩', '下装', '腰带', '鞋', '手镯', '项链', '戒指', '耳环', '辅助装备', '魔法石', '武器']
const parts = [
'头肩',
'上衣',
'下装',
'腰带',
'鞋',
'武器',
'称号',
'手镯',
'项链',
'辅助装备',
'戒指',
'耳环',
'魔法石',
'宠物',
]
const createCharacter = async (alter: string, equVersion?: string) => {
const time = new Date().getTime()
alter_token.value = btoa(JSON.stringify({alter, equVersion, time}))
alter_token.value = btoa(JSON.stringify({ alter, equVersion, time }))
infos.value = await api.characterInfo()
}
@@ -34,6 +48,6 @@ export const useInfoStore = defineStore("infoStore", ()=>{
createCharacter,
enchants,
emblems,
parts
parts,
}
})