|
@@ -26,7 +26,13 @@ const _sfc_main = {
|
|
isNameValid: false,
|
|
isNameValid: false,
|
|
isIdCardValid: false,
|
|
isIdCardValid: false,
|
|
genderOptions: ["男", "女"],
|
|
genderOptions: ["男", "女"],
|
|
- genderIndex: 0
|
|
|
|
|
|
+ genderIndex: 0,
|
|
|
|
+ genderMapping: {
|
|
|
|
+ "男": "1",
|
|
|
|
+ "女": "2",
|
|
|
|
+ "1": "男",
|
|
|
|
+ "2": "女"
|
|
|
|
+ }
|
|
};
|
|
};
|
|
},
|
|
},
|
|
onLoad() {
|
|
onLoad() {
|
|
@@ -107,7 +113,15 @@ const _sfc_main = {
|
|
if (!userData.name || !userData.phone) {
|
|
if (!userData.name || !userData.phone) {
|
|
this.userInfoFilled = true;
|
|
this.userInfoFilled = true;
|
|
this.formData.name = userData.name || "";
|
|
this.formData.name = userData.name || "";
|
|
- this.formData.gender = userData.gender || "";
|
|
|
|
|
|
+ if (userData.gender) {
|
|
|
|
+ this.formData.gender = this.genderMapping[userData.gender] || userData.gender;
|
|
|
|
+ const index = this.genderOptions.findIndex((item) => item === this.formData.gender);
|
|
|
|
+ if (index !== -1) {
|
|
|
|
+ this.genderIndex = index;
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ this.formData.gender = "";
|
|
|
|
+ }
|
|
this.formData.phone = userData.phone || "";
|
|
this.formData.phone = userData.phone || "";
|
|
this.formData.idCard = userData.id_card || "";
|
|
this.formData.idCard = userData.id_card || "";
|
|
this.formData.emergencyContact = userData.emergency_contact || "";
|
|
this.formData.emergencyContact = userData.emergency_contact || "";
|
|
@@ -304,6 +318,7 @@ const _sfc_main = {
|
|
});
|
|
});
|
|
},
|
|
},
|
|
submitUserInfo() {
|
|
submitUserInfo() {
|
|
|
|
+ const genderValue = this.genderMapping[this.formData.gender] || this.formData.gender;
|
|
const submitData = {
|
|
const submitData = {
|
|
openid: JSON.parse(common_vendor.index.getStorageSync("userInfo") || "{}").openid || "",
|
|
openid: JSON.parse(common_vendor.index.getStorageSync("userInfo") || "{}").openid || "",
|
|
name: this.formData.name,
|
|
name: this.formData.name,
|
|
@@ -318,7 +333,7 @@ const _sfc_main = {
|
|
relation: this.formData.relation, */
|
|
relation: this.formData.relation, */
|
|
age: "20",
|
|
age: "20",
|
|
job_id: this.selectedJobId,
|
|
job_id: this.selectedJobId,
|
|
- gender: this.formData.gender
|
|
|
|
|
|
+ gender: genderValue
|
|
};
|
|
};
|
|
api_user.fillUserInfo(submitData).then((res) => {
|
|
api_user.fillUserInfo(submitData).then((res) => {
|
|
common_vendor.index.hideLoading();
|
|
common_vendor.index.hideLoading();
|
|
@@ -372,7 +387,8 @@ const _sfc_main = {
|
|
},
|
|
},
|
|
genderChange(e) {
|
|
genderChange(e) {
|
|
this.genderIndex = e.detail.value;
|
|
this.genderIndex = e.detail.value;
|
|
- this.formData.gender = this.genderOptions[this.genderIndex];
|
|
|
|
|
|
+ const displayGender = this.genderOptions[this.genderIndex];
|
|
|
|
+ this.formData.gender = displayGender;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
};
|
|
};
|