mod: userInfo data type

This commit is contained in:
guozhigq
2024-11-17 22:18:53 +08:00
parent 570a073963
commit 1252b609a9
22 changed files with 60 additions and 47 deletions

View File

@ -6,6 +6,7 @@ import 'package:pilipala/http/follow.dart';
import 'package:pilipala/http/member.dart';
import 'package:pilipala/models/follow/result.dart';
import 'package:pilipala/models/member/tags.dart';
import 'package:pilipala/models/user/info.dart';
import 'package:pilipala/utils/storage.dart';
/// 查看自己的关注时,可以查看分类
@ -18,7 +19,7 @@ class FollowController extends GetxController with GetTickerProviderStateMixin {
RxList<FollowItemModel> followList = <FollowItemModel>[].obs;
late int mid;
late String name;
var userInfo;
UserInfoData? userInfo;
RxString loadingText = '加载中...'.obs;
RxBool isOwner = false.obs;
late List<MemberTagItemModel> followTags;
@ -30,9 +31,9 @@ class FollowController extends GetxController with GetTickerProviderStateMixin {
userInfo = userInfoCache.get('userInfoCache');
mid = Get.parameters['mid'] != null
? int.parse(Get.parameters['mid']!)
: userInfo.mid;
isOwner.value = mid == userInfo.mid;
name = Get.parameters['name'] ?? userInfo.uname;
: userInfo!.mid!;
isOwner.value = mid == userInfo?.mid;
name = Get.parameters['name'] ?? userInfo?.uname ?? '';
}
Future queryFollowings(type) async {
@ -68,7 +69,7 @@ class FollowController extends GetxController with GetTickerProviderStateMixin {
// 当查看当前用户的关注时,请求关注分组
Future followUpTags() async {
if (userInfo != null && mid == userInfo.mid) {
if (userInfo != null && mid == userInfo!.mid) {
var res = await MemberHttp.followUpTags();
if (res['status']) {
followTags = res['data'];