// // MemberManagementViewController.m // LekangGuard // // Created by ecell on 2023/8/29. // #import "MemberManagementViewController.h" #import "MCPageView.h" #import "MemberListViewController.h" #import "AttentionMessageViewController.h" @interface MemberManagementViewController () @property (nonatomic , strong) MCPageView * PageView; @property (nonatomic ,strong) NSMutableArray *controllers; @end @implementation MemberManagementViewController - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view. self.zx_navTitle = @"成员管理"; self.view.backgroundColor = KKBackgroundGrey; NSMutableArray *titles = [NSMutableArray array]; [titles addObject:GJText(@"成员管理")]; [titles addObject:GJText(@"绑定审批/申请")]; self.controllers = [NSMutableArray array]; MemberListViewController *vc = [MemberListViewController new]; AttentionMessageViewController *vc1 = [AttentionMessageViewController new]; [self.controllers addObject:vc]; [self.controllers addObject:vc1]; self.PageView = [[MCPageView alloc]initWithFrame:CGRectMake(0, iPhoneX_NavHeight, SCREEN_WIDTH,SCREEN_HEIGHT-iPhoneX_NavHeight) titles:titles controllers:self.controllers]; self.PageView.delegate = self; //self.PageView.titleButtonWidth = Adapted(94); self.PageView.backgroundColor = KKWhiteColorColor; self.PageView.lineWitdhScale = 0.65; self.PageView.lineColor = KKMainColor; self.PageView.selectTitleFont = FontBoldADA_(16); self.PageView.defaultTitleFont = FontADA_(14); self.PageView.defaultTitleColor = KKTextBlackColor; self.PageView.selectTitleColor = KKMainColor; self.PageView.lastItemBackgroundColor = KKClearColor; [self.view addSubview:self.PageView]; [self zx_setPopGestureCompatibleScrollViews:@[self.PageView.titleScroll,self.PageView.contentCollection]]; [self.PageView selectIndex:self.selectedIndex]; [[[NSNotificationCenter defaultCenter] rac_addObserverForName:KK_UPDATE_ALL_NEWS_MESSAGE object:nil] subscribeNext:^(NSNotification *x) { [self GetUnReadTotal]; }]; } - (void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; [self GetUnReadTotal]; } - (void)MCPageView:(MCPageView *)MCPageView didSelectIndex:(NSInteger)Index { NSLog(@"%ld",Index); self.selectedIndex = Index; } /// 申请关注 - (void)applicationRrecord { AttentionMessageViewController *vc = self.controllers[1]; [vc GetQueryFollowInfo:TableisReload_h]; } #pragma mark 查询未读消息数 /// 查询未读消息数 - (void)GetUnReadTotal { kWeakSelf(self) [UICommon MessageUpload:@"加载中"]; NSMutableDictionary *parameters = [NSMutableDictionary dictionary]; [[[APIManager sharedManager] APGET:UnReadTotal_URL parameters:parameters resultClass:nil] subscribeNext:^(NSArray *arr) { [UICommon HidenLoading]; if (ARRAYHASVALUE(arr)) { [arr enumerateObjectsUsingBlock:^(NSDictionary *obj, NSUInteger idx, BOOL * _Nonnull stop) { NSInteger total = [obj[@"total"] integerValue]; NSInteger type = [obj[@"type"] integerValue]; if (type == 2) { [weakself.PageView setBadgeWithIndex:type-1 badge:total]; } }]; } } error:^(NSError * _Nullable error) { NSDictionary *dic = error.userInfo; [UICommon MessageErrorText:dic[NSLocalizedDescriptionKey]]; }]; } /* #pragma mark - Navigation // In a storyboard-based application, you will often want to do a little preparation before navigation - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { // Get the new view controller using [segue destinationViewController]. // Pass the selected object to the new view controller. } */ @end