<template>
  <div id="app">
    <transition
      name="fade-transform"
      mode="out-in"
    >
      <router-view />
    </transition>
  </div>
</template>

<script>
export default {
  methods: {
    verify(res) {
      let userInfo = JSON.parse(res);
      if (!userInfo.userId) {
        this.$dialog
          .confirm({
            message: "请先登录！",
            showCancelButton: false,
          })
          .then(() => {
            this.back();
          });
        return;
      }
      sessionStorage.setItem("ZJCD-UserInfo", res);
      this.userInfo = userInfo;
    },
    init() {
      if (process.env.NODE_ENV === "development") {
        let userInfo = {
          mobileNo: 13900000000,
          userId: 37393,
          name: "124晚6565",
          realName: "张媛媛",
          idCardNo: "32068219980926002X",
        };
        this.verify(JSON.stringify(userInfo));
      }
    },
  },
  created() {
    // 测试模拟人员信息
    // this.init();
  },
};
</script>
<style lang="stylus">
#app {
  background: #F3F6F9;
  height: 100vh;
  overflow: hidden;

  .fade-transform-leave-active, .fade-transform-enter-active {
    transition: all 0.5s;
  }

  .fade-transform-enter {
    opacity: 0;
    transform: translateX(-50px);
  }

  .fade-transform-leave-to {
    opacity: 0;
    transform: translateX(50px);
  }
}
</style>
