<template>
  <view>
    <view class="main">
      <view v-if="params" class="content">
        <verify
          :imgSize="{ width: '330px', height: '155px' }"
          :mode="'fixed'"
          :params="params"
          captchaType="blockPuzzle"
          @success="success"
        ></verify>
      </view>
    </view>
  </view>
</template>

<script setup>
  import { onLoad } from '@dcloudio/uni-app'
  import { getCurrentInstance, ref } from 'vue'
  import verify from '@/components/verify/verify.vue'

  const instance = getCurrentInstance().proxy
  const eventChannel = instance.getOpenerEventChannel()

  const params = ref(null)

  onLoad(async options => {
    params.value = options
  })

  const success = result => {
    eventChannel.emit('successEvent', result || {})
    uni.navigateBack()
  }
</script>

<style lang="scss">
  page {
    background: $uni-bg-color;
  }
</style>

<style lang="scss" scoped>
  .main {
    margin-top: 32rpx;
    text-align: center;

    .content {
      display: inline-block;
    }
  }
</style>
