浏览代码

📦 按要求修改细节问题

imengyu 4 周之前
父节点
当前提交
966ebd3900

+ 12 - 0
src/common/utils/StringUtils.ts

@@ -209,6 +209,18 @@ const StringUtils = {
   convertPhoneToUserName(str: string): string{
     return '尾号' + str.substring(str.length - 4) + '用户';
   },
+  /**
+   * 字符串截取
+   * @param str 
+   * @param len 
+   * @returns 
+   */
+  cutString(str: string, len: number) : string {
+    if(str.length > len) {
+      str = str.substring(0, len) + '...';
+    }
+    return str;
+  }
 }
 
 export default StringUtils;

+ 7 - 0
src/pages.json

@@ -33,6 +33,13 @@
       }
     },
     {
+      "path": "pages/introduction/custom/list",
+      "style": {
+        "navigationBarTitleText": "闽南民俗",
+        "enablePullDownRefresh": true
+      }
+    },
+    {
       "path": "pages/introduction/character/details",
       "style": {
         "navigationBarTitleText": "历史人物详情"

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

@@ -281,6 +281,14 @@ function handleChangeDropDownValue(index: number, value: number) {
   dropDownValues.value[index] = value;
   listLoader.loadData(undefined, true);
 }
+function handleTabClick(e: any) {
+  if (e.jump) {
+    e.jump();
+    return;
+  }
+  tabCurrentIndex.value = e.index;
+  listLoader.loadData(undefined, true);
+}
 function doSearch() {
   listLoader.loadData(undefined, true);
 }
@@ -302,13 +310,11 @@ function goDetails(item: any, id: number) {
   })
 }
 
