|
@@ -3,9 +3,9 @@
|
|
|
<uni-forms ref="form" :modelValue="formData" :rules="rules" validateTrigger="bind" label-width="105px" label-align="right">
|
|
|
<uni-forms-item label="头像" name="avatar" class="f-straight">
|
|
|
<view style="display: flex;flex-wrap: wrap;">
|
|
|
- <view class="upload-img" v-if="formData.avatar" @click="handlePreviewImage">
|
|
|
- <uni-icons size="30" type="clear" color="#00897B" style="position: absolute;right: -11px; top: -11px; z-index: 9" @click="formData.avatar = ''"></uni-icons>
|
|
|
- <image :src="formData.avatar" mode="contain" style="width: 200rpx;height: 200rpx;"></image>
|
|
|
+ <view class="upload-img" v-if="formData?.avatar" @click="handlePreviewImage">
|
|
|
+ <uni-icons size="30" type="clear" color="#fe574a" style="position: absolute;right: -11px; top: -11px; z-index: 9" @click="formData.avatar = ''"></uni-icons>
|
|
|
+ <image :src="formData?.avatar" mode="contain" style="width: 200rpx;height: 200rpx;"></image>
|
|
|
</view>
|
|
|
<view v-else class="upload-file" @click="uploadPhotos">
|
|
|
<uni-icons type="plusempty" size="50" color="#f1f1f1"></uni-icons>
|
|
@@ -70,9 +70,25 @@ const form = ref()
|
|
|
const sexData = ref([])
|
|
|
const map = { text: 'label', value: 'value' }
|
|
|
const useUserStore = userStore()
|
|
|
+
|
|
|
const formData = ref({})
|
|
|
const getInfo = () => {
|
|
|
- formData.value = cloneDeep(useUserStore?.baseInfo)
|
|
|
+ formData.value = cloneDeep(useUserStore?.baseInfo) || {
|
|
|
+ avatar: '',
|
|
|
+ name: '',
|
|
|
+ sex: '',
|
|
|
+ regId: '',
|
|
|
+ birthday: '',
|
|
|
+ phone: '',
|
|
|
+ email: '',
|
|
|
+ eduType: '',
|
|
|
+ firstWorkTime: '',
|
|
|
+ expType: '',
|
|
|
+ jobType: '',
|
|
|
+ jobStatus: '',
|
|
|
+ maritalStatus: '',
|
|
|
+ areaId: ''
|
|
|
+ }
|
|
|
}
|
|
|
getInfo()
|
|
|
|
|
@@ -153,13 +169,12 @@ const rules = {
|
|
|
const submit = async () => {
|
|
|
const valid = await unref(form).validate()
|
|
|
if (!valid) return
|
|
|
- console.log(formData.value.avatar, formData.value)
|
|
|
|
|
|
- // await updatePersonAvatar(formData.value.avatar)
|
|
|
- // await saveBaseInfo(formData.value)
|
|
|
- // uni.showToast({ title: '编辑成功', icon: 'success' })
|
|
|
- // useUserStore.getInfo()
|
|
|
- // getInfo()
|
|
|
+ await updatePersonAvatar(formData.value.avatar)
|
|
|
+ await saveBaseInfo(formData.value)
|
|
|
+ uni.showToast({ title: '编辑成功', icon: 'success' })
|
|
|
+ await useUserStore.getInfo()
|
|
|
+ getInfo()
|
|
|
}
|
|
|
</script>
|
|
|
|