Selaa lähdekoodia

🎨 按要求调整栏目

快乐的梦鱼 5 päivää sitten
vanhempi
commit
a9b296d940

+ 9 - 0
src/common/scss/common.scss

@@ -4,6 +4,15 @@
   color: #432A04;
   font-family: "SongtiSCBlack";
 
+  &.h2 {
+    font-size: 36rpx;
+    margin: 30rpx 0 20rpx 0;
+  }
+  &.h3 {
+    font-size: 30rpx;
+    margin: 20rpx 0 20rpx 0;
+  }
+
   .more {
     font-size: 30rpx;
   }

+ 1 - 0
src/pages/article/data/CommonCategoryBlocks.vue

@@ -6,6 +6,7 @@
       <HomeTitle 
         v-if="category.showTitle"
         :title="category.title"
+        :titleLevel="category.textLevel"
         :showMore="category.showMore !== false"
         :moreText="category.moreText || '更多'"
         @clickMore="category.morePage" 

+ 0 - 2
src/pages/article/data/CommonCategoryGlobalLoader.ts

@@ -1,7 +1,5 @@
 import { inject, provide, ref, type Ref } from "vue";
-import NotConfigue from "@/api/NotConfigue";
 import { showError } from "@/common/composeabe/ErrorDisplay";
-import ApiCofig from "@/common/config/ApiCofig";
 import DefaultCofig from "./DefaultCategory.json";
 import type { IHomeCommonCategoryDefine } from "./CommonCategoryDefine";
 import CommonCategoryApi from "./api/CommonCategoryApi";

+ 25 - 14
src/pages/article/data/CommonCategoryList.vue

@@ -21,6 +21,10 @@
           v-if="tabRenderDefines[tabId]?.type === 'nestCategory'" 
           :categoryDefine="tabRenderDefines[tabId].categoryDefine"
         />
+        <CommonCategoryBlocks
+          v-else-if="tabRenderDefines[tabId]?.type === 'list' && tabRenderDefines[tabId].preInsertCategorys?.length" 
+          :categoryDefine="tabRenderDefines[tabId].categoryDefine"
+        />
       </template>
     </CommonListPage>
 
@@ -33,7 +37,7 @@ import { computed, onMounted, ref, watch } from 'vue';
 import { injectCommonCategory } from './CommonCategoryGlobalLoader';
 import { navTo } from '@/components/utils/PageAction';
 import { doLoadDynamicCategoryDataMergeTypeGetColumns, doLoadDynamicDropdownData, doLoadDynamicListData } from './CommonCategoryDynamicData';
-import { CommonCategoryListTabNestCategoryDataToContent, type IHomeCommonCategoryDefine, type IHomeCommonCategoryListDefine, type IHomeCommonCategoryListTabDefine } from './CommonCategoryDefine';
+import { CommonCategoryListTabNestCategoryDataToContent, type IHomeCommonCategoryDefine, type IHomeCommonCategoryListDefine, type IHomeCommonCategoryListTabDefine, type IHomeCommonCategoryListTabNestCategoryItemDefine } from './CommonCategoryDefine';
 import { resolveCommonContentSolveProps } from '../common/CommonContent';
 import { waitTimeOut } from '@imengyu/imengyu-utils';
 import { formatError } from '@/common/composeabe/ErrorDisplay';
@@ -103,6 +107,9 @@ async function loadPageConfig() {
       if (tab.type === 'nestCategory') {
         tab.categorys = await doLoadDynamicCategoryDataMergeTypeGetColumns(tab.categorys)
         hasNestCategory = true;
+      } else if (tab.type === 'list') {
+        tab.preInsertCategorys = await doLoadDynamicCategoryDataMergeTypeGetColumns(tab.preInsertCategorys || [])
+        hasNestCategory = true;
       }
     }
 
