<template>
  <div class="header">
    <div class="title">
      <img class="logo" src="@/assets/images/common/logo.png" alt="" />
      <span>飞鸟智慧巡园平台</span>
      <img class="logo-icon" src="@/assets/images/common/logo-icon.png" alt="" />
    </div>
    <div class="focus-farm">
        <el-select
            v-model="farmVal"
            placeholder="我的关注农场"
            style="width: 189px"
            popper-class="focus-farm-select"
            @change="toggleFarm"
        >
            <el-option label="荔博园" :value="1" />
            <el-option label="井冈红糯基地" :value="2" />
        </el-select>
    </div>
    <div class="date" v-show="showDate">
      <el-icon size="25"><MoreFilled /></el-icon>
      <div class="time">
        <div>21:05:46</div>
        <span>2025.01.14 星期二</span>
      </div>
    </div>
  </div>
  <!-- 四个方向的阴影 -->
  <div class="page-shadow">
    <div class="page-bg bg-top"></div>
    <div class="page-bg bg-right"></div>
    <div class="page-bg bg-bottom"></div>
    <div class="page-bg bg-left"></div>
  </div>
</template>

<script setup>
import { ref } from "vue";
import { useRouter } from "vue-router";

const router = useRouter();
const props = defineProps({
  showDate:{
    type:Boolean,
    defalut:false
  },
})

const farmVal = ref(null)
const toggleFarm = (val) => {
    router.push({ name: "Home" });
};
</script>

<style lang="scss" scoped>
.header {
  width: 100%;
  height: 74px;
  display: flex;
  justify-content: space-between;
  box-sizing: border-box;
  pointer-events: all;
  position: relative;

  .title {
    width: 100%;
    height: 100%;
    font-size: 24px;
    letter-spacing: 2px;
    padding-left: 20px;
    display: flex;
    align-items: center;
    box-sizing: border-box;
    background: url("@/assets/images/common/header-bg.png") no-repeat center
      center / 100% 100%;
      .logo{
        width: 23px;
        height: 26px;
      }
      .logo-icon{
        width: 33px;
        height: 12px;
      }
    span {
      margin: 0 5px;
      font-family: "PangMenZhengDao";
    }
  }
  .focus-farm {
    margin-right: 192px;
    // margin-top: 42px;
    margin-top: 26px;
    ::v-deep {
        .el-select__wrapper {
            background: rgba(255, 212, 137, 0.2);
            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;
        }
    }
  }
  .date {
    display: flex;
    align-items: center;
    position: absolute;
    right: 30px;
    top: 24px;
    .time{
      margin-left: 14px;
      line-height: 18px;
      div{
        font-family: "PangMenZhengDao";
        letter-spacing: 1px;
        font-size: 16px;
      }
      span{
        font-size: 11px;
        font-family: 'SOURCEHANTIFINE';
      }
    }
  }
}
// 阴影样式
.page-bg{
  position: fixed;
  z-index: -1;
}
.bg-top{
  top: 0;
  width: 100%;
  height: 200px;
  background: linear-gradient( 0deg, rgba(0, 21, 31,0), #00151f);
}
.bg-right{
  right: 0;
  width: 600px;
  height: 100%;
  background: linear-gradient( 90deg, rgba(0, 21, 31,0), rgb(0, 21, 31,0.7));
}
.bg-bottom{
  bottom: 0;
  width: 100%;
  height: 200px;
  background: linear-gradient( 180deg, rgba(0, 21, 31,0), rgb(0, 21, 31,0.7));
}
.bg-left{
  left: 0;
  width: 600px;
  height: 100%;
  background: linear-gradient( 270deg, rgba(0, 21, 31,0), rgb(0, 21, 31,0.7));
}
</style>

<style lang="less">
.focus-farm-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);
    }
}
</style>