<template>
    <div class="base-container">
        <fnHeader showDate hideSwitch></fnHeader>
        <div class="content">
            <div class="tool">
                <div class="button" @click="goBack">
                    <img src="@/assets/images/common/back-icon.png" alt="" />
                    返回
                </div>
            </div>
            <div class="medal-list">
                <div class="medal-item" v-for="(item, index) in 5" :key="index" @click="handleMedal">
                    <div class="btn" :class="{ active: index === 0 }">{{ index === 0 ? "已置顶" : "设为置顶" }}</div>
                    <img class="medal" src="@/assets/images/more/medal.png" alt="" />
                    <div class="icon-name">水源洁净</div>
                </div>
            </div>
        </div>
    </div>
    <Popup v-model:show="showPopup" class="medal-popup" overlay-class="medal-overlay" closeable>
        <div class="btn" :class="{ active: false }">设为置顶</div>
        <img class="medal" src="@/assets/images/more/medal-popup.png" alt="" />
        <div class="icon-name">水源洁净</div>
        <div class="desc">
            评分规则评分规则评分规则评分规则评分规则评分规则评分规则评分规则评分规则评分规则评分规则评分规则
        </div>
    </Popup>
</template>

<script setup>
import fnHeader from "@/components/fnHeader.vue";
import { ref } from "vue";
import { Popup } from "vant";
import { useRouter } from "vue-router";
const router = useRouter();

const list = ref([
    {
        isDefalut: 1,
    },
]);

const showPopup = ref(false);
const handleMedal = () => {
    showPopup.value = true;
};

const goBack = () => {
    router.go("-1");
};
</script>

<style lang="scss" scoped>
.base-container {
    width: 100%;
    height: 100vh;
    color: #fff;
    box-sizing: border-box;
    background: #000;
    .content {
        width: 100%;
        height: 100%;
        height: calc(100% - 74px);
        padding: 16px 20px 0 20px;
        box-sizing: border-box;
        .tool {
            padding-bottom: 24px;
            border-bottom: 1px solid #444444;
            margin-bottom: 24px;
            display: flex;
            align-items: center;
            justify-content: space-between;
            .button {
                display: flex;
                align-items: center;
                justify-content: center;
                border: 1px solid rgba(255, 255, 255, 0.78);
                border-radius: 4px;
                padding: 9px;
                width: 104px;
                cursor: pointer;
                img {
                    width: 14px;
                    margin-right: 5px;
                }
            }
        }
        .medal-list {
            width: 100%;
            height: calc(100% - 65px - 24px);
            overflow-y: auto;
            display: flex;
            align-content: flex-start;
            flex-wrap: wrap;
            .medal-item {
                width: 13.7%;
                height: 220px;
                border-radius: 8px;
                position: relative;
                margin: 0 12px 12px 0;
                background: #282828;
                display: flex;
                align-items: center;
                flex-direction: column;
                justify-content: center;
                cursor: pointer;
                &.medal-item:nth-child(7n) {
                    margin-right: 0;
                }
                .icon-name {
                    margin-top: 18px;
                    position: relative;
                    &::before {
                        content: "";
                        position: absolute;
                        top: -16px;
                        width: 60px;
                        height: 5px;
                        border-radius: 50%;
                        background: rgba(204, 204, 204, 0.1);
                    }
                }
                // .btn {
                //     position: absolute;
                //     cursor: pointer;
                //     right: 8px;
                //     top: 8px;
                //     background: rgba(0, 0, 0, 0.6);
                //     border-radius: 4px;
                //     padding: 4px 8px;
                //     color: #ffd489;
                //     &.active {
                //         background: #ffd489;
                //         color: #000;
                //     }
                // }
            }
        }
    }
}
.btn {
    position: absolute;
    cursor: pointer;
    right: 8px;
    top: 8px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 4px;
    padding: 4px 8px;
    color: #ffd489;
    &.active {
        background: #ffd489;
        color: #000;
    }
}
// .medal-overlay {
//     background: rgba(0, 0, 0, 0.8);
// }
.medal-popup {
    background: rgba(255, 255, 255, 0.2);
    padding: 70px 24px 24px 24px;
    border-radius: 5px;
    display: flex;
    align-items: center;
    flex-direction: column;
    .btn {
        position: absolute;
        left: 24px;
        top: 24px;
        right: auto;
        font-size: 16px;
        padding: 8px 16px;
    }
    .medal {
        width: 180px;
        height: 180px;
    }
    .icon-name {
        margin-top: 40px;
        font-size: 28px;
        color: #fff;
        position: relative;
        &::before {
            content: "";
            position: absolute;
            top: -28px;
            left: -18px;
            width: 155px;
            height: 14px;
            border-radius: 50%;
            background: rgba(204, 204, 204, 0.1);
        }
    }
    .desc {
        margin-top: 34px;
        width: 500px;
        font-size: 19px;
        color: rgba(255, 255, 255, 0.6);
        text-align: center;
    }
}
</style>
