王子贤 4 months ago
parent
commit
bbb4428997
3 changed files with 14 additions and 18 deletions
  1. 11
      lib/controller/mine/auth_controller.dart
  2. 15
      lib/controller/mine/user_controller.dart
  3. 6
      lib/model/mine/user_data.dart

11
lib/controller/mine/auth_controller.dart

@ -27,13 +27,16 @@ class AuthController extends GetxController {
try { try {
isLoading.value = true; isLoading.value = true;
late bool realAuth = false; late bool realAuth = false;
if(GlobalData().userData?.realAuth != null){
realAuth = GlobalData().userData!.realAuth!;
if (GlobalData().userData != null) {
final information = GlobalData().userData!;
if(information.identityCard != null){
realAuth = true;
}
} }
dataList.assignAll([ dataList.assignAll([
AuthCard( title: '手机绑定', desc: '防止账号丢失', index: 1, authed: true), AuthCard( title: '手机绑定', desc: '防止账号丢失', index: 1, authed: true),
AuthCard( title: '真实头像', desc: '提高交友成功率', index: 2, authed: false), AuthCard( title: '真实头像', desc: '提高交友成功率', index: 2, authed: false),
AuthCard( title: '实名认证', desc: '提高交友成功率', index: 3, authed: false),
AuthCard( title: '实名认证', desc: '提高交友成功率', index: 3, authed: realAuth),
]); ]);
// //
// final response = await _userApi.login({}); // final response = await _userApi.login({});
@ -106,7 +109,7 @@ class AuthController extends GetxController {
final response = await _userApi.saveCertificationAudit(param); final response = await _userApi.saveCertificationAudit(param);
// //
if (response.data.isSuccess) { if (response.data.isSuccess) {
GlobalData().userData?.realAuth = true;
GlobalData().userData!.identityCard = idcard.value;
SmartDialog.showToast('认证成功'); SmartDialog.showToast('认证成功');
Get.back(result: 3); Get.back(result: 3);
} else { } else {

15
lib/controller/mine/user_controller.dart

@ -75,7 +75,6 @@ class UserController extends GetxController {
final response = await _userApi.getMarriageInformationDetail(); final response = await _userApi.getMarriageInformationDetail();
if (response.data.isSuccess) { if (response.data.isSuccess) {
// data是否为null或者是空对象 // data是否为null或者是空对象
print(78111);
if(response.data.data == null){ if(response.data.data == null){
if(isMain){ if(isMain){
SmartDialog.showToast('转到完善信息'); SmartDialog.showToast('转到完善信息');
@ -86,15 +85,13 @@ class UserController extends GetxController {
return; return;
} }
final information = response.data.data!; final information = response.data.data!;
if (information.id.isNotEmpty) {
final result = await _userApi.getCertificationList(information.id);
List<AuthenticationData> list = result.data.data!;
final record = list.firstWhere((item) => item.authenticationCode == 0);
information.realAuth = record.status == 1;
}
// if (information.id.isNotEmpty) {
// final result = await _userApi.getCertificationList(information.id);
// List<AuthenticationData> list = result.data.data!;
// final record = list.firstWhere((item) => item.authenticationCode == 0);
// information.realAuth = record.status == 1;
// }
GlobalData().userData = information; GlobalData().userData = information;
print(95111);
print(GlobalData().userData);
if (information.id.isEmpty || information.genderCode.isNaN || information.birthYear == null || information.nickName.isEmpty) { if (information.id.isEmpty || information.genderCode.isNaN || information.birthYear == null || information.nickName.isEmpty) {
// //
SmartDialog.showToast('转到完善信息'); SmartDialog.showToast('转到完善信息');

6
lib/model/mine/user_data.dart

@ -4,7 +4,7 @@ class UserData {
final String nickName; final String nickName;
final String? name; final String? name;
final String? profilePhoto; final String? profilePhoto;
final String? identityCard;
String? identityCard;
final int genderCode; final int genderCode;
final String genderValue; final String genderValue;
final String? homeCountryCode; final String? homeCountryCode;
@ -59,7 +59,6 @@ class UserData {
final String? hometownProvinceName; final String? hometownProvinceName;
final int? hometownCityCode; final int? hometownCityCode;
final String? hometownCityName; final String? hometownCityName;
bool? realAuth;
UserData({ UserData({
required this.id, required this.id,
@ -121,7 +120,6 @@ class UserData {
this.hometownProvinceName, this.hometownProvinceName,
this.hometownCityCode, this.hometownCityCode,
this.hometownCityName, this.hometownCityName,
this.realAuth,
}); });
// JSON映射创建实例 // JSON映射创建实例
@ -186,7 +184,6 @@ class UserData {
hometownProvinceName: json['hometownProvinceName'], hometownProvinceName: json['hometownProvinceName'],
hometownCityCode: json['hometownCityCode'], hometownCityCode: json['hometownCityCode'],
hometownCityName: json['hometownCityName'], hometownCityName: json['hometownCityName'],
realAuth: json['realAuth'],
); );
} }
@ -252,7 +249,6 @@ class UserData {
'hometownProvinceName': hometownProvinceName, 'hometownProvinceName': hometownProvinceName,
'hometownCityCode': hometownCityCode, 'hometownCityCode': hometownCityCode,
'hometownCityName': hometownCityName, 'hometownCityName': hometownCityName,
'realAuth': realAuth,
}; };
} }

Loading…
Cancel
Save