diff --git a/lib/models/space/data.dart b/lib/models/space/data.dart index 5de5d48b1..029a5521e 100644 --- a/lib/models/space/data.dart +++ b/lib/models/space/data.dart @@ -21,6 +21,8 @@ part 'data.g.dart'; @JsonSerializable() class Data { int? relation; + @JsonKey(name: 'rel_special') + int? relSpecial; @JsonKey(name: 'guest_relation') int? guestRelation; @JsonKey(name: 'default_tab') @@ -54,6 +56,7 @@ class Data { Data({ this.relation, + this.relSpecial, this.guestRelation, this.defaultTab, this.isParams, diff --git a/lib/models/space/data.g.dart b/lib/models/space/data.g.dart index e29e1bd92..0765da583 100644 --- a/lib/models/space/data.g.dart +++ b/lib/models/space/data.g.dart @@ -8,6 +8,7 @@ part of 'data.dart'; Data _$DataFromJson(Map json) => Data( relation: (json['relation'] as num?)?.toInt(), + relSpecial: (json['rel_special'] as num?)?.toInt(), guestRelation: (json['guest_relation'] as num?)?.toInt(), defaultTab: json['default_tab'] as String?, isParams: json['is_params'] as bool?, @@ -64,6 +65,7 @@ Data _$DataFromJson(Map json) => Data( Map _$DataToJson(Data instance) => { 'relation': instance.relation, + 'rel_special': instance.relSpecial, 'guest_relation': instance.guestRelation, 'default_tab': instance.defaultTab, 'is_params': instance.isParams, diff --git a/lib/pages/follow/widgets/follow_item.dart b/lib/pages/follow/widgets/follow_item.dart index 89c870159..1bd3b5089 100644 --- a/lib/pages/follow/widgets/follow_item.dart +++ b/lib/pages/follow/widgets/follow_item.dart @@ -46,10 +46,12 @@ class FollowItem extends StatelessWidget { ? SizedBox( height: 34, child: TextButton( - onPressed: () async { - await Get.bottomSheet( - GroupPanel(mid: item.mid!), - isScrollControlled: true, + onPressed: () { + Utils.actionRelationMod( + context: context, + mid: item.mid, + isFollow: true, + callback: (attribute) {}, ); }, style: TextButton.styleFrom( diff --git a/lib/pages/member/new/controller.dart b/lib/pages/member/new/controller.dart index fc3862e3b..7b1e9be9b 100644 --- a/lib/pages/member/new/controller.dart +++ b/lib/pages/member/new/controller.dart @@ -36,7 +36,9 @@ class MemberControllerNew extends CommonController bool customHandleResponse(Success response) { username = response.response?.card?.name ?? ''; isFollow.value = response.response?.card?.relation?.isFollow == 1; - relation.value = response.response?.relation ?? 1; + relation.value = response.response?.relSpecial == 1 + ? 2 + : response.response?.relation ?? 1; tab2 = response.response.tab2; if (tab2 != null && tab2!.isNotEmpty) { if (!response.response.tab.toJson().values.contains(true) && @@ -127,7 +129,7 @@ class MemberControllerNew extends CommonController mid: mid, isFollow: isFollow.value, callback: (attribute) { - relation.value = 1; + relation.value = attribute; isFollow.value = attribute != 0; }, ); diff --git a/lib/pages/member/new/widget/user_info_card.dart b/lib/pages/member/new/widget/user_info_card.dart index 98e8b2f97..a25286e3a 100644 --- a/lib/pages/member/new/widget/user_info_card.dart +++ b/lib/pages/member/new/widget/user_info_card.dart @@ -238,9 +238,11 @@ class UserInfoCard extends StatelessWidget { TextSpan( text: relation == -1 ? '移除黑名单' - : isFollow - ? ' 已关注' - : '关注', + : relation == 2 + ? ' 特别关注' + : isFollow + ? ' 已关注' + : '关注', ) ], ), diff --git a/lib/pages/video/detail/introduction/widgets/group_panel.dart b/lib/pages/video/detail/introduction/widgets/group_panel.dart index faf71beec..01995bf74 100644 --- a/lib/pages/video/detail/introduction/widgets/group_panel.dart +++ b/lib/pages/video/detail/introduction/widgets/group_panel.dart @@ -53,11 +53,11 @@ class _GroupPanelState extends State { final bool anyHasChecked = tagsList.any((MemberTagItemModel e) => e.checked == true); late String tagids; + List? tagidList; if (anyHasChecked) { final List checkedList = tagsList.where((MemberTagItemModel e) => e.checked == true).toList(); - final List tagidList = - checkedList.map((e) => e.tagid!).toList(); + tagidList = checkedList.map((e) => e.tagid!).toList(); tagids = tagidList.join(','); } else { tagids = '0'; @@ -66,7 +66,7 @@ class _GroupPanelState extends State { final res = await MemberHttp.addUsers(widget.mid, tagids); SmartDialog.showToast(res['msg']); if (res['status']) { - Get.back(result: true); + Get.back(result: tagidList?.contains(-10) == true); } } diff --git a/lib/utils/utils.dart b/lib/utils/utils.dart index d4f47a4e5..4c8dfdada 100644 --- a/lib/utils/utils.dart +++ b/lib/utils/utils.dart @@ -46,7 +46,7 @@ class Utils { ); SmartDialog.showToast(res['status'] ? "关注成功" : res['msg']); if (res['status']) { - callback(2); + callback(1); // followStatus['attribute'] = 2; // followStatus.refresh(); } @@ -84,6 +84,11 @@ class Utils { // followStatus['tag'] = tags; // followStatus.refresh(); SmartDialog.showToast('$text成功'); + if (isSpecialFollowed) { + callback(1); + } else { + callback(2); + } } else { SmartDialog.showToast(res['msg']); } @@ -97,7 +102,7 @@ class Utils { dense: true, onTap: () async { Get.back(); - await showModalBottomSheet( + dynamic result = await showModalBottomSheet( context: context, useSafeArea: true, isScrollControlled: true, @@ -125,10 +130,11 @@ class Utils { ); }, ); - // await Future.delayed(const Duration(milliseconds: 500)); - // if (result == true) { - // queryFollowStatus(); - // } + if (result == true) { + callback(2); + } else if (result == false) { + callback(1); + } }, title: const Text( '设置分组',