快乐的梦鱼 8 часов назад
Родитель
Сommit
736fcf9b3e

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

@@ -2,6 +2,8 @@
   <a-select
     style="width: 100%"
     v-model:value="localValue"
+    allowClear
+    :placeholder="`列表项类型,默认${CommonListPageItemTypeOptions[0].label}`"
     :options="CommonListPageItemTypeOptions"
     @change="updateValue"
   />

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

@@ -43,7 +43,7 @@
               placeholder="请选择动态页面"
             >
               <a-select-option 
-                v-for="page in pageList" 
+                v-for="page in pageListFiltered" 
                 :key="page.name" 
                 :value="page.name"
               >
@@ -91,7 +91,7 @@
 </template>
 
 <script setup lang="ts">
-import { inject, ref, watch, computed } from 'vue';
+import { inject, ref, watch, computed, type Ref } from 'vue';
 import { EditOutlined, DatabaseOutlined } from '@ant-design/icons-vue';
 import KeyValueEditor from './KeyValueEditor.vue';
 import type { IHomeCommonCategoryDefine } from '@/pages/article/data/CommonCategoryDefine';
@@ -148,7 +148,19 @@ const emit = defineEmits<{
   (e: 'update:modelValue', value: string): void;
 }>();
 
-const pageList = inject<(IHomeCommonCategoryDefine['page'][0])[]>('pageList', []);
+const pageList = inject<Ref<(IHomeCommonCategoryDefine['page'][0])[]>>('pageList', ref([]));
+const pageListFiltered = computed(() => {
+  if (!pageList.value) 
+    return [];
+  switch (pathType.value) {
+    case 'dynamic-list':
+      return pageList.value.filter((page) => page.content.type === 'CommonList');
+    case 'dynamic-detail':
+      return pageList.value.filter((page) => page.content.type === 'Details');
+    default:
+      return [];
+  }
+});
 const modalVisible = ref(false);
 
 // 触发框显示文案:有值时显示路径,否则占位

+ 13 - 5
src/pages/article/data/editor/editors/CommonListPropsEditor.vue

@@ -10,10 +10,10 @@
       <a-form-item label="显示总数">
         <a-checkbox v-model:checked="props.props.showTotal" :indeterminate="props.props.showTotal === undefined" />
       </a-form-item>
-      <a-form-item label="列表项类型">
+      <a-form-item label="通用列表项类型">
         <ItemTypeEditor v-model="props.props.itemType" />
       </a-form-item>
-      <a-form-item label="详情页">
+      <a-form-item label="通用列表详情页">
         <LinkPathEditor v-model="(props.props.detailsPage as string)" />
       </a-form-item>
     </a-form>
@@ -52,6 +52,7 @@
                 <a-form-item label="TAB宽度">
                   <a-input-number
                     v-model:value="tab.width"
+                    placeholder="TAB宽度(像素)"
                     style="width: 100%"
                   />
                 </a-form-item>
@@ -121,6 +122,7 @@ import ItemTypeEditor from '../components/ItemTypeEditor.vue';
 import DropdownDefinesEditor from '../components/DropdownDefinesEditor.vue';
 import { ArrowUpOutlined, ArrowDownOutlined, CopyOutlined, DeleteOutlined } from '@ant-design/icons-vue';
 import { ArrayUtils } from '@imengyu/imengyu-utils';
+import { message } from 'ant-design-vue';
 
 type TabItem = IHomeCommonCategoryListTabItemDefine;
 
@@ -170,7 +172,7 @@ function copyTab(i: number) {
   uni.setClipboardData({
     data: JSON.stringify({ type: 'Copy:CommonListTabItem', data: tab }),
   });
-  uni.showToast({ title: '复制成功', icon: 'success' });
+  message.success('复制成功');
 }
 async function pasteTab() {
   const res = await uni.getClipboardData();
@@ -178,8 +180,14 @@ async function pasteTab() {
   if (typeof data === 'string') {
     try {
       const json = JSON.parse(data);
-      if (json.type === 'Copy:CommonListTabItem') getTabs().push(json.data);
-    } catch (_) {}
+      if (json.type === 'Copy:CommonListTabItem') {
+        getTabs().push(json.data);
+      } else {
+        message.error('粘贴失败,粘贴内容不是列表项');
+      }
+    } catch (_) {
+      message.error('粘贴失败,请检查粘贴内容是否正确');
+    }
   }
 }
 </script>

