<template>
  <CommonListPage
    title="闽南文化资讯"
    :load="loadData"
    itemType="article-common"
    :detailsParams="{
      modelId: CommonContent.modelId,
    }"
  />
</template>

<script setup lang="ts">
import CommonContent, { GetContentListParams } from '@/api/CommonContent';
import CommonListPage from './common/CommonListPage.vue';
import { DataDateUtils } from '@imengyu/js-request-transform';

async function loadData(
  page: number, 
  pageSize: number,
  searchText: string,
  dropDownValues: number[]
) {
  const res = await CommonContent.getContentList(new GetContentListParams()
    .setMainBodyColumnId([228/* , 298, 299 */])
    .setKeywords(searchText)
  , page, pageSize);
  return { list: res.list.map((item) => {
    return {
      id: item.id,
      image: item.thumbnail || item.image,
      title: item.title,
      date: DataDateUtils.formatDate(item.publishAt, 'YYYY-MM-dd'),
    }
  }), total: res.total }
}
</script>
