Browse Source

no message

ios
ZHR007 4 months ago
parent
commit
f425e0fd27
2 changed files with 15 additions and 16 deletions
  1. 25
      lib/controller/mine/auth_controller.dart
  2. 6
      lib/pages/mine/auth_center_page.dart

25
lib/controller/mine/auth_controller.dart

@ -6,7 +6,8 @@ import '../global.dart';
class AuthController extends GetxController {
final isLoading = false.obs;
final List<AuthCard> dataList = [];
// var List<AuthCard> dataList = [];
var dataList = <AuthCard>[].obs;
//
final isLoggingIn = false.obs;
final name = ''.obs;
@ -19,31 +20,28 @@ class AuthController extends GetxController {
super.onInit();
// UserApi
_userApi = Get.find<UserApi>();
_loadInitialData();
loadInitialData();
}
//
Future<void> _loadInitialData() async {
Future<void> loadInitialData() async {
try {
isLoading.value = true;
late bool realAuth = false;
late bool realAuth = false, checkPhoto = false;
if (GlobalData().userData != null) {
final information = GlobalData().userData!;
if(information.identityCard != null){
realAuth = true;
}
if(information.profilePhoto != null){
checkPhoto = true;
}
}
dataList.assignAll([
AuthCard( title: '手机绑定', desc: '防止账号丢失', index: 1, authed: true),
AuthCard( title: '真实头像', desc: '提高交友成功率', index: 2, authed: false),
AuthCard( title: '真实头像', desc: '提高交友成功率', index: 2, authed: checkPhoto),
AuthCard( title: '实名认证', desc: '提高交友成功率', index: 3, authed: realAuth),
]);
//
// final response = await _userApi.login({});
//
// if (response.data.isSuccess) {
//
// }
} catch (e) {
SmartDialog.showToast('网络请求失败,请检查网络连接');
} finally {
@ -78,8 +76,9 @@ class AuthController extends GetxController {
}
void changeAuth(int index){
AuthCard card = dataList.firstWhere((item) => item.index == index);
card.authed = true;
final updatedMessages = List<AuthCard>.from(dataList);
updatedMessages[index].authed = true;
dataList.assignAll(updatedMessages);
}
Future<void> startAuthing() async {

6
lib/pages/mine/auth_center_page.dart

@ -115,12 +115,12 @@ class AuthCenterPage extends StatelessWidget {
).onTap(() async{
if(!item.authed){
if(item.index == 2){
Get.to(() => EditInfoPage());
// Get.to(widget.path);
await Get.to(() => EditInfoPage());
controller.loadInitialData();
} else if(item.index == 3){
final result = await Get.to(() => RealNamePage());
if(result > 0){
controller.changeAuth(result);
controller.loadInitialData();
}
}
}

Loading…
Cancel
Save