<template>
  <CommonListPage
    title="闽南闽南新鲜事"
    :load="loadData"
    itemType="article-common"
    :detailsParams="{
      modelId: NewsIndexContent.modelId,
    }"
  />
</template>

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

async function loadData(
  page: number, 
  pageSize: number,
  searchText: string,
  dropDownValues: number[]
) {
  const res = await NewsIndexContent.getContentList(new GetContentListParams()
    .setMainBodyColumnId([228/* , 298, 299 */])
    .setKeywords(searchText)
    .setSelfValues({
      platfrom: 327,
    })
  , 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>
