Newer
Older
VueSharedPrinting / src / views / complete.vue
<template>
  <!--打印完成-->
  <div class="complete">
    <div :class="['box', 'flex-center', { 'vertical-box': isVertical }]">
      <div :class="['left', { 'vertical-margin-right': isVertical }]">
        <img src="../assets/complete.png" alt="" />
        <div>打印完成</div>
        <div>感谢您使用天章自助打印服务</div>
      </div>
      <div class="right">
        <div class="title flex-center">温馨提示</div>
        <div class="content">请从出纸口取走您的文件,并带齐您的资料和所有随身物品。</div>
        <div class="tip" v-show="false">
          <div>本次打印您将获得:</div>
          <div class="flex-center">
            <img src="../assets/points.png" alt="" />
            <span v-show="jsNum>0">{{ jsNum }}积分</span>
          </div>
        </div>
        <div class="btn flex-center" @click="skip('device')">回到首页</div>
      </div>
    </div>
<!--    <audio ref="audio" class="aud">-->
<!--      <source src="../assets/audio/Thank4UseWelComeback.mp3" />-->
<!--    </audio>-->
  </div>
</template>

<script>
import {getPointByCode} from "@/api/resultApi";

export default {
  name: 'complete',
  data() {
    return {
      num: 0,
      isVertical: false,
      jsNum: 0
    }
  },
  created() {
    this.isVertical = this.cite.isVertical
  },
  mounted() {
    // this.play()
    this.num = 0
    this.load()
    this.hqjf()
  },
  destroyed() {
    // 销毁监听
    // clearTimeout()
    this.num = -1
  },
  methods: {
    hqjf() {
      let code = this.cite.jfCode
      if(code) {
        getPointByCode({code: code}).then(res => {
          if (res) {
            this.jsNum = res
          }
        })
      }else{
        this.jsNum = 0
      }

    },
    skip(href) {
      this.cite.fileNum = 0
      this.$router.push({
        name: href
      })
    },
    load() {
      let n = this.num
      if (n == -1) {
        return
      } else if (n < 10) {
        this.num = n + 1
        setTimeout(() => {
          this.load()
        }, 1000)
      } else {
        // this.quit()
        // console.log('我触发的?complete',n)
        this.cite.fileNum = 0
        this.$router.push({
          name: 'device'
        })
      }
    },
    play() {
      this.$refs.audio.play()
    }
  }
}
</script>

<style scoped lang="less">
.box {
  width: 114.06rem;
  height: 49.25rem;
  background: #ffffff;
  box-shadow: 0rem 0.31rem 0.63rem 0.06rem rgba(0, 0, 0, 0.14);
  border-radius: 1.63rem;
  margin: 3.75rem auto 0;
  font-size: 1.88rem;
  font-weight: bold;
  color: #323232;
  line-height: 2rem;
  .left {
    margin-right: 14.94rem;
    img {
      width: 26.88rem;
      margin-bottom: 5.06rem;
    }
  }
  .right {
    width: 42.13rem;
    text-align: left;
    .title {
      font-size: 2.88rem;
      font-weight: bold;
      color: #d41212;
      line-height: 4.06rem;
    }
    .content {
      font-size: 2.25rem;
      font-weight: bold;
      color: #323232;
      line-height: 3rem;
      margin: 2.94rem auto 6.25rem;
    }
    .tip {
      img {
        width: 7.38rem;
        margin-right: 1.13rem;
      }
      span {
        font-size: 2.13rem;
        font-weight: bold;
        color: #323232;
        line-height: 3rem;
      }
    }
  }
  .btn {
    width: 100%;
    height: 5.5rem;
    background: linear-gradient(132deg, #52a39d 0%, #a1c553 50%, #81d012 100%);
    border-radius: 1.25rem;
    font-size: 1.88rem;
    font-weight: 400;
    color: #ffffff;
    line-height: 2.63rem;
    cursor: pointer;
  }
}
.vertical-box {
  height: 90rem !important;
  width: 90%;
  justify-content: space-around;
  flex-direction: column;
}
.vertical-margin-right {
  margin-right: 0 !important;
}
</style>