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); console.log(res);
showSnackbar({ text: "获取成功!", color: "success" }); showSnackbar({ text: "获取成功!", color: "success" });
userStore.propMap = res.property_map;
} }
</script> </script>
<style lang="css" scoped> <style lang="css" scoped>

View File

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

View File

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