| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- <template>
- <CommonListPage
- title="非遗"
- itemType="image-large-2"
- detailsPage="/pages/inhert/intangible/details"
- :dropDownNames="dropdownNames"
- :tabs="[
- { id: 0, name: '非遗项目' },
- { id: 1, name: '非遗产品' },
- ]"
- :load="loadData"
- />
- </template>
- <script setup lang="ts">
- import CommonContent, { GetContentListParams } from '@/api/CommonContent';
- import ProductsContent from '@/api/inheritor/ProductsContent';
- import ProjectsContent from '@/api/inheritor/ProjectsContent';
- import CommonListPage, { type DropDownNames } from '@/pages/article/common/CommonListPage.vue';
- import { onMounted, ref } from 'vue';
- const dropdownNames = ref<DropDownNames[]>([]);
- async function loadData(
- page: number,
- pageSize: number,
- searchText: string,
- dropDownValues: number[],
- tabSelect: number,
- ) {
- let api;
- switch (tabSelect) {
- case 0: api = ProjectsContent; break;
- default:
- case 1: api = ProductsContent; break;
- }
- return (await api.getContentList(new GetContentListParams().setSelfValues({
- ichType: dropDownValues[0] == 0 ? undefined: dropDownValues[0],
- level: dropDownValues[1] == 0 ? undefined: dropDownValues[1],
- region: dropDownValues[2] == 0 ? undefined: dropDownValues[2],
- keyword: searchText,
- }), page, pageSize)).list;
- }
- onMounted(async () => {
- dropdownNames.value.push({
- options: [{
- id: 0,
- name: '全部分类'
- }].concat((await CommonContent.getCategoryList(4)).map((item) => ({
- id: item.id,
- name: item.title,
- }))),
- defaultSelectedValue: 0,
- });
- dropdownNames.value.push({
- options: [{
- id: 0,
- name: '全部级别'
- }].concat((await CommonContent.getCategoryList(2)).map((item) => ({
- id: item.id,
- name: item.title,
- }))),
- defaultSelectedValue: 0,
- });
- dropdownNames.value.push({
- options: [{
- id: 0,
- name: '全部地区'
- }].concat((await CommonContent.getCategoryList(1)).map((item) => ({
- id: item.id,
- name: item.title,
- }))),
- defaultSelectedValue: 0,
- });
- })
- </script>
|