propMap缓存

This commit is contained in:
目棃
2024-08-15 18:55:57 +08:00
parent 6e0bb42c3b
commit bb0227cd0c
3 changed files with 11 additions and 3 deletions

View File

@@ -61,6 +61,7 @@ async function tryGetDetail(): Promise<void> {
}
console.log(res);
showSnackbar({ text: "获取成功!", color: "success" });
userStore.propMap = res.property_map;
}
</script>
<style lang="css" scoped>

View File

@@ -1,7 +1,7 @@
/**
* @file store/modules/user.ts
* @description 用户信息模块
* @since Beta v0.5.1
* @since Beta v0.5.3
*/
import { defineStore } from "pinia";
@@ -27,6 +27,7 @@ export const useUserStore = defineStore(
regionName: "",
});
const cookie = ref<TGApp.User.Account.Cookie>();
const propMap = ref<TGApp.Game.Avatar.PropMap>();
function getAllCookie(): string {
let res = "";
@@ -59,6 +60,7 @@ export const useUserStore = defineStore(
cookie,
briefInfo,
account,
propMap,
getAllCookie,
};
},
@@ -79,6 +81,11 @@ export const useUserStore = defineStore(
storage: window.localStorage,
paths: ["account"],
},
{
key: "propMap",
storage: window.localStorage,
paths: ["propMap"],
},
],
},
);

View File

@@ -98,7 +98,7 @@ declare namespace TGApp.Game.Avatar {
* @interface AvatarDetail
* @since Beta v0.5.3
* @property {DetailList[]} list - 角色详情列表
* @property {PropMap[]} property_map - 角色属性映射
* @property {PropMap} property_map - 角色属性映射
* @property {PropRecommend} relic_property_options - 圣遗物属性选项
* @property {Record<string, string>} relic_wiki - 圣遗物属性对应的百科
* @property {Record<string, string>} weapon_wiki - 武器属性对应的百科
@@ -107,7 +107,7 @@ declare namespace TGApp.Game.Avatar {
*/
interface AvatarDetail {
list: DetailList[];
property_map: PropMap[];
property_map: PropMap;
relic_property_options: PropRecommend;
relic_wiki: Record<string, string>;
weapon_wiki: Record<string, string>;