| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317 | <!-- 自定义卡片红包封面 --><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 == 2"                class="card-cover">            <img :src="require('@/assets/subject/img-card-cover-blue.png')"                v-else                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"/> {{data.userInfo.name}}            </div>            <div class="content-text">                <div class="title">                    {{data.tokenSymbol}} 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 == 2">                        <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>                        {{data.totalCount}} WINNERS TO SHARE                    </template>                </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: "",                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;        }    }    .content-text {        position: absolute;        top: 53px;        left: 35px;        .title {            font-weight: 800;            font-size: 16px;            color: #ffffff;        }        .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;            }        }    }    .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>
 |