diff --git a/src/components/t-calendar.vue b/src/components/t-calendar.vue index f76e6ac2..fd0fbbdf 100644 --- a/src/components/t-calendar.vue +++ b/src/components/t-calendar.vue @@ -98,7 +98,6 @@ import { ref, onMounted } from "vue"; // data import { TGAppData } from "../data/index"; // interface -import { type Map } from "../interface/Base"; import { CalendarData, CalendarItem, MiniMaterial } from "../interface/Calendar"; import { OBC_CONTENT_API } from "../plugins/Mys/interface/utils"; import { createTGWindow } from "../utils/TGWindow"; @@ -107,13 +106,13 @@ import { createTGWindow } from "../utils/TGWindow"; const loading = ref(true as boolean); // data -const calendarData = ref(TGAppData.calendar as Map); +const calendarData = ref(TGAppData.calendar as Record); const weekNow = ref(0 as number); const btnNow = ref(0 as number); const dateNow = ref(new Date().toLocaleDateString()); const calendarNow = ref({} as CalendarData); -const characterCards = ref({} as Map); -const weaponCards = ref({} as Map); +const characterCards = ref({} as Record); +const weaponCards = ref({} as Record); const btnText = [ { diff --git a/src/components/t-pool.vue b/src/components/t-pool.vue index 48f8a5ef..c07ea53b 100644 --- a/src/components/t-pool.vue +++ b/src/components/t-pool.vue @@ -57,7 +57,6 @@ import { createTGWindow } from "../utils/TGWindow"; import MysOper from "../plugins/Mys"; // interface import { GachaCard, GachaData } from "../plugins/Mys/interface/gacha"; -import { Map } from "../interface/Base"; // vue const router = useRouter(); @@ -70,8 +69,8 @@ const loading = ref(true as boolean); // data const poolCards = ref([] as GachaCard[]); -const poolTimeGet = ref({} as Map); -const poolTimePass = ref({} as Map); +const poolTimeGet = ref({} as Record); +const poolTimePass = ref({} as Record); // expose defineExpose({ @@ -87,7 +86,7 @@ onMounted(async () => { } if (!checkCover(gachaData)) { poolCards.value = await MysOper.Gacha.card(gachaData); - const coverData: Map = {}; + const coverData: Record = {}; poolCards.value.map((pool) => { coverData[pool.post_id] = pool.cover; return pool; @@ -119,7 +118,7 @@ function checkCover (data: GachaData[]) { return false; } // 获取缓存 - const cover = homeStore.poolCover satisfies Map; + const cover = homeStore.poolCover satisfies Record; if (cover === undefined || cover === null) { return false; } diff --git a/src/components/t-position.vue b/src/components/t-position.vue index e8a52957..f841ae0a 100644 --- a/src/components/t-position.vue +++ b/src/components/t-position.vue @@ -57,15 +57,13 @@ import { createTGWindow } from "../utils/TGWindow"; import MysOper from "../plugins/Mys"; // interface import { PositionCard } from "../plugins/Mys/interface/position"; -import { Map } from "../interface/Base"; - // loading const loading = ref(true as boolean); // 数据 const positionCards = ref([] as PositionCard[]); -const positionTimeGet = ref({} as Map); -const positionTimeEnd = ref({} as Map); +const positionTimeGet = ref({} as Record); +const positionTimeEnd = ref({} as Record); const router = useRouter(); // expose diff --git a/src/core/db/init.ts b/src/core/db/init.ts deleted file mode 100644 index 8bd964e8..00000000 --- a/src/core/db/init.ts +++ /dev/null @@ -1,5 +0,0 @@ -/** - * @file src core db init - * @description 初始化 sqlite 数据库 - * @author BTMuli - */ diff --git a/src/core/types/GCG.d.ts b/src/core/types/GCG.d.ts deleted file mode 100644 index b79f5005..00000000 --- a/src/core/types/GCG.d.ts +++ /dev/null @@ -1,337 +0,0 @@ -/** - * @file core types GCG.d.ts - * @description 类型定义,用于定义GCG卡牌数据类型 - * @author BTMuli - * @since Alpha v0.1.2 - */ - -namespace TGCG { - /** - * @description Gcg 基本卡牌类型 - * @interface BaseCardType - * @since Alpha v0.1.2 - * @property {string} characterCard 角色卡 - * @property {string} actionCard 行动卡 - * @property {string} monsterCard 魔物卡 - * @return BaseCardType - */ - export enum BaseCardType { - characterCard = "角色牌", - actionCard = "行动牌", - monsterCard = "魔物牌", - } - - /** - * @description Gcg 基本卡牌 - * @interface BaseCard - * @since Alpha v0.1.2 - * @see BaseCardType - * @see CharacterCard - * @see ActionCard - * @see MonsterCard - * @property {string} name 卡牌名称 - * @property {number} id 卡牌 ID // TODO: 用于短期外链跳转 - * @property {string} type 卡牌类型 - * @property icon 卡牌图标 - * @property {string} icon.normal 正常图标 - * @property {string} icon.special 特殊图标 - * @property {unknown} info 卡牌信息 - * @property {unknown} skills 卡牌技能,仅角色卡与魔物卡有 - * @property {unknown} affect 卡牌效果,仅行动卡有 - * @return BaseCard - */ - export interface BaseCard { - name: string - id: number - type: BaseCardType - icon: { normal: string, special?: string } - info: unknown - skills?: unknown - affect?: unknown - } - - /** - * @description Gcg 角色卡牌 - * @interface CharacterCard - * @since Alpha v0.1.2 - * @see BaseCard - * @see CharacterCardType - * @property {EnumElement} info.element 元素 - * @property {EnumWeapon} info.weapon 武器 - * @property {EnumCamp} info.camp 阵营 - * @property {string} info.source 卡牌来源 - * @property {string} info.title 卡牌标题 - * @property {string} info.description 卡牌描述 - * @property {string} skills[].name 技能名称 - * @property {string} skills[].type 技能类型 - * @property {string} skills[].description 技能描述 - * @property {string} skills[].cost 技能花费 - * @property {string} skills[].cost.type 花费类型 - * @property {string} skills[].cost.value 花费值 - * @description 当技能类型为 “召唤物” 时,会有以下属性 - * @property {number} skills[].count 可用次数 - * @return CharacterCard - */ - export interface CharacterCard extends BaseCard { - type: BaseCardType.characterCard - info: { - element: EnumElement - weapon: EnumWeapon - camp: EnumCamp - source: string - title: string - description: string - } - skills: Array<{ - name: string - type: string - description: string - cost: { - type: string - value: string - } - count?: number - }> - } - - /** - * @description Gcg 行动卡牌 - * @interface ActionCard - * @since Alpha - * @see BaseCard - * @see ActionCardType - * @property {EnumActionType} info.actionType 类型 - * @property {EnumActionTag} info.actionTag 标签 - * @property {EnumActionCost} info.actionCost 花费 - * @property {string} info.source 卡牌来源 - * @property {string} info.title 卡牌标题 - * @property {string} info.description 卡牌描述 - * @description 当类型为“天赋”时,可能会有以下属性 - * @property {string} info.charge 充能 - * @property {string} affect 卡牌效果 - * @return ActionCard - */ - export interface ActionCard extends BaseCard { - type: BaseCardType.actionCard - info: { - actionType: EnumActionType - actionTag: EnumActionTag - actionCost: EnumActionCost - source: string - title: string - description: string - charge?: string - } - affect: string - } - - /** - * @description Gcg 魔物卡牌 - * @description 与角色卡牌类似 - * @interface MonsterCard - * @since Alpha - * @see BaseCard - * @see CharacterCardType - * @property {EnumElement} info.element 元素 - * @property {EnumWeapon} info.weapon 武器 - * @property {EnumCamp} info.camp 阵营 - * @property {string} info.source 卡牌来源 - * @description 无标题跟描述 - * @property {string} skills[].name 技能名称 - * @property {string} skills[].type 技能类型 - * @property {string} skills[].description 技能描述 - * @property {string} skills[].cost 技能花费 - * @property {string} skills[].cost.type 花费类型 - * @property {string} skills[].cost.value 花费值 - * @description 当技能类型为 “召唤物” 时,会有以下属性 - * @return MonsterCard - */ - export interface MonsterCard extends BaseCard { - type: BaseCardType.monsterCard - info: { - element: EnumElement - weapon: EnumWeapon - camp: EnumCamp - source: string - } - skills: Array<{ - name: string - type: string - description: string - cost: { - type: string - value: string - } - }> - } - - /** - * @description Gcg 角色牌分类依据 - * @interface CharacterCardType - * @since Alpha - * @see BaseCardType - * @property {EnumElement} element 元素 - * @property {EnumWeapon} weapon 武器 - * @property {EnumCamp} camp 阵营 - * @return CharacterCardType - */ - export interface CharacterCardType { - element: EnumElement - weapon: EnumWeapon - camp: EnumCamp - } - - /** - * @description Gcg 行动牌分类依据 - * @interface ActionCardType - * @since Alpha - * @see BaseCardType - * @property {EnumActionType} actionType 类型 - * @property {EnumActionTag} actionTag 标签 - * @property {EnumActionCost} actionCost 花费 - * @return ActionCardType - */ - export interface ActionCardType { - actionType: EnumActionType - actionTag: EnumActionTag - actionCost: EnumActionCost - } - - /** - * @description 角色牌元素 - * @enum EnumElement - * @since Alpha - * @see CharacterCardType - * @property {string} pyro 火元素 - * @property {string} hydro 水元素 - * @property {string} cryo 冰元素 - * @property {string} electro 雷元素 - * @property {string} anemo 风元素 - * @property {string} geo 岩元素 - * @property {string} dendro 草元素 - * @return EnumElement - */ - export enum EnumElement { - pyro = "火元素", - hydro = "水元素", - cryo = "冰元素", - electro = "雷元素", - anemo = "风元素", - geo = "岩元素", - dendro = "草元素", - } - - /** - * @description 角色牌武器 - * @enum EnumWeapon - * @since Alpha - * @see CharacterCardType - * @property {string} sword 单手剑 - * @property {string} claymore 双手剑 - * @property {string} pole 长柄武器 - * @property {string} bow 弓 - * @property {string} catalyst 法器 - * @property {string} other 其他武器 - * @return EnumWeapon - */ - export enum EnumWeapon { - sword = "单手剑", - claymore = "双手剑", - pole = "长柄武器", - bow = "弓", - catalyst = "法器", - other = "其他武器", - } - - /** - * @description 角色牌阵营 - * @enum EnumCamp - * @since Alpha - * @see CharacterCardType - * @property {string} mondstadt 蒙德 - * @property {string} liyue 璃月 - * @property {string} inazuma 稻妻 - * @property {string} sumeru 须弥 - * @property {string} fatui 愚人众 - * @property {string} monster 魔物 - * @return EnumCamp - */ - export enum EnumCamp { - mondstadt = "蒙德", - liyue = "璃月", - inazuma = "稻妻", - sumeru = "须弥", - fatui = "愚人众", - monster = "魔物", - } - - /** - * @description 行动牌类型 - * @enum EnumActionType - * @since Alpha - * @see ActionCardType - * @property {string} equipment 装备牌 - * @property {string} event 事件牌 - * @property {string} support 支援牌 - * @return EnumActionType - */ - export enum EnumActionType { - equipment = "装备牌", - event = "事件牌", - support = "支援牌", - } - - /** - * @description 行动牌标签 - * @enum EnumActionTag - * @since Alpha - * @see ActionCardType - * @property {string} weapon 武器 - * @property {string} artifact 圣遗物 - * @property {string} talent 天赋 - * @property {string} food 料理 - * @property {string} item 道具 - * @property {string} partner 伙伴 - * @property {string} filed 场地 - * @property {string} elementResonance 元素共鸣 - * @property {string} other 其他标签 - * @return EnumActionTag - */ - export enum EnumActionTag { - weapon = "武器", - artifact = "圣遗物", - talent = "天赋", - food = "料理", - item = "道具", - partner = "伙伴", - filed = "场地", - elementResonance = "元素共鸣", - other = "其他标签", - } - - /** - * @description 行动牌花费 - * @enum EnumActionCost - * @since Alpha - * @see ActionCardType - * @property {string} cost0 花费0 - * @property {string} cost1 花费1 - * @property {string} cost2 花费2 - * @property {string} cost3 花费3 - * @property {string} cost4 花费4 - * @property {string} cost5 花费5 - * @property {string} cost6 花费6 - * @property {string} other 其他花费 - * @return EnumActionCost - */ - export enum EnumActionCost { - cost0 = "花费0", - cost1 = "花费1", - cost2 = "花费2", - cost3 = "花费3", - cost4 = "花费4", - cost5 = "花费5", - cost6 = "花费6", - other = "其他花费", - } -} diff --git a/src/core/types/TGAchievement.d.ts b/src/core/types/TGAchievement.d.ts index 5f59dfbf..227cfbff 100644 --- a/src/core/types/TGAchievement.d.ts +++ b/src/core/types/TGAchievement.d.ts @@ -5,7 +5,7 @@ * @ since Alpha v0.1.2 */ -namespace TGAchievements { +namespace TGAchievement { /** * @description 本应用的成就类型 * @since Alpha v0.1.2 @@ -62,3 +62,5 @@ namespace TGAchievements { icon: string } } + +export default TGAchievement; diff --git a/src/core/types/TGBase.d.ts b/src/core/types/TGBase.d.ts index 071551b7..1fd8a036 100644 --- a/src/core/types/TGBase.d.ts +++ b/src/core/types/TGBase.d.ts @@ -6,15 +6,20 @@ */ namespace TGBase { - /** - * @description 定义一个 Map 接口 - * @since Alpha v0.1.2 - * @description 该接口的方法实现在 TGMap 中 - * @see TGMap - * @interface Map - * @template T - * @return Map - */ - - export type Map = Record; +/** + * @description 定义 IndexedDB 数据库配置 + * @since Alpha v0.1.2 + * @interface DBConfig + * @property {string} storeName 数据库名称 + * @property {string} keyPath 数据库主键 + * @property {string[]} indexes 数据库索引 + * @returns {DBConfig} + */ + export interface DBConfig { + storeName: string + keyPath: string + indexes: string[] + } } + +export default TGBase; diff --git a/src/interface/NameCard.ts b/src/core/types/TGNameCard.d.ts similarity index 61% rename from src/interface/NameCard.ts rename to src/core/types/TGNameCard.d.ts index f70bcb08..8ccb4c72 100644 --- a/src/interface/NameCard.ts +++ b/src/core/types/TGNameCard.d.ts @@ -1,13 +1,14 @@ /** - * @file interface NameCard.ts - * @description NameCard interface + * @file core types TGNameCard.d.ts + * @description 本应用的名片类型定义 * @author BTMuli - * @since Alpha + * @since Alpha v0.1.2 */ -/** +namespace TGNameCard { + /** * @description 本应用的名片类型 - * @since Alpha + * @since Alpha v0.1.2 * @interface NameCard * @property {string} name - 名片名称,同时也是文件名 * @property {string} description - 名片描述 @@ -18,12 +19,15 @@ * @property {string} source - 名片来源 * @returns {NameCard} */ -export interface NameCard { - name: string - description: string - icon: string - bg: string - profile: string - type: string - source: string + export interface NameCard { + name: string + description: string + icon: string + bg: string + profile: string + type: number + source: string + } } + +export default TGNameCard; diff --git a/src/core/types/TGTypes.d.ts b/src/core/types/TGTypes.d.ts new file mode 100644 index 00000000..5a8523ce --- /dev/null +++ b/src/core/types/TGTypes.d.ts @@ -0,0 +1,19 @@ +/** + * @file core types App.d.ts + * @description 本应用的类型定义 + * @author BTMuli + * @since Alpha v0.1.2 + */ + +import type TGBase from "./TGBase"; +import type TGAchievement from "./TGAchievement"; +import type TGNameCard from "./TGNameCard"; + +namespace TGTypes { + export type DBConfig = TGBase.DBConfig; + export type NameCard = TGNameCard.NameCard; + export type Achievement = TGAchievement.Achievement; + export type AchievementSeries = TGAchievement.AchievementSeries; +} + +export default TGTypes; diff --git a/src/data/app/index.ts b/src/data/app/index.ts index a0292209..2b13fa68 100644 --- a/src/data/app/index.ts +++ b/src/data/app/index.ts @@ -12,20 +12,18 @@ import GCG from "./GCG.json"; import nameCards from "./nameCards.json"; import calendar from "./calendar.json"; // Interface -import { type Achievement, type AchievementSeries } from "../../interface/Achievements"; -import { type Map } from "../../interface/Base"; +import type TGAppTypes from "../../core/types/TGTypes"; import { type BaseCard } from "../../interface/GCG"; -import { type NameCard } from "../../interface/NameCard"; import { type CalendarData } from "../../interface/Calendar"; export const AppDataList = [ { name: "achievements.json", - data: achievements as Map, + data: achievements as Record, }, { name: "achievementSeries.json", - data: achievementSeries as Map, + data: achievementSeries as Record, }, { name: "GCG.json", @@ -33,18 +31,18 @@ export const AppDataList = [ }, { name: "nameCards.json", - data: nameCards as unknown as Map, + data: nameCards as Record, }, { name: "calendar.json", - data: calendar as Map, + data: calendar as Record, }, ]; export const AppData = { - achievements: achievements as Map, - achievementSeries: achievementSeries as Map, + achievements: achievements as Record, + achievementSeries: achievementSeries as Record, GCG: GCG as BaseCard[], - nameCards: nameCards as unknown as Map, - calendar: calendar as Map, + nameCards: nameCards as Record, + calendar: calendar as Record, }; diff --git a/src/data/init/GCG.ts b/src/data/init/GCG.ts index c27fdbc3..fb3223b5 100644 --- a/src/data/init/GCG.ts +++ b/src/data/init/GCG.ts @@ -6,15 +6,15 @@ * @since Alpha v0.1.2 */ import { AppData } from "../app"; +import type TGTypes from "../../core/types/TGTypes"; import { type BaseCard } from "../../interface/GCG"; -import { type DBConfig } from "../../interface/Base"; /** * @description 卡牌表参数 * @since Alpha v0.1.2 - * @returns {DBConfig} + * @returns {TGTypes.DBConfig} */ -export const Config: DBConfig = { +export const Config: TGTypes.DBConfig = { storeName: "GCG", keyPath: "id", // 根据 type 分类 diff --git a/src/data/init/achievementSeries.ts b/src/data/init/achievementSeries.ts index 1af1e1fa..02d9ee4a 100644 --- a/src/data/init/achievementSeries.ts +++ b/src/data/init/achievementSeries.ts @@ -4,16 +4,15 @@ * @author BTMuli * @since Alpha v0.1.2 */ -import { type AchievementSeries } from "../../interface/Achievements"; -import { type Map, type DBConfig } from "../../interface/Base"; +import type TGTypes from "../../core/types/TGTypes"; import { AppData } from "../app"; /** * @description 成就系列表参数 * @since Alpha v0.1.2 - * @returns {DBConfig} + * @returns {TGTypes.DBConfig} */ -export const Config: DBConfig = { +export const Config: TGTypes.DBConfig = { storeName: "AchievementSeries", keyPath: "id", indexes: ["order", "name", "card"], @@ -22,10 +21,10 @@ export const Config: DBConfig = { /** * @description 成就系列数据 * @since Alpha v0.1.2 - * @return {AchievementSeries[]} + * @return {TGTypes.AchievementSeries[]} */ -export function getData (): AchievementSeries[] { - const data: Map = AppData.achievementSeries; +export function getData (): TGTypes.AchievementSeries[] { + const data: Record = AppData.achievementSeries; return Object.keys(data).map((key) => { return data[Number(key)]; }); diff --git a/src/data/init/achievements.ts b/src/data/init/achievements.ts index e96bb52c..b659dd24 100644 --- a/src/data/init/achievements.ts +++ b/src/data/init/achievements.ts @@ -5,15 +5,14 @@ * @since Alpha v0.1.2 */ import { AppData } from "../app"; -import { type Achievement } from "../../interface/Achievements"; -import { type Map, type DBConfig } from "../../interface/Base"; +import type TGTypes from "../../core/types/TGTypes"; /** * @description 成就表参数 * @since Alpha v0.1.2 - * @returns {DBConfig} + * @returns {TGTypes.DBConfig} */ -export const Config: DBConfig = { +export const Config: TGTypes.DBConfig = { storeName: "Achievements", keyPath: "id", indexes: ["name", "description", "series", "order", "reward", "version"], @@ -22,10 +21,10 @@ export const Config: DBConfig = { /** * @description 成就数据 * @since Alpha v0.1.2 - * @return {Achievement[]} + * @return {TGTypes.Achievement[]} */ -export function getData (): Achievement[] { - const data: Map = AppData.achievements; +export function getData (): TGTypes.Achievement[] { + const data: Record = AppData.achievements; return Object.keys(data).map((key) => { return data[Number(key)]; }); diff --git a/src/data/init/nameCard.ts b/src/data/init/nameCard.ts index 7fa97de8..d928a0cc 100644 --- a/src/data/init/nameCard.ts +++ b/src/data/init/nameCard.ts @@ -6,15 +6,14 @@ */ import { AppData } from "../app"; -import { type NameCard } from "../../interface/NameCard"; -import { type Map, type DBConfig } from "../../interface/Base"; +import type TGTypes from "../../core/types/TGTypes"; /** * @description 名片表参数 * @since Alpha v0.1.2 - * @returns {DBConfig} + * @returns {TGTypes.DBConfig} */ -export const Config: DBConfig = { +export const Config: TGTypes.DBConfig = { storeName: "NameCard", keyPath: "name", indexes: ["type"], @@ -23,13 +22,13 @@ export const Config: DBConfig = { /** * @description 名片数据 * @since Alpha v0.1.2 - * @return {NameCard[]} + * @return {TGTypes.NameCard[]} */ -export function getData (): NameCard[] { - const data: Map = AppData.nameCards; - const result: NameCard[] = []; +export function getData (): TGTypes.NameCard[] { + const data: Record = AppData.nameCards; + const result: TGTypes.NameCard[] = []; Object.keys(data).map((key) => { - const cards: NameCard[] = data[Number(key)]; + const cards: TGTypes.NameCard[] = data[Number(key)]; return cards.map((card) => result.push(card)); }); return result; diff --git a/src/interface/Achievements.ts b/src/interface/Achievements.ts deleted file mode 100644 index e2fc57e3..00000000 --- a/src/interface/Achievements.ts +++ /dev/null @@ -1,64 +0,0 @@ -/** - * @file Achievements.ts - * @description Achievements interface - * @author BTMuli - * @since Alpha - */ - -/** - * @description 本应用的成就类型 - * @since Alpha - * @interface Achievement - * @property {number} id - 成就 ID - * @property {number} series - 成就系列 ID - * @property {number} order - 成就排列顺序,用于展示全部成就 - * @property {string} name - 成就名称 - * @property {string} description - 成就描述 - * @property {number} reward - 成就奖励 - * @property {boolean} completed - 成就是否完成 - * @property {string} completed_time - 成就完成时间 - * @property {number} progress - 成就进度 - * @property {string} version - 成就版本 - * @returns {Achievement} - */ -export interface Achievement { - id: number - series: number - order: number - name: string - description: string - reward: number - completed: boolean - completed_time: string | null - progress: number - version: string -} - -/** - * @description 本应用的成就系列类型 - * @since Alpha - * @interface AchievementSeries - * @property {number} id - 成就系列 ID - * @property {number} order - 成就系列排列顺序,用于展示全部成就系列 - * @property {string} name - 成就系列名称 - * @property {string} version - 成就系列版本 - * @property {number[]} achievements - 成就系列包含的成就 - * @property {number} total_count - 成就系列包含的成就数 - * @property {number} completed_count - 成就系列已完成的成就数 - * @description 有的成就系列没有名片奖励,这边的 card 可能为 undefined - * @property {string} card - 成就系列奖励,这边是名片名称 - * @description 像是天地万象这种一直更新的成就系列,这边的 version 可能为 undefined - * @property {string} icon - 成就系列图标 - * @returns {AchievementSeries} - */ -export interface AchievementSeries { - id: number - order: number - name: string - version: string - achievements: number[] - total_count: number - completed_count: number - card?: string - icon: string -} diff --git a/src/interface/Base.ts b/src/interface/Base.ts index d7fac18a..b9009eaf 100644 --- a/src/interface/Base.ts +++ b/src/interface/Base.ts @@ -5,30 +5,6 @@ * @since Alpha v0.1.2 */ -/** - * @description 定义一个 Map 接口 - * @since Alpha v0.1.2 - * @interface Map - * @template T - * @returns {Map} - */ -export type Map = Record; - -/** - * @description 定义 IndexedDB 数据库配置 - * @since Alpha v0.1.2 - * @interface DBConfig - * @property {string} storeName 数据库名称 - * @property {string} keyPath 数据库主键 - * @property {string[]} indexes 数据库索引 - * @returns {DBConfig} - */ -export interface DBConfig { - storeName: string - keyPath: string - indexes: string[] -} - /** * @description 地区的枚举 * @enum GameCountry diff --git a/src/interface/Calendar.ts b/src/interface/Calendar.ts index a95793a0..bd810f93 100644 --- a/src/interface/Calendar.ts +++ b/src/interface/Calendar.ts @@ -5,8 +5,6 @@ * @since Alpha v0.1.2 */ -import { type Map } from "./Base"; - /** * @description 素材日历接口 * @interface CalendarData @@ -17,8 +15,8 @@ import { type Map } from "./Base"; * @returns {CalendarData} */ export interface CalendarData { - characters: Map - weapons: Map + characters: Record + weapons: Record } /** diff --git a/src/interface/GCG.ts b/src/interface/GCG.ts index f3edda55..18b67419 100644 --- a/src/interface/GCG.ts +++ b/src/interface/GCG.ts @@ -173,7 +173,7 @@ export interface MonsterCard extends BaseCard { * @property {EnumElement} element 元素 * @property {EnumWeapon} weapon 武器 * @property {EnumCamp} camp 阵营 - * @returns {CharacterCardType} + * @returns {CharacterCardType} */ export interface CharacterCardType { element: EnumElement @@ -189,7 +189,7 @@ export interface CharacterCardType { * @property {EnumActionType} actionType 类型 * @property {EnumActionTag} actionTag 标签 * @property {EnumActionCost} actionCost 花费 - * @returns {ActionCardType} + * @returns {ActionCardType} */ export interface ActionCardType { actionType: EnumActionType diff --git a/src/pages/Achievements.vue b/src/pages/Achievements.vue index 01df6002..242ba1f3 100644 --- a/src/pages/Achievements.vue +++ b/src/pages/Achievements.vue @@ -108,9 +108,8 @@ import { dialog, fs } from "@tauri-apps/api"; // Store import { useAchievementsStore } from "../store/modules/achievements"; // Interface +import type TGTypes from "../core/types/TGTypes"; import { Achievements, UiafHeader, UiafAchievement } from "../plugins/UIAF/interface/UIAF"; -import { Achievement as TGAchievement, AchievementSeries as TGSeries } from "../interface/Achievements"; -import { NameCard } from "../interface/NameCard"; // Plugins import UiafOper from "../plugins/UIAF"; // Utils @@ -126,13 +125,13 @@ const loadingTitle = ref("正在加载数据" as string); // data const title = ref(achievementsStore.title as string); -const CardsInfo = ref([] as NameCard[]); -const getCardInfo = ref({} as NameCard); +const CardsInfo = ref([] as TGTypes.NameCard[]); +const getCardInfo = ref({} as TGTypes.NameCard); // series -const seriesList = ref([] as TGSeries[]); +const seriesList = ref([] as TGTypes.AchievementSeries[]); const selectedIndex = ref(-1 as number); const selectedSeries = ref(-1 as number); -const selectedAchievement = ref([] as TGAchievement[]); +const selectedAchievement = ref([] as TGTypes.Achievement[]); // render const search = ref("" as string); @@ -146,7 +145,7 @@ onMounted(async () => { // 加载数据,数据源:合并后的本地数据 async function loadData () { loadingTitle.value = "正在获取成就系列数据"; - const seriesDB: TGSeries[] = await ReadAllTGData("AchievementSeries"); + const seriesDB: TGTypes.AchievementSeries[] = await ReadAllTGData("AchievementSeries"); loadingTitle.value = "正在获取成就系列名片数据"; CardsInfo.value = await ReadTGDataByIndex("NameCard", "type", 1); loadingTitle.value = "对成就系列数据进行排序"; @@ -180,11 +179,11 @@ async function selectSeries (index: number) { selectedIndex.value = index; selectedSeries.value = seriesList.value[index].id; loadingTitle.value = "正在查找对应的成就名片"; - let getCard: NameCard; + let getCard: TGTypes.NameCard; if (selectedSeries.value !== 0 && selectedSeries.value !== 17) { getCard = CardsInfo.value.find((card) => card.name === seriesList.value[index].card)!; } else { - getCard = {} as NameCard; + getCard = {} as TGTypes.NameCard; } loadingTitle.value = "正在对成就数据进行排序"; getAchievements.sort((a, b) => { @@ -214,7 +213,7 @@ async function searchCard () { } loadingTitle.value = "正在搜索"; loading.value = true; - const res: TGAchievement[] = []; + const res: TGTypes.Achievement[] = []; const allAchievements = await ReadAllTGData("Achievements"); allAchievements.map((achievement) => { if (achievement.name.includes(search.value) || achievement.description.includes(search.value)) { @@ -266,7 +265,7 @@ async function importJson () { await Promise.allSettled( remoteData.list.map(async (data) => { const id = data.id; - const localData: TGAchievement = (await ReadTGDataByKey("Achievements", [id]))[0]; + const localData: TGTypes.Achievement = (await ReadTGDataByKey("Achievements", [id]))[0]; // 获取 timeStamp 2023-03-15 00:00:00 const localTime = localData.completed_time; // 如果本地数据不存在,或者本地数据的 timeStamp 小于远程数据的 timeStamp,更新数据 diff --git a/src/plugins/Mys/interface/calendar.ts b/src/plugins/Mys/interface/calendar.ts index dc09cfa5..a8056b9f 100644 --- a/src/plugins/Mys/interface/calendar.ts +++ b/src/plugins/Mys/interface/calendar.ts @@ -2,11 +2,10 @@ * @file plugins Mys interface calendar.ts * @description Mys 插件日历接口 * @author BTMuli - * @since Alpha v0.1.1 + * @since Alpha v0.1.2 */ import { type MysResponse } from "./base"; -import { type Map } from "../../../interface/Base"; /** * @description 日历返回数据 @@ -84,7 +83,7 @@ export interface CalendarContent { /** * @description 渲染用的日历数据 - * @since Alpha v0.1.1 + * @since Alpha v0.1.2 * @interface CalendarCard * @property {number} id 角色/武器 ID * @property {number} type 角色/武器,角色为 2,武器为 1 @@ -92,7 +91,7 @@ export interface CalendarContent { * @property {string} cover 角色/武器 封面 * @property {string} url 跳转链接,一般为 content_id * @property {string[]} drop_day 掉落日 - * @property {Map} sort_day 排序 + * @property {Record} sort_day 排序 * @property {CalendarContent[]} contentInfos 材料内容 * @returns {CalendarCard} */ @@ -103,6 +102,6 @@ export interface CalendarCard { cover: string url: string drop_day: string[] - sort_day: Map + sort_day: Record contentInfos: CalendarContent[] } diff --git a/src/plugins/Mys/utils/gacha.ts b/src/plugins/Mys/utils/gacha.ts index c6910e3e..03331631 100644 --- a/src/plugins/Mys/utils/gacha.ts +++ b/src/plugins/Mys/utils/gacha.ts @@ -7,7 +7,6 @@ import { getPostData } from "../request/post"; import { type GachaCard, type GachaData } from "../interface/gacha"; -import { type Map } from "../../../interface/Base"; /** * @description 根据卡池信息转为渲染用的卡池信息 @@ -18,7 +17,7 @@ import { type Map } from "../../../interface/Base"; */ export async function getGachaCard ( gachaData: GachaData[], - poolCover: Map | undefined = undefined, + poolCover: Record | undefined = undefined, ): Promise { const gachaCard: GachaCard[] = []; await Promise.allSettled( diff --git a/src/store/modules/home.ts b/src/store/modules/home.ts index b2dd4750..4506f0d9 100644 --- a/src/store/modules/home.ts +++ b/src/store/modules/home.ts @@ -9,8 +9,6 @@ import { ref } from "vue"; // pinia import { defineStore } from "pinia"; -// interface -import { type Map } from "../../interface/Base"; export const useHomeStore = defineStore( "home", () => { @@ -31,7 +29,7 @@ export const useHomeStore = defineStore( poolShow, positionShow, }); - const poolCover = ref({} satisfies Map); + const poolCover = ref({} satisfies Record); function init (): void { calendarShow.value = { diff --git a/tsconfig.node.json b/tsconfig.node.json index be4f2ed8..d3bf4b82 100644 --- a/tsconfig.node.json +++ b/tsconfig.node.json @@ -5,5 +5,5 @@ "moduleResolution": "Node", "allowSyntheticDefaultImports": true }, - "include": ["vite.config.ts", "src/utils/TGBuild.ts"] + "include": ["vite.config.ts"] }