seminar.vue 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. <template>
  2. <CommonListPage
  3. :title="'非遗传习所'"
  4. :prevPage="{ title: '保护传承' }"
  5. :dropDownNames="dropdownNames"
  6. :pageSize="8"
  7. :load="loadData"
  8. :loadDetail="loadDetail"
  9. />
  10. </template>
  11. <script setup lang="ts">
  12. import SeminarContent from '@/api/inheritor/SeminarContent';
  13. import CommonContent, { GetContentListParams } from '@/api/CommonContent';
  14. import { onMounted, ref } from 'vue';
  15. import type { DropDownNames } from '@/components/content/CommonListPage.vue';
  16. async function loadDetail(id: number, item: any) {
  17. const res = await SeminarContent.getContentDetail(id);
  18. res.addItems = [
  19. { name: '地理位置', text: res.address, span: 12 },
  20. { name: '保护级别', text: res.levelText, span: 12 },
  21. ];
  22. return res;
  23. }
  24. async function loadData(
  25. page: number,
  26. pageSize: number,
  27. selectedTag: number,
  28. searchText: string,
  29. dropDownValues: number[]
  30. ) {
  31. const res = await SeminarContent.getContentList(new GetContentListParams().setSelfValues({
  32. level: dropDownValues[0] == 0 ? undefined: dropDownValues[0],
  33. region: dropDownValues[1] == 0 ? undefined: dropDownValues[1],
  34. keywords: searchText,
  35. }), page, pageSize);
  36. return {
  37. page: page,
  38. total: res.total,
  39. data: res.list.map((item, index) => {
  40. return {
  41. id: item.id,
  42. title: item.title ?? '!!title!!',
  43. desc: item.desc,
  44. image: item.thumbnail || item.image,
  45. addItems: [
  46. { name: '地理位置', text: item.address, span: 12 },
  47. { name: '保护级别', text: item.levelText, span: 12 },
  48. ],
  49. };
  50. }),
  51. }
  52. }
  53. const dropdownNames = ref<DropDownNames[]>([]);
  54. onMounted(async () => {
  55. dropdownNames.value.push({
  56. options: [{
  57. id: 0,
  58. name: '全部'
  59. }].concat((await CommonContent.getCategoryList(2)).map((item) => ({
  60. id: item.id,
  61. name: item.title,
  62. }))),
  63. defaultSelectedValue: 0,
  64. });
  65. dropdownNames.value.push({
  66. options: [{
  67. id: 0,
  68. name: '全部'
  69. }].concat((await CommonContent.getCategoryList(1)).map((item) => ({
  70. id: item.id,
  71. name: item.title,
  72. }))),
  73. defaultSelectedValue: 0,
  74. });
  75. })
  76. </script>
  77. <style>
  78. </style>