<template>
   <CommonListPage
    :title="'研究成果'"
    :prevPage="{ title: '理论研究' }"
    :dropDownNames="[]"
    :showSearch="true"
    :tagsData="tagsData"
    :pageSize="8"
    :defaultSelectTag="269"
    :load="loadData"
    :loadDetail="loadDetail"
  />
</template>

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

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 ResultContent.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.thumbnail || item.thumbnail || item.image,
      };
    }),
  }
}

//子分类
const tagsData = ref([
  { id: 269, name: '全部' },
  { id: 270, name: '文献' },
  { id: 271, name: '著作' },
]);
</script>

<style>
</style>

