<template>
  <div class="app-container">
    <Sidebar class="noneText" @activeIndex="activeIndexFn" />
    <div class="content ">
      <div v-show="activeIndex == 1">
        <workbenches v-if="openWerk" />
      </div>
      <div v-show="activeIndex == 2">
        <hostsList v-if="openList" />
      </div>


    </div>
  </div>
</template>

<script setup>
import Sidebar from '../components/Sidebar.vue';
import { RouterLink, RouterView } from 'vue-router'
import hostsList from '@/views/hosts/hostsList.vue'
import workbenches from '@/views/hosts/workbenches.vue'
import { ref } from 'vue'
import { getUser } from '@/utils/storage'

let userType = ref(getUser().userType)
let activeIndex = ref(userType.value == 3 ? 1 : 2)
let openWerk = ref(userType.value == 3 ? true : false)
let openList = ref(userType.value == 3 ? false : true)
console.log("用户等级", getUser().userType)



function activeIndexFn(data) {
  activeIndex.value = data
  openWerk.value = true
  openList.value = true
  console.log(data)
}


</script>

<style>
body,
html {
  margin: 0;
  padding: 0;
  height: 100%;
}

.app-container {
  display: flex;
  width: 1600px;
  height: 900px;
  background-color: #338F6A;


}

.noneText {
  /* 页面无法选中 */
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

.sidebar {
  width: 200px;
  background-color: #338F6A;
  padding: 20px;
  /* box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1); */
}

.content {
  margin-left: 280px;
  width: 1304px;
  height: 868px;
  background: #FFFFFF;
  border-radius: 36px;
  margin-top: 16px;
}

.center-justify {
  display: flex;
  justify-content: space-around;
  align-items: center;
}
</style>