+ 10 - 3
src/pages/article/data/editor/editors/DetailPropsEditor.vue

@@ -159,6 +159,7 @@ import NestCategoryEditor from '../subpart/NestCategoryEditor.vue';
 import KeyValueEditor from '../components/KeyValueEditor.vue';
 import { ArrowUpOutlined, ArrowDownOutlined, CopyOutlined, DeleteOutlined } from '@ant-design/icons-vue';
 import { ArrayUtils } from '@imengyu/imengyu-utils';
+import { message } from 'ant-design-vue';
 
 const props = defineProps<{
   props: IHomeCommonCategoryDetailDefine['props'];
@@ -213,7 +214,7 @@ function copyIntroBlockDesc(i: number) {
   uni.setClipboardData({
     data: JSON.stringify({ type: 'Copy:DetailIntroBlockDesc', data: item }),
   });
-  uni.showToast({ title: '复制成功', icon: 'success' });
+  message.success('复制成功');
 }
 async function pasteIntroBlockDesc() {
   const res = await uni.getClipboardData();
@@ -221,8 +222,14 @@ async function pasteIntroBlockDesc() {
   if (typeof data === 'string') {
     try {
       const json = JSON.parse(data);
-      if (json.type === 'Copy:DetailIntroBlockDesc') getIntroBlockDescs().push(json.data);
-    } catch (_) {}
+      if (json.type === 'Copy:DetailIntroBlockDesc') {
+        getIntroBlockDescs().push(json.data);
+      } else {
+        message.error('粘贴失败,粘贴内容不是简介块描述项');
+      }
+    } catch (_) {
+      message.error('粘贴失败,请检查粘贴内容是否正确');
+    }
   }
 }
 

+ 8 - 2
src/pages/article/data/editor/subpart/NestCategoryEditor.vue

@@ -62,9 +62,15 @@ function remove(i: number) {
 async function paste() {
   const data = (await uni.getClipboardData()).data;
   if (typeof data === 'string') {
+    try {
     const json = JSON.parse(data);
-    if (json.type === 'Copy:NestCategoryItem') {
-      getCategorys().push(json.data);
+      if (json.type === 'Copy:NestCategoryItem') {
+        getCategorys().push(json.data);
+      } else {
+        message.error('粘贴失败,粘贴内容不是子分类项');
+      }
+    } catch (_) {
+      message.error('粘贴失败,请检查粘贴内容是否正确');
     }
   }
 }

+ 2 - 2
src/pages/article/data/editor/subpart/NestCategoryEditorItem.vue

@@ -26,7 +26,7 @@
       <LinkPathEditor v-model="cat.morePage" />
     </a-form-item>
     <a-form-item v-if="cat.showTitle !== false && cat.showMore !== false" label="更多文本">
-      <a-input v-model:value="cat.moreText" />
+      <a-input v-model:value="cat.moreText" placeholder="更多文本,默认:更多" />
     </a-form-item>
     <a-form-item label="可见">
       <a-checkbox v-model:checked="cat.visible" :indeterminate="cat.visible === undefined">
@@ -80,7 +80,7 @@
         <DynamicDataEditor v-model="cat.data" />
       </a-form-item>
       <a-form-item label="加载数量">
-        <a-input-number v-model:value="cat.count" :min="1" style="width: 100%" />
+        <a-input-number v-model:value="cat.count" placeholder="加载数量,默认:4" :min="1" style="width: 100%" />
       </a-form-item>
       <a-form-item label="数据展示">
         <DataSolveEditor v-model="cat.dataSolve" />