|
@@ -1,8 +1,9 @@
|
|
|
<template>
|
|
|
<div id="app" v-cloak v-loading="state.loading">
|
|
|
<template v-if="!state.error">
|
|
|
- <control-display :companyArr="companyArr" />
|
|
|
+ <control-display :companyArr="companyArr" :hasPlatformDimension="hasPlatformDimension" />
|
|
|
</template>
|
|
|
+
|
|
|
<template v-else>
|
|
|
<unusual-state :message="state.message" />
|
|
|
</template>
|
|
@@ -10,14 +11,16 @@
|
|
|
</template>
|
|
|
<script>
|
|
|
import asyncRequest from "@/api/index"
|
|
|
-import { getParameterByName,mockData } from "../utils/auth"
|
|
|
+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,
|
|
@@ -27,20 +30,21 @@ export default {
|
|
|
},
|
|
|
async mounted(){
|
|
|
this.state.loading = true
|
|
|
- alert(getParameterByName('code'))
|
|
|
- // const result = await asyncRequest.userinfo({code: getParameterByName('code')})
|
|
|
- // const result = mockData
|
|
|
- // this.state.loading = false
|
|
|
+ const result = await asyncRequest.userinfo(
|
|
|
+ { code: getParameterByName('code') }
|
|
|
+ )
|
|
|
|
|
|
- // switch(Number(result.code)){
|
|
|
- // case 0:
|
|
|
- // this.companyArr = result.data.companyArr || []
|
|
|
- // break
|
|
|
- // default:
|
|
|
- // this.state.error = true
|
|
|
- // this.state.message = result.message
|
|
|
- // break
|
|
|
- // }
|
|
|
+ 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>
|