|  |  | 
 |  |  | import { FormRules } from '@nutui/nutui-taro/dist/types/__VUE/form/types'; | 
 |  |  | import { ChooseInputWithPicker, ChooseInputWithAreaPicker } from '@12333/components'; | 
 |  |  | import { convertApi2FormUrlOnlyOne, Message, setOSSLink } from '@12333/utils'; | 
 |  |  | import { useAreaTree, useDictionaryDataSelect } from '@12333/hooks'; | 
 |  |  | import { CategoryCode } from '@12333/constants'; | 
 |  |  | import { useAreaTree, useDictionaryDataSelect, useUpdateResume } from '@12333/hooks'; | 
 |  |  | import { AreaType, CategoryCode } from '@12333/constants'; | 
 |  |  | import * as userResumeServices from '@12333/services/apiV2/userResume'; | 
 |  |  | import Taro from '@tarojs/taro'; | 
 |  |  | import { useQuery } from '@tanstack/vue-query'; | 
 |  |  | import { useEventChannel } from 'senin-mini/hooks'; | 
 |  |  | import { goBack } from '@/utils'; | 
 |  |  |  | 
 |  |  | defineOptions({ | 
 |  |  |   name: 'InnerPage', | 
 |  |  | }); | 
 |  |  |  | 
 |  |  | const { updateUserResume } = useUpdateResume(); | 
 |  |  |  | 
 |  |  | const eventChannel = useEventChannel(); | 
 |  |  |  | 
 |  |  | const { dictionaryDataList: identityList } = useDictionaryDataSelect({ | 
 |  |  |   categoryCode: CategoryCode.Identity, | 
 |  |  | 
 |  |  |   categoryCode: CategoryCode.Education, | 
 |  |  | }); | 
 |  |  |  | 
 |  |  | const { areaTree } = useAreaTree(); | 
 |  |  | const { areaTree } = useAreaTree({ | 
 |  |  |   maxLayer: AreaType.City, | 
 |  |  | }); | 
 |  |  |  | 
 |  |  | const form = reactive({ | 
 |  |  |   avatar: [], | 
 |  |  |   name: '', | 
 |  |  |   identity: '', | 
 |  |  |   contactPhoneNumber: '', | 
 |  |  |   personalIdentityCode: '', | 
 |  |  |   educationalBackgroundCode: '', | 
 |  |  | 
 |  |  |   }, | 
 |  |  |   placeholderData: () => ({} as API.GetUserResumePersonalQueryResult), | 
 |  |  |   onSuccess(data) { | 
 |  |  |     form.avatar = convertApi2FormUrlOnlyOne(setOSSLink(data.avatar)); | 
 |  |  |     form.name = data.name; | 
 |  |  |     form.identity = data.identity; | 
 |  |  |     form.contactPhoneNumber = data.contactPhoneNumber; | 
 |  |  |     form.avatar = convertApi2FormUrlOnlyOne(data.avatar); | 
 |  |  |     form.name = data.name ?? ''; | 
 |  |  |     form.contactPhoneNumber = data.contactPhoneNumber ?? ''; | 
 |  |  |     form.personalIdentityCode = data.personalIdentityCode ?? ''; | 
 |  |  |     form.educationalBackgroundCode = data.educationalBackgroundCode ?? ''; | 
 |  |  |     form.areaList = | 
 |  |  |       data.provinceCode && data.cityCode ? [data.provinceCode, data.cityCode] : ['', '']; | 
 |  |  |     form.areaList = [data.provinceCode, data.cityCode].filter(Boolean); | 
 |  |  |   }, | 
 |  |  | }); | 
 |  |  |  | 
 |  |  | 
 |  |  |   try { | 
 |  |  |     let params: API.SaveUserResumePersonalCommand = { | 
 |  |  |       name: form.name, | 
 |  |  |       identity: form.identity, | 
 |  |  |       avatar: form.avatar[0]?.path, | 
 |  |  |       avatar: form.avatar?.[0]?.path ?? '', | 
 |  |  |       contactPhoneNumber: form.contactPhoneNumber, | 
 |  |  |       educationalBackgroundCode: form.educationalBackgroundCode, | 
 |  |  |       personalIdentityCode: form.personalIdentityCode, | 
 |  |  |       provinceCode: form.areaList[0], | 
 |  |  |       cityCode: form.areaList[1], | 
 |  |  |       provinceCode: form.areaList?.[0] ?? '', | 
 |  |  |       cityCode: form.areaList?.[1] ?? '', | 
 |  |  |     }; | 
 |  |  |     let res = await userResumeServices.saveUserResumePersonal(params); | 
 |  |  |     if (res) { | 
 |  |  |       Message.success('保存成功', { | 
 |  |  |         onClosed() { | 
 |  |  |           Taro.navigateTo({ | 
 |  |  |             url: `${RouterPath.mineCurriculumVitae}`, | 
 |  |  |             success: function (res) { | 
 |  |  |               res.eventChannel.emit('updateResume', { content: true }); | 
 |  |  |             }, | 
 |  |  |           }); | 
 |  |  |           goBack(); | 
 |  |  |           updateUserResume(); | 
 |  |  |         }, | 
 |  |  |       }); | 
 |  |  |     } | 
 |  |  |   } catch (error) {} | 
 |  |  | } | 
 |  |  | </script> | 
 |  |  |  | 
 |  |  | <style lang="scss"> | 
 |  |  | @import '@/styles/common.scss'; | 
 |  |  | </style> |