材料overlay完工

This commit is contained in:
目棃
2024-01-27 12:52:55 +08:00
parent aabb4e4a97
commit aaf4c28143
10 changed files with 186 additions and 16 deletions

BIN
public/icon/bg/0-BGC.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 106 B

BIN
public/icon/bg/1-BGC.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 106 B

BIN
public/icon/bg/2-BGC.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 106 B

BIN
public/icon/bg/3-BGC.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 116 B

BIN
public/icon/bg/4-BGC.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 108 B

BIN
public/icon/bg/5-BGC.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 128 B

View File

@@ -37,6 +37,7 @@ const showOverlay = ref(false);
const curData = ref<TGApp.App.Material.WikiItem>(); const curData = ref<TGApp.App.Material.WikiItem>();
function checkData(item: TGApp.App.Calendar.Material) { function checkData(item: TGApp.App.Calendar.Material) {
if (showOverlay.value) showOverlay.value = false;
const material = WikiMaterialData.find((m) => m.id === item.id); const material = WikiMaterialData.find((m) => m.id === item.id);
if (material) { if (material) {
curData.value = material; curData.value = material;

View File

@@ -0,0 +1,65 @@
<template>
<div class="twoc-container">
<v-icon>mdi-all-inclusive</v-icon>
<div class="twoc-box" v-for="(item, index) in props.data.source" :key="index">
<img
class="twoc-left"
:src="`/icon/material/${item.id}.webp`"
alt="icon"
:style="{
'background-image': `url('/icon/bg/${item.star}-BGC.webp')`,
}"
/>
<div class="twoc-right">
<span>{{ item.name }}</span>
<span>{{ item.count }}</span>
</div>
</div>
</div>
</template>
<script lang="ts" setup>
interface TwoConvertProps {
data: TGApp.App.Material.Convert;
}
const props = defineProps<TwoConvertProps>();
</script>
<style lang="css" scoped>
.twoc-container {
display: flex;
width: 100%;
height: 100%;
align-items: center;
justify-content: flex-start;
border-radius: 5px;
column-gap: 10px;
}
.twoc-box {
display: flex;
border-radius: 5px;
background: var(--box-bg-3);
color: var(--box-text-4);
column-gap: 5px;
}
.twoc-left {
display: flex;
width: 45px;
height: 45px;
align-items: center;
justify-content: center;
border-radius: 5px;
background-position: center;
background-repeat: no-repeat;
background-size: cover;
}
.twoc-right {
display: flex;
align-items: center;
justify-content: flex-start;
padding-right: 10px;
column-gap: 15px;
}
</style>

View File

@@ -2,21 +2,18 @@
<TOverlay v-model="visible" hide :to-click="onCancel" blur-val="20px"> <TOverlay v-model="visible" hide :to-click="onCancel" blur-val="20px">
<div v-if="props.data" class="twom-container"> <div v-if="props.data" class="twom-container">
<div class="twom-box"> <div class="twom-box">
<!-- todo 根据类型显示不同的背景 -->
<div class="twom-top"> <div class="twom-top">
<div class="twom-ttl">{{ props.data.name }}</div> <img :src="`/icon/material/${props.data.id}.webp`" alt="icon" class="twom-left" />
<div class="twom-right"> <div class="twom-name">{{ props.data.name }}</div>
<img :src="`/icon/material/${props.data.id}.webp`" alt="icon" /> <div class="twom-type">{{ props.data.type }}</div>
</div>
<div class="twom-tbl">{{ props.data.type }}</div>
</div> </div>
<div class="twom-bottom"> <div class="twom-bottom">
<div class="twom-desc">{{ props.data.description }}</div> <div class="twom-desc">{{ parseDesc() }}</div>
<div class="twom-source" v-if="props.data.source.length > 1"> <div class="twom-source" v-if="props.data.source.length > 1">
{{ props.data.source }} <TwoSource :data="item" v-for="(item, index) in props.data.source" :key="index" />
</div> </div>
<div class="twom-convert" v-if="props.data.convert.length > 1"> <div class="twom-convert" v-if="props.data.convert.length > 1">
{{ props.data.convert }} <TwoConvert :data="item" v-for="(item, index) in props.data.convert" :key="index" />
</div> </div>
</div> </div>
</div> </div>
@@ -26,6 +23,8 @@
<script setup lang="ts"> <script setup lang="ts">
import { computed } from "vue"; import { computed } from "vue";
import TwoConvert from "./two-convert.vue";
import TwoSource from "./two-source.vue";
import TOverlay from "../main/t-overlay.vue"; import TOverlay from "../main/t-overlay.vue";
interface TwoMaterialProps { interface TwoMaterialProps {
@@ -46,8 +45,18 @@ const visible = computed({
emits("update:modelValue", value); emits("update:modelValue", value);
}, },
}); });
const iconBg = computed(() => {
if (!props.data) return "url('/icon/bg/0-BGC.webp')";
return `url('/icon/bg/${props.data.star}-BGC.webp')`;
});
function parseDesc() {
if (!props.data) return "";
return props.data.description.replace(/\\n/g, "\n");
}
function onCancel() { function onCancel() {
console.log(props.data);
visible.value = false; visible.value = false;
} }
</script> </script>
@@ -58,27 +67,91 @@ function onCancel() {
justify-content: center; justify-content: center;
padding: 10px; padding: 10px;
border-radius: 10px; border-radius: 10px;
background: var(--app-side-bg); background: var(--box-bg-1);
column-gap: 10px;
} }
.twom-box { .twom-box {
position: relative; position: relative;
overflow: hidden; display: flex;
width: 800px; max-width: 800px;
height: 400px; flex-direction: column;
border-radius: 10px; border-radius: 10px;
row-gap: 10px;
} }
.twom-top { .twom-top {
position: relative; position: relative;
display: flex; display: flex;
height: 200px;
align-items: center; align-items: center;
justify-content: space-between; justify-content: flex-start;
padding: 10px; padding: 10px;
border-bottom: 1px solid var(--common-shadow-1); border-bottom: 1px solid var(--common-shadow-1);
background-position: center; background-position: center;
background-size: cover; background-size: cover;
column-gap: 10px;
}
.twom-left {
overflow: hidden;
width: 60px;
border-radius: 50%;
aspect-ratio: 1;
background-image: v-bind(iconBg);
background-position: center;
background-repeat: no-repeat;
background-size: cover;
}
.twom-name {
color: var(--common-text-title);
font-family: var(--font-title);
font-size: 30px;
}
.twom-type {
position: absolute;
right: 10px;
bottom: 10px;
opacity: 0.8;
}
.twom-bottom {
display: flex;
max-height: 400px;
flex-direction: column;
padding-right: 10px;
overflow-y: auto;
row-gap: 10px;
}
.twom-desc,
.twom-source,
.twom-convert {
padding: 10px;
border-radius: 10px;
background: var(--box-bg-2);
color: var(--box-text-2);
}
.twom-desc {
font-size: 16px;
white-space: pre-wrap;
word-break: break-all;
}
.twom-source {
display: flex;
flex-direction: column;
padding: 10px;
font-size: 16px;
row-gap: 5px;
white-space: pre-wrap;
}
.twom-convert {
display: flex;
flex-direction: column;
padding: 10px;
row-gap: 5px;
} }
</style> </style>

View File

@@ -0,0 +1,31 @@
<template>
<div class="twos-box">
<v-icon>mdi-map-marker</v-icon>
<span>{{ props.data.name }}</span>
</div>
</template>
<script lang="ts" setup>
import { computed } from "vue";
interface TwoConvertProps {
data: TGApp.App.Material.Source;
}
const props = defineProps<TwoConvertProps>();
const textColor = computed(() => {
if (!props.data || !props.data.days) return "var(--tgc-blue-2)";
const day = new Date().getDay();
if (props.data.days.includes(day)) return "var(--tgc-pink-1)";
return "var(--tgc-blue-2)";
});
</script>
<style lang="css" scoped>
.twos-box {
display: flex;
width: fit-content;
align-items: center;
color: v-bind(textColor);
column-gap: 5px;
}
</style>