<template>
    <div class="layout-container-main" id="jcsb">
        <div class="item" id="box1">
            <div class="layout-container-main-top" style="display: flex;justify-content: space-between;">
                <div class="top-left">
                    <div class="line"></div>
                    <span>平台用户行为数据统计与趋势图</span>
                </div>
                <div class="main"></div>
            </div>
            <div class="main-echart" style="height: 55vh;" ref="chartRef">
                <el-table class="table" :data="tableData" border height="100%">
                    <el-table-column prop="name" label="统计" align="center" />
                    <el-table-column prop="today" label="今日" align="center" />
                    <el-table-column prop="yesterday" label="昨日" align="center" />
                    <el-table-column prop="month" label="本月" align="center" />
                </el-table>
                <Chart class="line" :option="options" />
            </div>
        </div>
    </div>
</template>

<script setup>
import { ref } from 'vue'
import Chart from '@/components/charts/index.vue'
//穿山甲、优量汇、快手、Sigmob、百度

const options = {
    tooltip: {
        trigger: 'axis'
    },
    legend: {
        data: ['新增数(ZID)', '注册数', '登录数', '新增封禁', '总封禁', '新增封号', '总封号']
    },
    xAxis: {
        type: 'category',
        boundaryGap: false,
        data: [
            '2025-06-23 00:00', '2025-06-23 04:00', '2025-06-23 08:00',
            '2025-06-23 12:00', '2025-06-23 16:00', '2025-06-23 20:00'
        ]
    },
    yAxis: {
        type: 'value'
    },
    series: [
        {
            name: '新增数(ZID)',
            type: 'line',
            data: [0.03, 0.1, 0.1, 0.3, 0.2, 0.5]
        },
        {
            name: '注册数',
            type: 'line',
            data: [0.3, 0, 0.2, 0.1, 0.3, 0.2]
        },
        {
            name: '登录数',
            type: 'line',
            data: [0.2, 0.4, 0.2, 1, 0, 0.3]
        },
        {
            name: '新增封禁',
            type: 'line',
            data: [0, 0.2, 0.4, 0, 0.5, 0.7]
        },
        {
            name: '总封禁',
            type: 'line',
            data: [0.1, 0.1, 0, 0.1, 0, 0]
        },
        {
            name: '新增封号',
            type: 'line',
            data: [0, 0.1, 0, 0.3, 0, 0]
        },
        {
            name: '总封号',
            type: 'line',
            data: [0, 0, 0, 0, 0, 0]
        }
    ]
}


// 表格数据
const tableData = ref([
    { name: '注册数', today: 0, yesterday: 0, month: 877 },
    { name: '新增数(ZID)', today: 0, yesterday: 0, month: 62 },
    { name: '登录数', today: 1, yesterday: 0, month: 1376 },
    { name: '新增封禁', today: 1, yesterday: 3, month: 653 },
    { name: '总封禁数', today: 0, yesterday: 0, month: 636 },
    { name: '新增封号', today: 1, yesterday: 3, month: 32 },
    { name: '总封号', today: 0, yesterday: 0, month: 19 }
]);
</script>

<style lang="scss" scoped>
.box {
    margin: 20px auto 0;
    width: calc(100% - 40px);
    /* height: 400px; */
    background: var(--system-page-background);
    padding: 20px 20px 10px;
    overflow: hidden;
}

.layout-container-main {
    display: flex;
    /* margin: 0 1.25rem; */
    flex-wrap: wrap;
    justify-content: space-between;

    .item {
        width: 100%;
        /* width: 40vw; */
        display: flex;
        flex-direction: column;
        padding: 1.13rem 1.31rem;
        margin-bottom: 1.25rem;
        /* height: 26.94rem; */
        border-radius: 0.5rem;
        background: #fff;
        box-shadow: 0 0 0.13rem #00000029;

        .layout-container-main-top {
            height: 6vh;

            .top-left {
                display: flex;

                .line {
                    width: 0.25rem;
                    height: 1.56rem;
                    border-radius: 0.13rem;
                    background: #fdb818;
                }

                span {
                    margin: 0 1rem;
                    font-family: "PingFang SC SNaNremibold";
                    font-weight: 600;
                    font-size: 1.13rem;

                    color: #333;
                }

                .text {
                    display: inline-block;
                    /* // margin: 0 0.63rem; */
                    width: 3.63rem;
                    font-weight: 400;
                    height: 1.88rem;
                    line-height: 1.88rem;
                    border-radius: 0.25rem;
                    background: transparent;
                    border: 0.03rem solid #999;
                    font-size: 0.88rem;
                    text-align: center;
                    color: #999;
                    cursor: pointer;
                }

                .active {
                    border-radius: 0.25rem;
                    background: #fdb818;
                    color: #fff;
                    border: 0.03rem solid #fff;
                }
            }
        }

        .main-echart {
            width: 100%;
            height: 500%;
            display: flex;

            .table {
                flex: 1;
            }

            .table :deep(.el-table__body-wrapper tbody tr) {
                // height: calc(100% / 7);
                height: calc(50.8vh / 7);
                /* 均匀分7行 */
            }

            .line {
                flex: 3;
            }
        }
    }
}


.stats-table {
    margin: 20px;
    width: 100vw;
}

:deep(.el-table__header th) {
    background-color: #f5f7fa;
    font-weight: bold;
}
</style>