Browse Source

优化用户详情页面,优化编辑信息

ios
王子贤 4 months ago
parent
commit
1b42fc22cf
2 changed files with 9 additions and 6 deletions
  1. 11
      lib/controller/mine/edit_info_controller.dart
  2. 4
      lib/pages/mine/edit_info_page.dart

11
lib/controller/mine/edit_info_controller.dart

@ -37,10 +37,11 @@ class EditInfoController extends GetxController {
// //
void selectBirthday(String selectedDate) { void selectBirthday(String selectedDate) {
birthday.value = selectedDate; birthday.value = selectedDate;
saveData();
// //
print('选择的出生日期: $selectedDate'); print('选择的出生日期: $selectedDate');
// //
SmartDialog.showToast('出生日期已选择');
// SmartDialog.showToast('出生日期已选择');
} }
@ -115,7 +116,7 @@ class EditInfoController extends GetxController {
_userApi = Get.find<UserApi>(); _userApi = Get.find<UserApi>();
getEducationList();
getIncomeList(); getIncomeList();
getMaritalList(); getMaritalList();
getPropertyList(); getPropertyList();
@ -283,6 +284,8 @@ class EditInfoController extends GetxController {
homeLocation.value = "${userData.value?.hometownProvinceName}-${userData.value?.hometownCityName}"; homeLocation.value = "${userData.value?.hometownProvinceName}-${userData.value?.hometownCityName}";
homeLocationValue.value = [userData.value?.hometownProvinceCode, userData.value?.hometownCityCode]; homeLocationValue.value = [userData.value?.hometownProvinceCode, userData.value?.hometownCityCode];
} }
birthday.value = userData.value?.birthDate ?? "";
} }
goPreview() async { goPreview() async {
@ -576,7 +579,7 @@ class EditInfoController extends GetxController {
try { try {
final payload = { final payload = {
'birthDate': userData.value?.birthDate ?? "",
'birthDate': birthday.value,
'birthYear': userData.value?.birthYear ?? "", 'birthYear': userData.value?.birthYear ?? "",
'provinceCode': locationValue.length >= 3 ? locationValue[0] : "", 'provinceCode': locationValue.length >= 3 ? locationValue[0] : "",
'provinceName': location.value != "" ? location.value.split("-")[0] : "", 'provinceName': location.value != "" ? location.value.split("-")[0] : "",
@ -584,7 +587,7 @@ class EditInfoController extends GetxController {
'cityName': location.value != "" ? location.value.split("-")[1] : "", 'cityName': location.value != "" ? location.value.split("-")[1] : "",
'districtCode': locationValue.length >= 3 ? locationValue[2] : "", 'districtCode': locationValue.length >= 3 ? locationValue[2] : "",
'districtName': location.value != "" ? location.value.split("-")[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] : "", "height": heightSelect.value != -1 ? heightList[heightSelect.value] : "",
'hometownProvinceCode': homeLocationValue.length >= 2 ? homeLocationValue[0] : "", 'hometownProvinceCode': homeLocationValue.length >= 2 ? homeLocationValue[0] : "",
'hometownProvinceName': homeLocation.value != "" ? homeLocation.value.split("-")[0] : "", 'hometownProvinceName': homeLocation.value != "" ? homeLocation.value.split("-")[0] : "",

4
lib/pages/mine/edit_info_page.dart

@ -512,8 +512,8 @@ class _EditInfoPageState extends State<EditInfoPage> {
"${controller.birthday.value != "" ? controller.birthday.value : (controller.userData.value?.birthDate != null && controller.userData.value?.birthDate != "") ? controller.userData.value?.birthDate : "请选择"}", "${controller.birthday.value != "" ? controller.birthday.value : (controller.userData.value?.birthDate != null && controller.userData.value?.birthDate != "") ? controller.userData.value?.birthDate : "请选择"}",
style: TextStyle( style: TextStyle(
fontSize: 13.w, 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,), SizedBox(width: 15.w,),

Loading…
Cancel
Save