@@ -160,26 +167,30 @@ const tabRenderDefines = computed(() => {
       const renderItem : RenderTabDefine = {
         ...item,
       };
+      function loadNestCategoryData(items: IHomeCommonCategoryListTabNestCategoryItemDefine[]) {
+        return items
+          .filter((item) => item.visible !== false)
+          .map((item) => {
+            return {
+              ...item,
+              showTitle: item.showTitle !== false,
+              title: item.text,
+              content: CommonCategoryListTabNestCategoryDataToContent(
+                item.data, item
+              ),
+              type: item.type as CategoryDefine['type'],
+            }
+          });
+      }
       switch (item.type) {
         default:
         case 'list':
+          renderItem.categoryDefine = loadNestCategoryData(item.preInsertCategorys || []);
           break;
         case 'jump':
           break;
         case 'nestCategory':
-          renderItem.categoryDefine = item.categorys
-            .filter((item) => item.visible !== false)
-            .map((item) => {
-              return {
-                ...item,
-                showTitle: item.showTitle !== false,
-                title: item.text,
-                content: CommonCategoryListTabNestCategoryDataToContent(
-                  item.data, item
-                ),
-                type: item.type as CategoryDefine['type'],
-              }
-            });
+          renderItem.categoryDefine = loadNestCategoryData(item.categorys);
           break;
       }
       result[i] = renderItem;

+ 271 - 61
src/pages/article/data/DefaultCategory.json

@@ -14,44 +14,74 @@
               "title": "常识一点通",
               "icon": "https://mncdn.wenlvti.net/app_static/minnan/images/home/IconMap.png",
               "size": 50,
-              "link": ["/pages/article/data/list", { "pageConfigName": "explore" }]
+              "link": [
+                "/pages/article/data/list",
+                {
+                  "pageConfigName": "explore"
+                }
+              ]
             },
             {
               "title": "闽南新鲜事",
               "icon": "https://mncdn.wenlvti.net/app_static/minnan/images/home/IconDoc.png",
               "size": 50,
-              "link": ["/pages/introduction/news", {}]
+              "link": [
+                "/pages/article/data/list",
+                {
+                  "pageConfigName": "news"
+                }
+              ]
             },
             {
               "title": "遗产报你知",
               "icon": "https://mncdn.wenlvti.net/app_static/minnan/images/home/IconIch.png",
               "size": 50,
-              "link": ["/pages/article/data/list", { "pageConfigName": "inhert" }]
+              "link": [
+                "/pages/article/data/list",
+                {
+                  "pageConfigName": "inhert"
+                }
+              ]
             },
             {
               "title": "文化新视角",
               "icon": "https://mncdn.wenlvti.net/app_static/minnan/images/home/IconReserch.png",
               "size": 50,
-              "link": ["/pages/article/data/list", { "pageConfigName": "research" }]
+              "link": [
+                "/pages/article/data/list",
+                {
+                  "pageConfigName": "research"
+                }
+              ]
             },
             {
               "title": "世界走透透",
               "icon": "https://mncdn.wenlvti.net/app_static/minnan/images/home/IconArtifact.png",
               "size": 50,
-              "link": ["/pages/article/data/list", { "pageConfigName": "communicate" }]
+              "link": [
+                "/pages/article/data/list",
+                {
+                  "pageConfigName": "communicate"
+                }
+              ]
             },
             {
               "title": "来厦门䢐迌",
               "icon": "https://mncdn.wenlvti.net/app_static/minnan/images/home/IconDiscover.png",
               "size": 50,
-              "link": ["/pages/article/data/list", { "pageConfigName": "travel" }]
+              "link": [
+                "/pages/article/data/list",
+                {
+                  "pageConfigName": "travel"
+                }
+              ]
             }
           ],
           "categorys": [
             {
               "text": "数据统计",
               "showTitle": false,
-              "blockProps" : {
+              "blockProps": {
                 "statsNameConfig": [
                   {
                     "name": "projects",
@@ -79,7 +109,7 @@
             },
             {
               "text": "文化地图",
-              "blockProps" : {
+              "blockProps": {
                 "mapConfigItems": [
                   {
                     "title": "非遗项目",
@@ -134,7 +164,9 @@
               },
               "showMore": false,
               "detailsPage": "/pages/inhert/intangible/details",
-              "dataSolve": [ "common" ],
+              "dataSolve": [
+                "common"
+              ],
               "type": "small-grid2"
             },
             {
@@ -145,7 +177,9 @@
               },
               "showTitle": false,
               "detailsPage": "/pages/inhert/artifact/details",
-              "dataSolve": [ "common" ],
+              "dataSolve": [
+                "common"
+              ],
               "type": "small-grid2"
             }
           ]
@@ -154,7 +188,7 @@
     },
     {
       "name": "explore",
-      "title": "闽南百科",
+      "title": "常识一点通",
       "content": {
         "type": "CommonList",
         "props": {
@@ -165,15 +199,33 @@
               "type": "nestCategory",
               "categorys": [
                 {
-                  "text": "文化概况",
+                  "text": "文化生态保护区",
                   "data": {
                     "type": "serializedApi",
                     "name": "HistoryContent"
                   },
-                  "dataSolve": [ "common" ],
+                  "dataSolve": [
+                    "common"
+                  ],
                   "type": ""
                 },
                 {
+                  "text": "世界闽南文化交流中心",
+                  "type": "",
+                  "data": {
+                    "type": "commonContent",
+                    "params": {
+                      "modelId": 18,
+                      "mainBodyColumnId": 232
+                    }
+                  }
+                },
+                {
+                  "text": "闽南文化",
+                  "type": "",
+                  "showMore": false
+                },
+                {
                   "text": "闽南百问",
                   "detailsPage": "/pages/article/details",
                   "itemType": "article-common",
@@ -184,7 +236,8 @@
                       "modelId": 18
                     }
                   },
-                  "type": "article"
+                  "type": "article",
+                  "textLevel": "h3"
                 },
                 {
                   "text": "历史人物",
@@ -192,10 +245,18 @@
                     "type": "serializedApi",
                     "name": "CharacterContent"
                   },
-                  "dataSolve": [ "inheritor" ],
+                  "dataSolve": [
+                    "inheritor"
+                  ],
                   "detailsPage": "/pages/introduction/character/details",
-                  "morePage": ["/pages/article/data/list", { "pageConfigName": "character" }],
-                  "type": ""
+                  "morePage": [
+                    "/pages/article/data/list",
+                    {
+                      "pageConfigName": "character"
+                    }
+                  ],
+                  "type": "",
+                  "textLevel": "h3"
                 },
                 {
                   "text": "民间习俗",
@@ -203,9 +264,12 @@
                     "type": "serializedApi",
                     "name": "CustomContent"
                   },
-                  "dataSolve": [ "common" ],
+                  "dataSolve": [
+                    "common"
+                  ],
                   "morePage": "/pages/introduction/custom/list",
-                  "type": ""
+                  "type": "",
+                  "textLevel": "h3"
                 },
                 {
                   "text": "艺术特色",
@@ -213,8 +277,11 @@
                     "type": "serializedApi",
                     "name": "FeatureContent"
                   },
-                  "dataSolve": [ "common" ],
-                  "type": ""
+                  "dataSolve": [
+                    "common"
+                  ],
+                  "type": "",
+                  "visible": false
                 },
                 {
                   "text": "海洋文化",
@@ -222,8 +289,11 @@
                     "type": "serializedApi",
                     "name": "SeaContent"
                   },
-                  "dataSolve": [ "common" ],
-                  "type": ""
+                  "dataSolve": [
+                    "common"
+                  ],
+                  "type": "",
+                  "visible": false
                 },
                 {
                   "text": "政策法规",
@@ -231,9 +301,17 @@
                     "type": "serializedApi",
                     "name": "PolicyContent"
                   },
-                  "dataSolve": [ "date" ],
+                  "dataSolve": [
+                    "date"
+                  ],
                   "type": "",
-                  "morePage": ["/pages/article/data/list", { "pageConfigName": "laws" }]
+                  "morePage": [
+                    "/pages/article/data/list",
+                    {
+                      "pageConfigName": "laws"
+                    }
+                  ],
+                  "visible": false
                 }
               ]
             }
