<template>
  <div class="main-content market">
    <DetailHead result="双随机一公开" style="border-top:0;border-left:0;border-right:0" />
    <div ref="content">
      <!-- <iframe v-if="url != 'http://172.22.80.156:8085/aicods_gz/doLoginRisk'" id="randomFrame" frameborder="0" src="http://192.168.100.28:8080/doLoginRisk?userName=13922439605&deptName=广州市市场监督管理局&riskKey=risk" width="100%" height="800" /> -->
    </div>
  </div>
</template>

<script>
import DetailHead from '@/components/DetailHead'
export default {
  components: {
    DetailHead
  },
  data() {
    return {
      url: '/doLoginRisk',
      prevUrl: `${process.env.VUE_APP_RANDOM_URL}`,
      user: JSON.parse(sessionStorage.getItem('user'))
    }
  },
  created() {
    this.url = this.prevUrl + this.url
    // console.log(this.url)
    // this.url += `?userName=${this.user.username}&deptName=${this.user.orgName}&riskKey=risk`
    this.formOpen()
    // this.formOpen
  },
  methods: {
    formOpen() {
      const form = document.createElement('form')
      form.action = this.url
      form.target = '_blank'
      form.method = 'post'

      let input = document.createElement('input')
      input.setAttribute('userName', 'userName')
      input.setAttribute('value', this.user.username)
      input.name = 'userName'
      input.value = this.user.username
      form.appendChild(input)

      input = document.createElement('input')
      input.setAttribute('userName', 'deptName')
      input.setAttribute('value', this.user.orgName)
      input.name = 'deptName'
      input.value = this.user.orgName
      form.appendChild(input)

      input = document.createElement('input')
      input.setAttribute('userName', 'riskKey')
      input.setAttribute('value', 'risk')
      input.name = 'riskKey'
      input.value = 'risk'
      form.appendChild(input)
      document.body.append(form)
      form.submit()
      form.remove()
    }
  }
}
</script>

<style>

</style>
