From 1b42fc22cf6d9c5451fe5d52638a114950296016 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=AD=90=E8=B4=A4?= Date: Tue, 25 Nov 2025 18:44:29 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E7=94=A8=E6=88=B7=E8=AF=A6?= =?UTF-8?q?=E6=83=85=E9=A1=B5=E9=9D=A2=EF=BC=8C=E4=BC=98=E5=8C=96=E7=BC=96?= =?UTF-8?q?=E8=BE=91=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/controller/mine/edit_info_controller.dart | 11 +++++++---- lib/pages/mine/edit_info_page.dart | 4 ++-- 2 files changed, 9 insertions(+), 6 deletions(-) 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,),