快乐的梦鱼 1 неделя назад
Родитель
Сommit
fa65a31ec8

+ 2 - 2
src/components/display/parse/Parse.vue

@@ -14,7 +14,7 @@ export interface ParseProps {
   /**
    * HTML解析内容
    */
-  content: string;
+  content?: string|null|undefined;
   /**
    * 标签样式。键为标签名,值为样式
    */
@@ -84,7 +84,7 @@ const parseHtml = (html: string): ParseNode[] => {
 };
 
 // 计算属性,获取解析后的节点树
-const nodes = computed(() => parseHtml(props.content));
+const nodes = computed(() => parseHtml(props.content || ''));
 </script>
 
 <style scoped>

+ 47 - 2
src/components/display/parse/ParseNodeRender.vue

@@ -100,14 +100,59 @@ const props = withDefaults(defineProps<{
 });
 
 const tagStyle = inject<Ref<Record<string, string>>>('tagStyle', ref({}));
+const builtInStyles = {
+  // 标题标签
+  'h1': 'font-size: 2em; font-weight: bold; margin: 0.67em 0;',
+  'h2': 'font-size: 1.5em; font-weight: bold; margin: 0.83em 0;',
+  'h3': 'font-size: 1.17em; font-weight: bold; margin: 1em 0;',
+  'h4': 'font-size: 1em; font-weight: bold; margin: 1.33em 0;',
+  'h5': 'font-size: 0.83em; font-weight: bold; margin: 1.67em 0;',
+  'h6': 'font-size: 0.67em; font-weight: bold; margin: 2.33em 0;',
+  
+  // 段落和引用
+  'p': 'margin: 1em 0;',
+  'blockquote': 'margin: 1em 0; padding: 0 1em; border-left: 4px solid #ddd; color: #666;',
+  
+  // 列表
+  'ul': 'margin: 1em 0; padding-left: 2em;',
+  'ol': 'margin: 1em 0; padding-left: 2em;',
+  'li': 'margin: 0.5em 0;',
+  
+  // 强调标签
+  'b': 'font-weight: bold;',
+  'strong': 'font-weight: bold;',
+  'i': 'font-style: italic;',
+  'em': 'font-style: italic;',
+  'u': 'text-decoration: underline;',
+  'del': 'text-decoration: line-through;',
+  
+  // 代码相关
+  'code': 'font-family: monospace; background: #f5f5f5; padding: 0.2em 0.4em; border-radius: 3px;',
+  'pre': 'font-family: monospace; background: #f5f5f5; padding: 1em; border-radius: 3px; overflow: auto;',
+  
+  // 其他内联标签
+  'mark': 'background-color: #ffeb3b; padding: 0.2em;',
+  'sup': 'font-size: 0.83em; vertical-align: super;',
+  'sub': 'font-size: 0.83em; vertical-align: sub;',
+  'small': 'font-size: 0.83em;',
+  'large': 'font-size: 1.17em;',
+  
+  // 分隔线
+  'hr': 'border: 0; border-top: 1px solid #ddd; margin: 1em 0;'
+} as Record<string, string>;
 const style = computed(() => 
   [
     (props.node.attrs?.style || ''), 
+    (builtInStyles[props.node.tag] || ''),
+    isInline.value ? 'display:inline' : '',
     (tagStyle.value[props.node.tag] || ''),
-    isInline.value ? 'display:inline;' : '',
   ].join(';'),
 );
-const isInline = computed(() => ['span','a','large','small'].includes(props.node.tag));
+const isInline = computed(() => [
+  'span', 'a', 'large','small',
+  'i', 'b', 'em', 'strong', 'u', 'del',
+  'code', 'sup', 'sub', 'mark'
+].includes(props.node.tag));
 
 // 链接点击事件
 const linkTap = (e: any) => {

+ 0 - 6
src/pages.json

@@ -21,12 +21,6 @@
       }
     },
     {
-      "path": "pages/home/laws",
-      "style": {
-        "navigationBarTitleText": "政策法规"
-      }
-    },
-    {
       "path": "pages/introduction/news",
       "style": {
         "navigationBarTitleText": "闽南新鲜事",

+ 10 - 2
src/pages/article/data/CommonCategoryDynamicData.ts

@@ -46,6 +46,9 @@ export interface IHomeCommonCategoryDynamicDataCommonContent {
 export interface IHomeCommonCategoryDynamicDataSerializedApi {
   type: 'serializedApi',
   name: string,
+  params?: {
+    mainBodyColumnId?: string|number|number[],
+  },
   otherParams?: Record<string, any>,
 }
 export interface IHomeCommonCategoryDynamicDataRequest {
@@ -113,14 +116,19 @@ export async function doLoadDynamicListData(
           ...CommonCategorDynamicDropDownValuesToParams(dropDownValues, dropdownDefines || []),
         }) 
       , page, pageSize);
-    case 'serializedApi':
-      return (await CommonCategoryDynamicDataSerializedApi(item).getContentList(new GetContentListParams()
+    case 'serializedApi': {
+      const params = new GetContentListParams();
+      if (item.params?.mainBodyColumnId)
+        params.setMainBodyColumnId(item.params.mainBodyColumnId);
+      return (await CommonCategoryDynamicDataSerializedApi(item).getContentList(
+        params
         .setKeywords(keywords)
         .setSelfValues({
           ...item.otherParams,
           ...CommonCategorDynamicDropDownValuesToParams(dropDownValues, dropdownDefines || []),
         }) 
       , page, pageSize));
+    }
     case 'request':
       return (await CommonContent.request(
         item.url, 

+ 45 - 4
src/pages/article/data/DefaultCategory.json

@@ -192,7 +192,7 @@
                     "type": "serializedApi",
                     "name": "CharacterContent"
                   },
-                  "dataSolve": [ "inheritor", "ich", "common" ],
+                  "dataSolve": [ "inheritor" ],
                   "detailsPage": "/pages/introduction/character/details",
                   "morePage": ["/pages/article/data/list", { "pageConfigName": "character" }],
                   "type": ""
@@ -233,7 +233,7 @@
                   },
                   "dataSolve": [ "date" ],
                   "type": "",
-                  "morePage": "/pages/home/laws"
+                  "morePage": ["/pages/article/data/list", { "pageConfigName": "laws" }]
                 }
               ]
             }
@@ -778,8 +778,8 @@
                 "type": "serializedApi",
                 "name": "CharacterContent"
               },
