<template>
  <div>
    <el-row :gutter="20">
      <el-col :span="12" v-for="(item,index) in menulist" :key="index">
        <el-card shadow="hover" class="" style="">
          <div class="grid-content bg-purple">
            <div class="dpzsiimg img1" @click="topage(item.path)">
              <img
                src="../assets/img/dpzs2.png"
                title="大屏展示"
                alt=""
                class="dzimg1"
              />
              <img
                src="../assets/img/dpzs3.png"
                title="大屏展示"
                alt=""
                class="dzimg2"
              />
            </div>
            <div class="dpzsiimg img2" @click="topage(item.path1)">
              <img
                src="../assets/img/dpzs.png"
                alt=""
                title="数据列表"
                class="dzimg1"
              />
              <img
                src="../assets/img/dpzs1.png"
                alt=""
                title="数据列表"
                class="dzimg2"
              />
            </div>
            <img :src="item.src" alt="" class="bgimg" />
          </div>
        </el-card>
        <div class="sgtitle">{{ item.title }}</div>
      </el-col>
    </el-row>
  </div>
</template>

<script>
import { mapState } from "vuex";
import { httpGet } from "../api/index";
export default {
  name: "homepage",
  data() {
    return {
      menulist: [
        {
          path: "/Datavisualization",
          path1: "/dashboard",
          src: require("../assets/img/zhihuixy.png"),
          title: "宿管系统",
        },
        {
          path: "/studentsRoom",
          path1: "/studentsRoom",
          src: require("../assets/img/zhihuixy.png"),
          title: "学生教室",
        },
        {
          path: "/books",
          path1: "/books",
          src: require("../assets/img/zhihuixy.png"),
          title: "图书馆",
        },
        {
          path: "/academicBuilding",
          path1: "/academicBuilding",
          src: require("../assets/img/zhihuixy.png"),
          title: "教学楼",
        },
      ],
    };
  },
  computed: {
    ...mapState({
      index: (state) => state,
    }),
  },
  created() {
      var tenantId=JSON.parse(localStorage.getItem('tenantId'))
      if(tenantId==400){
        localStorage.setItem('tenantId',300)
      }
      this.getUserID()
  },
  methods: {
    // 获取角色id
    getUserID(){
      var data={
        pageNum:1,
        pageSize:10
      }
      httpGet(data, this.$api.getRoleList).then((res) => {

      });
    },
    topage(e) {
      this.$router.push({
        path: e,
      });
    },
  },
};
</script>

<style scoped>
.el-row {
  box-sizing: border-box;
}
.el-col {
  text-align: center;
  cursor: pointer;
  margin-bottom: 20px;
}
.grid-content {
  position: relative;
  text-align: center;
}
.grid-content::after {
  content: " ";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  z-index: 99;
  opacity: 0;
}
.grid-content:hover::after {
  opacity: 1;
}
.bgimg {
  display: block;
  width: 100%;
}
.grid-content:hover .dpzsiimg {
  display: block;
}
.sgtitle {
  margin-top: 10px;
}
.dpzsiimg {
  position: absolute;
  top: 50%;
  transform: translateY(-50%) translateX(-50%);
  z-index: 999;
  display: none;
}
.dpzsiimg img {
  width: 60px;
  display: block;
}
.img1 {
  left: 40%;
}
.img2 {
  left: 60%;
}
.dpzsiimg .dzimg2 {
  display: none;
}
.img1:hover .dzimg2,
.img2:hover .dzimg2 {
  display: block;
}
.img1:hover .dzimg1,
.img2:hover .dzimg1 {
  display: none;
}
</style>
