| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- <template>
- <CommonListPage
- title="非遗传承人"
- itemType="article-character"
- detailsPage="/pages/inhert/inheritor/details"
- showTotal
- :dropDownNames="dropdownNames"
- :load="loadData"
- />
- </template>
- <script setup lang="ts">
- import CommonContent, { GetContentListParams } from '@/api/CommonContent';
- import InheritorContent from '@/api/inheritor/InheritorContent';
- import CommonListPage, { type DropDownNames } from '@/pages/article/common/CommonListPage.vue';
- import { onLoad } from '@dcloudio/uni-app';
- import { onMounted, ref } from 'vue';
- const dropdownNames = ref<DropDownNames[]>([]);
- async function loadData(
- page: number,
- pageSize: number,
- searchText: string,
- dropDownValues: number[]
- ) {
- const res = (await InheritorContent.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],
- keywords: searchText,
- }), page, pageSize));
- res.list.forEach((p) => {
- p.titleBox = Boolean(p.deathBirth);
- p.desc = p.ichName as string;
- p.bottomTags = [
- p.levelText,
- p.nation,
- ];
- })
- return res;
- }
- onLoad(async (querys) => {
- dropdownNames.value.push({
- options: [{
- id: 0,
- name: '全部类别'
- }].concat((await CommonContent.getCategoryList(4)).map((item) => ({
- id: item.id,
- name: item.title,
- }))),
- defaultSelectedValue: 0,
- });
- const levels = await CommonContent.getCategoryList(2);
- dropdownNames.value.push({
- options: [{
- id: 0,
- name: '全部级别'
- }].concat(levels.map((item) => ({
- id: item.id,
- name: item.title,
- }))),
- defaultSelectedValue: querys?.level ?? 0,
- });
- console.log('level', querys?.level);
-
- dropdownNames.value.push({
- options: [{
- id: 0,
- name: '全部区域'
- }].concat((await CommonContent.getCategoryList(1)).map((item) => ({
- id: item.id,
- name: item.title,
- }))),
- defaultSelectedValue: 0,
- });
- })
- </script>
|