<template>
  <div class="real-pages">
    <div>
      <div class="real-info">
        <div class="title">{{ dataInfo.caseTitle }}</div>
        <div class="time">{{ dataInfo.projectBrief }}</div>
        <div class="real-html" v-html="dataInfo.projectDetails"></div>
      </div>
    </div>
    <div class="related-bos">
      <div class="flex-row-between related-title">
        <div>其他客户案例</div>
        <div class="flex-row-start related-huan" @click="onPath('/plan/project')">
          <div>更多</div>
          <el-icon style="margin-left: 4px"><ArrowRight /></el-icon>
        </div>
      </div>
      <div class="related-box">
        <div v-for="(item, index) in dataList" :key="index" class="procure-list ellipsis" @click="onPath('/plan_info/project?id=' + item.id)">
          {{ item.caseTitle }}
        </div>
      </div>
    </div>
  </div>
</template>

<script setup lang="ts">
import { onPath } from '@/utils/siteConfig';
import { getProjectCaseDetail, getProjectCaseAllList } from '@/api/plan/index';
const id = ref<any>(null);
const dataInfo = ref<any>({});
const dataList = ref<any>([]);
const route = useRoute();

onMounted(() => {
  id.value = route.query.id;
  getInfo();
  getList();
});

const getInfo = () => {
  getProjectCaseDetail(id.value).then((res) => {
    if (res.code == 200) {
      dataInfo.value = res.data;
    }
  });
};

const getList = () => {
  getProjectCaseAllList({
    pageSize: 10,
    pageNum: 1
  }).then((res) => {
    if (res.code == 200) {
      dataList.value = res.rows;
    }
  });
};
</script>

<style lang="scss" scoped>
.real-pages {
  width: 1200px;
  margin: 0 auto;
  display: flex;
  gap: 0 20px;
  padding-bottom: 50px;
  .real-info {
    width: 715px;
    background: #ffffff;
    border-radius: 10px;
    padding: 20px;
    .title {
      font-size: 20px;
      color: #666666;
    }
    .time {
      font-size: 14px;
      color: #999999;
      margin: 10px 0 18px 0;
    }
    .real-html {
      width: 679px;
      :deep(img) {
        max-width: 100%;
        height: auto;
      }
    }
    .img {
      width: 679px;
      height: 351px;
      border-radius: 10px;
    }
    .head {
      font-weight: 600;
      font-size: 14px;
      color: #101828;
      margin: 10px 0 18px 0;
    }
    .info {
      font-size: 14px;
      color: #364153;
      margin-bottom: 15px;
    }
  }

  .related-bos {
    flex: 1;
    .related-title {
      font-size: 16px;
      color: #323232;
      width: 100%;
      background-color: #ffffff;
      border-radius: 10px;
      padding: 10px 20px;
      .related-huan {
        font-size: 14px;
        cursor: pointer;
        color: #969696;
        &:hover {
          color: var(--el-color-primary);
        }
      }
    }
    .related-box {
      width: 100%;
      background-color: #ffffff;
      border-radius: 10px;
      padding: 10px 20px;
      margin-top: 20px;
      display: flex;
      flex-direction: column;
      gap: 15px;

      .procure-list {
        width: 100%;
        background: #ffffff;
        cursor: pointer;
        border-radius: 10px;
        font-size: 14px;
        color: #333333;
        &:hover {
          color: var(--el-color-primary);
        }
      }
    }
  }
}
</style>