@@ -258,7 +336,9 @@
                   "data": {
                     "type": "commonContent",
                     "params": {
-                      "mainBodyColumnId": [385],
+                      "mainBodyColumnId": [
+                        385
+                      ],
                       "modelId": 18
                     }
                   },
@@ -271,7 +351,9 @@
                   "data": {
                     "type": "commonContent",
                     "params": {
-                      "mainBodyColumnId": [375],
+                      "mainBodyColumnId": [
+                        375
+                      ],
                       "modelId": 18
                     }
                   },
@@ -288,7 +370,9 @@
                       "modelId": 18
                     }
                   },
-                  "dataSolve": [ "common" ],
+                  "dataSolve": [
+                    "common"
+                  ],
                   "detailsPage": "byContent",
                   "type": ""
                 },
@@ -301,7 +385,9 @@
                       "modelId": 18
                     }
                   },
-                  "dataSolve": [ "common" ],
+                  "dataSolve": [
+                    "common"
+                  ],
                   "detailsPage": "byContent",
                   "type": ""
                 },
@@ -314,7 +400,9 @@
                       "modelId": 18
                     }
                   },
-                  "dataSolve": [ "common" ],
+                  "dataSolve": [
+                    "common"
+                  ],
                   "detailsPage": "byContent",
                   "type": ""
                 },
