list.vue 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <template>
  2. <CommonListPage
  3. title="闽南民俗"
  4. itemType="image-large-2"
  5. :detailsPage="[
  6. '/pages/article/details',
  7. '/pages/inhert/intangible/details',
  8. ]"
  9. showTotal
  10. :dropDownNames="dropdownNames"
  11. :load="loadData"
  12. :tabs="[
  13. { id: 0, text: '民俗资讯' },
  14. { id: 1, text: '非遗民俗' },
  15. ]"
  16. :detailsParams="{
  17. modelId: 4,
  18. }"
  19. />
  20. <!-- -->
  21. </template>
  22. <script setup lang="ts">
  23. import { ref } from 'vue';
  24. import CommonListPage, { type DropDownNames } from '@/pages/article/common/CommonListPage.vue';
  25. import CommonContent, { GetContentListParams } from '@/api/CommonContent';
  26. import ProjectsContent from '@/api/inheritor/ProjectsContent';
  27. const dropdownNames = ref<DropDownNames[]>([]);
  28. async function loadData(
  29. page: number,
  30. pageSize: number,
  31. searchText: string,
  32. dropDownValues: number[],
  33. tabSelect: number,
  34. ) {
  35. let res;
  36. switch (tabSelect) {
  37. case 1:
  38. res = await ProjectsContent.getContentList(new GetContentListParams()
  39. .setKeywords('民俗 ' + searchText)
  40. , page, pageSize);
  41. res.list.forEach((item) => {
  42. item.bottomTags = [
  43. item.levelText,
  44. item.ichTypeText,
  45. item.batchText,
  46. item.regionText,
  47. ]
  48. })
  49. break;
  50. case 0:
  51. default:
  52. res = await CommonContent.getContentList(new GetContentListParams()
  53. .setKeywords(searchText)
  54. .setModelId(4)
  55. .setMainBodyColumnId([ 245,248 ])
  56. , page, pageSize);
  57. break;
  58. }
  59. return { list: res.list, total: res.total }
  60. }
  61. </script>