123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406 |
- <!-- 自定义卡片红包封面 -->
- <template>
- <div class="card-wrapper" :class="{'custom-card-in-poster': !showBottom}" >
- <template v-if="data.customPosterUrl">
- <img class="customImg" :src="data.customPosterUrl" />
- </template>
- <template v-else-if="isMoneyRewardCpd">
- <img :src="require('@/assets/img/img-preview-draw-after-bg.png')"
- v-if="data.type == PlayType.lottery"
- class="card-cover">
- <img :src="require('@/assets/subject/img-card-cover-blue.png')"
- v-else-if="data.type == PlayType.common"
- class="card-cover"/>
- <img :src="require('@/assets/img/img-preview-treasure-link-bg.png')"
- v-else-if="data.type == PlayType.treasure"
- class="card-cover"/>
- <div class="bottom-bar">
- <div class="title">
- DeNet.me
- </div>
- <div class="desc">
- 🎁 <template v-if="data.tokenSymbol=='USD'">$</template>{{data.amountValue}} GIVEAWAY
- </div>
- </div>
- <div class="user-info">
- <img :src="data.userInfo.avatarUrl"
- class="avatar"/>
- <template v-if="data.type != PlayType.treasure">
- {{data.userInfo.name}}
- </template>
- <span class="treasure-info" style="color: #fff; opacity: 0.7;font-weight: 300;" v-else>
- from @{{data.userInfo.name || ""}}
- </span>
- </div>
- <div class="content-text">
- <template v-if="data.type != PlayType.treasure">
- <div class="title">
- <span>{{data.currencyCode == 'USD' ? 'US Dollar' : data.tokenSymbol}} </span>
- GIVEAWAY
- </div>
- <div class="center"
- :style="{
- fontSize: amountFontSize + 'px'
- }">
- <img :src="data.currencyIconUrl" class="icon">
- <span id="preview-before-amount">
- {{data.amountValue}}
- </span>
- </div>
- <div class="desc">
- <template v-if="data.type == PlayType.lottery">
- <img class="icon-clock"
- :src="require('@/assets/svg/icon-preview-clock.svg')" /> {{data.validityDuration}} H
- <img class="icon-trophy"
- :src="require('@/assets/svg/icon-preview-trophy.svg')" /> <span class="trophy-count">{{data.totalCount}} WINNERS</span>
- </template>
- <template v-else-if="data.type == PlayType.common">
- {{data.totalCount}} WINNERS TO SHARE
- </template>
- </div>
- </template>
- <div class="treasure-layout" v-else>
- <div class="treasure-row-1">
- <span class="left">Treasure</span>
- <component-zoom :width="160">
- <span class="right">${{data.amountValue}}</span>
- </component-zoom>
- </div>
- <div class="treasure-desc-data">
- <div class="item">
- <img class="icon"
- :src="require('@/assets/svg/icon-preview-trophy.svg')" />
- 5000 Winners
- </div>
- <div class="item">
- <img class="icon" :src="data.currencyIconUrl">
- {{data.currencyCode == 'USD' ? 'US Dollar' : data.tokenSymbol}} equivalent
- </div>
- </div>
- </div>
- </div>
- </template>
- <template class="custom-card" v-else>
- <img class="custom-card-cover" v-if="isLottaryCpd" :src="require('@/assets/subject/img-custom-lottary-bg.png')" />
- <img class="custom-card-cover" v-else :src="require('@/assets/subject/img-custom-common-bg.png')" />
- <div class="bottom-bar" v-if="showBottom">
- <div class="title">
- DeNet.me
- </div>
- <div class="desc">
- 🎁 <template v-if="data.tokenSymbol=='USD'">$</template>{{data.amountValue}} GIVEAWAY
- </div>
- </div>
- <div class="custom-card-prize">
- <component-zoom :width="showBottom ? 210 : 300">
- <span class="custom-card-prize-name" id="custom-name" >
- <img class="custom-card-prize-gift-inline" :src="require('@/assets/subject/icon-gift-inline.svg')" />
- {{data.customizedReward}}
- <span class="custom-card-prize-name-total">X{{data.totalCount}}</span>
- </span>
- </component-zoom>
- </div>
- <div class="custom-card-desc" :class="{'custom-card-desc-lottary': !isLottaryCpd}">
- <span class="last-time" v-if="isLottaryCpd">
- <img class="custom-card-desc-clock-icon" :src="require('@/assets/subject/icon-clock.png')" />
- {{data.validityDuration}} H
- </span>
- <span class="trophy-count">
- <img class="custom-card-desc-prize-icon" :src="require('@/assets/subject/icon-prize.png')" />
- {{data.totalCount}} WINNERS
- </span>
- </div>
- </template>
- </div>
- </template>
- <script setup>
- import { defineProps, defineEmits, watch, ref, computed } from "vue";
- import ComponentZoom from "./component-zoom.vue";
- import { RewardType, PlayType } from "@/types";
- const imgHeaderCover = require('@/assets/img/icon-header-cover.png');
- const props = defineProps({
- data: {
- type: Object,
- default: () => {
- return {
- totalCount: 0,
- amountValue: 0,
- tokenSymbol: '',
- currencyCode: '',
- type: 1,
- validityDuration: '',
- customPosterUrl: '',
- userInfo: {
- avatarUrl: "",
- nickName: "",
- },
- rewardType: RewardType.money,
- customizedReward: ""
- };
- },
- },
- showBottom: {
- type: Boolean,
- default: true
- }
- });
- let isMoneyRewardCpd =computed(() => props.data.rewardType === RewardType.money);
- let isLottaryCpd = computed(() => props.data.type === PlayType.lottery);
- let amountFontSize = ref(60);
- watch(() => props.data, () => {
- let lenstr = document.querySelector('#preview-before-amount')?.innerHTML?.length;
- let num = parseInt(360/lenstr);
- amountFontSize.value = num < 56 ? num : 56;
- })
- </script>
- <style scoped lang="scss">
- .card-wrapper {
- width: 491px;
- border: 1px solid #D1D9DD;
- background: #ffffff;
- box-sizing: border-box;
- overflow: hidden;
- position: relative;
- box-sizing: border-box;
- border-radius: 16px;
- left: 73px;
- top: 238px;
- .customImg {
- width: 100%;
- min-height: 200px;
- }
- .user-info {
- position: absolute;
- left: 8px;
- top: 8px;
- z-index: 100;
- display: flex;
- align-items: center;
- font-size: 16px;
- color: #FFF;
- width: max-content;
- img {
- width: 24px;
- height: 24px;
- border: 2px solid #FFF4DB;
- box-sizing: border-box;
- border-radius: 50%;
- margin-right: 10px;
- }
- .treasure-info {
- color: #fff;
- opacity: 0.7;
- font-weight: 300;
- }
- }
- .content-text {
- position: absolute;
- top: 53px;
- left: 35px;
- .title {
- font-weight: 800;
- font-size: 16px;
- color: #ffffff;
- span {
- color: #F9C545;
- }
- }
- .center {
- padding: 12px 0;
- box-sizing: border-box;
- font-weight: 800;
- font-size: 56px;
- color: #fff;
- display: flex;
- align-items: center;
- .icon {
- width: 46px;
- height: 46px;
- margin-right: 10px;
- border: 3px solid #fff;
- border-radius: 50%;
- }
- }
- .desc {
- font-weight: 800;
- font-size: 13px;
- color: #ffffff;
- display: flex;
- align-items: center;
- .icon-clock {
- margin-right: 4px;
- }
- .icon-trophy {
- margin-left: 8px;
- margin-right: 4px;
- }
- .trophy-count {
- color: #FFCC4D;
- }
- }
- .treasure-layout {
- margin-top: -8px;
- .treasure-row-1 {
- display: flex;
- align-items: center;
- justify-content: center;
- font-weight: 900;
- font-size: 35px;
- color: #fff;
- .left {
- margin-right: 7px;
- color: #FFC83A;
- }
- .right {
- font-weight: 900;
- font-size: 35px;
- color: #fff;
- }
- }
- .treasure-desc-data {
- margin-top: 18px;
- .item {
- font-weight: 500;
- font-size: 14px;
- color: #E1D4C5;
- margin-bottom: 10px;
- display: flex;
- align-items: center;
- .icon {
- width: 20px;
- margin-right: 8px;
- }
- }
- }
- }
- }
- .card-cover {
- width: 100%;
- object-fit: contain;
- }
- .bottom-bar {
- padding: 12px;
- box-sizing: border-box;
- .title {
- color: #566370;
- font-weight: 400;
- font-size: 14px;
- margin-bottom: 6px;
- }
- .desc {
- font-weight: 500;
- font-size: 15px;
- color: #101419;
- }
- }
- }
- .custom-card {
- width: 100%;
- height: 100%;
- &-cover {
- width: 100%;
- }
- &-prize {
- position: absolute;
- left: 0%;
- top: 16%;
- width: 65%;
- line-height: 42px;
- display: flex;
- background-image: url('@/assets/subject/icon-uninstall-bg.svg');
- background-size: 100% 100%;
- padding-left: 5px;
- &-name {
- font-weight: 800;
- font-size: 16px;
- // line-height: 20px;
- letter-spacing: 0.22px;
- color: #FFFFFF;
- text-shadow: 0px 1.46341px 0px rgba(0, 0, 0, 0.15);
- display: flex;
- justify-content: center;
- align-items: center;
- &-total {
- color: #F5C03F;
- }
- }
- &-gift-inline {
- width: 30px;
- height: 30px;
- padding: 0 5px;
- }
- }
- &-desc {
- font-size: 12px;
- line-height: 13px;
- letter-spacing: 0.219512px;
- color: #FFFFFF;
- opacity: 0.7;
- position: absolute;
- left: 0;
- top: 37%;
- display: flex;
- padding-left: 4%;
- .last-time {
- display: flex;
- align-items: center;
- margin-right: 12px;
- img {
- width: 12px;
- margin-right: 2px;
- }
- }
- .trophy-count {
- display: flex;
- align-items: center;
- img {
- width: 12px;
- margin-right: 2px;
- }
- }
- }
- }
- .custom-card-in-poster {
- .custom-card-prize {
- top: 24%;
- line-height: 54px;
- }
- .custom-card-desc{
- top: 50%;
- }
- }
- </style>
|