<template>
    <div class="base-container no-events">
        <fnHeader showDate></fnHeader>
        <div class="content">
            <div class="warning-l left">
                <div class="warning-top">
                    <div class="top-l yes-events">
                        <div>
                            <el-select
                                v-model="areaVal"
                                placeholder=""
                                style="width: 184px"
                                popper-class="area-select"
                                >
                                <el-option label="广东省" :value="0" />
                                <el-option label="广东省-从化" :value="1" />
                            </el-select>
                        </div>
                        <div class="type-box"><img src="@/assets/images/warningHome/lz.png" /></div>
                    </div>
                    <div class="top-r yes-events">
                        <div class="data-box">
                            <div class="data-value"><span>526</span>亩</div>
                            <div class="data-name">种植面积</div>
                        </div>
                        <div class="data-box" v-if="areaVal === 1">
                            <div class="data-value"><span>526</span>亩</div>
                            <div class="data-name">疑似失管面积</div>
                        </div>
                        <div class="data-box">
                            <div class="data-value"><span>526</span>亩</div>
                            <div class="data-name">预估产量</div>
                        </div>
                        <div class="data-box">
                            <div class="data-value"><span>526</span>万元</div>
                            <div class="data-name">预估总产值</div>
                        </div>
                    </div>
                </div>
                <div class="warning-alarm yes-events">
                    <alarm-list></alarm-list>
                </div>
            </div>
            <div class="warning-r right yes-events">
                <album></album>
            </div>
            <div class="warning-search">
                <img src="@/assets/images/warningHome/search-img.png" />
            </div>
        </div>

    <div id="popup" class="ol-popup-warning">
        <div class="warning-info-title">
            <div class="icon">
                <img src="@/assets/images/common/chart-icon.png" />
            </div>
            <div id="popup-title"></div>
            <div class="close">
                <img src="@/assets/images/warningHome/close-btn.png" />
            </div>
        </div>
        <div id="popup-content" class="info-content"></div>
    </div>
    </div>
    <div ref="mapRef" class="bottom-map"></div>
</template>

<script setup>
import { onMounted, ref } from "vue";
import fnHeader from "@/components/fnHeader.vue";
import WarningMap from "./warningMap";
import album from "./components/album.vue";
import alarmList from "./components/alarmList.vue";
import { useRouter } from "vue-router";
import { useStore } from "vuex";
let store = useStore();

let warningMap = new WarningMap();
const router = useRouter();

const areaVal = ref(0)
const mapRef = ref();
onMounted(() => {
    warningMap.initMap(store.getters.userinfo.location, mapRef.value);
});

</script>

<style lang="scss" scoped>
.base-container {
    width: 100%;
    height: 100vh;
    color: #fff;
    position: absolute;
    box-sizing: border-box;
    z-index: 1;

    .content {
        width: 100%;
        height: calc(100% - 74px - 48px);
        padding: 0 20px 0 27px;
        display: flex;
        justify-content: space-between;
        box-sizing: border-box;
        position: relative;
        .left,
        .right {
            width: calc(376px + 54px);
            height: 100%;
            padding-top: 10px;
            box-sizing: border-box;
            // display: flex;
        }
        .right {
            width: 395px;
            .list {
                width: 100%;
                height: 100%;
            }
        }
        .warning-search {
            position: absolute;
            right: 192px;
            top: -30px;
        }
        .warning-top {
            display: flex;
            .top-l {
                display: flex;
                flex-direction: column;
                align-items: center;
                .type-box {
                    margin-top: 10px;
                    background: rgba(29, 29, 29, 0.54);
                    border: 1px solid rgba(255, 212, 137, 0.3);
                    border-radius: 2px;
                    text-align: center;
                    line-height: 48px;
                    height: 48px;
                    width: 184px;
                }
                ::v-deep {
                    .el-select__wrapper {
                        background: rgba(29, 29, 29, 0.54);
                        box-shadow: 0 0 0 1px rgba(255, 212, 137, 0.3) inset;
                        height: 50px;
                        line-height: 50px;
                        .el-select__caret {
                            color: #FFD489;
                        }
                    }
                    .el-select__placeholder {
                        color: #F7BE5A;
                        font-size: 20px;
                        font-family: 'PangMenZhengDao';
                        text-align: center;
                    }
                }
            }
            .top-r {
                display: flex;
                .data-box {
                    cursor: pointer;
                    margin-left: 20px;
                    width: 200px;
                    height: 104px;
                    background: url("@/assets/images/warningHome/box-bg.png") no-repeat center center / cover;
                    display: flex;
                    flex-direction: column;
                    align-items: center;
                    .data-value {
                        padding-top: 15px;
                        font-size: 20px;
                        color: rgba(255, 212, 137, 0.4);
                        font-family: 'PangMenZhengDao';
                        span {
                            font-size: 38px;
                            color: #F7BE5A;
                            padding-right: 2px;
                        }
                    }
                    .data-name {
                        color: #CECECE;
                        font-size: 16px;
                    }
                }
            }
        }
        .warning-alarm {
            width: 88px;
            padding-top: 14px;
        }
    }
}
.bottom-map {
    width: 100%;
    height: 100vh;
    position: absolute;
    z-index: 0;
}
</style>

<style lang="less">
.area-select {
    &.el-popper.is-light {
        background: #232323;
        border-color: rgba(255, 212, 137, 0.3);
        box-shadow: 0px 0px 12px rgba(255, 212, 137, 0.3);
        .el-select-dropdown__item {
            background: none;
            color: rgba(255, 212, 137, 0.6);
        }
        .el-select-dropdown__item.is-selected {
            background: rgba(255, 212, 137, 0.2);
            color: #FFD489;
        }
    }
    &.el-popper.is-light .el-popper__arrow:before {
        background: #232323;
        border-color: rgba(255, 212, 137, 0.3);
    }
}
.ol-popup-warning {
    position: relative;
    width: 295px;
    background: rgb(35, 35, 35, 0.86);
    color: #fff;
    font-size: 16px;
    .warning-info-title {
        display: flex;
        padding: 6px 10px;
        background: rgba(255, 255, 255, 0.05);
        font-size: 18px;
        .icon {
            padding-right: 6px;
        }
        .close {
            position: absolute;
            right: 12px;
            top: 8px;
        }
    }
    .info-content {
        padding: 16px 20px 40px 20px;
    }
}
</style>
