Browse Source

📦 投稿页面显示

imengyu 2 months ago
parent
commit
ed25eb5664
2 changed files with 42 additions and 65 deletions
  1. 40 63
      src/pages/user/contribute/submit.vue
  2. 2 2
      src/pages/user/index.vue

+ 40 - 63
src/pages/user/contribute/submit.vue

@@ -1,5 +1,5 @@
 <template>
-  <view class="d-flex flex-column bg-base">
+  <view class="d-flex flex-column bg-base p-3">
     <u-loading-page :loading="loading" /> 
     <SimpleDynamicFormUni
       ref="formRef"
@@ -17,9 +17,8 @@
 
 <script setup lang="ts">
 import ContributeApi, { ContributeItem } from '@/api/user/ContributeApi';
-import CheckUtils from '@/common/utils/CheckUtils';
 import { showError } from '@/common/composeabe/ErrorDisplay';
-import { ref } from 'vue';
+import { onMounted, ref } from 'vue';
 import type { FormDefine, FormExport } from '@/common/components/form';
 import type { DynamicSelectProps } from '@/common/components/form/components/DynamicSelect.vue';
 import SimpleDynamicFormUni from '@/common/components/form/SimpleDynamicFormUni.vue';
@@ -39,86 +38,58 @@ const formDefine : FormDefine = {
         propNestType: 'nest', 
         items: [
           { 
-            label: '认领村庄', 
-            name: 'village_id',
+            label: '栏目', 
+            name: 'mainBodyColumnId',
             type: 'dynamic-select', 
             params: {
-              loadData: async () => 
-              (await ContributeApi.getCanClaimVallageList())
-                .map((p) => ({
-                  value: p.id,
-                  text: p.villageName,
-                }))
-              ,
+              loadData: async () => {
+                /* (await ContributeApi.getCanClaimVallageList())
+                  .map((p) => ({
+                    value: p.id,
+                    text: p.villageName,
+                  })) */
+               return []
+              },
             } as DynamicSelectProps,
             rules: [{
               required: true,
-              errorMessage: '请选择要认领的村庄',
+              errorMessage: '请选择投稿栏目',
             }],
+            onChange: (_, value, model) => {
+              //model.
+            }
           },
           { 
-            label: '姓名', 
-            name: 'name', 
+            label: '文章标题', 
+            name: 'title', 
             type: 'text', 
             defaultValue: '',
             params: {
-              placeholder: '请输入姓名',
+              placeholder: '请输入文章标题',
             },
             rules:  [{
               required: true,
-              errorMessage: '请输入姓名',
+              errorMessage: '请输入文章标题',
             }] 
           },
           { 
-            label: '性别', 
-            name: 'sex', 
+            label: '内容类型', 
+            name: 'type', 
             type: 'select', 
             params: {
+              disabled: true,
               localdata: [
-                { value: 1, text: "男" },
-                { value: 2, text: "女" },
-                { value: 3, text: "不透露" },
+                { value: 1, text: "文章" },
+                { value: 2, text: "音频" },
+                { value: 3, text: "视频" },
+                { value: 4, text: "相册" },
               ],
               clear: false,
             },
+            defaultValue: 1,
             rules: [{
               required: true,
-              errorMessage: '请选择性别',
-            }]
-          },
-          {
-            label: '联系方式',
-            name: 'mobile',
-            type: 'text', 
-            defaultValue: '',
-            params: {
-              placeholder: '请输入联系方式',
-            },
-            rules:  [{
-              required: true,
-              errorMessage: '请输入手机号',
-            },{
-              required: true,
-              validateFunction: (rule: any, value: any,data: any,callback: (e: any) => void) => {
-                if (!CheckUtils.checkIsChinesePhoneNumber(value)) {
-                  callback('手机号格式不正确')
-                  return false
-                }
-                return true
-              }
-            }]
-          },
-          {
-            label: '地址',
-            name: 'address',
-            type: 'text', 
-            defaultValue: '',
-            params: {
-              placeholder: '请输入地址',
-            },
-            rules: [{
-              required: true,
-              errorMessage: '请输入地址',
+              errorMessage: '请选择类型',
             }]
           },
         ]
@@ -134,16 +105,17 @@ const formDefine : FormDefine = {
         propNestType: 'nest', 
         items: [
           {
-            label: '申请理由',
-            name: 'claim_reason',
-            type: 'textarea',
+            label: '内容',
+            name: 'intro',
+            type: 'richtext',
             defaultValue: '',
             params: {
-              placeholder: '请输入申请理由',
+              placeholder: '请输入内容',
+              saveTempKey: 'contribute',
             },
             rules: [{
               required: true,
-              errorMessage: '请输入申请理由',
+              errorMessage: '请输入内容',
             }]
           }
         ]
@@ -175,6 +147,11 @@ async function submit() {
     loading.value = false;
   }
 }
+
+onMounted(() => {
+
+})
+
 </script>
 
 <style lang="scss">

+ 2 - 2
src/pages/user/index.vue

@@ -49,11 +49,11 @@
             <text class="label">我的收藏</text>
             <text class="iconfont icon-arrow-right"></text>
           </view> -->
-          <!-- <view class="entry" @click="goContribute">
+          <view class="entry" @click="goContribute">
             <image src="https://mn.wenlvti.net/uploads/20250313/07f750b4cf4959654c40171fdae91c3a.png" mode="aspectFill"></image>
             <text class="label">投稿</text>
             <view class="btn">去投稿</view><text class="iconfont icon-arrow-right"></text>
-          </view> -->
+          </view>
           <view class="entry" @click="goContributeList">
             <image src="https://mn.wenlvti.net/uploads/20250313/66d4665b1da5075e60148312469b2630.png" mode="aspectFill"></image>
             <text class="label">我的投稿</text>