mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2025-12-12 09:18:14 +08:00
@@ -132,17 +132,6 @@
|
||||
<img src="/source/UI/wikiWeapon.webp" alt="weaponIcon" class="side-icon-menu" />
|
||||
</template>
|
||||
</v-list-item>
|
||||
<v-list-item
|
||||
class="side-item-menu"
|
||||
title="GCG"
|
||||
value="wiki-GCG"
|
||||
:link="true"
|
||||
href="/wiki/GCG"
|
||||
>
|
||||
<template #prepend>
|
||||
<img src="/source/UI/wikiGCG.webp" alt="gcgIcon" class="side-icon-menu" />
|
||||
</template>
|
||||
</v-list-item>
|
||||
<v-list-item
|
||||
class="side-item-menu"
|
||||
value="wiki-namecard"
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* @file src/data/index.ts
|
||||
* @description 数据文件入口
|
||||
* @since Beta v0.5.0
|
||||
* @since Beta v0.5.3
|
||||
*/
|
||||
|
||||
import type { Schema } from "ajv";
|
||||
@@ -11,7 +11,6 @@ import achievementSeries from "./app/achievementSeries.json";
|
||||
import calendar from "./app/calendar.json";
|
||||
import character from "./app/character.json";
|
||||
import gacha from "./app/gacha.json";
|
||||
import GCG from "./app/GCG.json";
|
||||
import nameCards from "./app/namecard.json";
|
||||
import weapon from "./app/weapon.json";
|
||||
import arcBirCalendar from "./archive/birth_calendar.json";
|
||||
@@ -30,7 +29,6 @@ export const AppAchievementSeriesData: TGApp.App.Achievement.Series[] = achievem
|
||||
export const AppCalendarData: TGApp.App.Calendar.Item[] = calendar;
|
||||
export const AppCharacterData: TGApp.App.Character.WikiBriefInfo[] = character;
|
||||
export const AppGachaData: TGApp.App.Gacha.PoolItem[] = gacha;
|
||||
export const AppGCGData: TGApp.App.GCG.WikiBriefInfo[] = GCG;
|
||||
export const AppNameCardsData: TGApp.App.NameCard.Item[] = nameCards;
|
||||
export const AppWeaponData: TGApp.App.Weapon.WikiBriefInfo[] = weapon;
|
||||
// Schema
|
||||
|
||||
@@ -1,128 +0,0 @@
|
||||
<template>
|
||||
<ToLoading v-model="loading" title="正在加载卡牌列表" />
|
||||
<v-tabs v-model="tab" align-tabs="start" class="cards-tab">
|
||||
<div v-if="!doSearch">
|
||||
<v-tab value="character">角色牌</v-tab>
|
||||
<v-tab value="action">行动牌</v-tab>
|
||||
<v-tab value="monster">魔物牌</v-tab>
|
||||
</div>
|
||||
<v-text-field
|
||||
v-model="search"
|
||||
class="card-search"
|
||||
prepend-inner-icon="mdi-magnify"
|
||||
label="搜索"
|
||||
:single-line="true"
|
||||
hide-details
|
||||
@click:append="searchCard"
|
||||
@keyup.enter="searchCard"
|
||||
/>
|
||||
<v-spacer />
|
||||
</v-tabs>
|
||||
<div v-if="!doSearch">
|
||||
<v-window v-model="tab">
|
||||
<v-window-item v-for="(item, index) in tabValues" :key="index" :value="item">
|
||||
<div class="cards-grid">
|
||||
<TwgCard v-for="(card, index) in cardsInfo[item]" :key="index" :data="card" />
|
||||
</div>
|
||||
</v-window-item>
|
||||
</v-window>
|
||||
</div>
|
||||
<div v-else>
|
||||
<div class="cards-grid">
|
||||
<TwgCard v-for="(item, index) in CardsInfoS" :key="index" :data="item" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { onBeforeMount, onMounted, ref } from "vue";
|
||||
|
||||
import showSnackbar from "../../components/func/snackbar.js";
|
||||
import ToLoading from "../../components/overlay/to-loading.vue";
|
||||
import TwgCard from "../../components/wiki/twg-card.vue";
|
||||
import { AppGCGData } from "../../data/index.js";
|
||||
|
||||
const loading = ref<boolean>(true);
|
||||
const doSearch = ref<boolean>(false);
|
||||
const search = ref<string>("");
|
||||
|
||||
const tab = ref<string>("character");
|
||||
const cardsInfo = ref<{ [key: string]: TGApp.App.GCG.WikiBriefInfo[] }>({
|
||||
character: [],
|
||||
action: [],
|
||||
monster: [],
|
||||
});
|
||||
const tabValues = ref<string[]>(["character", "action", "monster"]);
|
||||
const CardsInfoS = ref<TGApp.App.GCG.WikiBriefInfo[]>([]);
|
||||
|
||||
onBeforeMount(() => {
|
||||
for (const item of AppGCGData) {
|
||||
if (item.type === "角色牌") cardsInfo.value.character.push(item);
|
||||
if (item.type === "行动牌") cardsInfo.value.action.push(item);
|
||||
if (item.type === "魔物牌") cardsInfo.value.monster.push(item);
|
||||
}
|
||||
});
|
||||
|
||||
onMounted(() => {
|
||||
loading.value = false;
|
||||
});
|
||||
|
||||
async function searchCard(): Promise<void> {
|
||||
loading.value = true;
|
||||
if (search.value === "") {
|
||||
if (CardsInfoS.value.length === 0) {
|
||||
showSnackbar({
|
||||
text: "未搜索任何卡牌",
|
||||
color: "error",
|
||||
});
|
||||
loading.value = false;
|
||||
return;
|
||||
}
|
||||
doSearch.value = false;
|
||||
loading.value = false;
|
||||
CardsInfoS.value = [];
|
||||
showSnackbar({
|
||||
text: "已重置搜索",
|
||||
color: "success",
|
||||
});
|
||||
return;
|
||||
}
|
||||
doSearch.value = true;
|
||||
const res: TGApp.App.GCG.WikiBriefInfo[] = [];
|
||||
await Promise.allSettled(
|
||||
AppGCGData.map((item) => (item.name.includes(search.value) ? res.push(item) : null)),
|
||||
);
|
||||
loading.value = false;
|
||||
if (res.length === 0) {
|
||||
showSnackbar({
|
||||
text: "未找到相关卡牌",
|
||||
color: "error",
|
||||
});
|
||||
doSearch.value = false;
|
||||
} else {
|
||||
CardsInfoS.value = res.sort((a, b) => a.name.localeCompare(b.name));
|
||||
showSnackbar({
|
||||
text: `找到 ${res.length} 张相关卡牌`,
|
||||
color: "success",
|
||||
});
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style lang="css" scoped>
|
||||
.cards-tab {
|
||||
margin-bottom: 20px;
|
||||
color: var(--common-text-title);
|
||||
font-family: var(--font-title);
|
||||
}
|
||||
|
||||
.card-search {
|
||||
margin-left: 10px;
|
||||
color: var(--box-text-1);
|
||||
}
|
||||
|
||||
.cards-grid {
|
||||
display: grid;
|
||||
overflow: hidden;
|
||||
grid-gap: 10px;
|
||||
grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
|
||||
}
|
||||
</style>
|
||||
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* @file router/modules/wiki.ts
|
||||
* @description wiki 路由模块
|
||||
* @since Beta v0.4.6
|
||||
* @since Beta v0.5.3
|
||||
*/
|
||||
|
||||
const wikiRoutes = [
|
||||
@@ -15,11 +15,6 @@ const wikiRoutes = [
|
||||
name: "角色图鉴",
|
||||
component: async () => await import("../../pages/WIKI/Character.vue"),
|
||||
},
|
||||
{
|
||||
path: "/wiki/GCG",
|
||||
name: "卡牌图鉴",
|
||||
component: async () => await import("../../pages/WIKI/GCG.vue"),
|
||||
},
|
||||
{
|
||||
path: "/wiki/namecard",
|
||||
name: "名片图鉴",
|
||||
|
||||
82
src/types/App/GCG.d.ts
vendored
82
src/types/App/GCG.d.ts
vendored
@@ -1,82 +0,0 @@
|
||||
/**
|
||||
* @file types App GCG.d.ts
|
||||
* @description 本应用的卡牌相关类型定义
|
||||
* @author BTMuli<bt-muli@outlook.com>
|
||||
* @since Beta v0.3.3
|
||||
*/
|
||||
|
||||
declare namespace TGApp.App.GCG {
|
||||
/**
|
||||
* @description Wiki页用到的简略信息
|
||||
* @interface WikiBriefInfo
|
||||
* @since Beta v0.3.3
|
||||
* @property {number} id - 卡牌 ID
|
||||
* @property {number} contentId - 观测枢的 content_id
|
||||
* @property {string} name - 卡牌名称
|
||||
* @property {string} type - 卡牌类型
|
||||
* @property {string} icon - 卡牌图标
|
||||
* @property {Partial<GCGTags>} tags - 卡牌标签
|
||||
* @return WikiBriefInfo
|
||||
*/
|
||||
export interface WikiBriefInfo {
|
||||
id: number;
|
||||
contentId: number;
|
||||
name: string;
|
||||
type: string;
|
||||
icon: string;
|
||||
tags: Partial<GCGTags> | null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 卡牌 Tag
|
||||
* @interface GCGTags
|
||||
* @since Beta v0.3.3
|
||||
* @description 元素标签
|
||||
* @property {string} GCG_TAG_ELEMENT_CRYO - 冰元素
|
||||
* @property {string} GCG_TAG_ELEMENT_DENDRO - 草元素
|
||||
* @property {string} GCG_TAG_ELEMENT_ELECTRO - 雷元素
|
||||
* @property {string} GCG_TAG_ELEMENT_GEO - 岩元素
|
||||
* @property {string} GCG_TAG_ELEMENT_HYDRO - 水元素
|
||||
* @property {string} GCG_TAG_ELEMENT_PYRO - 火元素
|
||||
* @property {string} GCG_TAG_ELEMENT_ANEMO - 风元素
|
||||
* @description 武器标签
|
||||
* @property {string} GCG_TAG_WEAPON_SWORD - 单手剑
|
||||
* @property {string} GCG_TAG_WEAPON_CLAYMORE - 双手剑
|
||||
* @property {string} GCG_TAG_WEAPON_POLE - 长柄武器
|
||||
* @property {string} GCG_TAG_WEAPON_BOW - 弓
|
||||
* @property {string} GCG_TAG_WEAPON_CATALYST - 法器
|
||||
* @property {string} GCG_TAG_WEAPON_NONE - 无
|
||||
* @description 地区标签
|
||||
* @property {string} GCG_TAG_NATION_MONDSTADT - 蒙德
|
||||
* @property {string} GCG_TAG_NATION_LIYUE - 璃月
|
||||
* @property {string} GCG_TAG_NATION_INAZUMA - 稻妻
|
||||
* @property {string} GCG_TAG_NATION_SUMERU - 须弥
|
||||
* @description 阵营
|
||||
* @property {string} GCG_TAG_CAMP_FATUI - 愚人众
|
||||
* @property {string} GCG_TAG_CAMP_MONSTER - 魔物
|
||||
* @property {string} GCG_TAG_CAMP_HILICHURL - 丘丘人
|
||||
* @return GCGTags
|
||||
*/
|
||||
export interface GCGTags {
|
||||
GCG_TAG_ELEMENT_CRYO: string;
|
||||
GCG_TAG_ELEMENT_DENDRO: string;
|
||||
GCG_TAG_ELEMENT_ELECTRO: string;
|
||||
GCG_TAG_ELEMENT_GEO: string;
|
||||
GCG_TAG_ELEMENT_HYDRO: string;
|
||||
GCG_TAG_ELEMENT_PYRO: string;
|
||||
GCG_TAG_ELEMENT_ANEMO: string;
|
||||
GCG_TAG_WEAPON_SWORD: string;
|
||||
GCG_TAG_WEAPON_CLAYMORE: string;
|
||||
GCG_TAG_WEAPON_POLE: string;
|
||||
GCG_TAG_WEAPON_BOW: string;
|
||||
GCG_TAG_WEAPON_CATALYST: string;
|
||||
GCG_TAG_WEAPON_NONE: string;
|
||||
GCG_TAG_NATION_MONDSTADT: string;
|
||||
GCG_TAG_NATION_LIYUE: string;
|
||||
GCG_TAG_NATION_INAZUMA: string;
|
||||
GCG_TAG_NATION_SUMERU: string;
|
||||
GCG_TAG_CAMP_FATUI: string;
|
||||
GCG_TAG_CAMP_MONSTER: string;
|
||||
GCG_TAG_CAMP_HILICHURL: string;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user