<template>
   <CommonListPage
    :title="'文化旅游路线'"
    :prevPage="{ title: '文旅融合' }"
    :dropDownNames="[]"
    :showSearch="true"
    :tagsData="tagsData"
    :pageSize="8"
    :defaultSelectTag="274"
    :load="loadData"
    :loadDetail="loadDetail"
  />
</template>

<script setup lang="ts">
import { ref } from 'vue';
import { GetContentListParams } from '@/api/CommonContent';
import ResultContent from '@/api/research/ResultContent';
import RouteContent from '@/api/fusion/RouteContent';

async function loadDetail(id: number, item: any) {
  return await ResultContent.getContentDetail(id);
}
async function loadData(
  page: number, 
  pageSize: number,
  selectedTag: number,
  searchText: string,
  dropDownValues: number[]
) {

  const res = await RouteContent.getContentList(new GetContentListParams().setSelfValues({
    mainBodyColumnId: selectedTag == tagsData.value[0].id ? tagsData.value.map(p => p.id).join(',') : selectedTag,
    keywords: searchText,
  }), page, pageSize);

  return { 
    page: page,
    total: res.total,
    data: res.list.map((item, index) => {
      return {
        id: item.id,
        title: item.title,
        desc: item.desc,
        image: item.thumbnail || item.image,
      };
    }),
  }
}

//子分类
const tagsData = ref([
  { id: 274, name: '全部' },
  { id: 275, name: '非遗旅游路线' },
  { id: 276, name: '闽南红色文化旅游路线' },
  { id: 277, name: '闽南美食旅游路线' },
]);
</script>

<style>
</style>

