|
@@ -1,32 +1,117 @@
|
|
|
<template>
|
|
|
<div class="muti-relic">
|
|
|
- <div class="muti-relic-container">
|
|
|
+ <template v-if="!showMyBox">
|
|
|
+ <div class="muti-relic-container">
|
|
|
+ <div
|
|
|
+ v-for="(item, idx) in relicInfo"
|
|
|
+ :key="idx"
|
|
|
+ class="muti-relic__item"
|
|
|
+ @click="handleClick(item['序号'] - 1, idx)"
|
|
|
+ >
|
|
|
+ <div class="muti-relic__item__title">
|
|
|
+ <p>{{ item['名称'] }}</p>
|
|
|
+ </div>
|
|
|
+ <div
|
|
|
+ class="img"
|
|
|
+ :style="{
|
|
|
+ backgroundImage: `url(${getImgUrl(item)})`
|
|
|
+ }"
|
|
|
+ />
|
|
|
+ <p class="description">
|
|
|
+ {{ item['文物简介'] }}
|
|
|
+ </p>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
<div
|
|
|
- v-for="(item, idx) in relicInfo"
|
|
|
- :key="idx"
|
|
|
- class="muti-relic__item"
|
|
|
- @click="handleClick(idx)"
|
|
|
+ class="muti-relic__btn"
|
|
|
+ @click="handleShowBox"
|
|
|
>
|
|
|
- <p>{{ item['名称'] }}</p>
|
|
|
- <div
|
|
|
- class="img"
|
|
|
- :style="{
|
|
|
- backgroundImage: `url(${getImgUrl(item)})`
|
|
|
- }"
|
|
|
- />
|
|
|
+ <span>我的宝盒</span>
|
|
|
</div>
|
|
|
- </div>
|
|
|
+ </template>
|
|
|
+
|
|
|
+ <template v-else>
|
|
|
+ <div class="my-box">
|
|
|
+ <div class="my-box-list">
|
|
|
+ <div
|
|
|
+ v-for="(item, idx) in store.getters.hotRelicData"
|
|
|
+ :key="idx"
|
|
|
+ class="my-box-list__item"
|
|
|
+ >
|
|
|
+ <div
|
|
|
+ class="img"
|
|
|
+ >
|
|
|
+ <img
|
|
|
+ v-if="relicClicked.includes(idx)"
|
|
|
+ :src="getImgUrl(item)"
|
|
|
+ >
|
|
|
+ <div
|
|
|
+ class="img__bg"
|
|
|
+ :style="{
|
|
|
+ backgroundImage: `url(${relicClicked.includes(idx) ? require('@/assets/images/hotspot-relic/bg-box1kongbai-min.png') : require('@/assets/images/hotspot-relic/kongbai-min.png')})`
|
|
|
+ }"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ <p class="label">
|
|
|
+ {{ relicClicked.includes(idx) ? item['名称'] : `宝箱${idx + 1}` }}
|
|
|
+ </p>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <img
|
|
|
+ v-if="showCompose"
|
|
|
+ class="muti-relic__compose"
|
|
|
+ src="@/assets/images/hotspot-relic/box_jicheng-min.png"
|
|
|
+ @click="handlePoster"
|
|
|
+ >
|
|
|
+ <img
|
|
|
+ v-if="showPoster"
|
|
|
+ class="muti-relic__poster"
|
|
|
+ :src="POSTER_LIST[posterIndex]"
|
|
|
+ >
|
|
|
+
|
|
|
+ <div
|
|
|
+ class="muti-relic__btn"
|
|
|
+ :style="{
|
|
|
+ zIndex: hideBox ? 2 : 1
|
|
|
+ }"
|
|
|
+ @click="handleBack"
|
|
|
+ >
|
|
|
+ <span>返回</span>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
|
|
|
<div
|
|
|
class="mask"
|
|
|
- @click="emits('close')"
|
|
|
+ :style="{
|
|
|
+ zIndex: hideBox ? 1 : -1
|
|
|
+ }"
|
|
|
/>
|
|
|
+
|
|
|
+ <img
|
|
|
+ class="muti-relic__close"
|
|
|
+ draggable="false"
|
|
|
+ src="@/assets/images/btn-close.png"
|
|
|
+ :style="{
|
|
|
+ zIndex: hideBox ? 2 : 1
|
|
|
+ }"
|
|
|
+ @click="emits('close')"
|
|
|
+ >
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
-import { computed } from 'vue'
|
|
|
+import { computed, ref } from 'vue'
|
|
|
import { useStore } from "vuex"
|
|
|
+import Poster1Img from '@/assets/images/hotspot-relic/poster1-min.png'
|
|
|
+
|
|
|
+const RELIC_KEY = 'ydd-relic-clicked'
|
|
|
+const COMPOSE_KEY = 'ydd-relic-compose'
|
|
|
+const POSTER_LIST = [
|
|
|
+ Poster1Img
|
|
|
+]
|
|
|
|
|
|
const store = useStore()
|
|
|
const props = defineProps({
|
|
@@ -35,6 +120,12 @@ const props = defineProps({
|
|
|
default: () => ({})
|
|
|
}
|
|
|
})
|
|
|
+const showMyBox = ref(false)
|
|
|
+const showCompose = ref(false)
|
|
|
+const showPoster = ref(false)
|
|
|
+const posterIndex = ref(0)
|
|
|
+const hideBox = computed(() => showCompose.value || showPoster.value)
|
|
|
+const relicClicked = ref([])
|
|
|
|
|
|
const emits = defineEmits(['close', 'openRelicDetail'])
|
|
|
|
|
@@ -47,12 +138,49 @@ const relicInfo = computed(() => {
|
|
|
})
|
|
|
|
|
|
const getImgUrl = (item) => {
|
|
|
- return `${process.env.BASE_URL}relic-data/big-photo/${item['图片名'][0]}`
|
|
|
+ return `${process.env.BASE_URL}relic-data/small-photo/${item['图片名'][0]}`
|
|
|
}
|
|
|
|
|
|
-const handleClick = (idx) => {
|
|
|
+const handleClick = (relicIndex, idx) => {
|
|
|
const stack = props.relicInfo.hotspotTitle.split(',')
|
|
|
emits('openRelicDetail', Number(stack[idx]))
|
|
|
+ const cache = localStorage.getItem(RELIC_KEY) ? JSON.parse(localStorage.getItem(RELIC_KEY)) : []
|
|
|
+ if (!cache.includes(relicIndex)) {
|
|
|
+ cache.push(relicIndex)
|
|
|
+ localStorage.setItem(RELIC_KEY, JSON.stringify(cache))
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+const handleShowBox = () => {
|
|
|
+ relicClicked.value = localStorage.getItem(RELIC_KEY) ? JSON.parse(localStorage.getItem(RELIC_KEY)) : []
|
|
|
+ showMyBox.value = true
|
|
|
+
|
|
|
+ if (relicClicked.value.length === store.getters.hotRelicData.length) {
|
|
|
+ // 宝盒已全部打开
|
|
|
+ if (!localStorage.getItem(COMPOSE_KEY)) {
|
|
|
+ showCompose.value = true
|
|
|
+ } else {
|
|
|
+ // 已合成海报
|
|
|
+ showRandomPoster()
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+const handleBack = () => {
|
|
|
+ showCompose.value = false
|
|
|
+ showPoster.value = false
|
|
|
+ showMyBox.value = false
|
|
|
+}
|
|
|
+
|
|
|
+const handlePoster = () => {
|
|
|
+ showCompose.value = false
|
|
|
+ showRandomPoster()
|
|
|
+ localStorage.setItem(COMPOSE_KEY, 1)
|
|
|
+}
|
|
|
+
|
|
|
+const showRandomPoster = () => {
|
|
|
+ posterIndex.value = Math.floor(Math.random() * POSTER_LIST.length)
|
|
|
+ showPoster.value = true
|
|
|
}
|
|
|
</script>
|
|
|
|
|
@@ -77,45 +205,175 @@ const handleClick = (idx) => {
|
|
|
background: rgba(0,0,0,0.85);
|
|
|
z-index: -1;
|
|
|
}
|
|
|
+ &__btn {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: center;
|
|
|
+ position: absolute;
|
|
|
+ left: 50%;
|
|
|
+ bottom: 60px;
|
|
|
+ width: 259px;
|
|
|
+ height: 67px;
|
|
|
+ cursor: pointer;
|
|
|
+ font-size: 28px;
|
|
|
+ font-family: "Source Han Serif CN Heavy";
|
|
|
+ transform: translateX(-50%);
|
|
|
+ background: url('@/assets/images/hotspot-relic/btn-min.png') no-repeat center / contain;
|
|
|
+
|
|
|
+ span {
|
|
|
+ background: linear-gradient(180deg, #FFFBC4 0%, #E5C05B 100%);
|
|
|
+ -webkit-background-clip: text;
|
|
|
+ -webkit-text-fill-color: transparent;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ &__close {
|
|
|
+ position: absolute;
|
|
|
+ top: 95px;
|
|
|
+ right: 88px;
|
|
|
+ cursor: pointer;
|
|
|
+ }
|
|
|
+ .my-box {
|
|
|
+ position: relative;
|
|
|
+ top: -20px;
|
|
|
+ width: 1538px;
|
|
|
+ height: 759px;
|
|
|
+ background: url('@/assets/images/hotspot-relic/bg_baoxiang-min.png') no-repeat center / contain;
|
|
|
+
|
|
|
+ &-list {
|
|
|
+ position: absolute;
|
|
|
+ top: 120px;
|
|
|
+ left: 395px;
|
|
|
+ display: grid;
|
|
|
+ grid-template-columns: repeat(6, 1fr);
|
|
|
+ gap: 35px;
|
|
|
+
|
|
|
+ &__item {
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ width: 103px;
|
|
|
+
|
|
|
+ .img {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: center;
|
|
|
+ position: relative;
|
|
|
+ width: 103px;
|
|
|
+ height: 103px;
|
|
|
+
|
|
|
+ img {
|
|
|
+ position: relative;
|
|
|
+ width: 70px;
|
|
|
+ height: 70px;
|
|
|
+ object-position: center;
|
|
|
+ object-fit: contain;
|
|
|
+ z-index: 1;
|
|
|
+ }
|
|
|
+ &__bg {
|
|
|
+ position: absolute;
|
|
|
+ top: 0;
|
|
|
+ left: 0;
|
|
|
+ right: 0;
|
|
|
+ bottom: 0;
|
|
|
+ background-position: center;
|
|
|
+ background-size: contain;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .label {
|
|
|
+ width: 103px;
|
|
|
+ overflow: hidden;
|
|
|
+ white-space: nowrap;
|
|
|
+ text-overflow: ellipsis;
|
|
|
+ color: #B9A67C;
|
|
|
+ font-size: 16px;
|
|
|
+ text-align: center;
|
|
|
+ letter-spacing: 0 !important;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ &__compose,
|
|
|
+ &__poster {
|
|
|
+ position: absolute;
|
|
|
+ top: 50%;
|
|
|
+ left: 50%;
|
|
|
+ animation: bounceIn linear .2s;
|
|
|
+ transform: translate(-50%, -50%);
|
|
|
+ cursor: pointer;
|
|
|
+ z-index: 2;
|
|
|
+ }
|
|
|
&-container {
|
|
|
display: flex;
|
|
|
+ gap: 50px;
|
|
|
}
|
|
|
&__item {
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ align-items: center;
|
|
|
position: relative;
|
|
|
- width: 427px;
|
|
|
- height: 491px;
|
|
|
- background: url('@/assets/images/hotspot-relic/Group491-min.png') no-repeat center / cover;
|
|
|
+ padding: 110px 90px 150px;
|
|
|
+ width: 442px;
|
|
|
+ height: 565px;
|
|
|
+ background: url('@/assets/images/hotspot-relic/Label_wenwu-min.png') no-repeat center / cover;
|
|
|
cursor: pointer;
|
|
|
transition: transform linear .2s;
|
|
|
+ box-sizing: border-box;
|
|
|
|
|
|
&:hover {
|
|
|
transform: scale(1.05);
|
|
|
}
|
|
|
- p {
|
|
|
- position: absolute;
|
|
|
- top: 52px;
|
|
|
- left: 110px;
|
|
|
- right: 110px;
|
|
|
- font-size: 20px;
|
|
|
- font-family: "Source Han Serif CN-Bold";
|
|
|
- color: #724B26;
|
|
|
- line-height: 23px;
|
|
|
- letter-spacing: 2px;
|
|
|
+ &__title {
|
|
|
+ flex-shrink: 0;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: center;
|
|
|
+ padding: 0 50px;
|
|
|
+ width: 269px;
|
|
|
+ height: 57px;
|
|
|
text-align: center;
|
|
|
overflow: hidden;
|
|
|
white-space: nowrap;
|
|
|
text-overflow: ellipsis;
|
|
|
+ box-sizing: border-box;
|
|
|
+ background: url('@/assets/images/hotspot-relic/tab_title-min.png') no-repeat center / contain;
|
|
|
+
|
|
|
+ p {
|
|
|
+ flex: 1;
|
|
|
+ width: 0;
|
|
|
+ white-space: nowrap;
|
|
|
+ overflow: hidden;
|
|
|
+ text-overflow: ellipsis;
|
|
|
+ font-size: 17px;
|
|
|
+ letter-spacing: 1px !important;
|
|
|
+ font-family: "Source Han Serif CN Heavy" !important;
|
|
|
+ color: #724B26;
|
|
|
+ }
|
|
|
}
|
|
|
.img {
|
|
|
- position: absolute;
|
|
|
- top: 131px;
|
|
|
- left: 102px;
|
|
|
+ flex-shrink: 0;
|
|
|
width: 222px;
|
|
|
- height: 207px;
|
|
|
+ height: 230px;
|
|
|
background-repeat: no-repeat;
|
|
|
background-position: center;
|
|
|
background-size: contain;
|
|
|
}
|
|
|
+
|
|
|
+ .description {
|
|
|
+ font-size: 18px;
|
|
|
+ letter-spacing: 0 !important;
|
|
|
+ font-family: "Source Han Sans SC light" !important;
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+@keyframes bounceIn {
|
|
|
+ 0% {
|
|
|
+ transform: translate(-50%, -50%) scale(0.2);
|
|
|
+ }
|
|
|
+ 80% {
|
|
|
+ transform: translate(-50%, -50%) scale(1.2);
|
|
|
+ }
|
|
|
+ 100% {
|
|
|
+ transform: translate(-50%, -50%) scale(1);
|
|
|
}
|
|
|
}
|
|
|
</style>
|