<template>
   <CommonListPage
    :title="'非遗研学点'"
    :prevPage="{ title: '文旅融合' }"
    :dropDownNames="[]"
    :pageSize="8"
    :rowType="4"
    :load="loadData"
    :loadDetail="loadDetail"
  />
</template>

<script setup lang="ts">
import CommonContent, { GetContentListParams } from '@/api/CommonContent';
import DiscussContent from '@/api/research/DiscussContent';

async function loadDetail(id: number, item: any) {
  const res = await DiscussContent.getContentDetail(id);
  res.content = res.content || res.intro as string;
  res.addItems = [
  ];
  return res;
}
async function loadData(
  page: number, 
  pageSize: number,
  selectedTag: number,
  searchText: string,
  dropDownValues: number[]
) {

  const res = await CommonContent.getContentList(new GetContentListParams()
    .setModelId(17)
    .setMainBodyColumnId(319)
    .setKeywords(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,
        addItems: [
          { name: '联系人', text: item.contact as string, span: 12 },
          { name: '联系电话', text: item.mobile as string, span: 12 },
        ],
      };
    }),
  }
}
</script>

<style>
</style>

