Browse Source

feat: 更新数据表单组件,添加图片上传功能;优化表单字段,增加必填项验证;更新首页设计师列表,添加跳转路径

EvilDragon 3 months ago
parent
commit
b4be71aa5b

+ 9 - 1
packages/merchant/src/components/data-form.ts

@@ -8,7 +8,15 @@ export interface DataFormProps {
 }
 export interface DataFormSchema {
   [key: symbol | string]: {
-    type: 'TextField' | 'Select' | 'Radio' | 'Submit' | 'TimePick' | 'Textarea' | 'Checkbox'
+    type:
+      | 'TextField'
+      | 'Select'
+      | 'Radio'
+      | 'Submit'
+      | 'TimePick'
+      | 'Textarea'
+      | 'Checkbox'
+      | 'ImageUploader'
     label?: string
     labelWidth?: number
     hiddenLabel?: boolean

+ 23 - 4
packages/merchant/src/layouts/tabbar.vue

@@ -2,7 +2,6 @@
 import TabbarEvo from '@/components/tabbar-evo.vue'
 import { currRoute } from '../utils'
 import { defaultThemeVars } from '../core/themes/default'
-// import DataForm from '@designer-hub/app/src/components/data-form.vue'
 import DataForm from '@/components/data-form.vue'
 import { useUserStore } from '../store'
 import { storeToRefs } from 'pinia'
@@ -13,6 +12,7 @@ import {
   channelTabbarMine,
   channelTabbarMineActive,
 } from '@designer-hub/assets/src/assets/svgs'
+import { DataFormSchema } from '../components/data-form'
 
 const userStore = useUserStore()
 const { userInfo, isAgent, isMerchant } = storeToRefs(userStore)
@@ -59,31 +59,46 @@ const items = computed(() => {
   ]
 })
 
-const schema = ref({
+const schema = ref<DataFormSchema>({
   user: {
+    required: true,
     type: 'TextField',
     label: '设计师',
+    labelWidth: 64,
   },
   dateTime: {
+    required: true,
     type: 'TextField',
     label: '时间',
+    labelWidth: 64,
   },
   type: {
-    type: 'TextField',
+    required: true,
+    type: 'Select',
     label: '类型',
+    labelWidth: 64,
+    props: {},
   },
   remark: {
+    required: true,
     type: 'TextField',
     label: '备注',
+    labelWidth: 64,
   },
   location: {
+    required: true,
     type: 'TextField',
     label: '地址',
+    labelWidth: 64,
   },
   images: {
+    required: true,
     type: 'ImageUploader',
     label: '图片',
-    max: 9,
+    labelWidth: 64,
+    props: {
+      // max: 9,
+    },
   },
 })
 const handleTabbarItemClick = (path: string) => {
@@ -93,6 +108,10 @@ const handleTabbarItemClick = (path: string) => {
   }
   uni.switchTab({ url: path })
 }
+const handleAdd = async (e) => {
+  console.log(e)
+  publishState.value = true
+}
 onMounted(async () => {})
 </script>
 

+ 17 - 12
packages/merchant/src/pages/home/index.vue

@@ -164,26 +164,31 @@ onShareAppMessage(() => ({}))
                   color: 'white',
                   path: '/pages/home/agent/report-infos/index',
                 },
-                { label: '重点跟进设计师', color: '#FF523F' },
-                { label: '全部设计师', color: '#7199FF' },
-                { label: '本月新增设计师', color: '#FFE786' },
-                { label: '超过30天未跟进', color: '#89F4E3' },
-                { label: '超过60天未产生积分设计师', color: '#FFBA6A' },
-                { label: '超过60天未消耗积分设计师', color: '#C494FF' },
-                { label: '未成交过设计师', color: '#FF9EE2' },
+                { label: '重点跟进设计师', color: '#FF523F', path: '/pages/designer/index' },
+                { label: '全部设计师', color: '#7199FF', path: '/pages/designer/index' },
+                { label: '本月新增设计师', color: '#FFE786', path: '/pages/designer/index' },
+                { label: '超过30天未跟进', color: '#89F4E3', path: '/pages/designer/index' },
+                {
+                  label: '超过60天未产生积分设计师',
+                  color: '#FFBA6A',
+                  path: '/pages/designer/index',
+                },
+                {
+                  label: '超过60天未消耗积分设计师',
+                  color: '#C494FF',
+                  path: '/pages/designer/index',
+                },
+                { label: '未成交过设计师', color: '#FF9EE2', path: '/pages/designer/index' },
               ]"
               :key="label"
             >
-              <div
-                class="h-12 bg-white rounded-lg shadow flex items-center hover:bg-[#fff6f5]"
-                @click="it.path ? router.push(it.path) : toDesigner"
-              >
+              <div class="h-12 bg-white rounded-lg shadow flex items-center hover:bg-[#fff6f5]">
                 <div
                   class="w-1.5 h-12 rounded-tl-lg rounded-bl-lg shadow"
                   :style="{ background: color }"
                 ></div>
                 <div class="flex-1 mx-3">
-                  <SectionHeading :title="label" :end-arrow="true" size="sm"></SectionHeading>
+                  <SectionHeading :title="label" :path="it.path" size="sm"></SectionHeading>
                 </div>
               </div>
             </template>