<template>
  <!-- 平台功能 + 集成平台 -->
  <view class="feature-section">
    <text class="section-title">用强大的功能，开启盈利快车道</text>

    <!-- 功能卡片横向滚动 -->
    <scroll-view scroll-x class="feat-scroll" show-scrollbar="false">
      <view class="feat-list">
        <view
          class="feat-card"
          :class="{ active: activeFeat === index }"
          v-for="(item, index) in features"
          :key="index"
          @tap="onFeatTap(index)"
        >
          <text class="feat-num">0{{ index + 1 }}</text>
          <text class="feat-title">{{ item.title }}</text>
          <text class="feat-desc">{{ item.desc }}</text>
        </view>
      </view>
    </scroll-view>

    <!-- 集成平台大图 -->
    <view class="integration-wrap">
      <view class="integration-box">
        <image
          class="integration-img"
          src="/static/images/home/Rectangle_64_1484_1735.png"
          mode="widthFix"
        ></image>
      </view>
    </view>
  </view>
</template>

<script>
export default {
  name: 'PlatformFeatures',
  props: {
    features: {
      type: Array,
      default: () => []
    }
  },
  data() {
    return {
      activeFeat: 3
    }
  },
  methods: {
    onFeatTap(index) {
      this.activeFeat = index
      this.$emit('change', index)
    }
  }
}
</script>

<style scoped>
.feature-section {
  width: 100%;
  padding: 70rpx 0 0 0;
  background: #ffffff;
}

.section-title {
  display: block;
  padding: 0 32rpx;
  font-size: 38rpx;
  font-weight: 700;
  color: #1a1a1a;
  margin-bottom: 30rpx;
}

/* 功能卡片横向滚动 */
.feat-scroll {
  width: 100%;
  white-space: nowrap;
  margin-bottom: 50rpx;
}
.feat-list {
  display: inline-flex;
  gap: 20rpx;
  padding: 0 32rpx;
}
.feat-card {
  flex-shrink: 0;
  width: 320rpx;
  padding: 28rpx 24rpx;
  background: #f8f8f8;
  border-radius: 12rpx;
  display: flex;
  flex-direction: column;
}
.feat-card.active {
  background: #ff6800;
}
.feat-num {
  font-size: 32rpx;
  font-weight: 900;
  color: #ff6800;
  line-height: 1;
  margin-bottom: 12rpx;
}
.feat-card.active .feat-num {
  color: #ffffff;
}
.feat-title {
  font-size: 28rpx;
  font-weight: 600;
  color: #1a1a1a;
  margin-bottom: 8rpx;
}
.feat-card.active .feat-title {
  color: #ffffff;
}
.feat-desc {
  font-size: 20rpx;
  color: #999999;
  line-height: 1.5;
  white-space: normal;
}
.feat-card.active .feat-desc {
  color: rgba(255, 255, 255, 0.85);
}

/* 集成平台大图 */
.integration-wrap {
  padding: 0 32rpx;
}
.integration-box {
  width: 100%;
  background: #ff6800;
  border-radius: 16rpx;
  padding: 30rpx;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
}
.integration-img {
  width: 100%;
  display: block;
}
</style>
