<template>
  <div class="all">
    <div v-show="!appNavJx" class="noData flex-box-v flex-center-center">
      <div class="data-all">
        <img src="static/images/init.gif" class="appImg" />
        <div style="font-size: .31rem;">管理执行难，就用功道云</div>
      </div>
    </div>
    <div v-show="appNavJx" class="jxNav">
      <img :src="'static/images/' + navList[navNew].image + '.png'" />
      <van-button @click="navNew++" v-if="navNew < 1" type="primary" color="rgb(125 171 255)" block>下一步</van-button>
      <van-button @click="navPaths" v-else type="primary" color="rgb(125 171 255)" block>进入</van-button>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      userInfo: {}, // 绩效接口人员信息
      userData: {}, // 7.0系统接口人员信息
      newNav: this.plusStoGet('newNav'),
      appNavJx: false,
      navList: [{ image: 'newNav1' }, { image: 'newNav2' }],
      navNew: 0
    };
  },
  created() {
    this.$removeCache("addthePlan")
    this.$removeCache("actionplanDetails")
    this.$removeCache("actionplanList")
  },
  activated() {
    this.newNav = this.plusStoGet('newNav');
    this.appNavJx = false;
    this.setRouters();
  },
  methods: {
    setRouters() {
        if (this.newNav) {
          this.$router.replace({ name: 'navigation',query:{index:this.$route.query.index} });
        } else {
          this.appNavJx = true;
        }
    },
    navPaths() {
      this.plusStoSet('newNav', 'true', () => {
        this.$router.replace({ name: 'navigation',query:{index:this.$route.query.index} });
      });
    },
    plusStoGet(key) {
      if (window.plus) {
        return plus.storage.getItem(key);
      } else {
        return localStorage.getItem(key);
      }
    },
    plusStoSet(key, val, fun = function() {}) {
      if (window.plus) {
        plus.storage.setItem(key, val);
      } else {
        localStorage.setItem(key, val);
      }
      fun();
    }
  }
};
</script>

<style scoped="scoped" lang="less">
.all {
  background-color: #fff;
}
.appImg {
  width: 200px;
  height: 200px;
}
.noData {
  text-align: center;
  position: fixed;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
}
.data-all {
  margin-bottom: 10%;
  color: #595959;
}
.jxNav {
  width: 100%;
  height: 100%;
  img {
    width: 100%;
    margin-top: 50px;
  }
  button {
    width: 90%;
    margin: auto;
    border-radius: 5px;
  }
}
</style>
