Prechádzať zdrojové kódy

feat: 简化用户审核信息更新逻辑;新增修改公司功能,优化性别设置交互

EvilDragon 1 mesiac pred
rodič
commit
6a45578a5d

+ 2 - 16
packages/app/src/core/libs/requests.ts

@@ -163,22 +163,8 @@ export const getUserAuthInfo = () => httpGet<UserAuthInfo>('/app-api/member/user
 /**
  * 更新设计师审核信息
  */
-export const updateUserAuthInfo = (
-  data: Partial<{
-    id: number
-    userId: number
-    designerName: string
-    gender: number
-    mobile: string
-    channelSource: number
-    referrer: string
-    employer: string
-    spatialExpertiseType: number
-    attachment: string
-    auditStatus: number
-    remark: string
-  }>,
-) => httpPost('/app-api/member/user-auth-info/update', data)
+export const updateUserAuthInfo = (data: Partial<UserAuthInfo>) =>
+  httpPost('/app-api/member/user-auth-info/update', data)
 export const getCircles = (query: { tagName?: string; circleType?: string; stylistId?: string }) =>
   httpGet<{
     list: {

+ 46 - 5
packages/app/src/pages/mine/setting/index.vue

@@ -9,6 +9,7 @@ import {
   getUserAuthInfo,
   updateMemberUserInfo,
   getUserBasicInfo,
+  updateUserAuthInfo,
 } from '../../../core/libs/requests'
 import { NetImages } from '../../../core/libs/net-images'
 import FormMessageBox from '@/components/form-message-box.vue'
@@ -98,6 +99,7 @@ const handleSetSex = async () => {
     sex: {
       type: 'Radio',
       label: '性别',
+      hiddenLabel: true,
       props: {
         columns: [
           { label: '男', value: '0' },
@@ -109,10 +111,7 @@ const handleSetSex = async () => {
   confirm({
     title: '修改性别',
     beforeConfirm: async ({ resolve }) => {
-      const res = await Promise.all([
-        updateMemberUserInfo(formData.value),
-        // updateUserBasicInfo({ ...formData.value, userId: userInfo.value.userId }),
-      ])
+      const res = await Promise.all([updateMemberUserInfo(formData.value)])
       console.log(res)
       setUserInfo({
         ...userInfo.value,
@@ -128,6 +127,41 @@ const handleSetSex = async () => {
     },
   })
 }
+const handleSetEmployer = async () => {
+  formData.value = {
+    employer: userAuthInfo.value.employer,
+  }
+  schema.value = {
+    employer: {
+      type: 'TextField',
+      label: '公司',
+      hiddenLabel: true,
+      props: {},
+    },
+  }
+  confirm({
+    title: '修改公司',
+    beforeConfirm: async ({ resolve }) => {
+      const { code } = await requestToast(
+        () =>
+          updateUserAuthInfo({
+            ...userAuthInfo.value,
+            employer: formData.value.employer,
+          }),
+        {
+          success: true,
+          successTitle: '修改成功',
+        },
+      )
+      if (code === 0) {
+        resolve(true)
+        formData.value = {}
+        setUserAuthInfo()
+      }
+      resolve(false)
+    },
+  })
+}
 const handeleSetBirthday = async () => {
   const { code, data } = await requestToast(
     () =>
@@ -209,7 +243,14 @@ onMounted(async () => {
       path="/pages/mine/setting/mobile/index"
     ></SectionHeading>
     <template v-if="isDesigner">
-      <SectionHeading title="公司" size="sm" :end-text="userAuthInfo?.employer"></SectionHeading>
+      <div @click="handleSetEmployer">
+        <SectionHeading
+          title="公司"
+          size="sm"
+          :end-text="userAuthInfo?.employer"
+          end-arrow
+        ></SectionHeading>
+      </div>
       <SectionHeading title="推荐人" size="sm" :end-text="userAuthInfo?.referrer"></SectionHeading>
       <SectionHeading
         title="经纪人"