list.vue 1.7 KB

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