<template>
  <div id="app" v-cloak v-loading="state.loading">
    <template v-if="!state.error">
      <control-display :companyArr="companyArr" :hasPlatformDimension="hasPlatformDimension"  />
    </template>

    <template v-else>
      <unusual-state :message="state.message" />
    </template>
  </div>
</template>
<script>
import asyncRequest from "@/api/index"
import { getParameterByName } from "../utils/auth"
import UnusualState from "@/components/unusual/index.vue"

export default {
  name:'report',
  components:{ UnusualState },
  data() {
    return {
      companyArr:[],
      hasPlatformDimension: false,
      state:{
        error:false,
        loading:false,
        message:'',
      }
    }
  },
  async mounted(){
    this.state.loading = true;

    alert(code)
    return
    const result = await asyncRequest.userinfo(
      { code: getParameterByName('code') }
    )

    this.state.loading = false
    switch(Number(result.code)){
      case 0:
        this.companyArr = result.data.companyArr
        this.hasPlatformDimension = result.data.is_show === "1"
        break
      default:
        this.state.error = true
        this.state.message = result.message
        break
    }
  }
};
</script>
