<template>
  <div class="app-container custom-main-w ">
    <div style="margin: 0 auto; padding: 0 84px;">
      <el-row :gutter="24">
        <el-col v-for="(item,index) in assemblyData" :key="item.id" :span="6">
          <div class="item flex service-card">
            <div class="thumb">
              <img :src="item.image" alt=""/>
            </div>
            <div class="content">
              <div class="title">{{ item.title }}</div>
              <p v-html="item.description"></p>
              <el-button size="small" type="primary" plain round @click="openPage(item,index)">了解详情</el-button>
            </div>
          </div>
        </el-col>
      </el-row>
    </div>
  </div>
</template>

<script setup name="ComponentServicesList">
import {ref} from 'vue'
import {assemblyList} from '@/api/home.js'
import { useRouter } from 'vue-router'

const assemblyData = ref([])
const router = useRouter()

function getAassemblyList() {
  assemblyList().then(res => {
    assemblyData.value = res.data;
  })
}

function openPage(data, index) {
  if (data && data.id) {
    router.push({ path: '/componentServices/detail', query: { id: data.id } })
  }
}

getAassemblyList()
</script>
<style scoped lang="scss">
.app-container {
  min-height: 100%;
  padding-top: 130px;
  //background-color: #F7F8F9;
}

.flex {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.item {
  //height: 168px;
  //background: url("@/assets/images/assemblyBg.jpg") no-repeat center center / cover;
  background: #F7FAFF; /* 蓝白风格浅蓝背景 */
  border: 1px solid #E3EEFF;
  border-radius: 14px;
  padding: 28px 24px 32px;
  margin-bottom: 40px;
  text-align: center;
  box-shadow: 0 4px 18px rgba(31, 74, 175, 0.06);
  transition: transform 0.2s ease, box-shadow 0.2s ease;

  &:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(31, 74, 175, 0.12);
  }

  .thumb {
    width: 110px;
    height: 110px;
    border-radius: 22px;
    overflow: hidden;
    margin: 0 auto 18px;
    background: none;
    box-shadow: none;
  }

  .title {
    font-weight: bold;
    font-size: 18px;
    line-height: 28px;
    height: 28px;
    color: #1F2D3D;
  }

  p {
    font-weight: 400;
    font-size: 14px;
    color: #5E6D82;
    line-height: 22px;
    margin-top: 8px;
    margin-bottom: 22px;
    height: 44px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }

  .thumb img {
    width: 100%;
    height: 100%;
    object-fit: contain; /* 不裁切，完整展示 */
    display: block;
    border-radius: 0;
  }
}

/* 旧iframe容器样式已移除 */

/* 清理过期的弹窗与Tab样式 */

.el-button {
  height: 32px;
  line-height: 30px;
  padding: 0 14px;
  width: auto;
  min-width: 0;
  border: 1px solid #1F4AAF;
  border-radius: 18px;
  color: #1F4AAF;
  background: #FFFFFF;
}
</style>
