<template>
  <div class="base_box">
    <div class="base top_border" v-if="baseData" @click="handleBaseDetail()">
      <img v-if="baseData.coverList.length > 0" :src="baseData.coverList[0].cover_url" alt="" />
      <div class="center">
        <p class="basename">{{ baseData.baseName }}</p>
        <p class="address" v-if="baseData.city">
          <van-icon name="location-o" />{{ baseData.city }}{{ baseData.area}}{{ baseData.address }}
        </p>
        <p class="tag" v-if="baseData.baseLabel.length>0">{{ baseData.baseLabel.join("/") }}</p>
      </div>
    </div>
  </div>
</template>
<script>
export default {
  props: ['baseId'],
  data () {
    return {
      baseData: "", //基地信息
    }
  },
  mounted () {
    this.GetOneBase()
  },
  methods: {
    // 获取单个基地
    GetOneBase () {
      this.yxAxios
        .get(`${this.yanxueUrl}/api/Manage/GetOneBase?id=${this.baseId}`)
        .then((res) => {
          // console.log(res.data.data)
          if (res.data.data) {
            this.baseData = res.data.data;
          }
        });
    },
    handleBaseDetail () {
      this.$router.push({ name: 'ServiceBaseDetail', query: { baseId: this.baseData.id } })
    },
  }
}
</script>