-              "dataSolve": [ "common", "ich" ],
-              "detailsPage": "/pages/inhert/inheritor/details",
+              "dataSolve": [ "inheritor" ],
+              "detailsPage": "/pages/introduction/character/details",
               "itemType": "article-common",
               "showTotal": true,
               "dropdownDefines": []
@@ -921,6 +921,47 @@
           ]
         }
       }
+    },
+    {
+      "name": "laws",
+      "title": "政策法规",
+      "content": {
+        "type": "CommonList",
+        "props": {
+          "tabsScrollable": false,
+          "showTab": true,
+          "tabs": [
+            {
+              "text": "国家政策",
+              "type": "list",
+              "data": {
+                "type": "serializedApi",
+                "name": "PolicyContent",
+                "params": {
+                  "mainBodyColumnId": 360
+                }
+              },
+              "dataSolve": [ "common" ],
+              "detailsPage": "/pages/article/details",
+              "itemType": "article-common"
+            },
+            {
+              "text": "地方政策",
+              "type": "list",
+              "data": {
+                "type": "serializedApi",
+                "name": "PolicyContent",
+                "params": {
+                  "mainBodyColumnId": 361
+                }
+              },
+              "dataSolve": [ "common" ],
+              "detailsPage": "/pages/article/details",
+              "itemType": "article-common"
+            }
+          ]
+        }
+      }
     }
   ]
 }

+ 6 - 6
src/pages/home/index.vue

@@ -19,9 +19,9 @@
         >
           <Image 
             innerClass="logo"
-            src="https://mncdn.wenlvti.net/app_static/minnan/images/home/MainLogo.png"
-            :width="150"
-            :height="150"
+            src="https://mncdn.wenlvti.net/app_static/minnan/images/home/MainLogo1.png"
+            :width="140"
+            :height="85"
           />
           <view>
             <text class="title">{{pageContentDefine?.props.title || ''}}</text>
@@ -192,11 +192,11 @@ onShareAppMessage(() => {
     > view {
       display: flex;
       flex-direction: column;
-      margin-left: -20rpx;
+      margin-left: -30rpx;
     }
 
     .logo {
-      margin-left: -20rpx;
+      margin-left: -10rpx;
       margin-right: 0rpx;
     }
     
@@ -230,7 +230,7 @@ onShareAppMessage(() => {
       width: 180rpx;
       z-index: 2;
       height: auto;
-      opacity: 0.4;
+      opacity: 0.15;
     }
   }
 }

+ 1 - 1
src/pages/home/introduction.vue

@@ -31,7 +31,7 @@
         </view>
         <view 
           class="mt-3 d-flex flex-row justify-center align-center p-25 radius-base border-all-primary color-primary"
-          @click="navTo('./laws')"
+          @click="navTo('/pages/article/data/list', { pageConfigName: 'laws' })"
         >
           <text class="iconfont icon-task-history-4 size-lll mr-2"></text>
           <text>相关政策法规</text>

+ 0 - 47
src/pages/home/laws.vue

@@ -1,47 +0,0 @@
-<template>
-  <CommonListPage 
-    title="政策法规"
-    itemType="article-common"
-    showTotal
-    :dropDownNames="dropdownNames"
-    :load="loadData" 
-    :tabs="[{
-      id: 360,
-      text: '国家政策',
-    },{
-      id: 361,
-      text: '地方政策',
-    }]"
-  />
-  <!--  -->
-</template>
-
-<script setup lang="ts">
-import { ref } from 'vue';
-import CommonListPage, { type DropDownNames } from '@/pages/article/common/CommonListPage.vue';
-import { GetContentListParams } from '@/api/CommonContent';
-import PolicyContent from '@/api/introduction/PolicyContent';
-import { DateUtils } from '@imengyu/imengyu-utils';
-
-const dropdownNames = ref<DropDownNames[]>([]);
-
-async function loadData(
-  page: number, 
-  pageSize: number,
-  searchText: string,
-  dropDownValues: number[],
-  tabSelect: number,
-) {
-  const res = (await PolicyContent.getContentList(new GetContentListParams()
-    .setKeywords(searchText)
-    .setMainBodyColumnId(tabSelect)
-  , page, pageSize));
-  return { 
-    list: res.list.map((p) => ({ 
-      ...p, 
-      desc: DateUtils.formatDate(p.publishAt, 'yyyy-MM-dd'),
-    })), 
-    total: res.total 
-  }
-}
-</script>