mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2025-12-12 09:18:14 +08:00
🏷️ fix(type): 一些 Type 改动
This commit is contained in:
@@ -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<CalendarData>);
|
||||
const calendarData = ref(TGAppData.calendar as Record<number, CalendarData>);
|
||||
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<CalendarItem>);
|
||||
const weaponCards = ref({} as Map<CalendarItem>);
|
||||
const characterCards = ref({} as Record<number, CalendarItem>);
|
||||
const weaponCards = ref({} as Record<number, CalendarItem>);
|
||||
|
||||
const btnText = [
|
||||
{
|
||||
|
||||
@@ -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<string>);
|
||||
const poolTimePass = ref({} as Map<number>);
|
||||
const poolTimeGet = ref({} as Record<number, string>);
|
||||
const poolTimePass = ref({} as Record<number, number>);
|
||||
|
||||
// expose
|
||||
defineExpose({
|
||||
@@ -87,7 +86,7 @@ onMounted(async () => {
|
||||
}
|
||||
if (!checkCover(gachaData)) {
|
||||
poolCards.value = await MysOper.Gacha.card(gachaData);
|
||||
const coverData: Map<string> = {};
|
||||
const coverData: Record<number, string> = {};
|
||||
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<string>;
|
||||
const cover = homeStore.poolCover satisfies Record<number, string>;
|
||||
if (cover === undefined || cover === null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -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<string>);
|
||||
const positionTimeEnd = ref({} as Map<number>);
|
||||
const positionTimeGet = ref({} as Record<number, string>);
|
||||
const positionTimeEnd = ref({} as Record<number, number>);
|
||||
const router = useRouter();
|
||||
|
||||
// expose
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
/**
|
||||
* @file src core db init
|
||||
* @description 初始化 sqlite 数据库
|
||||
* @author BTMuli<bt-muli@outlook.com>
|
||||
*/
|
||||
337
src/core/types/GCG.d.ts
vendored
337
src/core/types/GCG.d.ts
vendored
@@ -1,337 +0,0 @@
|
||||
/**
|
||||
* @file core types GCG.d.ts
|
||||
* @description 类型定义,用于定义GCG卡牌数据类型
|
||||
* @author BTMuli<bt-muli@outlook.com>
|
||||
* @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 = "其他花费",
|
||||
}
|
||||
}
|
||||
4
src/core/types/TGAchievement.d.ts
vendored
4
src/core/types/TGAchievement.d.ts
vendored
@@ -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;
|
||||
|
||||
27
src/core/types/TGBase.d.ts
vendored
27
src/core/types/TGBase.d.ts
vendored
@@ -6,15 +6,20 @@
|
||||
*/
|
||||
|
||||
namespace TGBase {
|
||||
/**
|
||||
* @description 定义一个 Map<T> 接口
|
||||
* @since Alpha v0.1.2
|
||||
* @description 该接口的方法实现在 TGMap<T> 中
|
||||
* @see TGMap
|
||||
* @interface Map
|
||||
* @template T
|
||||
* @return Map
|
||||
*/
|
||||
|
||||
export type Map<T> = Record<number, T>;
|
||||
/**
|
||||
* @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;
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
/**
|
||||
* @file interface NameCard.ts
|
||||
* @description NameCard interface
|
||||
* @file core types TGNameCard.d.ts
|
||||
* @description 本应用的名片类型定义
|
||||
* @author BTMuli<bt-muli@outlook.com>
|
||||
* @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;
|
||||
19
src/core/types/TGTypes.d.ts
vendored
Normal file
19
src/core/types/TGTypes.d.ts
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
/**
|
||||
* @file core types App.d.ts
|
||||
* @description 本应用的类型定义
|
||||
* @author BTMuli<bt-muli@outlook.com>
|
||||
* @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;
|
||||
@@ -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<Achievement>,
|
||||
data: achievements as Record<number, TGAppTypes.Achievement>,
|
||||
},
|
||||
{
|
||||
name: "achievementSeries.json",
|
||||
data: achievementSeries as Map<AchievementSeries>,
|
||||
data: achievementSeries as Record<number, TGAppTypes.AchievementSeries>,
|
||||
},
|
||||
{
|
||||
name: "GCG.json",
|
||||
@@ -33,18 +31,18 @@ export const AppDataList = [
|
||||
},
|
||||
{
|
||||
name: "nameCards.json",
|
||||
data: nameCards as unknown as Map<NameCard[]>,
|
||||
data: nameCards as Record<number, TGAppTypes.NameCard[]>,
|
||||
},
|
||||
{
|
||||
name: "calendar.json",
|
||||
data: calendar as Map<CalendarData>,
|
||||
data: calendar as Record<number, CalendarData>,
|
||||
},
|
||||
];
|
||||
|
||||
export const AppData = {
|
||||
achievements: achievements as Map<Achievement>,
|
||||
achievementSeries: achievementSeries as Map<AchievementSeries>,
|
||||
achievements: achievements as Record<number, TGAppTypes.Achievement>,
|
||||
achievementSeries: achievementSeries as Record<number, TGAppTypes.AchievementSeries>,
|
||||
GCG: GCG as BaseCard[],
|
||||
nameCards: nameCards as unknown as Map<NameCard[]>,
|
||||
calendar: calendar as Map<CalendarData>,
|
||||
nameCards: nameCards as Record<number, TGAppTypes.NameCard[]>,
|
||||
calendar: calendar as Record<number, CalendarData>,
|
||||
};
|
||||
|
||||
@@ -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 分类
|
||||
|
||||
@@ -4,16 +4,15 @@
|
||||
* @author BTMuli<bt-muli@outlook.com>
|
||||
* @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<AchievementSeries> = AppData.achievementSeries;
|
||||
export function getData (): TGTypes.AchievementSeries[] {
|
||||
const data: Record<number, TGTypes.AchievementSeries> = AppData.achievementSeries;
|
||||
return Object.keys(data).map((key) => {
|
||||
return data[Number(key)];
|
||||
});
|
||||
|
||||
@@ -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<Achievement> = AppData.achievements;
|
||||
export function getData (): TGTypes.Achievement[] {
|
||||
const data: Record<number, TGTypes.Achievement> = AppData.achievements;
|
||||
return Object.keys(data).map((key) => {
|
||||
return data[Number(key)];
|
||||
});
|
||||
|
||||
@@ -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<NameCard[]> = AppData.nameCards;
|
||||
const result: NameCard[] = [];
|
||||
export function getData (): TGTypes.NameCard[] {
|
||||
const data: Record<number, TGTypes.NameCard[]> = 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;
|
||||
|
||||
@@ -1,64 +0,0 @@
|
||||
/**
|
||||
* @file Achievements.ts
|
||||
* @description Achievements interface
|
||||
* @author BTMuli<bt-muli@outlook.com>
|
||||
* @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
|
||||
}
|
||||
@@ -5,30 +5,6 @@
|
||||
* @since Alpha v0.1.2
|
||||
*/
|
||||
|
||||
/**
|
||||
* @description 定义一个 Map<T> 接口
|
||||
* @since Alpha v0.1.2
|
||||
* @interface Map
|
||||
* @template T
|
||||
* @returns {Map<T>}
|
||||
*/
|
||||
export type Map<T> = Record<number, T>;
|
||||
|
||||
/**
|
||||
* @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
|
||||
|
||||
@@ -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<CalendarItem>
|
||||
weapons: Map<CalendarItem>
|
||||
characters: Record<number, CalendarItem>
|
||||
weapons: Record<number, CalendarItem>
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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,更新数据
|
||||
|
||||
@@ -2,11 +2,10 @@
|
||||
* @file plugins Mys interface calendar.ts
|
||||
* @description Mys 插件日历接口
|
||||
* @author BTMuli<bt-muli@outlook.com>
|
||||
* @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<number>} sort_day 排序
|
||||
* @property {Record<number, number>} sort_day 排序
|
||||
* @property {CalendarContent[]} contentInfos 材料内容
|
||||
* @returns {CalendarCard}
|
||||
*/
|
||||
@@ -103,6 +102,6 @@ export interface CalendarCard {
|
||||
cover: string
|
||||
url: string
|
||||
drop_day: string[]
|
||||
sort_day: Map<number>
|
||||
sort_day: Record<number, number>
|
||||
contentInfos: CalendarContent[]
|
||||
}
|
||||
|
||||
@@ -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<string> | undefined = undefined,
|
||||
poolCover: Record<number, string> | undefined = undefined,
|
||||
): Promise<GachaCard[]> {
|
||||
const gachaCard: GachaCard[] = [];
|
||||
await Promise.allSettled(
|
||||
|
||||
@@ -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<string>);
|
||||
const poolCover = ref({} satisfies Record<number, string>);
|
||||
|
||||
function init (): void {
|
||||
calendarShow.value = {
|
||||
|
||||
@@ -5,5 +5,5 @@
|
||||
"moduleResolution": "Node",
|
||||
"allowSyntheticDefaultImports": true
|
||||
},
|
||||
"include": ["vite.config.ts", "src/utils/TGBuild.ts"]
|
||||
"include": ["vite.config.ts"]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user