<template>
    <div class="container">
        <div class="content">
            <div class="logo">
                <svg-icon style="width: 42px; height: 36px;" name="angle-token" />
                <div class="logo-text">Angle Token</div>
            </div>
            <div class="card-box">
                <div class="box-item">
                    <div class="box-item-lf">
                        <svg-icon style="width: 50px; height: 50px;" name="pledge" />
                        <div class="box-item-text">
                            <div>300W</div>
                            <div>質押數</div>
                        </div>
                    </div>
                    <div class="box-item-ri">
                        <svg-icon style="width: 50px; height: 50px;" name="available" />
                        <div class="box-item-text">
                            <div>0.0STT</div>
                            <div>可領取數</div>
                        </div>
                    </div>
                </div>
                <div class="deadline">收益週期截止時間：2025-12-01 23:59:59</div>
                <div class="btn">
                    <van-button class="activate" color="#4765DD" :disabled="true">激活創世節點</van-button>
                    <van-button class="receive" color="#4765DD">領取STT</van-button>
                </div>
                <div class="list-box">
                    <div class="receive-record">領取記錄</div>
                    <div class="list-ul">
                        <div class="list-li" v-for="item in 40">
                            <div>2025-06-16 15:22:36</div>
                            <div>49.260000000STT</div>
                        </div>
                    </div>
                    <!-- <van-pull-refresh v-model="refreshing" @refresh="onRefresh">
                        <van-list
                            v-model:loading="loading"
                            :finished="finished"
                            finished-text="没有更多了"
                            @load="onLoad"
                        >
                            <van-cell v-for="item in list" :key="item" :title="item" />
                        </van-list>
                    </van-pull-refresh> -->
                </div>
            </div>
        </div>
    </div>
</template>

<script setup>
    const list = ref([]);
    const loading = ref(false);
    const finished = ref(false);
    const refreshing = ref(false);
    const onLoad = () => {
        setTimeout(() => {
            if (refreshing.value) {
                list.value = [];
                refreshing.value = false;
            }
            for (let i = 0; i < 10; i++) {
                list.value.push(list.value.length + 1);
            }
            loading.value = false;
            if (list.value.length >= 40) {
                finished.value = true;
            }
        }, 1000);
    };

    const onRefresh = () => {
      // 清空列表数据
      finished.value = false;
      // 重新加载数据
      // 将 loading 设置为 true，表示处于加载状态
      loading.value = true;
      onLoad();
    };
</script>

<style lang="less" scoped>
.container{
    background: url('@/assets/img/bg.png') no-repeat;
    background-size: 100% 100%;
    height: calc(100vh - 44px);
    display: flex;
    flex-direction: column;
    .content{
        padding: 17px 17px 56px;
        display: flex;
        flex-direction: column;
        overflow: hidden;
        flex: 1;
        .logo{
            display: flex;
            flex-direction: column;
            align-items: center;
            font-family: PingFang SC, PingFang SC;
            font-weight: 500;
            font-size: 19px;
            color: #FFFFFF;
            .logo-text{
                margin-top: 10px;
                margin-bottom: 12px;
            }
        }
        .card-box{
            background: #FFFFFF;
            border-radius: 24px;
            padding: 17px;
            flex: 1;
            display: flex;
            flex-direction: column;
            overflow: hidden;
            .box-item{
                display: flex;
                align-items: center;
                gap: 12px;
                .box-item-lf,.box-item-ri{
                    background: #F6F7FF;
                    border-radius: 17px;
                    padding: 20px 0;
                    width: 50%;
                    display: flex;
                    align-items: center;
                    justify-content: center;
                }
                .box-item-text{
                    margin-left: 12px;
                    font-family: PingFang SC, PingFang SC;
                    font-weight: 500;
                    font-size: 15px;
                    color: #000000;
                }
            }
            .deadline{
                background: #F6F7FF;
                border-radius: 17px;
                text-align: center;
                height: 33px;
                line-height: 33px;
                box-sizing: border-box;
                margin: 10px 0;
                font-family: PingFang SC, PingFang SC;
                font-weight: 400;
                font-size: 12px;
                color: #000000;
            }
            .btn{
                display: flex;
                align-items: center;
                gap: 12px;
                .activate,.receive{
                    width: 50%;
                    height: 33px;
                    line-height: 33px;
                    font-family: PingFang SC, PingFang SC;
                    font-weight: 400;
                    font-size: 15px;
                    color: #FFFFFF;
                    border-radius: 17px !important;
                }
            }
            .list-box{
                margin-top: 37px;
                flex: 1;
                display: flex;
                flex-direction: column;
                overflow: hidden;
                .receive-record{
                    font-family: PingFang SC, PingFang SC;
                    font-weight: 500;
                    font-size: 15px;
                    color: #4F4F4F;
                    margin-bottom: 17px;
                }
                .list-ul{
                    flex:1;
                    overflow: auto;
                    .list-li{
                        display: flex;
                        align-items: center;
                        justify-content: space-between;
                        font-family: PingFang SC, PingFang SC;
                        font-weight: 500;
                        font-size: 12px;
                        color: #4F4F4F;
                        margin-bottom: 8px;
                    }
                }
                .list-ul::-webkit-scrollbar{
                    width: 0;
                }
            }
        }
    }
}
</style>