<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: "342601199503121817",
          // idCardNo: "321111198502254219",
          // idCardNo: "321183199610151344",
          // idCardNo: "DDfCYHcrBMRhvRt4AQKt+WfGq6l2uT5G",
          // mobileNo: 13776475181,
          // userId: 3182743,
          // userId: 15237836350,
          // name: "lXi375Ch1K4Q636",
          // realName: "殷铭",
          // idCardNo: "321102199408261015"
        };
        this.verify(JSON.stringify(userInfo));
      }
      // let userInfo = {
      //   mobileNo: 13900000000,
      //   userId: 373931,
      //   name: "124晚6565",F
      //   realName: "梁中全",
      //   idCardNo: "DDfCYHcrBMRhvRt4AQKt+WfGq6l2uT5G",
      // };
      // let userInfo = {
      //   mobileNo: 13900000000,
      //   userId: 37393,
      //   name: "124晚6565",
      //   realName: "孙辉",
      //   idCardNo: "DDfCYHcrBMRhvRt4AQKt+WfGq6l2uT5G",
      // };
    },
  },
  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>
