<script setup lang="ts">
import { $getWechat } from '@/commons/utils';
import { onMounted, ref } from 'vue';

defineProps<{
    imageUrls: Record<string, string>
    tick: number
    rank: number
}>()

defineEmits<{
    replay: []
    back: []
}>()
const nickname = ref('');
const avatar = ref('');
onMounted(() => {
    const wechat = $getWechat();
    nickname.value = wechat.nickname;
    avatar.value = wechat.avatar;
});
</script>

<template>
    <div class="h5-page game-stage">
        <div class="img-logo"></div>
        <div class="bg-bottom"></div>
        <div class="img-score">
            <div class="score-avatar"
                :style="`background: url(${avatar});border-radius:66px;width:132px;height:132px;`"></div>
            <div class="score-content">
                <div>{{ nickname }}</div>
                <div>您的成绩</div>
                <div>得分</div>
                <div>{{ tick }}</div>
                <div>最终排名</div>
                <div v-if="rank>0">第<label>{{ rank }}</label>名</div>
                <div v-else>未上榜</div>
            </div>
        </div>
    </div>
</template>

<style scoped>
.game-stage {
    position: absolute;
    width: 750px;
    height: 1624px;
    padding: 0;
}

.bg-bottom {
    position: absolute;
    bottom: 0;
    left: var(--stage-viewport-left, 0);
    width: var(--stage-viewport-width, 750px);
    height: 479px;
    background: v-bind('imageUrls.bg2') center/cover;
    opacity: 0.6;
}

.img-logo {
    position: absolute;
    top: 66px;
    left: 50%;
    width: 428px;
    height: 77px;
    background: v-bind('imageUrls.logo') center/cover;
    transform: translateX(-50%);
}

.img-score {
    position: absolute;
    top: 450px;
    left: 50%;
    width: 465px;
    height: 731px;
    background: v-bind('imageUrls.scoreBg') center/cover;
    transform: translateX(-50%) scale(1.2);
}

.score-avatar {
    position: absolute;
    top: -50px;
    left: 50%;
    width: 60px;
    height: 60px;
    background: v-bind('imageUrls.avatar') center/cover;
    transform: translateX(-50%);
}

.score-content {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: calc(100% - 100px);
    font-size: 28pt;
    text-align: center;
}

.score-content>div:nth-child(1) {
    color: #E00000;
    font-size: 32pt;
    font-weight: bold;
}

.score-content>div:nth-child(2) {
    margin-top: 20px;
    font-size: 32pt;
}

.score-content>div:nth-child(3) {
    margin-top: 40px;
}

.score-content>div:nth-child(4) {
    margin-top: 30px;
    color: #E00000;
    font-size: 32pt;
    /* font-weight: bold; */
    transform: scale(1.5);
}

.score-content>div:nth-child(5) {
    margin-top: 40px;
}

.score-content>div:nth-child(6) {
    margin-top: 20px;
    color: #E00000;
    font-size: 32pt;
    font-weight: bold;
}

.score-content>div:nth-child(6) label {
    color: #E00000;
    font-size: 42pt;
    margin: 0 10px;
}

</style>
