<template>
    <view class="user-list">
        <scroll-view :scroll-x="true" class="scroll-box">
            <view class="user-box">
                <view class="user first">
                    <image :src="avatar" class="user-head"></image> <text>拼主</text>
                </view>
            </view>
            <view class="user-box" v-for="i in memberNum - 1" :key="i">
                <view class="user">
                    <image v-if="i < existNum - 1" :src="avatar" class="user-head"></image>
                </view>
            </view>
        </scroll-view>
    </view>
</template>

<script>
export default {
    props: {
        // 总人数
        memberNum: {
            type: Number,
            default: 0
        },
        // 已有人数
        existNum:{
            type: Number,
            default: 0
        }
    },
    computed:{
        avatar(){
            return this.$Static + 'icon-default-avatar.png'
        }
    }
}
</script>

<style lang="scss" scoped>
.flex-center-box {
    display: flex;
    justify-content: center;
    align-items: center;
}

.user-list {
    padding: 0 24rpx;
    
    .scroll-box {
        white-space: nowrap;
        text-align: center;
    }

    .user-box {
        display: inline-block;
        margin: 12rpx 12rpx;
    }

    // @extend .flex-center-box;
    .user {
        @extend .flex-center-box;
        position: relative;
        width: 100rpx;
        height: 100rpx;

        border-radius: 50%;

        border: 2rpx dashed #cccccc;
        border-radius: 50%;
        box-sizing: border-box;

        &::before {
            content: '?';
            font-size: 36rpx;
            color: #999999;
        }

        .user-head {
            position: absolute;
            left: -2rpx;
            top: -2rpx;
            z-index: 1;
            display: block;
            width: 100rpx;
            height: 100rpx;
            border-radius: 50%;
        }

        text {
            @extend .flex-center-box;
            position: absolute;
            left: -12rpx;
            top: 0;
            z-index: 2;
            width: 56rpx;
            height: 28rpx;
            background: #ff457b;
            border: 1rpx solid #ffffff;
            border-radius: 14rpx;
            font-size: 20rpx;
            color: #ffffff;
        }
    }
}
</style>
