<template>
  <div id="service">
    <el-row>
      <el-col :span="24" class="service">
        <el-col :span="24" class="one">
          <div class="title">办事事项</div>
          <div class="English">AFFAIRS</div>
        </el-col>
        <el-col :span="24" class="two">
          <el-col
            :span="6"
            :style="`background: url(${item.url}) center no-repeat`"
            class="list"
            v-for="(item, index) in menuList"
            :key="index"
            @click="toCommon(item)"
          >
            <div class="name">
              {{ item.name }}
            </div>
          </el-col>
        </el-col>
        <el-col :span="24" class="thr">
          <el-col :span="12" class="left">
            <div class="title">政策法规</div>
            <div class="English">POLITICS and REGULATIONS</div>
          </el-col>
          <el-col :span="12" class="right" @click="toPolicy">查看更多 ></el-col>
        </el-col>
        <el-col :span="24" class="four">
          <el-col :span="3" class="left">
            <el-image class="image" src="/src/assets/service_5.jpg" fit="fill" />
          </el-col>
          <el-col :span="21" class="right">
            <el-col :span="12" class="list" v-for="(item, index) in list" :key="index" @click="toView(item)">
              <el-col :span="4" class="left">
                <div class="year" v-if="item.time">{{ moment(item.time).format('YYYY') }}</div>
                <div class="date" v-if="item.time">{{ moment(item.time).format('MM-DD') }}</div>
              </el-col>
              <el-col :span="20" class="right">
                <el-col :span="24" class="name textOver">
                  <el-tooltip effect="dark" :content="item.title" placement="top">
                    {{ item.title || '暂无标题' }}
                  </el-tooltip>
                </el-col>
                <el-col :span="24" class="content"> {{ item.content || '暂无内容' }}</el-col>
              </el-col>
            </el-col>
          </el-col>
        </el-col>
        <el-col :span="24" class="one">
          <div class="title">服务内容</div>
          <div class="English">SERVICE CONTENT</div>
        </el-col>
        <el-col :span="24" class="five">
          <el-carousel height="300px" :interval="5000" type="card">
            <el-carousel-item v-for="(item, index) in carouselList" :key="index">
              <el-col :span="24" class="content" :style="`background-image: url(${item.url})`" @click="toService(item)">
                <el-col :span="24" class="title"> {{ item.title }}</el-col>
                <el-col :span="12" class="brief"> {{ item.content }}</el-col>
              </el-col>
            </el-carousel-item>
          </el-carousel>
        </el-col>
      </el-col>
    </el-row>
  </div>
</template>

