| | |
| | | |
| | | <script setup lang="ts"> |
| | | import { FormRules } from '@nutui/nutui-taro/dist/types/__VUE/form/types'; |
| | | import { convertApi2FormUrlOnlyOne, Message } from '@12333/utils'; |
| | | import { useUpdateResume } from '@12333/hooks'; |
| | | import * as userResumeServices from '@12333/services/apiV2/userResume'; |
| | | import { convertApi2FormUrlOnlyOne, FormValidator, Message } from '@12333/utils'; |
| | | import * as enterpriseServices from '@12333/services/apiV2/enterprise'; |
| | | import Taro from '@tarojs/taro'; |
| | | import { useQuery } from '@tanstack/vue-query'; |
| | | import { goBack } from '@/utils'; |
| | |
| | | name: 'InnerPage', |
| | | }); |
| | | |
| | | const { updateUserResume } = useUpdateResume(); |
| | | |
| | | const { userDetail } = useUser(); |
| | | const { userDetail, updateUserInfo } = useUser(); |
| | | |
| | | const form = reactive({ |
| | | avatar: [], |
| | | name: '', |
| | | contactPhoneNumber: '', |
| | | }); |
| | | |
| | | const { isLoading, isError, refetch } = useQuery({ |
| | | queryKey: ['userResumeServices/getUserResumePersonal'], |
| | | queryFn: async () => { |
| | | return await userResumeServices.getUserResumePersonal( |
| | | {}, |
| | | { |
| | | showLoading: false, |
| | | } |
| | | ); |
| | | }, |
| | | placeholderData: () => ({} as API.GetUserResumePersonalQueryResult), |
| | | onSuccess(data) { |
| | | form.avatar = convertApi2FormUrlOnlyOne(data.avatar); |
| | | form.name = data.name ?? ''; |
| | | form.contactPhoneNumber = data.contactPhoneNumber ?? ''; |
| | | }, |
| | | avatar: convertApi2FormUrlOnlyOne(userDetail.value.originalAvatar), |
| | | name: userDetail.value.name ?? '', |
| | | contactPhoneNumber: userDetail.value.contactPhoneNumber ?? '', |
| | | }); |
| | | |
| | | const rules = reactive<FormRules>({ |
| | | name: [{ required: true, message: '请输入姓名' }], |
| | | contactPhoneNumber: [{ required: true, message: '请输入手机号' }], |
| | | contactPhoneNumber: [ |
| | | { required: true, message: '请输入手机号' }, |
| | | { validator: FormValidator.validatorPhoneNumber, message: '请输入正确的手机号' }, |
| | | ], |
| | | }); |
| | | const formRef = ref<any>(null); |
| | | function handleConfirm() { |
| | |
| | | |
| | | async function confirm() { |
| | | try { |
| | | let params: API.SaveUserResumePersonalCommand = { |
| | | let params: API.SetEnterpriseLoginInfoCommand = { |
| | | name: form.name, |
| | | avatar: form.avatar?.[0]?.path ?? '', |
| | | contactPhoneNumber: form.contactPhoneNumber, |
| | | }; |
| | | let res = await userResumeServices.saveUserResumePersonal(params); |
| | | let res = await enterpriseServices.setEnterpriseLoginInfo(params); |
| | | if (res) { |
| | | Message.success('保存成功', { |
| | | onClosed() { |
| | | goBack(); |
| | | updateUserResume(); |
| | | updateUserInfo(); |
| | | }, |
| | | }); |
| | | } |