<template>
  <div id="app">
    <router-view />
  </div>
</template>

<script>
import moment from 'moment'
export default {
  name: 'app',
  components: {
  },
  data() {
    return {
    }
  },
  computed:{
  },
  created() {
  },
  mounted() {
    //判断是否在系统更新期间
    var time = new Date(this.$c.updateTime).getTime()
    var time2 = new Date().getTime()
    if(time2 < time && !localStorage.canShow){
        this.$router.push({path: '/'})
        return false
    }
    //特殊日期设置主题
    var today = moment().format('MM-DD')
    var index = this.$c.specialDays.indexOf(today)
    if(index!=-1){
      document.body.style.filter = 'grayscale(100%)'
    }

    //切换主题
    var theme = localStorage.getItem('theme')
    if (theme) {
      var dom = document.getElementsByTagName('html')[0]
      dom.setAttribute('theme-type',theme)
    }
  },
  methods: {
    
  },
    //注册局部组件指令
    directives: {
    drag: function (el,data,vnode) {
      let dragBox = el; //获取当前元素
      // 当前页面可视区的高
      let clientHeight = document.documentElement.clientHeight 
      dragBox.onmousedown = e => {
        //算出鼠标相对元素的位置
        let disX = e.clientX - dragBox.offsetLeft;
        let disY = dragBox.offsetTop - e.clientY;
        // let disY = e.clientY - dragBox.offsetTop;
        document.onmousemove = e => {
          if ( e.stopPropagation ) {
            e.stopPropagation()
          }
          if ( e.preventDefault ) {
            e.preventDefault()
          }
          //用鼠标的位置减去鼠标相对元素的位置，得到元素的位置
          let left = disX + 100 +'px';
          let top = -(clientHeight - e.clientY);
          if (top > -50) {
            top=-50
          } else if (top < -clientHeight) {
            top = -clientHeight
          }
          // let left = e.clientX - disX;
          // let top = e.clientY - disY;
          //移动当前元素
          dragBox.style.left = left + "px";
          dragBox.style.top = top + "px";
        };
        document.onmouseup = e2 => {
          //鼠标弹起来的时候不再移动
          document.onmousemove = null;
          //预防鼠标弹起来后还会循环（即预防鼠标放上去的时候还会移动）  
          document.onmouseup = null;
          if ( e.clientX == e2.clientX && e.clientY == e2.clientY ) {
            vnode.context.feedback()//想要添加的元素的点击事件
          }
        };
      };
    }
  }
}
</script>

<style lang="scss">
//driver.js
.driver-fix-stacking .header {
  position:relative;
}

.height_100{
  height: 100%;
}


.showPiZhu{
  position: absolute;
  background: rgb(255 249 199);
  left:0;
  width:200px;
  box-shadow: 5px 5px 5px rgb(227, 227, 75);
  padding: 5px;
  border-radius: 5px;
}
.pizhuLightHeigh{
  position: relative;
  background: #409EFF !important;
}

.greenColor{
  background: #409EFF !important;
}

   .jinzhi{
    cursor: not-allowed;
    pointer-events:none;
  }
  .el-dropdown .el-button-group .el-button--primary:first-child{
    padding: 0;
    p{
      margin: 0;
      min-width: 50px;
      line-height: 30px;
      height: 30px;
      padding: 0 10px;
    }
  }
  </style>
