소스 검색

个人信息编辑

Xiao_123 8 달 전
부모
커밋
29aed14fa6
2개의 변경된 파일28개의 추가작업 그리고 13개의 파일을 삭제
  1. 3 3
      pages/index/my.vue
  2. 25 10
      pagesA/info/index.vue

+ 3 - 3
pages/index/my.vue

@@ -94,9 +94,9 @@ const handleTap = () => {
 		showAuthModal()
 		return
 	}
-	// uni.navigateTo({
-	// 	url: '/pagesA/info/index'
-	// })
+	uni.navigateTo({
+		url: '/pagesA/info/index'
+	})
 }
 
 // 退出登录

+ 25 - 10
pagesA/info/index.vue

@@ -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>