<template>
  <div class="container bgcolor">
    <keep-alive>
      <router-view :key="$route.fullPath"/>
    </keep-alive>
  </div>
</template>
<script>
export default {
  created() {
    if(this.$route.query.token!=undefined){
      localStorage.setItem("loginName",this.$route.query.token)
    }
   if(process.env.NODE_ENV!="development"){
     var ua= window.navigator.userAgent.toLowerCase();
     if( (ua.match(/MicroMessenger/i) == 'micromessenger') && (ua.match(/wxwork/i) == 'wxwork') ){

     }else{
       if(localStorage.getItem("loginName")=="lihaoyang.sm"||localStorage.getItem("loginName")=="zhangjunyang.sm"||localStorage.getItem("loginName")=="wukang"){

       }else{
         this.$router.push("/err")
       }
     }
   }
  },
  watch: {
    $route(to, from) {
      if(this.$route.query.token!=undefined){
        localStorage.setItem("loginName",this.$route.query.token)
      }
      if(process.env.NODE_ENV!="development"){
        var ua= window.navigator.userAgent.toLowerCase();
        if( (ua.match(/MicroMessenger/i) == 'micromessenger') && (ua.match(/wxwork/i) == 'wxwork') ){

        }else{
          if(localStorage.getItem("loginName")=="lihaoyang.sm"||localStorage.getItem("loginName")=="zhangjunyang.sm"){

          }else{
            this.$router.push("/err")
          }
        }
      }
    }
  }
}
</script>