<style lang="less">
.el-button--primary{
  background: var(--bg) !important;
  border-color: var(--bg) !important;
  color: var(--color);
}
.el-table{
  // border: 1px solid rgba(124,124,124) !important;
  height: 100%;
  width: 100%;
  padding-bottom:10px;
  .el-table__body-wrapper{
    max-height: calc(100% - 50px);
    overflow-y: auto;
  }
}
.el-table tr td{
  border-bottom: 1px solid rgba(124,124,124) !important;
}
.el-table tr td:first-child{
  border-right: 1px solid rgba(124,124,124) !important;
  border-left: 1px solid rgba(124,124,124) !important;
}
.el-table tr td:last-child{
  border-right: 1px solid rgba(124,124,124) !important;
  border-left: 1px solid rgba(124,124,124) !important;
}
.cursor_pointer{
  cursor:pointer
}
textarea {
  font-family: 微软雅黑;
}
html, body, #app {
  width: 100%;
  height: 100%;
  padding: 0;
  margin: 0;
  background: #f4f4f4;
}
.margin-left_0 {
  margin-left: 0 !important;
}
.margin-top_10 {
  margin-top: 10px !important;
}
.margin-left_10 {
  margin-left: 10px !important;
}
.padding-left_10 {
  padding-left: 10px;
}
.padding-right_10 {
  padding-right: 10px;
}
.margin-left_20 {
  margin-left: 20px;
}
.container-white-no-padding {
  background: #fff !important;
  padding: 0 !important;
}
.container-common-main {
  background: #fff;
  padding: 5px 20px !important;
  margin-top: 20px !important;
}
.footer-common {
  height: 70px !important;
  text-align: right;
}
.margin-right_20 {
  margin-right: 20px !important;
}
.width_100 {
  width: 100% !important;
}
.margin-bottom_10 {
  margin-bottom: 10px;
}
.float_right {
  float: right
}
.float_left {
  float: left;
}
.color-red {
  color: red !important;
}
.color-black {
  color: black;
}
.padding_0_5 {
  padding: 0 5px;
}
.color-primary {
  color: #409eff;
}
.margin-right_10 {
  margin-right: 10px !important;
}
.text-align_center {
  text-align: center !important;
}
.position_relative {
  position: relative;
}
.no-body-padding-dialog {
  .el-dialog__body {
    padding: 0 !important;
  }
}
.custom-table-header > th {
  word-break: break-word;
  background: var(--bg) !important;
  color: var(--color);
  height: 40px;
  font-size: 13px;
}
.el-header {
  padding: 13px 0 !important;
  .el-form {
    .el-form-item {
      margin-bottom: 0 !important
    }
  }
}
.custom-drawer-form {
  .el-drawer__header {
    padding: 0 20px !important;
    margin: 15px 0 !important;
    span {
      font-size: 18px;
      color: #303133;
    }
  }
  .el-drawer__body {
    border-top: 1px solid #e6e6e6;
  }
}
.upload-file {
  width: 100% !important;
  .el-upload, .el-upload-dragger {
    width: 100% !important;
  }
  .el-upload-dragger .el-icon-refresh {
    font-size: 67px;
    color: #C0C4CC;
    margin: 40px 0 16px;
    line-height: 50px;
  }
}
.scrollable {-webkit-overflow-scrolling: touch;}
::-webkit-scrollbar {width: 5px;height: 5px;}
::-webkit-scrollbar-thumb {background-color: rgba(50, 50, 50, 0.3);}
::-webkit-scrollbar-thumb:hover {background-color: rgba(50, 50, 50, 0.6);}
::-webkit-scrollbar-track {background-color: rgba(50, 50, 50, 0.1);}
::-webkit-scrollbar-track:hover {background-color: rgba(50, 50, 50, 0.2);}
.el-aside {border-right: 1px solid #e6e6e6;background: #fff;}
.el-header {background: #fff;border-bottom: 1px solid #e6e6e6;padding:13px 15px;display: flex;justify-content: space-between;align-items: center;}
.el-header .left-panel {display: flex;align-items: center;}
.el-header .right-panel {display: flex;align-items: center;}
.el-header .right-panel > * + * {margin-left:10px;}
.el-footer {background: #fff;border-top: 1px solid #e6e6e6;padding:13px 15px !important;}
.el-main {padding:15px;}
.el-main.nopadding {padding:0;background: #fff;}
// .el-main {flex-basis: 0}
.el-container {height: 100%;}
</style>

