mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2025-12-13 09:28:14 +08:00
📦 feat(weapon): 武器图鉴草创
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
* @file data app index
|
||||
* @description data app index
|
||||
* @author BTMuli<bt-muli@outlook.com>
|
||||
* @since Alpha v0.1.
|
||||
* @since Alpha v0.1.3
|
||||
*/
|
||||
|
||||
// Data
|
||||
@@ -12,6 +12,7 @@ import calendar from "./calendar.json";
|
||||
import character from "./character.json";
|
||||
import GCG from "./GCG.json";
|
||||
import nameCards from "./nameCards.json";
|
||||
import weapon from "./weapon.json";
|
||||
|
||||
export const AppDataList = [
|
||||
{
|
||||
@@ -38,7 +39,10 @@ export const AppDataList = [
|
||||
name: "nameCards.json",
|
||||
data: nameCards as Record<number, BTMuli.Genshin.NameCard[]>,
|
||||
},
|
||||
|
||||
{
|
||||
name: "weapon.json",
|
||||
data: weapon as BTMuli.Genshin.Wiki.Weapon.BriefInfo[],
|
||||
},
|
||||
];
|
||||
|
||||
export const AppData = {
|
||||
@@ -48,4 +52,5 @@ export const AppData = {
|
||||
character: character as BTMuli.Genshin.Wiki.Character.BriefInfo[],
|
||||
GCG: GCG as BTMuli.Genshin.Wiki.GCG.BriefInfo[],
|
||||
nameCards: nameCards as Record<number, BTMuli.Genshin.NameCard[]>,
|
||||
weapon: weapon as BTMuli.Genshin.Wiki.Weapon.BriefInfo[],
|
||||
};
|
||||
|
||||
1388
src/data/app/weapon.json
Normal file
1388
src/data/app/weapon.json
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,7 +1,147 @@
|
||||
<template>
|
||||
<TLoading empty title="开发中" loading="false" />
|
||||
<div class="cards-grid">
|
||||
<div v-for="item in cardsInfo" :key="item.id" class="card-box" @click="toOuter(item)">
|
||||
<!-- 底层背景图 -->
|
||||
<div class="card-bg">
|
||||
<img :src="item.bg" alt="bg">
|
||||
</div>
|
||||
<!-- 中层武器图 -->
|
||||
<div class="card-icon">
|
||||
<img :src="item.icon" alt="icon">
|
||||
</div>
|
||||
<!-- 上层图标&内容 -->
|
||||
<div class="card-cover">
|
||||
<div class="card-type">
|
||||
<img :src="item.type" alt="type">
|
||||
</div>
|
||||
<div class="card-name">
|
||||
<span>{{ item.name }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<v-snackbar v-model="snackbar" timeout="1500" color="error">
|
||||
该武器暂无详情
|
||||
</v-snackbar>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
// vue
|
||||
import TLoading from "../../components/t-loading.vue";
|
||||
import { ref, onMounted } from "vue";
|
||||
// utils
|
||||
import { createTGWindow } from "../../utils/TGWindow";
|
||||
import { TGAppData } from "../../data";
|
||||
import { OBC_CONTENT_API } from "../../plugins/Mys/interface/utils";
|
||||
|
||||
// snackbar
|
||||
const snackbar = ref(false);
|
||||
// data
|
||||
const cardsInfo = ref([] as BTMuli.Genshin.Wiki.Weapon.BriefInfo[]);
|
||||
|
||||
onMounted(async () => {
|
||||
cardsInfo.value = TGAppData.weapon;
|
||||
});
|
||||
|
||||
function toOuter (item: BTMuli.Genshin.Wiki.Weapon.BriefInfo) {
|
||||
if (item.content_id === null || item.content_id === undefined) {
|
||||
snackbar.value = true;
|
||||
return;
|
||||
}
|
||||
const url = OBC_CONTENT_API.replace("{content_id}", item.content_id.toString());
|
||||
createTGWindow(url, "武器详情", item.name, 1200, 800, true);
|
||||
}
|
||||
|
||||
</script>
|
||||
<style scoped>
|
||||
.cards-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(128px, 1fr));
|
||||
grid-gap: 20px;
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.card-box {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.card-bg {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border-radius: 5px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.card-icon {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
.card-icon img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
}
|
||||
|
||||
.card-cover {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border-radius: 5px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.card-type {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.card-type img {
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
object-fit: cover;
|
||||
}
|
||||
|
||||
.card-name img {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
margin-right: 5px;
|
||||
}
|
||||
|
||||
.card-name {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 30px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
background: rgba(20, 20, 20, 0.5);
|
||||
border-bottom-left-radius: 5px;
|
||||
border-bottom-right-radius: 5px;
|
||||
color: #fff;
|
||||
font-size: 20px;
|
||||
text-shadow: 0 0 5px #000;
|
||||
font-family: Genshin, serif;
|
||||
}
|
||||
</style>
|
||||
|
||||
6
src/types/Weapon.d.ts
vendored
6
src/types/Weapon.d.ts
vendored
@@ -12,16 +12,22 @@ declare namespace BTMuli.Genshin.Wiki.Weapon {
|
||||
* @since Alpha v0.1.3
|
||||
* @interface BriefInfo
|
||||
* @property {number} id - 武器 ID
|
||||
* @property {number} content_id - 观测枢 id
|
||||
* @property {string} name - 武器名称
|
||||
* @property {number} star - 武器星级
|
||||
* @property {string} bg - 武器背景图
|
||||
* @property {string} type - 武器类型
|
||||
* @property {string} icon - 武器图标
|
||||
* @return BriefInfo
|
||||
*/
|
||||
export interface BriefInfo {
|
||||
id: number
|
||||
content_id?: number
|
||||
name: string
|
||||
star: number
|
||||
bg: string
|
||||
type: string
|
||||
icon: string
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user