@@ -327,7 +415,9 @@
                       "modelId": 18
                     }
                   },
-                  "dataSolve": [ "common" ],
+                  "dataSolve": [
+                    "common"
+                  ],
                   "detailsPage": "byContent",
                   "type": ""
                 },
@@ -341,7 +431,9 @@
                     }
                   },
                   "visible": false,
-                  "dataSolve": [ "common" ],
+                  "dataSolve": [
+                    "common"
+                  ],
                   "detailsPage": "byContent",
                   "type": ""
                 },
@@ -354,7 +446,9 @@
                       "modelId": 9
                     }
                   },
-                  "dataSolve": [ "common" ],
+                  "dataSolve": [
+                    "common"
+                  ],
                   "detailsPage": "byContent",
                   "type": "horizontal-large"
                 },
@@ -367,7 +461,9 @@
                       "modelId": 18
                     }
                   },
-                  "dataSolve": [ "common" ],
+                  "dataSolve": [
+                    "common"
+                  ],
                   "detailsPage": "byContent",
                   "visible": false,
                   "type": ""
@@ -384,7 +480,9 @@
                     "type": "serializedApi",
                     "name": "TeamsContent"
                   },
-                  "dataSolve": [ "common" ],
+                  "dataSolve": [
+                    "common"
+                  ],
                   "detailsPage": "byContent",
                   "type": ""
                 },
@@ -394,7 +492,9 @@
                     "type": "serializedApi",
                     "name": "DiscussContent"
                   },
-                  "dataSolve": [ "common" ],
+                  "dataSolve": [
+                    "common"
+                  ],
                   "detailsPage": "byContent",
                   "type": ""
                 },
@@ -404,7 +504,9 @@
                     "type": "serializedApi",
                     "name": "ResultContent"
                   },
-                  "dataSolve": [ "common" ],
+                  "dataSolve": [
+                    "common"
+                  ],
                   "detailsPage": "byContent",
                   "type": ""
                 }
@@ -431,11 +533,17 @@
                   "data": {
                     "type": "commonContent",
                     "params": {
-                      "mainBodyColumnId": [260, 261, 262],
+                      "mainBodyColumnId": [
+                        260,
+                        261,
+                        262
+                      ],
                       "modelId": 18
                     }
                   },
-                  "dataSolve": [ "common" ]
+                  "dataSolve": [
+                    "common"
+                  ]
                 },
                 {
                   "text": "闽南语在线课程",
@@ -456,7 +564,9 @@
                     "mainBodyColumnId": 366,
                     "modelId": 18
                   },
-                  "dataSolve": [ "common" ],
+                  "dataSolve": [
+                    "common"
+                  ],
                   "detailsPage": "byContent"
                 }
               ]
@@ -482,7 +592,9 @@
                   "data": {
                     "type": "commonContent",
                     "params": {
-                      "mainBodyColumnId": [315],
+                      "mainBodyColumnId": [
+                        315
+                      ],
                       "modelId": 16
                     }
                   },
@@ -531,7 +643,9 @@
                       "modelId": 18
                     }
                   },
-                  "dataSolve": [ "common" ],
+                  "dataSolve": [
+                    "common"
+                  ],
                   "detailsPage": "byContent",
                   "type": ""
                 },
@@ -540,7 +654,12 @@
                   "data": {
                     "type": "commonContent",
                     "params": {
-                      "mainBodyColumnId": [274,275,276,277],
+                      "mainBodyColumnId": [
+                        274,
+                        275,
+                        276,
+                        277
+                      ],
                       "modelId": 17
                     }
                   },
@@ -570,7 +689,9 @@
                 "type": "serializedApi",
                 "name": "SeminarContent"
               },
-              "dataSolve": [ "ich" ],
+              "dataSolve": [
+                "ich"
+              ],
               "detailsPage": "/pages/inhert/seminar/details",
               "dropdownDefines": [
                 {
@@ -603,7 +724,9 @@
                 "type": "serializedApi",
                 "name": "UnitContent"
               },
-              "dataSolve": [ "ich" ]
+              "dataSolve": [
+                "ich"
+              ]
             }
           ]
         }
@@ -628,7 +751,9 @@
                 "type": "serializedApi",
                 "name": "ProjectsContent"
               },
