| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- <template>
- <CommonListPage
- :title="'非遗传习所'"
- :prevPage="{ title: '保护传承' }"
- :dropDownNames="dropdownNames"
- :pageSize="8"
- :load="loadData"
- :loadDetail="loadDetail"
- />
- </template>
- <script setup lang="ts">
- import SeminarContent from '@/api/inheritor/SeminarContent';
- import CommonContent, { GetContentListParams } from '@/api/CommonContent';
- import { onMounted, ref } from 'vue';
- import type { DropDownNames } from '@/components/content/CommonListPage.vue';
- async function loadDetail(id: number, item: any) {
- const res = await SeminarContent.getContentDetail(id);
- res.addItems = [
- { name: '地理位置', text: res.address, span: 12 },
- { name: '保护级别', text: res.levelText, span: 12 },
- ];
- return res;
- }
- async function loadData(
- page: number,
- pageSize: number,
- selectedTag: number,
- searchText: string,
- dropDownValues: number[]
- ) {
- const res = await SeminarContent.getContentList(new GetContentListParams().setSelfValues({
- level: dropDownValues[0] == 0 ? undefined: dropDownValues[0],
- region: dropDownValues[1] == 0 ? undefined: dropDownValues[1],
- keywords: searchText,
- }), page, pageSize);
- return {
- page: page,
- total: res.total,
- data: res.list.map((item, index) => {
- return {
- id: item.id,
- title: item.title ?? '!!title!!',
- desc: item.desc,
- image: item.thumbnail || item.image,
- addItems: [
- { name: '地理位置', text: item.address, span: 12 },
- { name: '保护级别', text: item.levelText, span: 12 },
- ],
- };
- }),
- }
- }
- const dropdownNames = ref<DropDownNames[]>([]);
- onMounted(async () => {
- 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>
- <style>
- </style>
|