<script setup lang="ts">
import moment from 'moment';
import type { Ref } from 'vue';
import { ref, toRefs } from 'vue';
// #region 参数传递
const props = defineProps({
  serviceList: { type: Array, default: () => [] }
});
const { serviceList } = toRefs(props);
// 列表
const list: Ref<any> = ref(serviceList);
// 菜单
const menuList: Ref<any> = ref([
  { name: '技术合同认定登记', url: '/src/assets/service_1.jpg', route: '/' },
  { name: '科技成果登记', url: '/src/assets/service_2.jpg', route: '/' },
  { name: '敬请期待', url: '/src/assets/service_3.jpg', route: '/' },
  { name: '敬请期待', url: '/src/assets/service_4.jpg', route: '/' }
]);
// 菜单
const carouselList: Ref<any> = ref([
  { title: '技术转移', url: '/src/assets/service1.png', content: '为企业提供跨领域、跨区域、全过程的技术转移集成服务。', type: '0' },
  {
    title: '科技金融',
    url: '/src/assets/service2.png',
    content: '面向科技型企业开展科技保险、科技担保、知识产权质押等科技金融服务，提供天使投资、创业投资等股权投资服务等。',
    type: '1'
  },
  {
    title: '政策咨询/服务',
    url: '/src/assets/service3.png',
    content: '为科学技术发展规划的编制和科研项目的组织实施提供科技发展水平和其他各方面的预测、设计实施方案等集成化应用的咨询和服务。',
    type: '2'
  },
  {
    title: '科技评估/评价',
    url: '/src/assets/service4.png',
    content:
      '遵循一定的原则、程序和标准，运用科学、可行的方法对承担科技战略、规划、政策、改革、计划、项目、载体、机构、科技成果、人才、资金预算及其他科技相关活动的研究和全过程评估、评价工作，提供科技创新发展决策辅助等服务。',
    type: '3'
  },
  {
    title: '知识产权',
    url: '/src/assets/service5.png',
    content: '提供知识产权代理、信息、咨询、培训等，以及知识产权分析评议、运营实施、保护维权等服务。',
    type: '4'
  },
  {
    title: '创业孵化',
    url: '/src/assets/service6.png',
    content: '为创业团队、科技型企业提供共享服务空间、经营场地、政策指导、资金申请、技术鉴定、咨询策划、项目顾问、人才培训等多类创业的服务。',
    type: '5'
  },
  { title: '财税法律', url: '/src/assets/service7.png', content: '为企业提供财税、法律服务。', type: '6' },
  { title: '工业设计', url: '/src/assets/service8.png', content: '以工学、美学、经济学为基础对工业产品提供设计服务。', type: '7' },
  {
    title: '检验检测',
    url: '/src/assets/service9.png',
    content: '面向设计开发、生产制造、售后服务全过程的观测、分析、测试、检验、标准、认证等第三方检验检测认证服务。',
    type: '8'
  },
  { title: '其他', url: '/src/assets/service10.png', content: '成果转化全链条中的其他类服务。', type: '9' }
]);
// #endregion
const emit = defineEmits(['toCommon', 'toView', 'toPolicy', 'toService']);
const toCommon = (item) => {
  emit('toCommon', item);
};
// 查看
const toView = (item) => {
  emit('toView', item);
};
// 政策法规查看更多
const toPolicy = () => {
  emit('toPolicy', '0');
};
// 服务内容查看更多
const toService = (item) => {
  emit('toService', { type: item.type });
};
</script>
<style lang="scss" scoped>
.service {
  width: 1200px;

  .one {
    width: 100%;
    margin: 10px 0;

    .title {
      font-family: PingFangSC-Medium;
      font-size: 24px;
      line-height: 26px;
      font-weight: 500;
    }

    .English {
      height: 12px;
      font-size: 12px;
      line-height: 12px;
      font-weight: 400;
      margin: 5px 0 0 0;
    }
  }

  .two {
    display: flex;
    justify-content: space-between;
    margin: 10px 0;

    .list {
      border-radius: 5px;

      .name {
        display: flex;
        align-items: center;
        justify-content: center;
        height: 50px;
        font-size: 20px;
        color: #ffff;
        font-family: PingFangSC-Medium;
      }
    }

    .list:hover {
      box-shadow: 0 0 16px rgba(35, 116, 255, 0.6);
    }
  }

  .thr {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin: 10px 0;

    .left {
      .title {
        font-family: PingFangSC-Medium;
        font-size: 23px;
        line-height: 26px;
        font-weight: 500;
      }

      .English {
        height: 12px;
        font-size: 11px;
        line-height: 12px;
        font-weight: 400;
        margin: 5px 0 0 0;
      }
    }

    .right {
      text-align: right;
      font-size: 14px;
    }

    .right:hover {
      color: #2374ff;
    }
  }

  .four {
    display: flex;

    .left {
      .image {
        width: 140px;
      }
    }

    .right {
      display: flex;
      justify-content: space-between;
      flex-wrap: wrap;

      .list {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 20px;
        transition: all 0.3s;

        .left {
          font-family: PingFangSC-Regular;
          font-size: 12px;
          color: #2374ff;
          line-height: 12px;

          .year {
            margin-bottom: 2px;
          }

          .date {
            font-size: 22px;
            line-height: 22px;
            margin-bottom: 10px;
          }
        }

        .right {
          .name {
            font-family: PingFangSC-Medium;
            font-size: 16px;
            color: #121834;
            line-height: 16px;
            font-weight: 700;
            margin-bottom: 8px;
          }

          .content {
            font-size: 12px;
            color: #525a68;
            line-height: 19px;
            font-weight: 400;
            display: -webkit-box;
            -webkit-line-clamp: 2;
            -webkit-box-orient: vertical;
            overflow: hidden;
            text-overflow: ellipsis;
            margin-top: 8px;
          }
        }
      }

      .list:hover {
        background: #f0f7ff;
        box-shadow: 0 0 16px rgba(205, 205, 205, 0.6);
      }
    }
  }

  .five {
    .content {
      background: #1f2431;
      background-repeat: no-repeat;
      background-size: contain;
      background-position: right bottom;
      height: 300px;
      padding: 20px;
      width: 100%;
      color: #ffff;

      .title {
        font-family: PingFangSC-Medium;
        font-size: 23px;
        line-height: 26px;
        font-weight: 500;
        margin: 10px 0;
      }

      .brief {
        height: 12px;
        font-size: 12px;
        line-height: 12px;
        font-weight: 400;
        margin: 5px 0 0 0;
      }
    }
  }
}
</style>
