<template>
  <div style="height: 100vh;">
    <div class="header">
      <div class="navBar">
        <div class="navBar-logo">
          <div>
          </div>
        </div>
        <div class="right-menu">
          <el-row v-if="device !== 'mobile'"
            style="display: flex;flex-direction: row;justify-content: flex-end;align-items: center;">
            <search id="header-search" class="right-menu-item" />
            <screenfull id="screenfull" class="right-menu-item hover-effect" />
            <el-tooltip content="常量管理" effect="dark" placement="bottom">
              <div class="right-menu-item" @click="toManage">
                <i class="el-icon-menu"></i>
              </div>
            </el-tooltip>

            <el-tooltip content="系统设置" effect="dark" placement="bottom">
              <div class="right-menu-item" @click="toSystem">
                <i class="el-icon-s-tools"></i>
              </div>
            </el-tooltip>
            <el-dropdown class="avatar-container right-menu-item hover-effect" trigger="click">
              <div class="avatar-wrapper">
                <i class="el-icon-user"></i>
                <i class="el-icon-caret-bottom" />
              </div>
              <el-dropdown-menu slot="dropdown">
                <router-link to="/user/profile">
                  <el-dropdown-item>个人中心</el-dropdown-item>
                </router-link>
                <el-dropdown-item @click.native="setting = true">
                  <span>布局设置</span>
                </el-dropdown-item>
                <el-dropdown-item divided @click.native="logout">
                  <span>退出登录</span>
                </el-dropdown-item>
              </el-dropdown-menu>
            </el-dropdown>
          </el-row>


        </div>
      </div>
    </div>
    <div class="content">
      <div class="box">
        <div class="title-container">
          <div class="title"></div>
        </div>
        <div class="menu-container">
          <!-- 第一行菜单 -->
          <div class="menu-row">
            <div class="side">
              <img @click="toDesign" class="logo" src="../assets/images/home/方案设计.png" alt="">
              <div @click="toDesign" class="info">
                <h3>方案设计</h3>
              </div>
            </div>
            <div class="side">
              <img @click="toOptimize" class="logo" src="../assets/images/home/钻井优化.png" alt="">
              <div @click="toOptimize" class="info">
                <h3>钻井优化</h3>
              </div>
            </div>
            <div class="side">
              <img class="logo" src="../assets/images/home/地质力学.png" alt="">
              <div class="info">
                <h3>设备运转优化</h3>
              </div>
            </div>
            <div class="side">
              <img class="logo" src="../assets/images/home/油藏评价.png" alt="">
              <div class="info">
                <h3>固井智能优化</h3>
              </div>
            </div>
            <div class="side">
              <img class="logo" src="../assets/images/home/常量管理.png" alt="">
              <div class="info">
                <h3>GPT大模型智脑</h3>
              </div>
            </div>
          </div>
          <!-- 第二行菜单 -->
          <div class="menu-row">
            <div class="side">
              <img class="logo" src="../assets/images/home/压裂优化.png" alt="">
              <div class="info">
                <h3>复杂预警</h3>
              </div>
            </div>
            <div class="side">
              <img class="logo" src="../assets/images/home/油气生产.png" alt="">
              <div class="info">
                <h3>智能井控</h3>
              </div>
            </div>
            <div class="side">
              <img class="logo" src="../assets/images/home/监督管理.png" alt="">
              <div class="info">
                <h3>钻具全生命周期管理</h3>
              </div>
            </div>
            <div class="side">
              <img class="logo" src="../assets/images/home/数据平台.png" alt="">
              <div class="info">
                <h3>地质工程一体化</h3>
              </div>
            </div>
            <div class="side">
              <img class="logo" src="../assets/images/home/系统设置.png" alt="">
              <div class="info">
                <h3>数字化井筒</h3>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { mapGetters } from 'vuex'
import Breadcrumb from '@/components/Breadcrumb'
import TopNav from '@/components/TopNav'
import Hamburger from '@/components/Hamburger'
import Screenfull from '@/components/Screenfull'
import SizeSelect from '@/components/SizeSelect'
import Search from '@/components/HeaderSearch'
import RuoYiGit from '@/components/RuoYi/Git'
import RuoYiDoc from '@/components/RuoYi/Doc'

