<template>
  <div>
    <img class="help" src="./image/help.jpeg" alt="" v-show="booHelp">
  </div>
</template>

<script>
import { platform } from '../../utils/platform'

export default {
  name: 'index',
  props: {
    alipayForm: {
      type: String,
      default: ''
    },
    wxpayHref: {
      type: String,
      default: ''
    }
  },
  data () {
    return {
      booHelp: true
    }
  },
  async mounted () {
    await this.$nextTick()
    if (!platform.isWeixin && this.alipayForm) {
      const div = document.createElement('div')
      div.innerHTML = decodeURIComponent(this.alipayForm)
      document.body.appendChild(div)
      document.forms[0].submit()
      this.booHelp = false
    }
    if (!(platform.isAlipay && platform.isWeixin) && this.wxpayHref) {
      location.replace(decodeURIComponent(this.wxpayHref))
    }
  }
}
</script>

<style lang="scss" scoped>
div {
  width: 100%;
  height: 100vh;
  background: #fff;

  .help {
    display: block;
    height: 180px;
  }
}
</style>
