<template>
  <div class="body-box">
    <SidevarItem></SidevarItem>
    <div class="content">
      <Navbar></Navbar>
      <router-view></router-view>
    </div>
  </div>
</template>

<script setup>
import { ref, reactive, onBeforeMount, onMounted, watch } from "vue";
import Navbar from "./sidebar/Navbar.vue";
import SidevarItem from "./sidebar/SidevarItem.vue";
import { useStore } from "vuex";
import axios from "axios";
import { useRouter } from "vue-router";
const store = useStore();
const router = useRouter();
const api = ref("");
watch(
  () => router.currentRoute.value.fullPath,
  (newValue, oldValue) => {
    console.log(newValue);
    if (newValue == "/schoolBus/statement") {
      store.commit("indexUp", 1);
      sessionStorage.setItem("sidevarItem", 1);
    }
    if (newValue == "/schoolBus/staff") {
      store.commit("indexUp", 2);
      sessionStorage.setItem("sidevarItem", 2);
    }
    if (newValue == "/schoolBus/account") {
      store.commit("indexUp", 3);
      sessionStorage.setItem("sidevarItem", 3);
    }
    if (newValue == "/schoolBus/bus") {
      store.commit("indexUp", 4);
      sessionStorage.setItem("sidevarItem", 4);
    }
    if (newValue == "/schoolBus/classes") {
      store.commit("indexUp", 6);
      sessionStorage.setItem("sidevarItem", 6);
    }
    if (newValue == "/schoolBus/buspath") {
      store.commit("indexUp", 5);
      sessionStorage.setItem("sidevarItem", 5);
    }
    if (newValue == "/schoolBus/system") {
      store.commit("indexUp", 8);
      sessionStorage.setItem("sidevarItem", 8);
    }
    if (newValue == "/schoolBus/blacklist") {
      store.commit("indexUp", 7);
      sessionStorage.setItem("sidevarItem", 7);
    }
    if (newValue == "/schoolBus/busquery") {
      store.commit("indexUp", 9);
      sessionStorage.setItem("sidevarItem", 9);
    }
    if (newValue == "/schoolBus/log") {
      store.commit("indexUp", 10);
      sessionStorage.setItem("sidevarItem", 10);
    }
    if (newValue == "/schoolBus/report") {
      store.commit("indexUp", 11);
      sessionStorage.setItem("sidevarItem", 11);
    }
    if (newValue == "/schoolBus/news") {
      store.commit("indexUp", 0);
      sessionStorage.setItem("sidevarItem", 0);
    }
  }
);
const tableData = reactive({
  list: [],
});
onBeforeMount(async () => {
  api.value = store.state.user.api;

  // {
  //   let res = await axios({
  //     method: "post",
  //     url: api.value + "/carBook/cnqueryHb.action",
  //     headers: {
  //       token: sessionStorage.getItem("token"),
  //     },
  //   });
  //   console.log(res, "系统配置");
  //   sessionStorage.setItem("waiting", JSON.stringify(res.data.data));
  // }
});
</script>

<style scoped lang="scss">
.body-box {
  display: flex;
  .content {
    // min-width: 1740px;
    max-width: calc(100vw - 81px);
    min-width: calc(100vw - 200px);
    width: 100%;
    height: calc(100vh);
    background-color: rgba(238, 238, 238, 1);
    :deep(.el-dialog__header .el-dialog__headerbtn) {
      outline: none;
    }
  }
}
</style>
<style lang="scss">
.is-message-box {
  .el-message-box__header {
    .el-message-box__headerbtn {
      outline: none;
    }
  }
  .el-message-box__btns {
    .el-button--primary {
      background-color: rgba(61, 81, 232, 1);
      border: 0.5px solid rgba(61, 81, 232, 1);
    }
    .el-button--primary:hover {
      background-color: rgb(119, 133, 239);
      border: 0.5px solid rgb(119, 133, 239);
    }
  }
}
.el-dialog__body {
  .el-input {
    .el-input__suffix-inner {
      color: rgba(61, 81, 232, 1);
    }
  }
}
.pw {
  .el-dialog__body {
    .el-form {
      .el-form-item {
        .queding {
          background-color: rgba(61, 81, 232, 1);
          border: 0.5px solid rgba(61, 81, 232, 1);
        }
        .queding:hover {
          background-color: rgb(119, 133, 239);
          border: 0.5px solid rgb(119, 133, 239);
        }
      }
    }
  }
}
#notification_1 {
  .el-notification__group {
    .el-notification__title {
      color: red;
    }
  }
}
</style>