export default {
  name: "home.js",
  components: {
    Breadcrumb,
    TopNav,
    Hamburger,
    Screenfull,
    SizeSelect,
    Search,
    RuoYiGit,
    RuoYiDoc
  },
  computed: {
    ...mapGetters([
      'sidebar',
      'avatar',
      'device'
    ]),
    setting: {
      get() {
        return this.$store.state.settings.showSettings
      },
      set(val) {
        this.$store.dispatch('settings/changeSetting', {
          key: 'showSettings',
          value: val
        })
      }
    },
    topNav: {
      get() {
        return this.$store.state.settings.topNav
      }
    }
  },
  methods: {
    toggleSideBar() {
      this.$store.dispatch('app/toggleSideBar')
    },
    async logout() {
      this.$confirm('确定注销并退出系统吗？', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        this.$store.dispatch('LogOut').then(() => {
          location.href = '/index';
        })
      }).catch(() => {
      });
    },
    //跳转方案设计
    toDesign() {
      this.$router.push('/schemeOptimization')
      // this.$router.push('/index')
      this.$store.dispatch('setJh', "");
    },
    //跳转钻井优化
    toOptimize() {
      this.$router.push('/initialization')
      // this.$router.push('/index')
      this.$store.dispatch('setJh', "");

    },
    //跳转常量管理
    toManage() {
      this.$router.push('/constantManagement/jtzj/jtzjZtou')
      // this.$router.push('/index')
      this.$store.dispatch('setJh', "");

    },
    //跳转系统设置
    toSystem() {
      this.$router.push('/systemSettings/system/user')
      // this.$router.push('/index')
      this.$store.dispatch('setJh', "");

    }
  }
}
</script>

<style scoped lang="scss">
.header {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 60px;
  z-index: 100;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding: 0 20px;
  background: rgba(47, 143, 251, 0.5);

  .tool-icons {
    display: flex;
    align-items: center;
    gap: 15px;

    .icon {
      width: 24px;
      height: 24px;
      cursor: pointer;
      color: #fff;
      display: flex;
      align-items: center;
      justify-content: center;

      i {
        font-size: 20px;
      }

      &:hover {
        opacity: 0.8;
      }
    }
  }
}

.navBar {
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;

  .right-menu {
    height: 100%;
    display: flex;
    align-items: center;
  }
}

.content {
  position: relative;
  width: 100vw;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background-color: #d9e9ff !important;

  .box {
    background: url("../assets/images/home/画板 13.png") no-repeat;
    background-size: 100% 100%;
    background-position: center;
    background-color: #d9e9ff;
    opacity: 1;
    width: 100vw;
    min-height: 100vh;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding-top: 100px;


    .title-container {
      width: 858px;
      height: 110px;
      text-shadow: 0px 3px 6px #0050aa;
      text-align: center;
      background: url("../assets/images/home/科学钻井远程决策支持系统.png") no-repeat center;
      background-size: 858px 110px;
      overflow: hidden;
      position: fixed;
      top: 170px;
      left: 50%;
      transform: translateX(-50%);
      margin: 0;
    }

    .title {
      font-size: 33px;
      color: #fff;
      //width: 572px;
      //height: 55px;
      //margin: 0 auto;
      //background: url("../assets/main/titleContent.png") no-repeat;
      //background-size: 100% 100%;
      //margin-top: 15px;
    }

    .menu-container {
      width: 100%;
      padding: 0;
      margin: 0;
      position: fixed;
      bottom: 113px;
      left: 50%;
      transform: translateX(-50%);

      .menu-row {
        width: 1600px;
        margin: 20px auto;
        display: flex;
        justify-content: center;
        align-items: center;
        gap: 30px;
        flex-wrap: nowrap;
      }
    }
  }

  .center {
    display: none;
  }

  .side {
    position: static;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    width: 300px;
    height: 150px;
    background: url("../assets/images/home/指标.png") no-repeat;
    background-size: 300px 150px;
    padding: 0 20px;
    margin: 0;

    .logo {
      width: 96px;
      height: 96px;
      cursor: pointer;
      object-fit: contain;
    }

    .info {
      margin-left: 5%;
      background: transparent;
      box-shadow: none;
      height: auto;
      padding: 0;
      cursor: pointer;

      h3 {
        width: 100%;
        height: 30px;
        line-height: normal;
        font-family: PingFang SC;
        font-weight: 900;
        color: #ffffff;
        font-size: 22px;
        text-align: left;
        margin: 0;
        white-space: normal;
      }
    }
  }




}

.right-menu {
  float: right;
  height: 100%;
  line-height: 50px;

  &:focus {
    outline: none;
  }

  .right-menu-item {
    display: inline-block;
    padding: 0 8px;
    height: 100%;
    font-size: 18px;
    color: #fff;
    vertical-align: text-bottom;

    &.hover-effect {
      cursor: pointer;
      transition: background .3s;

      &:hover {
        background: rgba(0, 0, 0, .025)
      }
    }
  }

  .avatar-container {
    margin-right: 30px;

    .avatar-wrapper {
      // margin-top: 5px;
      position: relative;

      .user-avatar {
        cursor: pointer;
        width: 40px;
        height: 40px;
        border-radius: 10px;
      }

      .el-icon-caret-bottom {
        cursor: pointer;
        position: absolute;
        right: -15px;
        top: 15px;
        font-size: 12px;
      }
    }
  }


}
</style>
