<template>
    <view class="join-us">
        <view class="ewm-container">
            <view class="qrcode"><image :src="qrcodeUrl" mode="" :show-menu-by-longpress="true"></image></view>
            <view class="message">
                <view class="row">长按识别二维码</view>
                <view class="row">加微信获取优惠福利</view>
            </view>
        </view>
    </view>
</template>

<script>
import { fetchGroupQrCode } from '@/services/api/common.js'
export default {
    data() {
        return {
            qrcodeUrl: ''
        }
    },
    onLoad() {
        this.fetchGroupQrCode()
    },
    methods: {
        async fetchGroupQrCode() {
            try {
                const { data } = await fetchGroupQrCode()
                this.qrcodeUrl = data
            } catch (e) {
                //TODO handle the exception
                console.log(e)
            }
        }
    }
}
</script>

<style lang="scss" scoped>
.join-us {
    @extend .cm-flex-center;
    width: 100%;
    height: 100vh;
    background: url(https://static.caimei365.com/app/mini-hehe/icon/bg-join.png) no-repeat center;
    background-size: cover;
    background-color: #fff;

    .ewm-container {
        position: relative;
        width: 622rpx;
        height: 766rpx;
        background: #ffffff;
        border-radius: 16rpx;

        &::after {
            content: '';
            position: absolute;
            bottom: 0;
            left: 50%;
            transform: translateX(-50%);
            display: block;
            width: 48rpx;
            height: 8rpx;
            background: #ff457b;
            border-radius: 8rpx 8rpx 0px 0px;
        }

        .qrcode {
            width: 500rpx;
            height: 500rpx;
            margin: 61rpx 61rpx 0;
            background: #000;
            border-radius: 8rpx;

            image {
                width: 500rpx;
                height: 500rpx;
            }
        }

        .message {
            margin-top: 48rpx;
            text-align: center;
            font-size: 40rpx;
            color: #333333;

            .row {
                &:first-child {
                    font-weight: bold;
                }
                &:last-child {
                    margin-top: 8rpx;
                    font-size: 32rpx;
                    color: #666666;
                }
            }
        }
    }
}
</style>
