<template>
  <div id="home">
    <div  class="top" >
        <a-row type="flex" justify="end">
          <a-col :span="4">
            <div class="home-card">
              <span style="float:left">
                <img src="@/assets/icon/xq.png" alt="">
              </span>
              <span >
                <p>住宅</p>
                  {{data.community}}
              </span>
            </div>
          </a-col>
          <a-col :span="4">
             <div class="home-card">
              <img src="@/assets/icon/mp.png" alt="">
              <p>门牌幢</p>
              <span>{{data.building}}</span>
            </div>

          </a-col>
          <a-col :span="4">
             <div class="home-card">
              <img src="@/assets/icon/fj.png" alt="">
              <p>非居项目</p>
              <span>{{data.nonResident}}</span>
            </div>
          </a-col>
          <a-col :span="4">
             <div class="home-card">
              <img src="@/assets/icon/jd.png" alt="">
              <p>街道镇</p>
              <span>{{data.street}}</span>
            </div>

          </a-col>
          <a-col :span="4">
             <div class="home-card">
              <img src="@/assets/icon/fb.png" alt="">
              <p>房管所</p>
              <span>{{data.houseOffice}}</span>
            </div>

          </a-col>
        </a-row>
    </div>
  </div>
</template>

<script>
export default {
  name: 'HomePage',
  data() {
    return{
      data: {},
      openConfig: false,

    }
  },
  methods: {
    getList(){ // 获取数据
      this.$ajax.get({
        url: this.$api.GET_RESOURE_LIST,
      }).then(res => { 
        if (res.code === '200') {
          this.data = this.$com.confirm(res, 'data.content', [])
        }
      })
    },
    //判断是否开启自定义字段
    getConfig(){
      this.$ajax.get({
        url: this.$api.GET_CONFIG,
      }).then(res => { 
        if (res.code === '200') {
          this.openConfig = this.$com.confirm(res, 'data.content', []).customKeyEnable
          // 是否开启自定义字段存入cookie
          this.$cookie.set('customKeyEnable', this.openConfig)
        }
      })
    }
  },
  created(){
    this.getList()
    this.getConfig()
  },
  mounted(){},
}
</script>

<style>

#home {
  width: 100%;
}

#home .top{
  width: 100%;
  margin-top: 20px;
}
.home-card{
  background-color: #fff;
  height: 70px;
  width: 170px;
  padding: 15px;
  margin-right:10px;
  text-align: center;
}
.home-card img{
    float: left;
}
.home-card p{
    color: #ccc;
    margin: 0;
} 

</style>
