ソースを参照

feat: 添加图片上传功能;优化表单样式和设计师页面反馈信息

EvilDragon 4 ヶ月 前
コミット
d2437e8c90

+ 33 - 5
packages/merchant/src/components/data-form.vue

@@ -22,6 +22,8 @@ withDefaults(
 )
 const emits = defineEmits(['submit'])
 const form = ref<InstanceType<typeof WdForm>>()
+const action = ref(`${import.meta.env.VITE_SERVER_BASEURL}/app-api/infra/file/upload`)
+
 const types = {
   TextField: WdInput,
   Submit: WdButton,
@@ -54,12 +56,14 @@ const verticalDefaultProps = {
 }
 const horizontalDefaultProps = {
   TextField: {
-    customClass: 'text-red! bg-[#f5f7f9]! h-10',
+    customClass: 'text-red! bg-[#f5f7f9]! py-2 px-4 rounded-lg',
     placeholderClass: 'text-black/30',
     noBorder: true,
   },
   Select: {
-    customClass: 'text-black/30! border-b-1 border-b-[#e1e1e1] border-b-solid',
+    customClass: 'text-black/30! bg-[#f5f7f9]! py-.75 px-4 rounded-lg!',
+    noBorder: true,
+    cell: false,
   },
   Radio: {
     customClass: 'my--4!',
@@ -68,7 +72,7 @@ const horizontalDefaultProps = {
     customClass: 'my--4!',
   },
   TimePick: {
-    customClass: 'm-0!',
+    customClass: 'm-0! bg-[#f5f7f9]! py-.75 px-4 rounded-lg!',
   },
 }
 const themeVars: ConfigProviderThemeVars = {
@@ -112,12 +116,16 @@ defineExpose({
           <label
             v-if="type !== 'Submit' && !hiddenLabel"
             class="text-sm font-normal leading-relaxed"
-            :class="[direction === 'horizontal' ? 'text-black/60' : 'mb-1 text-black/40']"
+            :class="[
+              direction === 'horizontal'
+                ? 'text-black/60 h-10 flex items-center'
+                : 'mb-1 text-black/40',
+            ]"
             :for="prop"
           >
             <span
-              v-if="required"
               class="text-[#ef4343] text-base font-normal font-['PingFang_SC'] leading-normal"
+              :class="required ? 'visible' : 'invisible'"
             >
               *
             </span>
@@ -200,6 +208,26 @@ defineExpose({
               <wd-checkbox custom-class="mr-4!" :modelValue="value">{{ label }}</wd-checkbox>
             </template>
           </wd-checkbox-group>
+          <wd-upload
+            v-if="type === 'ImageUploader'"
+            v-bind="{
+              ...(direction === 'vertical'
+                ? verticalDefaultProps[type]
+                : horizontalDefaultProps[type]),
+              ...props,
+              action,
+              fileList:
+                (modelValue[prop] ?? '') === ''
+                  ? []
+                  : modelValue[prop]?.split(',').map((it) => ({ url: it })),
+            }"
+            @change="
+              ({ fileList }) =>
+                (modelValue[prop] = fileList
+                  .map(({ response }) => JSON.parse(response).data)
+                  .join(','))
+            "
+          ></wd-upload>
           <wd-button
             v-if="type === 'Submit'"
             v-bind="{

+ 6 - 0
packages/merchant/src/core/themes/default.scss

@@ -4,3 +4,9 @@ page {
 .wd-button {
   line-height: 0;
 }
+.wd-picker__field {
+  // @apply h-full;
+}
+.wd-picker__cell {
+  @apply bg-transparent!;
+}

+ 1 - 1
packages/merchant/src/pages/designer/index.vue

@@ -80,7 +80,7 @@ const handleImportant = async (designer: Designer) => {
       }),
     {
       success: true,
-      successTitle: '重点跟进成功',
+      successTitle: '操作成功',
     },
   )
   if (code === 0) {

+ 4 - 1
packages/merchant/src/pages/home/index.vue

@@ -45,6 +45,9 @@ const todosQuery = computed(() => ({
     dayjs().endOf('days').format('YYYY-MM-DD HH:mm:ss'),
   ].join(','),
 }))
+const designerPointsActivitiesQuery = computed(() => ({
+  brokerId: userInfo.value.userId.toString(),
+}))
 const { data: tasks, run: setTasks } = useRequest(
   () => getTasks({ brokerId: userInfo.value.userId }),
   { initialData: { list: [], total: 0 } },
@@ -198,7 +201,7 @@ onShareAppMessage(() => ({}))
           <SectionHeading title="设计师最新动态" path="" custom-class="mb-5"></SectionHeading>
           <PageHelperEvo
             :request="getDeignerPointsActivities"
-            :query="{ brokerId: userInfo.userId }"
+            :query="designerPointsActivitiesQuery"
           >
             <template #default="{ source }">
               <div class="flex flex-col gap-4">