<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/driverAudit") {
      store.commit("indexUp", 17);
      sessionStorage.setItem("sidevarItem", 17);
    }
    if (newValue == "/schoolBus/driverManagement") {
      store.commit("indexUp", 18);
      sessionStorage.setItem("sidevarItem", 18);
    }
    if (newValue == "/schoolBus/driverDeposit") {
      store.commit("indexUp", 19);
      sessionStorage.setItem("sidevarItem", 19);
    }
    if (newValue == "/schoolBus/driverPath") {
      store.commit("indexUp", 20);
      sessionStorage.setItem("sidevarItem", 20);
    }
    if (newValue == "/schoolBus/driverOrder") {
      store.commit("indexUp", 21);
      sessionStorage.setItem("sidevarItem", 21);
    }
    if (newValue == "/schoolBus/driverRule") {
      store.commit("indexUp", 22);
      sessionStorage.setItem("sidevarItem", 22);
    }

    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 - 72px);
    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;
    }
  }
}

*::-webkit-scrollbar-track {
  background-color: #fff;
}

*::-webkit-scrollbar {
  background-color: #57b2ff;
  height: 0;
  width: 0;
}

*::-webkit-scrollbar-thumb {
  background: #57b2ff;
  border-radius: 4px;
  height: 0;
  width: 0;
}
</style>