-              "dataSolve": [ "ich" ],
+              "dataSolve": [
+                "ich"
+              ],
               "detailsPage": "/pages/inhert/intangible/details",
               "dropdownDefines": [
                 {
@@ -677,7 +802,9 @@
                 "type": "serializedApi",
                 "name": "SeminarContent"
               },
-              "dataSolve": [ "ich" ],
+              "dataSolve": [
+                "ich"
+              ],
               "detailsPage": "/pages/inhert/seminar/details",
               "dropdownDefines": [
                 {
@@ -700,7 +827,9 @@
                 "type": "serializedApi",
                 "name": "UnitContent"
               },
-              "dataSolve": [ "ich" ]
+              "dataSolve": [
+                "ich"
+              ]
             }
           ]
         }
@@ -721,7 +850,9 @@
                 "type": "serializedApi",
                 "name": "UnmoveableContent"
               },
-              "dataSolve": [ "ich" ],
+              "dataSolve": [
+                "ich"
+              ],
               "detailsPage": "/pages/inhert/artifact/details",
               "itemType": "image-large-2",
               "showTotal": true,
@@ -778,7 +909,9 @@
                 "type": "serializedApi",
                 "name": "CharacterContent"
               },
-              "dataSolve": [ "inheritor" ],
+              "dataSolve": [
+                "inheritor"
+              ],
               "detailsPage": "/pages/introduction/character/details",
               "itemType": "article-common",
               "showTotal": true,
@@ -807,8 +940,16 @@
                     "type": "serializedApi",
                     "name": "ProjectsContent"
                   },
-                  "dataSolve": [ "ich" ],
-                  "morePage": ["/pages/article/data/list", { "pageConfigName": "intangible", "tab": 0 }],
+                  "dataSolve": [
+                    "ich"
+                  ],
+                  "morePage": [
+                    "/pages/article/data/list",
+                    {
+                      "pageConfigName": "intangible",
+                      "tab": 0
+                    }
+                  ],
                   "detailsPage": "/pages/inhert/intangible/details",
                   "type": "horizontal-large"
                 },
@@ -818,7 +959,9 @@
                     "type": "serializedApi",
                     "name": "InheritorContent"
                   },
-                  "dataSolve": [ "ich" ],
+                  "dataSolve": [
+                    "ich"
+                  ],
                   "morePage": "/pages/inhert/inheritor/list",
                   "detailsPage": "/pages/inhert/inheritor/details",
                   "type": "horizontal-large"
@@ -829,7 +972,9 @@
                     "type": "serializedApi",
                     "name": "UnitContent"
                   },
-                  "dataSolve": [ "ich" ],
+                  "dataSolve": [
+                    "ich"
+                  ],
                   "morePage": "/pages/inhert/unit/list",
                   "type": "simple-text"
                 },
@@ -839,8 +984,16 @@
                     "type": "serializedApi",
                     "name": "SeminarContent"
                   },
-                  "dataSolve": [ "ich" ],
-                  "morePage": ["/pages/article/data/list", { "pageConfigName": "seminar", "tab": 0 }],
+                  "dataSolve": [
+                    "ich"
+                  ],
+                  "morePage": [
+                    "/pages/article/data/list",
+                    {
+                      "pageConfigName": "seminar",
+                      "tab": 0
+                    }
+                  ],
                   "detailsPage": "/pages/inhert/seminar/details",
                   "type": ""
                 },
@@ -853,7 +1006,9 @@
                       "modelId": 18
                     }
                   },
-                  "dataSolve": [ "common" ],
+                  "dataSolve": [
+                    "common"
+                  ],
                   "detailsPage": "byContent",
                   "type": "large-grid2"
                 }
@@ -866,8 +1021,16 @@
                 "type": "serializedApi",
                 "name": "UnmoveableContent"
               },
-              "dataSolve": [ "ich" ],
-              "morePage": ["/pages/article/data/list", { "pageConfigName": "artifact", "tab": 0 }],
+              "dataSolve": [
+                "ich"
+              ],
+              "morePage": [
+                "/pages/article/data/list",
+                {
+                  "pageConfigName": "artifact",
+                  "tab": 0
+                }
+              ],
               "detailsPage": "/pages/inhert/artifact/details",
               "itemType": "image-large-2",
               "dropdownDefines": [
@@ -913,10 +1076,27 @@
                   "modelId": 17
                 }
               },
-              "dataSolve": [ "ich" ],
+              "dataSolve": [
+                "ich"
+              ],
               "detailsPage": "/pages/inhert/artifact/details",
               "itemType": "image-large-2",
               "dropdownDefines": []
