<template>
  <child-view>
    <div class="mt-2">
      <user-initiate :showTitle="false" :formContent="form" />
    </div>
  </child-view>
</template>

<script lang="ts">
import childView from '@/layouts/childView.vue'
import Vue from 'vue'
import UserInitiate from '../initiate_comp/user_initiate.vue'
import { service } from '@/service/index'
export default Vue.extend({
  components: { childView, UserInitiate },
  data() {
    return {
      form: {}
    }
  },
  methods: {
    getDetails() {
      service.voteDetails({
        execer: 'user.p.szhtest.rankvote',
        funcName: 'GetRankVoteInfo',
        payload: {
          voteID: this.$route.query.voteID as string
        }
      }).then(res => {
        this.form = res.data.result
      })
    }
  },
  created() {
    this.getDetails()
  },
  watch: {
    $route(n, o) {
      if (n.query.voteID !== o.query.voteID) {
        this.getDetails()
      }
    }
  }
})
</script>