-function handleTabClick(e: any) {
-  if (e.jump) {
-    e.jump();
-    return;
+function loadDropDownValues() {
+  dropDownValues.value = [];
+  for (const element of props.dropDownNames) {
+    dropDownValues.value.push(element.defaultSelectedValue);
   }
-  tabCurrentIndex.value = e.index;
-  listLoader.loadData(undefined, true);
 }
 
 watch(tabCurrentIndex, () => {
@@ -319,6 +325,9 @@ watch(() => props.startTabIndex, () => {
     tabCurrentIndex.value = props.startTabIndex;
   }
 });
+watch(() => props.dropDownNames, () => {
+  loadDropDownValues();
+});
 
 defineExpose({
   load: () => {
@@ -332,8 +341,7 @@ onMounted(() => {
       tabCurrentIndex.value = props.startTabIndex;
     if (props.title)
       uni.setNavigationBarTitle({ title: props.title, })
-    for (const element of props.dropDownNames)
-      dropDownValues.value.push(element.defaultSelectedValue);
+    loadDropDownValues();
     if (props.loadMounted)
       listLoader.loadData(undefined, true);
   }, 300);

+ 2 - 0
src/pages/article/common/IntroBlock.vue

@@ -90,6 +90,8 @@ const emit = defineEmits([
       color: #312520;
       font-weight: 400;
       text-align: right;
+      max-width: 500rpx;
+      flex-shrink: 1;
     }
   }
   .sub-title{

+ 2 - 8
src/pages/discover.vue

@@ -211,15 +211,9 @@ const categories = [
     }) 
   },
   { 
-    name: '民俗文化', 
+    name: '闽南民俗', 
     icon: CategoryIcon1  , 
-    onClick: () => navTo('/pages/article/common/list', {
-      title: '民俗文化',
-      mainBodyColumnId: '245,248',
-      modelId: 4,
-      itemType: 'article-common',
-      detailsPage: '/pages/article/details',
-    }) 
+    onClick: () => navTo('/pages/introduction/custom/list') 
   },
   { 
     name: '美术技艺', 

+ 2 - 8
src/pages/home.vue

@@ -242,15 +242,9 @@ const subTabs = [
   },
   { name: '历史人物', icon: MainBoxIcon3, onClick: () => navTo('/pages/introduction/character/list') },
   { 
-    name: '民俗信俗', 
+    name: '闽南民俗', 
     icon: MainBoxIcon4, 
-    onClick: () => navTo('/pages/article/common/list', {
-      title: '民俗信俗', 
-      mainBodyColumnId: 299,
-      modelId: 18,
-      itemType: 'article-common',
-      detailsPage: '/pages/article/details',
-    }) 
+    onClick: () => navTo('/pages/introduction/custom/list')
   },
 ];
 

+ 3 - 2
src/pages/inhert/intangible/DetailsCommon.vue

@@ -102,8 +102,8 @@
     </template>
     <template #titleEnd="{ content }">
       <u-tag 
-        v-if="content.levelText"
-        :text="content.levelText"
+        v-if="content.levelText && content.title.length <= 10"
+        :text="StringUtils.cutString(content.levelText as string, 4)"
         size="mini" plain color="#d9492e"
         class="flex-shrink-0"
       />
@@ -156,6 +156,7 @@ import InheritorContent from "@/api/inheritor/InheritorContent";
 import ProductsContent from "@/api/inheritor/ProductsContent";
 import SeminarContent from "@/api/inheritor/SeminarContent";
 import ImagesUrls from "@/common/config/ImagesUrls";
+import StringUtils from "@/common/utils/StringUtils";
 
 defineProps({	
   commonRefName : {

+ 7 - 1
src/pages/inhert/intangible/list.vue

@@ -1,5 +1,6 @@
 <template>
   <CommonListPage 
+    ref="list"
     title="非遗"
     itemType="image-large-2"
     showTotal
@@ -19,6 +20,7 @@
     :tabsScrollable="true"
     :startTabIndex="startTab"
     :load="loadData" 
+    :loadMounted="false"
   />
 </template>
 
@@ -30,8 +32,10 @@ import SeminarContent from '@/api/inheritor/SeminarContent';
 import { navTo } from '@/common/utils/PageAction';
 import CommonListPage, { type DropDownNames } from '@/pages/article/common/CommonListPage.vue';
 import { onLoad } from '@dcloudio/uni-app';
+import { waitTimeOut } from '@imengyu/imengyu-utils';
 import { onMounted, ref } from 'vue';
 
+const list = ref();
 const dropdownNames = ref<DropDownNames[]>([]);
 const startTab = ref(0);
 async function loadData(
@@ -91,7 +95,7 @@ onLoad(async (querys) => {
       name: item.title,
     }))),
     activeTab: [0,3],
-    defaultSelectedValue: querys?.level ? (levels.find(p => p.title == querys.level)?.id ?? 0) : 0,
+    defaultSelectedValue: querys?.level ? (levels.find(p => p.title == querys.level || p.title.includes(querys.level))?.id ?? 0) : 0,
   });
   dropdownNames.value.push({ 
     options: [{
@@ -104,5 +108,7 @@ onLoad(async (querys) => {
     activeTab: [0],
     defaultSelectedValue: 0,
   });
+  await waitTimeOut(800);
+  list.value.load();
 })
 </script>

+ 1 - 0
src/pages/inhert/village/list.vue

@@ -9,6 +9,7 @@
     :load="loadData" 
     :tabs="tabs"
     :startTabIndex="1"
+    :loadMounted="false"
     @goCustomDetails="goDetails"
   />
 </template>

+ 63 - 0
src/pages/introduction/custom/list.vue

@@ -0,0 +1,63 @@
+<template>
+  <CommonListPage 
+    title="闽南民俗"
+    itemType="image-large-2"
+    :detailsPage="[
+      '/pages/inhert/intangible/details',
+      '/pages/article/details',
+    ]"
+    showTotal
+    :dropDownNames="dropdownNames"
+    :load="loadData" 
+    :tabs="[
+      { id: 0, name: '非遗民俗' },
+      { id: 1, name: '民俗资讯' },
+    ]"
+    :detailsParams="{
+      modelId: 4,
+    }"
+  />
+</template>
+
+<script setup lang="ts">
+import { ref } from 'vue';
+import CommonListPage, { type DropDownNames } from '@/pages/article/common/CommonListPage.vue';
+import CommonContent, { GetContentListParams } from '@/api/CommonContent';
+import ProjectsContent from '@/api/inheritor/ProjectsContent';
+
+const dropdownNames = ref<DropDownNames[]>([]);
+
+async function loadData(
+  page: number, 
+  pageSize: number,
+  searchText: string,
+  dropDownValues: number[],
+  tabSelect: number,
+) {
+  let res;
+  switch (tabSelect) {
+    case 0:
+      res = await ProjectsContent.getContentList(new GetContentListParams()
+        .setKeywords('民俗 ' + searchText)
+      , page, pageSize);
+      res.list.forEach((item) => {
+        item.bottomTags = [
+          item.levelText, 
+          item.ichTypeText, 
+          item.batchText,
+          item.regionText,
+        ]
+      })
+      break;
+    case 1:
+    default:
+      res = await CommonContent.getContentList(new GetContentListParams()
+        .setKeywords(searchText)
+        .setModelId(4)
+        .setMainBodyColumnId([ 245,248 ])
+      , page, pageSize);
+      break;
+  }
+  return { list: res.list, total: res.total }
+}
+</script>

+ 9 - 1
src/pages/introduction/food/list.vue

@@ -4,7 +4,7 @@
     itemType="image-large-2"
     :detailsPage="[
       '/pages/inhert/intangible/details',
-      '/pages/article/common/details',
+      '/pages/article/details',
     ]"
     showTotal
     :dropDownNames="dropdownNames"
@@ -37,6 +37,14 @@ async function loadData(
       res = await ProjectsContent.getContentList(new GetContentListParams()
         .setKeywords('美食 ' + searchText)
       , page, pageSize);
+      res.list.forEach((item) => {
+        item.bottomTags = [
+          item.levelText, 
+          item.ichTypeText, 
+          item.batchText,
+          item.regionText,
+        ]
+      })
       break;
     case 1:
     default:

+ 6 - 0
src/pages/parts/RoundTags.vue

@@ -6,6 +6,12 @@
       v-for="(tag, k) in tags"
       :key="k" 
       class="bg-place mr-2 mb-2"
+      :style="{
+        maxWidth: '160rpx',
+        overflow: 'hidden',
+        textOverflow: 'ellipsis',
+        whiteSpace: 'nowrap',
+      }"
       :class="[
         tag ? '' : 'd-none',
         small ? 'radius-l p-2 pt-0 pb-1' : 'radius-ll p-25 pt-1',

+ 2 - 2
src/pages/travel.vue

@@ -176,10 +176,10 @@ const subTabs = [
     }) 
   },
   { 
-    name: '重点区域', 
+    name: '非旅融合', 
     icon: CategoryIcon5 , 
     onClick: () => navTo('/pages/article/common/list', {
-      title: '重点区域',
+      title: '非遗与旅游融合发展推荐',
       mainBodyColumnId: 278,
       modelId: 17,
       itemType: 'article-common',