+            },
+            {
+              "text": "世界文化遗产",
+              "type": "list",
+              "data": {
+                "type": "commonContent",
+                "params": {
+                  "modelId": 17,
+                  "mainBodyColumnId": 310
+                }
+              },
+              "dropdownDefines": [],
+              "dataSolve": [
+                "ich"
+              ]
             }
           ]
         }
@@ -938,13 +1118,43 @@
                 "type": "serializedApi",
                 "name": "PolicyContent"
               },
-              "dataSolve": [ "date" ],
+              "dataSolve": [
+                "date"
+              ],
               "detailsPage": "/pages/article/details",
               "itemType": "article-common"
             }
           ]
         }
       }
+    },
+    {
+      "name": "news",
+      "title": "闽南新鲜事",
+      "content": {
+        "type": "CommonList",
+        "props": {
+          "showTab": false,
+          "showSearch": true,
+          "showTotal": false,
+          "tabs": [
+            {
+              "text": "新 Tab",
+              "type": "list",
+              "data": {
+                "type": "serializedApi",
+                "name": "NewsIndexContent"
+              },
+              "visible": false,
+              "dataSolve": [
+                "form",
+                "common"
+              ]
+            }
+          ],
+          "itemType": "article-common"
+        }
+      }
     }
   ]
 }

+ 9 - 0
src/pages/article/data/defines/List.ts

