Newer
Older
CloudBrainNew / src / views / cityConstruction / components / plan / ecology.vue
StephanieGitHub on 4 Feb 2021 2 KB first commit
<!--
 * @Description: 城市生态结构
 * @Author: 王晓颖
 * @Date: 2020-11-30 15:20:49
 -->
<template>
  <chart-layout title="生态结构" @click="getData">
    <div class="block-container">
      <div class="block" v-for="(value,key,index) in data" :key="index">
        <simple-block :data="value" :color="value.color">
          <img :src="value.icon">
        </simple-block>
      </div>
    </div>
    <corner1 slot="corner"/>
  </chart-layout>
</template>

<script>
import Corner1 from '@/components/corner/Corner1'
import SimpleBlock from '@/components/block/simpleBlock'
// import {fetchInfrastructure} from '@/api/jgzl'
export default {
  name: 'Ecology',
  components: {SimpleBlock, Corner1},
  data () {
    return {
      data: {
        jgzl: {name: '观景走廊', value: '7', unit: '个', color: '', icon: require('@/assets/images/construction/icon-jgzl.png')},
        cscl: {name: '城市长廊', value: '1', unit: '个', color: '', icon: require('@/assets/images/construction/icon-cscl.png')},
        stgy: {name: '生态公园', value: '43', unit: '个', color: '', icon: require('@/assets/images/construction/icon-stgy.png')},
        csgy: {name: '城市公园', value: '10', unit: '个', color: '', icon: require('@/assets/images/construction/icon-csgy.png')},
        hp: {name: '湖泊', value: '32', unit: '个', color: '', icon: require('@/assets/images/construction/icon-hp.png')},
        hl: {name: '河流', value: '1', unit: '个', color: '', icon: require('@/assets/images/construction/icon-hl.png')}
      }
    }
  },
  mounted () {
    this.getData()
  },
  methods: {
    getData () {
      for (const item of Object.keys(this.data)) {
        this.getItemData(item)
      }
    },
    // item,传参数
    getItemData (item) {
      console.log(item)
      // fetchInfrastructure(item).then(response => {
      //   if (response.code === 200) {
      //     this.data.item.value = response.data.total
      //   }
      // }).catch((e) => {
      //   this.data[item.value = 7
      // })
    }
  }
}
</script>

<style rel="stylesheet/scss" lang="scss" scoped>
  .block-container{
    height: 100%;
    width: 100%;
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    margin: 0.04rem;
    padding-top:0.04rem;
    .block{
      width: 33%;
      height: 45%;
    }
  }
</style>