素材日历 overlay 完工

This commit is contained in:
BTMuli
2023-05-19 22:52:48 +08:00
parent 779bc3a0d3
commit a27f627706
14 changed files with 301 additions and 148 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

BIN
public/icon/star/1.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 784 B

BIN
public/icon/star/2.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 848 B

BIN
public/icon/star/3.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 846 B

BIN
public/icon/star/4.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 850 B

BIN
public/icon/star/5.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 882 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 556 B

View File

@@ -2,7 +2,7 @@
* @file assets themes light.css
* @description 主题样式文件
* @author BTMuli<bt-muli@outlook.com>
* @since Alpha v0.1.4
* @since Alpha v0.1.5
*/
/* 主题色 */
@@ -15,6 +15,7 @@ html.dark {
--back-top-shadow: #000000;
--theme-switch-icon: #e1e1e1;
--post-default-text: #faf7e8;
--calendar-item-btn: #faf7e8;
--content-bg-1: #1e1e1e;
--content-bg-2: #393b40;

View File

@@ -2,7 +2,7 @@
* @file assets themes dark.css
* @description 主题样式文件
* @author BTMuli<bt-muli@outlook.com>
* @since Alpha v0.1.4
* @since Alpha v0.1.5
*/
/* 主题色 */
@@ -15,6 +15,7 @@ html.default {
--back-top-shadow: #546d8b;
--theme-switch-icon: #393b40;
--post-default-text: #1e1e1e;
--calendar-item-btn: #fec90b;
--content-bg-1: #546d8b;
--content-bg-2: #faf7e8;

View File

@@ -0,0 +1,109 @@
<template>
<div class="card-box">
<!-- 左侧图标 -->
<div class="card-left">
<!-- 底层背景图 -->
<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-star">
<img :src="`/icon/star/${item.star}.webp`" alt="element">
</div>
</div>
<!-- 右侧内容 -->
<div class="card-name">
{{ item.name }}
</div>
</div>
</template>
<script lang="ts" setup>
interface TMiniWeaponProps {
item: BTMuli.Genshin.Material.BriefInfo;
}
defineProps<TMiniWeaponProps>();
</script>
<style lang="css" scoped>
.card-box {
position: relative;
width: 150px;
height: 45px;
cursor: pointer;
display: flex;
flex-direction: row;
border-radius: 5px;
background: rgb(20 20 20 / 30%);
}
.card-left {
position: relative;
width: 45px;
height: 45px;
border-top-left-radius: 5px;
border-bottom-left-radius: 5px;
overflow: hidden;
}
.card-bg {
position: absolute;
top: 0;
left: 0;
width: 45px;
height: 45px;
border-top-left-radius: 5px;
border-bottom-left-radius: 5px;
overflow: hidden;
}
.card-bg img {
width: 45px;
height: 45px;
object-fit: cover;
}
.card-icon {
position: relative;
width: 45px;
height: 45px;
border-radius: 5px;
}
.card-icon img {
padding: 2px;
width: 41px;
height: 41px;
}
.card-star {
position: absolute;
bottom: 0;
width: 45px;
display: flex;
justify-content: center;
align-items: center;
background: rgb(0 0 0 / 30%);
border-bottom-left-radius: 5px;
}
.card-star img {
width: 45px;
height: auto;
}
.card-name {
width: calc(100% - 50px);
height: 45px;
display: flex;
justify-content: center;
align-items: center;
margin-left: 5px;
position: relative;
color: #fff;
font-size: 12px;
font-family: Genshin-Light, serif;
}
</style>

View File

@@ -4,7 +4,8 @@
<v-list-item-title style="color: #fec90b; margin-left: 10px; margin-bottom: 10px; font-family: Genshin, serif">
<v-icon color="#EBD49E">
mdi-calendar-clock
</v-icon> 今日素材
</v-icon>
今日素材
<span style="color: #faf7e8">{{ dateNow }}</span>
<v-btn
v-for="text of btnText"
@@ -31,23 +32,9 @@
v-for="item in characterCards"
:key="item.id"
class="card-box"
@click="showContent(item)"
@click="selectContent(item, 'character')"
>
<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-element">
<img :src="item.element" alt="element">
</div>
<div class="card-name">
<img :src="item.weapon_type" alt="weapon">
<span>{{ item.name }}</span>
</div>
</div>
<TMiniAvatar size="100px" :model-value="item" />
</div>
</div>
</div>
@@ -60,22 +47,9 @@
v-for="item in weaponCards"
:key="item.id"
class="card-box"
@click="showContent(item)"
@click="selectContent(item, 'weapon')"
>
<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.weapon_type" alt="element">
</div>
<div class="card-name">
<span>{{ item.name }}</span>
</div>
</div>
<TMiniWeapon size="100px" :model-value="item" />
</div>
</div>
</div>
@@ -84,11 +58,54 @@
<v-snackbar v-model="snackbar" :timeout="1500" :color="snackbarColor">
{{ snackbarText }}
</v-snackbar>
<v-overlay v-model="showItem">
<div class="calendar-item-box">
<div class="calendar-item-top">
<div class="calendar-item-icon">
<Component :is="TMiniAvatar" v-if="selectedType=== 'character'" :model-value="selectedItem" size="100px" />
<Component :is="TMiniWeapon" v-if="selectedType=== 'weapon'" :model-value="selectedItem" size="100px" />
</div>
<div class="calendar-item-content">
<div v-for="item in selectedItem.materials" class="calendar-item-sub">
<TCalendarMaterial :item="item" />
</div>
</div>
</div>
<div class="calendar-item-line">
<img src="/source/UI/item-line.webp" alt="line">
</div>
<div class="calendar-item-bottom">
<div class="calendar-item-source">
<div class="calendar-source-text">
来源
</div>
<img :src="`/icon/nation/${selectedItem.source.area}.webp`" alt="icon">
<div class="calendar-source-text">
{{ selectedItem.source.area }} - {{ selectedItem.source.name }}
</div>
</div>
<div class="detail-btn">
<v-btn @click="showDetail(selectedItem)">
<template #append>
<img src="../assets/icons/arrow-right.svg" alt="right">
</template>
详情
</v-btn>
</div>
</div>
</div>
<div class="calendar-item-close" @click="showItem = false">
<v-icon>mdi-close</v-icon>
</div>
</v-overlay>
</v-list>
</template>
<script lang="ts" setup>
// vue
import { ref, onMounted } from "vue";
import { onMounted, ref } from "vue";
import TMiniAvatar from "./t-mini-avatar.vue";
import TMiniWeapon from "./t-mini-weapon.vue";
import TCalendarMaterial from "./t-calendar-material.vue";
// data
import { TGAppData } from "../data";
// interface
@@ -103,9 +120,16 @@ const calendarData = ref(TGAppData.calendar);
const weekNow = ref(0 as number);
const btnNow = ref(0 as number);
const dateNow = ref(new Date().toLocaleDateString());
// calendar
const calendarNow = ref([] as BTMuli.Genshin.Calendar.Data[]);
const characterCards = ref({} as Record<number, BTMuli.Genshin.Calendar.Data>);
const weaponCards = ref({} as Record<number, BTMuli.Genshin.Calendar.Data>);
const characterCards = ref([] as BTMuli.Genshin.Calendar.Data[]);
const weaponCards = ref([] as BTMuli.Genshin.Calendar.Data[]);
// calendar item
const showItem = ref(false as boolean);
const selectedItem = ref({} as BTMuli.Genshin.Calendar.Data);
const selectedType = ref("character");
// snackbar
const snackbar = ref(false as boolean);
@@ -163,7 +187,13 @@ function getCalendar (day: number) {
return calendarData.value.filter((item) => item.drop_day.includes(day));
}
function showContent (item: BTMuli.Genshin.Calendar.Data) {
function selectContent (item: BTMuli.Genshin.Calendar.Data, type: string) {
selectedItem.value = item;
selectedType.value = type;
showItem.value = true;
}
function showDetail (item: BTMuli.Genshin.Calendar.Data) {
if (item.content_id === null) {
snackbarText.value = "暂无详情";
snackbarColor.value = "error";
@@ -182,6 +212,7 @@ function getContents (day: number) {
}
</script>
<style lang="css" scoped>
/* calendar 大盒子 */
.calendar-card {
margin-top: 10px;
font-family: Genshin-Light, serif;
@@ -197,7 +228,7 @@ function getContents (day: number) {
}
.calendar-box {
margin:5px;
margin: 5px;
}
.calendar-single {
@@ -222,117 +253,128 @@ function getContents (day: number) {
padding: 10px;
}
.card-box {
position: relative;
width: 100px;
/* overlay 盒子 */
.calendar-item-box {
position: absolute;
width: 440px;
height: 200px;
top: calc(50vh - 100px);
left: calc(50vw - 220px);
background: var(--content-bg-2);
border-radius: 10px;
padding: 10px;
align-items: center;
}
.calendar-item-top {
height: 100px;
cursor: pointer;
}
.card-bg {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
border-radius: 5px;
overflow: hidden;
}
.card-bg img {
width: 100%;
height: 100%;
object-fit: cover;
}
.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-element {
position: absolute;
top: 0;
left: 0;
width: 30px;
height: 30px;
display: flex;
justify-content: center;
align-items: center;
.calendar-item-icon {
height: 100px;
width: 100px;
}
.card-element img {
width: 20px;
height: 20px;
object-fit: cover;
}
.card-weapon img {
width: 20px;
height: 20px;
object-fit: cover;
}
.card-type {
position: absolute;
top: 0;
left: 0;
width: 30px;
height: 30px;
display: flex;
justify-content: center;
align-items: center;
}
.card-type img {
width: 20px;
height: 20px;
object-fit: cover;
}
.card-name {
position: absolute;
bottom: 0;
left: 0;
width: 100%;
height: 30px;
display: flex;
justify-content: center;
align-items: center;
background: rgb(20 20 20 / 50%);
border-bottom-left-radius: 5px;
border-bottom-right-radius: 5px;
color: #fff;
font-size: 8px;
text-shadow: 0 0 5px #000;
.calendar-item-content {
margin-left: 10px;
font-family: Genshin, serif;
color: var(--content-bg-1);
display: grid;
grid-template-columns: repeat(2, 1fr);
column-gap: 10px;
row-gap: 10px;
}
.card-name img {
width: 20px;
height: 20px;
margin-right: 5px;
.calendar-item-sub {
width: 150px;
height: 45px;
border-radius: 10px;
}
.calendar-item-sub img {
width: 40px;
height: 40px;
object-fit: cover;
border-radius: 10px;
}
.calendar-item-line {
width: 420px;
}
.calendar-item-line img {
width: 100%;
height: auto;
}
.calendar-item-bottom {
background: rgb(0 0 0 / 30%);
padding: 3px 10px;
width: 420px;
height: 56px;
border-radius: 5px;
display: flex;
justify-content: space-between;
align-items: center;
}
.calendar-item-bottom img {
width: 50px;
height: 50px;
}
.calendar-item-source {
width: 300px;
height: 50px;
display: flex;
justify-content: left;
align-items: center;
}
.calendar-source-text {
height: 50px;
color: #fff;
font-size: 20px;
font-family: Genshin-Light, serif;
display: flex;
justify-content: center;
align-items: center;
}
.detail-btn {
font-family: Genshin, serif;
display: flex;
justify-content: center;
align-items: center;
padding: 10px;
border-radius: 5px;
transition: all 0.3s linear;
}
.detail-btn button {
background: var(--btn-bg-1);
color: #faf7e8;
}
.detail-btn button img {
width: 18px;
height: 18px;
}
.calendar-item-close {
position: absolute;
top: calc(50vh + 120px);
left: calc(50vw - 15px);
border-radius: 50%;
width: 30px;
height: 30px;
background: var(--content-bg-2);
color: var(--calendar-item-btn);
cursor: pointer;
display: flex;
justify-content: center;
align-items: center;
}
</style>