@@ -72,6 +72,10 @@ export interface IHomeCommonCategoryListTabListDropdownDefine {
 export interface IHomeCommonCategoryListTabListDefine {
   type: 'list',
   /**
+   * 前缀嵌套子分类项定义
+   */
+  preInsertCategorys?: IHomeCommonCategoryListTabNestCategoryItemDefine[],
+  /**
    * 列表选项卡数据
    */
   data?: IHomeCommonCategoryDynamicData,
@@ -123,6 +127,11 @@ export interface IHomeCommonCategoryListTabNestCategoryItemDefine {
    */
   text: string,
   /**
+   * 子分类项标题级别
+   * @default 'h2'
+   */
+  textLevel?: 'h1'|'h2'|'h3',
+  /**
    * 是否显示标题
    * @default true
    */

+ 22 - 6
src/pages/article/data/editor/components/KeyValueEditor.vue

@@ -1,12 +1,12 @@
 <template>
   <div class="key-value-editor">
-    <a-button type="dashed" block @click="modalVisible = true">
-      {{ itemCount }} 条
+    <a-button class="preview-button" type="dashed" block @click="modalVisible = true">
+      {{ '{ ' + objectPreview + '}' }}
     </a-button>
     <a-modal
       v-model:open="modalVisible"
       title="键值编辑"
-      width="640px"
+      width="940px"
       :footer="null"
       destroy-on-close
     >
@@ -78,7 +78,21 @@ type LocalItem = {
 const modalVisible = ref(false);
 const localItems = ref<LocalItem[]>([]);
 
-const itemCount = computed(() => localItems.value.length);
+const objectPreview = computed(() => {
+  return localItems.value.map((item) => {
+    let value = '';
+    if (item.type === 'object' || item.type === 'array') {
+      value = '...';
+    } else if (item.type === 'string') {
+      value = `'${item.value}'`;
+    } else if (item.type === 'null') {
+      value = 'null';
+    } else {
+      value = item.value.toString();
+    }
+    return `${item.key}: ${value}`
+  }).join(', ');
+});
 
 function getType(value: any): LocalItem['type'] {
   if (value === null) {
@@ -173,7 +187,9 @@ const removeItem = (key: string) => {
 .key-value-editor {
   width: 100%;
 }
-
+.preview-button {
+  max-width: 400px;
+}
 .key-value-container {
   width: 100%;
   max-height: 500px;
@@ -182,7 +198,7 @@ const removeItem = (key: string) => {
 
 .key-value-item {
   display: flex;
-  align-items: center;
+  align-items: flex-start;
   margin-bottom: 8px;
 }
 

+ 2 - 2
src/pages/article/data/editor/components/LinkPathEditor.vue

@@ -1,12 +1,12 @@
 <template>
   <a-form-item class="link-path-editor" label="跳转路径">
     <a-collapse v-model:activeKey="activeKey" ghost>
-      <a-collapse-panel key="1" header="设置">
+      <a-collapse-panel key="1" header="点击展开">
         <a-form-item>
           <div class="path-selector">
             <a-select 
               v-model:value="pathType" 
-              style="width: 150px; margin-right: 8px"
+              style="width: 120px; margin-right: 8px"
             >
               <a-select-option v-if="!props.noParams" value="dynamic-list">动态页面列表</a-select-option>
               <a-select-option value="internal">程序内置页面</a-select-option>

+ 4 - 1
src/pages/article/data/editor/editors/CommonListPropsEditor.vue

@@ -61,6 +61,9 @@
                   <a-form-item label="数据处理显示">
                     <DataSolveEditor v-model="tab.dataSolve" />
                   </a-form-item>
+                  <a-form-item label="前缀子栏目">
+                    <NestCategoryEditor v-model:categorys="tab.preInsertCategorys" />
+                  </a-form-item>
                 </template>
                 <template v-else-if="tab.type === 'jump'">
                   <a-form-item label="跳转URL">
@@ -75,7 +78,7 @@
                 </template>
                 <template v-else-if="tab.type === 'nestCategory'">
                   <a-form-item label="子栏目">
-                    <NestCategoryEditor :categorys="tab.categorys" />
+                    <NestCategoryEditor v-model:categorys="tab.categorys" />
                   </a-form-item>
                 </template>
                 <a-popconfirm

+ 1 - 1
src/pages/article/data/editor/editors/HomePropsEditor.vue

@@ -37,7 +37,7 @@
       </a-collapse-panel>
 
       <a-collapse-panel key="categorys" header="首页栏目">
-        <NestCategoryEditor :categorys="props.props.categorys" />
+        <NestCategoryEditor v-model:categorys="props.props.categorys" />
       </a-collapse-panel>
     </a-collapse>
   </div>

+ 32 - 9
src/pages/article/data/editor/subpart/NestCategoryEditor.vue

@@ -20,6 +20,13 @@
             <a-form-item label="标题">
               <a-input v-model:value="cat.text" />
             </a-form-item>
+            <a-form-item label="标题级别">
+              <a-select v-model:value="cat.textLevel" style="width: 100%" allowClear placeholder="请选择标题级别">
+                <a-select-option v-for="level in titleLevels" :key="level" :value="level">
+                  {{ level }}
+                </a-select-option>
+              </a-select>
+            </a-form-item>
             <a-form-item label="显示更多">
               <a-checkbox 
                 v-model:checked="cat.showMore" 
@@ -45,6 +52,9 @@
             <a-form-item label="数据源">
               <DynamicDataEditor v-model="cat.data" />
             </a-form-item>
+            <a-form-item label="单元属性">
+              <KeyValueEditor v-model="cat.blockProps" />
+            </a-form-item>
             <a-form-item label="加载数量">
               <a-input-number v-model:value="cat.count" :min="1" style="width: 100%" />
             </a-form-item>
@@ -55,7 +65,7 @@
               <ItemTypeEditor v-model="cat.itemType" />
             </a-form-item>
             <a-form-item label="列表页详情页">
-              <a-input v-model:value="cat.detailsPage" />
+              <LinkPathEditor v-model:value="cat.detailsPage" :noParams="true" />
             </a-form-item>
             <a-popconfirm title="确定删除该子分类吗?" @confirm="remove(i)">
               <a-button type="link" danger size="small">删除子分类</a-button>
@@ -81,44 +91,57 @@ import { CommonCategoryBlockType } from '../../CommonCategoryBlocks';
 import ItemTypeEditor from '../components/ItemTypeEditor.vue';
 import { ArrowUpOutlined, ArrowDownOutlined, CopyOutlined } from '@ant-design/icons-vue';
 import { ArrayUtils } from '@imengyu/imengyu-utils';
+import KeyValueEditor from '../components/KeyValueEditor.vue';
 
 const props = defineProps<{
-  categorys: IHomeCommonCategoryListTabNestCategoryItemDefine[];
+  categorys: IHomeCommonCategoryListTabNestCategoryItemDefine[]|undefined;
+}>();
+const emit = defineEmits<{
+  (e: 'update:categorys', categorys: IHomeCommonCategoryListTabNestCategoryItemDefine[]): void;
 }>();
 
 const blockTypes = CommonCategoryBlockType;
+const titleLevels = ['h1', 'h2', 'h3'];
 
+function getCategorys() {
+  if (!props.categorys) {
+    const newArray = [] as IHomeCommonCategoryListTabNestCategoryItemDefine[];
+    emit('update:categorys', newArray);
+    return newArray;
+  }
+  return props.categorys;
+}
 function add() {
-  props.categorys.push({
+  getCategorys().push({
     text: '新子分类',
     type: '',
     data: undefined as unknown as IHomeCommonCategoryDynamicData,
   });
 }
 function remove(i: number) {
-  props.categorys.splice(i, 1);
+  getCategorys().splice(i, 1);
 }
 async function paste() {
-  const data = await uni.getClipboardData();
+  const data = (await uni.getClipboardData()).data;
   if (typeof data === 'string') {
     const json = JSON.parse(data);
     if (json.type === 'Copy:NestCategoryItem') {
-      props.categorys.push(json.data);
+      getCategorys().push(json.data);
     }
   }
 }
 
 function moveUp(i: number) {
-  ArrayUtils.upData(props.categorys, i);
+  ArrayUtils.upData(getCategorys(), i);
 }
 function moveDown(i: number) {
-  ArrayUtils.downData(props.categorys, i);
+  ArrayUtils.downData(getCategorys(), i);
 }
 function copy(i: number) {
   uni.setClipboardData({
     data: JSON.stringify({
       type: 'Copy:NestCategoryItem',
-      data: props.categorys[i]
+      data: getCategorys()[i]
     }),
   });
   uni.showToast({

+ 7 - 38
src/pages/blocks/StatsBlock.vue

@@ -1,46 +1,15 @@
 <template>
   <!-- 数据统计 -->
   <SimplePageContentLoader :loader="statsLoader">
-    <view v-if="statsLoader.content.value" class="d-flex flex-col justify-center mt-3 pt-3 pb-3 bg-light-page radius-base">
-      <view class="d-flex flex-col">
+    <view class="d-flex flex-col">
+      <template v-for="value in statsLoader.content.value" :key="value.type">
+        <view class="border-top-light-primary pt-2 mt-3"></view>
         <StatsText
-          :title="statsLoader.content.value[0].title" 
-          :data="statsLoader.content.value[0].datas" 
-          :type="statsLoader.content.value[0].type" 
+          :title="value.title" 
+          :data="value.datas" 
+          :type="value.type" 
         />
-        <view class="p-2">
-          <HorizontalScrollText :text="statsText1" :fontSize="26" color="text.second" :outerStyle="{ height: '40rpx' }" />
-        </view>
-      </view>
-      <view class="border-top-light-primary pt-2 mt-3"></view>
-      <view class="d-flex flex-col">
-        <StatsText
-          :title="statsLoader.content.value[1].title" 
-          :data="statsLoader.content.value[1].datas" 
-          :type="statsLoader.content.value[1].type" 
-        />
-        <view class="p-2">
-          <HorizontalScrollText :text="statsText2" :fontSize="26" color="text.second" :outerStyle="{ height: '40rpx' }" />
-        </view>
-      </view>
-      <view class="border-top-light-primary pt-2 mt-3"></view>
-      <StatsText
-        :title="statsLoader.content.value[2].title" 
-        :data="statsLoader.content.value[2].datas" 
-        :type="statsLoader.content.value[2].type" 
-      />
-      <view class="border-top-light-primary pt-2 mt-3"></view>
-      <StatsText
-        :title="statsLoader.content.value[3].title" 
-        :data="statsLoader.content.value[3].datas" 
-        :type="statsLoader.content.value[3].type" 
-      />
-      <view class="border-top-light-primary pt-2 mt-3"></view>
-      <StatsText
-        :title="statsLoader.content.value[4].title" 
-        :data="statsLoader.content.value[4].datas" 
-        :type="statsLoader.content.value[4].type" 
-      />
+      </template>
     </view>
   </SimplePageContentLoader>
 </template>

+ 8 - 1
src/pages/parts/HomeTitle.vue

@@ -2,6 +2,7 @@
   <view 
     :class="[
       'home-title',
+      titleLevel,
       showMore ? 'has-more' : '',
       inWing ? 'wing-l in-wing' : '',
     ]"
@@ -17,6 +18,8 @@
 </template>
 
 <script setup lang="ts">
+import type { PropType } from 'vue';
+
 defineProps({	
   title: {
     type: String,
@@ -33,7 +36,11 @@ defineProps({
   showMore: {
     type: Boolean,
     default: false,
-  }
+  },
+  titleLevel: {
+    type: String as PropType<'h1'|'h2'|'h3'>,
+    default: 'h1',
+  },
 })
 defineEmits(['clickMore'])
 </script>