<template>
  <div class="validation">
    <div class="jump">
      <loading/>
      <p>跳转中，请稍后...</p>
    </div>
  </div>
</template>

<script>
  import Loading from '~components/common/loading/Loading.vue'
  export default {
    name: 'validation',
    props: ['tokenId'],
    components: {
      Loading
    },
    mounted () {
      this.$nextTick(() => {
        this.jump()
      })
    },
    methods: {
      jump () {
        this.$http.get(`/update/user/email`, {params: {token: this.$route.query.token ? this.$route.query.token : this.tokenId}})
          .then(response => {
            if (response.data.success) {
              this.$emit('stepEvent', 'last')
            } else {
              this.$emit('stepEvent', 'fail')
              return Promise.reject(response.data)
            }
          }).catch(err => {
            this.$message.error(err.errMsg)
          })
      }
    }
  }
</script>
<style lang="scss" scoped>
  .jump{
    p{
      position: fixed;
      left: 0;
      right:0;
      top: 54%;
      z-index: 1000;
      text-align: center;
      font-size: 14px;
      color:#333;
    }
  }
</style>
