<template>
  <!-- 文化传承 - 非遗活动 -->
   <CommonListPage
    :title="'非遗活动'"
    :prevPage="{ title: '保护传承' }"
    :dropDownNames="[]"
    :showSearch="true"
    :pageSize="8"
    :load="loadData"
    :loadDetail="loadDetail"
    :tagsData="tagsData"
    :defaultSelectTag="tagsData[0].id"
  />
</template>

<script setup lang="ts">
import { ref } from 'vue';
import { GetContentListParams } from '@/api/CommonContent';
import CustomContent from '@/api/introduction/CustomContent';

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

  const res = await CustomContent.getContentList(new GetContentListParams().setSelfValues({
    mainBodyColumnId: 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.image,
      };
    }),
  }
}

//子分类
const tagsData = ref([
  { id: 290, name: '全部' },
  { id: 291, name: '闽南音乐' },
  { id: 187, name: '讲古' },
  { id: 292, name: '方言' },
  { id: 293, name: '民俗习俗' },
]);
</script>

<style>
</style>

