Ver código fonte

📦 非遗传承人

imengyu 1 mês atrás
pai
commit
2cdd9fadd7

+ 24 - 8
src/pages/article/common/CommonListPage.vue

@@ -17,7 +17,7 @@
       }"
       :scrollable="tabs && tabs.length > 5"
       class="top-tab"
-      @click="(e: any) => tab = e.id"
+      @click="handleTabClick"
     />
     <!-- 搜索 -->
     <view v-if="showSearch" class="d-flex flex-col p-2">
@@ -36,12 +36,14 @@
       v-if="dropDownNames && dropDownNames.length > 0" 
       class="d-flex flex-row justify-around p-2 pt-0"
     >
-      <SimpleDropDownPicker 
-        v-for="(drop, k) in dropDownNames" :key="k" 
-        :modelValue="dropDownValues[k] || drop.defaultSelectedValue"
-        :columns="drop.options" 
-        @update:modelValue="(v) => handleChangeDropDownValue(k, v)"
-      />
+      <template v-for="(drop, k) in dropDownNames" :key="k" >
+        <SimpleDropDownPicker 
+          v-if="drop.activeTab == undefined || drop.activeTab == tab"
+          :modelValue="dropDownValues[k] || drop.defaultSelectedValue"
+          :columns="drop.options" 
+          @update:modelValue="(v) => handleChangeDropDownValue(k, v)"
+        />
+      </template>
     </view>
     <!-- 列表 -->
     <view class="d-flex flex-row flex-wrap justify-between p-3 pt-0">
@@ -100,6 +102,7 @@ import SimpleDropDownPicker, { type SimpleDropDownPickerItem } from '@/common/co
 export interface DropDownNames {
   options: SimpleDropDownPickerItem[],
   defaultSelectedValue: number|string,
+  activeTab?: number,
 }
 export interface CommonListItem extends Record<string, any>  {
   id: number,
@@ -119,7 +122,11 @@ const props = defineProps({
    * 分组标签
    */
   tabs: {
-    type: Array as PropType<{ id: number, name: string }[]>,
+    type: Array as PropType<{ 
+      id: number, 
+      name: string,
+      jump?: () => void,
+    }[]>,
     default: null,
   },
   /**
@@ -207,6 +214,15 @@ function goDetails(id: number) {
   })
 }
 
+function handleTabClick(e: any) {
+  if (e.jump) {
+    e.jump();
+    return;
+  }
+  tab.value = e.id;
+  listLoader.loadData(undefined, true);
+}
+
 watch(tab, () => {
   listLoader.loadData(undefined, true);
 });

+ 1 - 1
src/pages/inhert/inheritor/list.vue

@@ -1,6 +1,6 @@
 <template>
   <CommonListPage 
-    title="先贤列传"
+    title="非遗传承人"
     itemType="article-character"
     detailsPage="/pages/inhert/inheritor/details"
     :dropdownNames="dropdownNames"

+ 8 - 3
src/pages/inhert/intangible/list.vue

@@ -7,6 +7,7 @@
     :tabs="[
       { id: 0, name: '非遗项目' },
       { id: 1, name: '非遗产品' },
+      { id: 2, name: '非遗传承人', jump: () => navTo('/pages/inhert/inheritor/list') },
     ]"
     :load="loadData" 
   />
@@ -16,6 +17,7 @@
 import CommonContent, { GetContentListParams } from '@/api/CommonContent';
 import ProductsContent from '@/api/inheritor/ProductsContent';
 import ProjectsContent from '@/api/inheritor/ProjectsContent';
+import { navTo } from '@/common/utils/PageAction';
 import CommonListPage, { type DropDownNames } from '@/pages/article/common/CommonListPage.vue';
 import { onMounted, ref } from 'vue';
 
@@ -35,9 +37,9 @@ async function loadData(
     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],
+    ichType: tabSelect !== 0 || dropDownValues[0] == 0 ? undefined: dropDownValues[0],
+    level: tabSelect !== 0 || dropDownValues[1] == 0 ? undefined: dropDownValues[1],
+    region: tabSelect !== 0 || dropDownValues[2] == 0 ? undefined: dropDownValues[2],
     keyword: searchText,
   }), page, pageSize)).list;
 }
@@ -51,6 +53,7 @@ onMounted(async () => {
       id: item.id,
       name: item.title,
     }))),
+    activeTab: 0,
     defaultSelectedValue: 0,
   });
   dropdownNames.value.push({ 
@@ -61,6 +64,7 @@ onMounted(async () => {
       id: item.id,
       name: item.title,
     }))),
+    activeTab: 0,
     defaultSelectedValue: 0,
   });
   dropdownNames.value.push({ 
@@ -71,6 +75,7 @@ onMounted(async () => {
       id: item.id,
       name: item.title,
     }))),
+    activeTab: 0,
     defaultSelectedValue: 0,
   });
 })