<template>
  <view class="school-info flex-row" @click="handleClick">
    <!-- 驾校图片 -->
    <image
      class="school-image"
      referrerpolicy="no-referrer"
      :src="schoolInfo.imageUrl"
    />
    <!-- 驾校详情 -->
    <view class="school-details flex-col">
      <!-- 驾校名称 -->
      <text class="school-name">{{ schoolInfo.corpName }}</text>
      <!-- 状态和时间 -->
      <view class="status-time flex-row">
        <text class="school-status">{{ schoolInfo.status }}</text>
        <text class="school-time">{{ schoolInfo.time }}</text>
      </view>
      <!-- 驾校地址 -->
      <text class="school-address">{{ schoolInfo.address }}</text>
      <!-- 驾校特色 -->
      <view class="school-features flex-row">
        <text
          v-for="(feature, index) in schoolInfo.features"
          :key="index"
          class="school-feature"
        >
          {{ feature }}
        </text>
      </view>
    </view>
  </view>
</template>

<script>
export default {
  props: {
    schoolInfo: {
      type: Object,
      required: true
    }
  },
  methods: {
      handleClick() {
        this.$emit('click', this.schoolInfo);
      }
    }
};
</script>

<style scoped lang="scss">
.school-info {
  display: flex;
  flex-direction: row;
  align-items: center;
  padding: 15rpx;
  border-bottom: 1rpx solid #e5e5e5;
  margin-bottom: 15rpx;
  padding-bottom: 15rpx;
}

.school-image {
  width: 200rpx;
  height: 130rpx;
  object-fit: cover;
  border-radius: 10rpx;
  margin-right: 20rpx;
}

.school-details {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  flex: 1;
}

.school-name {
  font-size: 28rpx;
  font-weight: bold;
  color: #333;
  margin-bottom: 10rpx;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 480rpx; /* 适当调整 */
  line-height: 1.2;
}

.status-time {
  display: flex;
  flex-direction: row;
  align-items: center;
  margin-bottom: 10rpx;
}

.school-status {
  font-size: 22rpx;
  color: #555;
  margin-right: 15rpx;
}

.school-time {
  font-size: 22rpx;
  color: #555;
}

.school-address {
  font-size: 20rpx;
  color: #777;
  margin-bottom: 10rpx;
}

.school-features {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  margin-bottom: 10rpx;
}

.school-feature {
  color: #666;
  font-size: 20rpx;
  padding: 6rpx 12rpx;
  border-radius: 6rpx;
  margin-right: 12rpx;
  margin-top: 6rpx;
  background-color: #FCEBE6;
}
</style>
