diff --git a/lib/controller/mine/edit_info_controller.dart b/lib/controller/mine/edit_info_controller.dart index 5c14cff..843e9e1 100644 --- a/lib/controller/mine/edit_info_controller.dart +++ b/lib/controller/mine/edit_info_controller.dart @@ -37,10 +37,11 @@ class EditInfoController extends GetxController { // 选择日期 void selectBirthday(String selectedDate) { birthday.value = selectedDate; + saveData(); // 打印选择的日期 print('选择的出生日期: $selectedDate'); // 显示选择结果 - SmartDialog.showToast('出生日期已选择'); + // SmartDialog.showToast('出生日期已选择'); } @@ -115,7 +116,7 @@ class EditInfoController extends GetxController { _userApi = Get.find(); - + getEducationList(); getIncomeList(); getMaritalList(); getPropertyList(); @@ -283,6 +284,8 @@ class EditInfoController extends GetxController { homeLocation.value = "${userData.value?.hometownProvinceName}-${userData.value?.hometownCityName}"; homeLocationValue.value = [userData.value?.hometownProvinceCode, userData.value?.hometownCityCode]; } + + birthday.value = userData.value?.birthDate ?? ""; } goPreview() async { @@ -576,7 +579,7 @@ class EditInfoController extends GetxController { try { final payload = { - 'birthDate': userData.value?.birthDate ?? "", + 'birthDate': birthday.value, 'birthYear': userData.value?.birthYear ?? "", 'provinceCode': locationValue.length >= 3 ? locationValue[0] : "", 'provinceName': location.value != "" ? location.value.split("-")[0] : "", @@ -584,7 +587,7 @@ class EditInfoController extends GetxController { 'cityName': location.value != "" ? location.value.split("-")[1] : "", 'districtCode': locationValue.length >= 3 ? locationValue[2] : "", 'districtName': location.value != "" ? location.value.split("-")[2] : "", - "educationCode": educationList[educationSelect.value].value, + "educationCode": educationSelect.value != -1 ? educationList[educationSelect.value].value : "", "height": heightSelect.value != -1 ? heightList[heightSelect.value] : "", 'hometownProvinceCode': homeLocationValue.length >= 2 ? homeLocationValue[0] : "", 'hometownProvinceName': homeLocation.value != "" ? homeLocation.value.split("-")[0] : "", diff --git a/lib/pages/mine/edit_info_page.dart b/lib/pages/mine/edit_info_page.dart index a84c17e..e9942cc 100644 --- a/lib/pages/mine/edit_info_page.dart +++ b/lib/pages/mine/edit_info_page.dart @@ -512,8 +512,8 @@ class _EditInfoPageState extends State { "${controller.birthday.value != "" ? controller.birthday.value : (controller.userData.value?.birthDate != null && controller.userData.value?.birthDate != "") ? controller.userData.value?.birthDate : "请选择"}", style: TextStyle( fontSize: 13.w, - fontWeight: (controller.birthday.value != "" && controller.userData.value?.birthDate != null && controller.userData.value?.birthDate != "") ? FontWeight.w500 : null, - color: (controller.birthday.value != "" && controller.userData.value?.birthDate != null && controller.userData.value?.birthDate != "") ? const Color.fromRGBO(51, 51, 51, 1) : const Color.fromRGBO(191, 191, 191, 1) + fontWeight: (controller.birthday.value != "" || (controller.userData.value?.birthDate != null && controller.userData.value?.birthDate != "")) ? FontWeight.w500 : null, + color: (controller.birthday.value != "" || (controller.userData.value?.birthDate != null && controller.userData.value?.birthDate != "")) ? const Color.fromRGBO(51, 51, 51, 1) : const Color.fromRGBO(191, 191, 191, 1) ), ), SizedBox(width: 15.w,),