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

defineProps<{
    imageUrls: Record<string, string>
    userJoinStatus: boolean
}>();
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="game-desc" @click="$emit('touchGameRule')">游戏规则</div>
        <div class="img-logo"></div>
        <div class="img-coin"></div>
        <div class="txt-bottom" v-if="userJoinStatus">您已成功加入游戏<br />等待主持人开始</div>
    </div>
</template>

<style scoped>
.img-coin {
    background: v-bind('imageUrls.coin') center / cover no-repeat;
    width: 744px;
    height: 756px;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%) scale(0.6);
    transform-origin: center;
}

.txt-bottom {
    position: absolute;
    bottom: 130px;
    width: 100%;
    line-height: 40px;
    color: white;
    font-size: 28px;
    text-align: center;
    animation: loading-text-scale 1.2s ease-in-out infinite;
}


@keyframes loading-text-scale {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.08);
    }
}

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

.game-desc {
    position: absolute;
    top: 40%;
    left: var(--stage-viewport-left, 0);
    display: flex;
    width: 58px;
    height: 158px;
    padding-top: 10px;
    align-items: center;
    justify-content: center;
    border-radius: 0 12px 12px 0;
    background: rgba(40, 12, 8, 0.52);
    color: rgba(255, 255, 255, 0.9);
    font-size: 25px;
    letter-spacing: 10px;
    line-height: 1.25;
    text-align: center;
    text-orientation: upright;
    transform: translateY(-50%);
    writing-mode: vertical-rl;
}

.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: 20px;
    width: 428px;
    height: 77px;
    background: v-bind('imageUrls.logo') center/cover;
}

.img-title {
    position: absolute;
    top: 200px;
    left: 50%;
    width: 609px;
    height: 243px;
    background: v-bind('imageUrls.title') center/cover;
    transform: translateX(-50%);
}

.img-avatar {
    position: absolute;
    top: 480px;
    left: 50%;
    /* width: 148px;
    height: 148px;
    background: v-bind('avatar') center/cover; */
    transform: translateX(-50%);
}

.txt-nickname {
    position: absolute;
    top: 640px;
    left: 50%;
    color: #E00000;
    font-size: 25pt;
    font-weight: bold;
    transform: translateX(-50%);
}

.txt-loading {
    position: absolute;
    top: 710px;
    left: 50%;
    width: 288px;
    color: #E00000;
    font-size: 25pt;
    font-weight: bold;
    text-align: center;
    transform: translateX(-50%);
}

.loading-gu {
    position: absolute;
    bottom: 100px;
    left: 50%;
    width: 600px;
    height: 534px;
    background: v-bind('imageUrls.gu') center/cover;
    transform: translateX(-50%);
}
</style>
