<template>
  <div id="app" :class="isElder ? 'elder' : ''">
    <router-view @openSchool="openSchool" @setElder="setElder" />
    <van-popup style="background: transparent" get-container="body" v-model="showSchool" @close="closeSchool">
      <school-add @closeAdd="closeAdd"></school-add>
    </van-popup>
  </div>
</template>
<script>
import schoolAdd from '@/views/Travel/component/schoolAdd'
import err from '@/views/502'
import vConsole from 'vconsole'
export default {
  data() {
    return {
      isElder: false,
      showSchool: false,
    }
  },
  watch: {
    $route(to, from) {
      let centerNo = localStorage.getItem('centerNo')
      if (centerNo) {
        console.log('zheliban hasUserId》》》 ', to, from)
        this.$zwlogPvGlobal({ url: to.meta.pagePath, enterPageTime: new Date() })
        this.$zwlogPvGlobal({
          url: from.meta.pagePath,
          leavePageTime: new Date(),
        })
      } else {
        console.log('zheliban noUserId》》》 ', to, from)
      }
    },
  },
  mounted() {
    // new vConsole()
    ZWJSBridge.onReady(() => {
      ZWJSBridge.getUiStyle({})
        .then((result) => {
          console.log(result)
          if (result.uiStyle == 'elder') {
            this.isElder = true
            localStorage.setItem('isElder', 1)
          } else {
            localStorage.removeItem('isElder')
          }
        })
        //浙里办APP 6.11.0 版本以下版本标准模式兼容
        .catch((error) => {
          console.log(error)
        })
    })
    // 健康地址调用
    // this.yxAxios.get(`https://proxy.shunzhi.net/achieve/healthCheckSXYX`).then((res) => {
    //   // this.yxAxios.get(`https://ocp.sxsedu.net/szsh/health/checkSx`).then((res) => {
    //   console.log('健康地址:', JSON.stringify(res.data))
    //   const bodyElement = document.getElementsByTagName('body')[0]
    //   bodyElement.append(JSON.stringify(res.data))
    // })
  },
  methods: {
    setElder(e) {
      this.isElder = e
    },
    openSchool() {
      this.showSchool = true
    },
    closeSchool() {
      if (localStorage.getItem('schoolNames') == 'undefined' || !localStorage.getItem('schoolNames')) {
        // this.showSchool = true
      }
    },
    closeAdd() {
      this.showSchool = false
    },
  },
  components: {
    schoolAdd,
    err,
  },
}
</script>
<style lang="stylus">
html,body,#app {
  height:100%;
  overflow: auto;
  font-size: 0;
}
html {
  font-size: 10px;
}

body {
  max-width: 800px;
  margin: auto;
}



.van-tabs__line {
  background-color: #1CDA89;
}

::-webkit-scrollbar {
  display: none; /* Chrome Safari */
}

.oh {
  overflow: hidden;
}

.fl {
  float: left;
}

.fr {
  float: right;
}

.van-rate__icon {
  font-size: 1.2rem;
}

.releaseEvaluate {
  .van-rate__icon {
    font-size: 1.8rem;
  }
}

.evaluateDetail {
  .van-rate__icon {
    font-size: 1.8rem;
  }
}

.cardCont {
  td {
    border: 1px solid #72DAB1;
    text-align: center;
  }
}

.noMove {
  text-align: center;
  padding: 10px 0;
  clear: both;
  color: #ccc;
}

.baseDetail .cont img, .courseDetail .courseCont img {
  width: 100% !important;
}

.custom-image .van-empty__image {
  width: 90px;
  height: 90px;
}
p{
  margin:0;
}
</style>
