<template>
  <div id="app">
    <HeaderBanner></HeaderBanner>
    <Navigation :navTitle1='navTitle1' :navTitle2='navTitle2'></Navigation>
    <div class="app_content">
      <div class="router">
        <LoginInfo></LoginInfo>
        <Routerbanner
          @change_nav="changeNav"
          :isManufacturer="isManufacturer"
        />
      </div>
      <div class="router_view">
        <router-view :isManufacturer="isManufacturer"></router-view>
      </div>
    </div>
    <FooterBanner/>
  </div>
</template>

<script>
import HeaderBanner from "./components/HeaderBanner";
import Navigation from "./components/Navigation";
import LoginInfo from "./components/LoginInfo";
import Routerbanner from "./components/RouterBanner";
import FooterBanner from "./components/Footerbanner";
export default {
  components: {
    HeaderBanner,
    Navigation,
    LoginInfo,
    Routerbanner,
    FooterBanner
  },
  data() {
    return {
      navTitle1: ' > 数据管理',
      navTitle2: '',
      isManufacturer: 'manufacturer', // distributor 经销商 manufacturer 厂商
    }
  },
  methods: {
    // 点击路由，导航栏对应变化
    changeNav: function(navTitle1, navTitle2){
      this.navTitle1 = ' > ' + navTitle1;
      if (navTitle2) {
        this.navTitle2 = ' > ' + navTitle2;
      } else {
        this.navTitle2 = '';
      }
    },
    // 测试接口
    getData() {
      // 正常token
      // dXNlcklkPTEyMyZhY2NvdW50PWRmc2FmYWVyJmZyb209c2l3ZWkmdGltZXN0YW1wPTE2MTY4NDYxMzkmc2lnbj1mOWUwNzJhZGUwODE4YjhhNzMzN2I0ZTMzMzU2OWJjOA==
      let query = this.$route.query || {};
      let token = query.token || '';
      console.log('token:', token);
      if(!token) {
        // alert('token值为空');
        return
      }
      this.$http({
        method: 'post',
        url: '/auth/checkSign',
        data: {
          token: token
        }
      }).then((res) => {
        console.log(res);
        if(res.status === 200){
          if(res.data.code === 200) {
            console.log(res.data, '200');
          }else {
            let message = res.data.message;
            console.log('message', message);
            alert(message);
          }
        }
      }).catch((err) => {
        alert('无法校验的字符串');
        console.log(err);
      })
    }
  },
  mounted() {
  },
  created() {
    this.getData();
  }
};
</script>

<style lang="less">
* {
  padding: 0;
  margin: 0;
  list-style: none;
  color: #333;
  font-size: 12px;
}
button{
  border: none;
  background-color: #0056A0;
  height: 30px;
  width: 58px;
  color: #fff;
  font-weight: 400px;
  font-family: Arial;
  margin-left: 18px;
  font-size: 14px;
  &:hover{
    cursor: pointer;
  }
}
.current_button{
  background-color: #0056A0;
  height: 30px;
  width: 58px;
  line-height: 30px;
  text-align: center;
  color: #fff;
  font-weight: 400px;
  font-family: Arial;
  margin-left: 18px;
  font-size: 14px;
  &:hover{
    cursor: pointer;
  }
}
#app {
  background-color: #eeeeee;
  height: 100%;
  min-height: 100vh;
  .app_content {
    width: 1190px;
    margin: 0 auto;
    font-size: 12px;
    color: #333;
    font-family: "微软雅黑";
    display: flex;
    justify-content: space-between;
    .router{
      width: 150px;
      height: 100%;
      background-color: #d4d4d4;
      height: auto;
      min-height: 50vh;
    }
    .router_view{
      width: 1030px;
    }
  }
}
@media screen and (max-width: 1190px) {
  #app{
    width: 1190px;
  }
}
</style>
