<template>
  <div class="body">
    <div class="db_bg">
      <div class="db_header">
        <div class="db_header_title">
        </div>
        <div class="db_check">
          <div :class="{ active: type == 1 }" @click="setType(1)">用户维度看板</div>
          <div :class="{ active: type == 2 }" @click="setType(2)">应用维度看板</div>
          <div :class="{ active: type == 3 }" @click="setType(3)">组织维度看板</div>
          <div :class="{ active: type == 4 }" @click="setType(4)">排行汇总</div>
        </div>
      </div>
      <div class="db_body">
        <UserDashboard v-if="type === 1" />
        <AppDashboard v-if="type === 2" />
        <OrgDashboard v-if="type === 3" />
        <RankingSummary v-if="type === 4" />
      </div>
    </div>
  </div>
</template>

<script>
import UserDashboard from '../dashboard/UserDashboard.vue'
import AppDashboard from '../dashboard/AppDashboard.vue'
import OrgDashboard from '../dashboard/OrgDashboard.vue'
import RankingSummary from '../dashboard/RankingSummary.vue'

export default {
  components: {
    UserDashboard,
    AppDashboard,
    OrgDashboard,
    RankingSummary
  },
  data() {
    return {
      type: 1,
      oid: this.$route.query.oid,
      org: this.$route.query.org,
      scourseLength: 0,
    };
  },
  methods: {
    setType(type) {
      this.type = type;
    },
    getData() {
    //   this.isLoading = true;
    //   let params = [
    //     {
    //       oid: this.oid,
    //       org: this.org,
    //     },
    //   ];
    //   this.ajax
    //     .post(this.$store.state.api + "getCourseLength", params)
    //     .then((res) => {
    //       this.isLoading = false;

    //       this.scourseLength = res.data[0][0].count;
    //       this.$forceUpdate();
    //     })
    //     .catch((err) => {
    //       this.isLoading = false;
    //       console.error(err);
    //     });
    },
  },
  mounted() {
    this.getData();
  },
};
</script>

<style scoped>
.body {
  height: 100%;
  width: 100%;
  min-width: 1550px;
  min-height: 750px;
  background: #e7f3fe;
  display: flex;
  align-items: center;
  justify-content: center;
}

.db_bg {
  width: calc(100% - 30px);
  height: calc(100% - 30px);
  /* padding: 10px; */
  border-radius: 8px;
  box-sizing: border-box;
  border: 2px solid #3681FC3D;
  box-shadow: 20px 20px 80px 0px #3681FC3D inset;
}

.db_header {
  width: 100%;
  height: 50px;
  display: flex;
  justify-content: center;
  position: relative;
  /* background: #fff; */
  align-items: center;
}

.logoTop {
  position: absolute;
  left: 30px;
}

.db_header_title {
  background-image: url("../../assets/data_title.png");
  width: 290px;
  height: 100%;
  background-size: 100% 100%;
  position: absolute;
  left: 0;
  /* font-weight: bold;
  font-size: 20px; */
}

.db_header:after {
  content: "";
    position: absolute;
    width: calc(100% - 300px);
    height: 2px;
    bottom: 0.5px;
    left: 264px;
    z-index: 1;
    background: linear-gradient(90deg, #9ac1fd 0%, rgba(134, 179, 253, 0) 91.13%);
}

.db_check {
  display: flex;
  align-items: center;
  position: absolute;
  left: 320px;
  height: calc(100% - 12px);
  top: 0;
}

.db_check>div {
  padding: 10px 20px;
  cursor: pointer;
  font-weight: 700;
  font-style: italic;
  color: #00000099;
}

.db_check>div:hover {
  /* background: #edf4ff; */
  background: linear-gradient(90deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.6) 44.48%, rgba(255, 255, 255, 0) 99.69%);
  color: #000000;
}

.db_check>div.active {
  /* font-weight: 700; */
  /* color: #297bff; */
  color: #000000;
  background: #edf4ff;
  /* border-top: 2px solid #297bff; */
  border-bottom: 3px solid #3681FC;
  box-sizing: border-box;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.6) 44.48%, rgba(255, 255, 255, 0) 99.69%);
}

/* .db_check > div + div {
  margin-left: 30px;
} */

.db_body {
  height: calc(100% - 50px);
  width: 100%;
  overflow: auto;
  /* background: rgb(231, 242, 252); */
}
</style>