<template>
  <div class="navigation-bac">
    <div class="navigation-bar">
      <div class="navigation-left" v-show="showLeft">
        <el-badge
          :value="item.title == '预警中心' ? yjTotal : ''"
          class="item"
          v-for="(item, index) in leftBtnList"
          :key="index"
        >
          <el-button type="text" @click="handleSearch(item.title)">{{
            item.title
          }}</el-button>
        </el-badge>
      </div>
      <div class="navigation-title">
        <div class="main-title" :text="mainTitle">{{ mainTitle }}</div>
        <div class="sub-title" :text="subTitle">{{ subTitle }}</div>
      </div>
      <div class="navigation-right" v-show="showRight">
        <div class="reset"></div>
        <el-button type="text">后台管理</el-button>
        <el-button type="text" v-show="showStreet">美丽街区</el-button>
        <el-button type="text" @click="handleBack()" v-show="!showStreet"
          >返回街道</el-button
        >
        <userModel :name="name" />
      </div>
      <!-- 四个中心 -->
      <el-dialog
        :visible.sync="open"
        :modal="false"
        custom-class="taicang-dialog"
      >
        <div class="dialog-main">
          <div class="dialog-title"><span></span> {{ title }}</div>
          <peopleCentre v-if="title == '搜索中心'" />
          <warningCentre v-if="title == '预警中心'" />
          <recycleCentre v-if="title == '回收中心'" />
          <logCentre v-if="title == '日志中心'" />
        </div>
      </el-dialog>
    </div>
  </div>
</template>

<script>
import { mapGetters } from "vuex";
import {
  peopleCentre,
  warningCentre,
  recycleCentre,
  logCentre,
  userModel,
} from "./index";
export default {
  components: {
    peopleCentre,
    warningCentre,
    recycleCentre,
    logCentre,
    userModel,
  },
  props: {
    //显示左边四个中心
    showLeft: {
      type: Boolean,
      default: true,
    },
    //显示右边
    showRight: {
      type: Boolean,
      default: true,
    },
    showStreet: {
      type: Boolean,
      default: true,
    },
    mainTitle: {
      type: String,
      default: "娄东街道人口数据管理系统",
    },
    subTitle: {
      type: String,
      default: "Population data management system",
    },
  },
  data() {
    return {
      title: "",
      open: false,
      leftBtnList: [
        { title: "搜索中心", isShow: true },
        { title: "预警中心", isShow: true },
        { title: "回收中心", isShow: true },
        { title: "日志中心", isShow: true },
      ],
    };
  },
  mounted() {},
  methods: {
    handleBack() {
      this.$router.back();
    },
    /**
     * 是个中心
     */
    handleSearch(title) {
      this.title = title;
      this.open = true;
    },
  },
  computed: {
    ...mapGetters(["name", "yjTotal"]),
  },
};
</script>

<style lang="scss" scoped>
.navigation-bac {
  position: fixed;
  top: 0;
  z-index: 100;
  height: 120px;
  width: 100%;
}
.navigation-bar {
  height: 100%;
  width: 100%;
  background: url("~@/assets/images/ui/navigation.png");
  background-size: cover;
  display: flex;
  justify-content: center;
  & > div {
    flex: 1;
  }
  .navigation-left {
    padding-top: 20px;
    padding-left: 25px;
  }
  .navigation-title {
    text-align: center;
    margin-top: 4px;
    .main-title {
      font-size: 36px;
      color: #ffffff;
      letter-spacing: 3px;
      text-shadow: #333 2px 2px 2px;
      font-family: "xiniu";
    }

    .sub-title {
      font-size: 16px;
      color: #f2fbff;
      text-align: center;
      font-family: "Alibaba-PuHuiTi-Regular.otf";
      text-shadow: #333 2px 2px 2px;
    }
    .main-title::before,
    .sub-title::before {
      content: attr(text);
      position: absolute;
      z-index: 10;
      color: #ffffff;
      background: linear-gradient(0deg, #9cf7ff 20%, #eaeaeb 100%);
      -webkit-background-clip: text;
      -webkit-text-fill-color: transparent;
      text-shadow: none;
    }
  }
  .navigation-right {
    padding-top: 20px;
    padding-right: 25px;
    display: flex;
    flex-direction: row-reverse;
    align-items: flex-start;
    .reset {
      height: 41px;
      width: 58px;
      background: url("~@/assets/images/ui/reset.png");
    }
  }
  .el-button {
    font-size: 14px;
    color: #cdfbff;
    font-weight: 400;
    background: url("~@/assets/images/ui/btn_bg.png");
    background-size: 100% 100%;
    padding: 12px 20px 14px 20px;
    font-family: "Alibaba-PuHuiTi-Regular.otf";
  }

  .dialog-main {
    min-height: 700px;
    display: flex;
    flex-direction: column;
    background: #031c3c;
    border-radius: 12px;
    padding: 20px;
    .dialog-title {
      display: flex;
      align-items: center;
      span {
        display: inline-block;
        height: 17px;
        width: 5px;
        background: #00a8ff;
        margin-right: 10px;
      }
      font-size: 18px;
      color: #f4f8fa;
      font-weight: 500;
      font-family: "Alibaba-PuHuiTi-Medium.otf";
    }
  }
}
::v-deep .el-badge__content.is-fixed {
  z-index: 10;
}
::v-deep .el-dialog {
  background: transparent;
}
::v-deep .el-dialog__header {
  padding: 0;
}
::v-deep .el-dialog__body {
  background: #009bf4;
  border-radius: 12px;
  padding: 1px;
}
::v-deep .el-dialog:not(.is-fullscreen) {
  margin-top: 6vh !important;
}
</style>
