diff --git a/LekangGuard.xcodeproj/project.pbxproj b/LekangGuard.xcodeproj/project.pbxproj index 51918df..fbb22f8 100644 --- a/LekangGuard.xcodeproj/project.pbxproj +++ b/LekangGuard.xcodeproj/project.pbxproj @@ -202,6 +202,10 @@ 615AD284293446A70066E20C /* PathView.m in Sources */ = {isa = PBXBuildFile; fileRef = 615AD27E293446A60066E20C /* PathView.m */; }; 615AD285293446A70066E20C /* WSBezier.m in Sources */ = {isa = PBXBuildFile; fileRef = 615AD282293446A60066E20C /* WSBezier.m */; }; 615AD286293446A70066E20C /* UILabel+BezierAnimation.m in Sources */ = {isa = PBXBuildFile; fileRef = 615AD283293446A60066E20C /* UILabel+BezierAnimation.m */; }; + 6172BFFF2A7245A000B3247F /* ReadFlowerViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6172BFFE2A7245A000B3247F /* ReadFlowerViewController.m */; }; + 6172C0022A72465B00B3247F /* MyChildViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6172C0012A72465B00B3247F /* MyChildViewController.m */; }; + 6172C0052A72467500B3247F /* OtherChildViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6172C0042A72467500B3247F /* OtherChildViewController.m */; }; + 6172C0082A72485B00B3247F /* RedFlowerModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 6172C0072A72485B00B3247F /* RedFlowerModel.m */; }; 6175597828DAE1C1008E5954 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 6175597728DAE1C1008E5954 /* AppDelegate.m */; }; 6175597E28DAE1C1008E5954 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6175597D28DAE1C1008E5954 /* ViewController.m */; }; 6175598128DAE1C1008E5954 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 6175597F28DAE1C1008E5954 /* Main.storyboard */; }; @@ -827,6 +831,14 @@ 615AD281293446A60066E20C /* PathView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PathView.h; sourceTree = ""; }; 615AD282293446A60066E20C /* WSBezier.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WSBezier.m; sourceTree = ""; }; 615AD283293446A60066E20C /* UILabel+BezierAnimation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UILabel+BezierAnimation.m"; sourceTree = ""; }; + 6172BFFD2A7245A000B3247F /* ReadFlowerViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ReadFlowerViewController.h; sourceTree = ""; }; + 6172BFFE2A7245A000B3247F /* ReadFlowerViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ReadFlowerViewController.m; sourceTree = ""; }; + 6172C0002A72465B00B3247F /* MyChildViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MyChildViewController.h; sourceTree = ""; }; + 6172C0012A72465B00B3247F /* MyChildViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MyChildViewController.m; sourceTree = ""; }; + 6172C0032A72467500B3247F /* OtherChildViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = OtherChildViewController.h; sourceTree = ""; }; + 6172C0042A72467500B3247F /* OtherChildViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = OtherChildViewController.m; sourceTree = ""; }; + 6172C0062A72485B00B3247F /* RedFlowerModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RedFlowerModel.h; sourceTree = ""; }; + 6172C0072A72485B00B3247F /* RedFlowerModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RedFlowerModel.m; sourceTree = ""; }; 6175597328DAE1C1008E5954 /* ECell care.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "ECell care.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 6175597628DAE1C1008E5954 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 6175597728DAE1C1008E5954 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; @@ -1353,6 +1365,12 @@ 611551562A3060F100F451E5 /* SchAndJobMessageViewController.m */, 6115516B2A3071A300F451E5 /* CommMessageDetailsViewController.h */, 6115516C2A3071A300F451E5 /* CommMessageDetailsViewController.m */, + 6172BFFD2A7245A000B3247F /* ReadFlowerViewController.h */, + 6172BFFE2A7245A000B3247F /* ReadFlowerViewController.m */, + 6172C0002A72465B00B3247F /* MyChildViewController.h */, + 6172C0012A72465B00B3247F /* MyChildViewController.m */, + 6172C0032A72467500B3247F /* OtherChildViewController.h */, + 6172C0042A72467500B3247F /* OtherChildViewController.m */, ); path = VC; sourceTree = ""; @@ -1364,6 +1382,8 @@ 611551692A30673300F451E5 /* SchModel.m */, 6115516E2A3072F600F451E5 /* JobModel.h */, 6115516F2A3072F700F451E5 /* JobModel.m */, + 6172C0062A72485B00B3247F /* RedFlowerModel.h */, + 6172C0072A72485B00B3247F /* RedFlowerModel.m */, ); path = Model; sourceTree = ""; @@ -3545,12 +3565,15 @@ 61D478A3295C1713002FC2D4 /* TracingPoint.m in Sources */, 614F0D1B296571F0007A912A /* SETextMagnifierRanged.m in Sources */, 614F0D18296571F0007A912A /* SECompatibility.m in Sources */, + 6172C0022A72465B00B3247F /* MyChildViewController.m in Sources */, 6115514A2A2F163B00F451E5 /* SelectCountryViewController.m in Sources */, 61D7AACF2987A28900E982AA /* QMUIRuntime.m in Sources */, 614F0D0B296571F0007A912A /* FLAnimatedImage.m in Sources */, 61D478CD295C3371002FC2D4 /* DLCustomSlideView.m in Sources */, 614F0D21296571F0007A912A /* UIImage+Resize.m in Sources */, 61D7AADC2987A28900E982AA /* UIControl+QMUI.m in Sources */, + 6172C0082A72485B00B3247F /* RedFlowerModel.m in Sources */, + 6172C0052A72467500B3247F /* OtherChildViewController.m in Sources */, 614F0D08296571F0007A912A /* XHMessageTextView.m in Sources */, 61D7AAD92987A28900E982AA /* UINavigationBar+QMUI.m in Sources */, 615AD2152930ACE90066E20C /* HAndTTableViewCell.m in Sources */, @@ -3652,6 +3675,7 @@ 61D7AAD62987A28900E982AA /* QMUIWeakObjectContainer.m in Sources */, 614F0CFA296571F0007A912A /* XHDisplayEmotionViewController.m in Sources */, 614F0D01296571F0007A912A /* XHMessageBubbleView.m in Sources */, + 6172BFFF2A7245A000B3247F /* ReadFlowerViewController.m in Sources */, 614F0CF8296571F0007A912A /* XHPhotographyHelper.m in Sources */, 614F0CE8296571F0007A912A /* XHMessageBubbleFactory.m in Sources */, 614F0CF2296571F0007A912A /* XHLocationHelper.m in Sources */, diff --git a/LekangGuard.xcworkspace/xcuserdata/ecell.xcuserdatad/UserInterfaceState.xcuserstate b/LekangGuard.xcworkspace/xcuserdata/ecell.xcuserdatad/UserInterfaceState.xcuserstate index 7844fb4..928ef78 100644 Binary files a/LekangGuard.xcworkspace/xcuserdata/ecell.xcuserdatad/UserInterfaceState.xcuserstate and b/LekangGuard.xcworkspace/xcuserdata/ecell.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/LekangGuard.xcworkspace/xcuserdata/ecell.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/LekangGuard.xcworkspace/xcuserdata/ecell.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist index e7dd035..9416eda 100644 --- a/LekangGuard.xcworkspace/xcuserdata/ecell.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +++ b/LekangGuard.xcworkspace/xcuserdata/ecell.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist @@ -215,22 +215,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + diff --git a/LekangGuard/AppDelegate.m b/LekangGuard/AppDelegate.m index 0d182ee..571b7cc 100644 --- a/LekangGuard/AppDelegate.m +++ b/LekangGuard/AppDelegate.m @@ -163,21 +163,12 @@ /** 收到推送的时候触发的 **/ --(void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler +-(void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler { [self setNotificationData:userInfo]; completionHandler(UIBackgroundFetchResultNewData); } -///** -//在前台时推送消息才会调用的接口 ios 10 以上的新接口 -// **/ -//- (void)userNotificationCenter:(UNUserNotificationCenter *)center -// willPresentNotification:(UNNotification *)notification -// withCompletionHandler:(void (^)(UNNotificationPresentationOptions))completionHandler -//{ -// [self setNotificationData:notification.request.content.userInfo]; -//} /** MARK: APP 挂后台的情况下 点击 通知栏跳转到响应页面 diff --git a/LekangGuard/Common/BaseViewController.m b/LekangGuard/Common/BaseViewController.m index c55b411..5986b11 100644 --- a/LekangGuard/Common/BaseViewController.m +++ b/LekangGuard/Common/BaseViewController.m @@ -272,7 +272,12 @@ return ; } - + if([msgType isEqualToString:@"redFlower"] || [msgType isEqualToString:@"ZYTZ"] || [msgType isEqualToString:@"XYTZ"]) + { + [[NSNotificationCenter defaultCenter] postNotificationName:@"XIAOHONGHUA" object:nil]; + return; + } + if([msgType isEqualToString:@"battery"] || [msgType isEqualToString:@"deviceNowLocation"]) { /// 电量推送和地理位置推送 diff --git a/LekangGuard/Managers/APIManager.m b/LekangGuard/Managers/APIManager.m index 08a5f06..6ff9758 100644 --- a/LekangGuard/Managers/APIManager.m +++ b/LekangGuard/Managers/APIManager.m @@ -12,7 +12,8 @@ #ifdef DEBUG //测试环境 //NSString *const dHostUrl = @"http://api.oversea.ecellsz.com:9876"; -NSString *const dHostUrl = @"http://1.13.186.145:8822"; +//NSString *const dHostUrl = @"http://1.13.186.145:8822"; +NSString *const dHostUrl = @"http://120.77.209.176:8822"; #else //正式环境 NSString *const dHostUrl = @"http://api.oversea.ecellsz.com:9876"; diff --git a/LekangGuard/Managers/UIModel.h b/LekangGuard/Managers/UIModel.h index 7c53da2..80736bf 100644 --- a/LekangGuard/Managers/UIModel.h +++ b/LekangGuard/Managers/UIModel.h @@ -38,7 +38,7 @@ #import "JobModel.h" #import "FamilyModel.h" #import "FeedbackModel.h" -//#import "TihuModel.h" +#import "RedFlowerModel.h" //#import "BairuiModel.h" diff --git a/LekangGuard/Managers/UIURL.h b/LekangGuard/Managers/UIURL.h index c889a0f..1ba3586 100644 --- a/LekangGuard/Managers/UIURL.h +++ b/LekangGuard/Managers/UIURL.h @@ -304,6 +304,17 @@ /// 分页查询作业接口 #define HomeWorkPage_GET_URL @"/home-work/query/homeWorkPage" +/// 查询小红花未读总数 +#define ReadFlowerCount_GET_URL @"/app/device/query/readFlowerCount" + +/// 查询小红花通知列表 +#define ReadFlowerList_GET_URL @"/app/device/query/readFlowerList" + +/// 修改小红花未读状态接口后面拼接id +#define ReadOwnFlowerStatus_GET_URL @"/app/device/edit/readOwnFlowerStatus/" + + + /// 查询亲情号 #define FamilyNumber_URL @"/family-number-info/query/familyNumber" diff --git a/LekangGuard/TabMessage/Model/RedFlowerModel.h b/LekangGuard/TabMessage/Model/RedFlowerModel.h new file mode 100644 index 0000000..af3f751 --- /dev/null +++ b/LekangGuard/TabMessage/Model/RedFlowerModel.h @@ -0,0 +1,56 @@ +// +// RedFlowerModel.h +// LekangGuard +// +// Created by ecell on 2023/7/27. +// + +#import "BaseModel.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface RedFlowerModel : BaseModel + + +/// string($date-time) 创建时间 +@property (nonatomic ,copy) NSString *createTime; + +/// integer($int32) 小红花个数 +@property (nonatomic ,assign) NSInteger flowerNumber; + +/// string 主键id +@property (nonatomic ,copy) NSString *Id; + +/// string imei +@property (nonatomic ,copy) NSString *imei; + +/// string 发布内容 +@property (nonatomic ,copy) NSString *pushContent; + +/// string 发布人id +@property (nonatomic ,copy) NSString *pushId; + +/// string 发布人姓名 +@property (nonatomic ,copy) NSString *pushName; + +/// string 接收人id +@property (nonatomic ,copy) NSString *receiveId; + +/// string 是否已读(0.未读,1.是已读) +@property (nonatomic ,assign) NSInteger receiveStatus; + +/// string 奖励人id +@property (nonatomic ,copy) NSString *rewardId; + +/// string 奖励人姓名 +@property (nonatomic ,copy) NSString *rewardName; + +/// string 小红花记录id +@property (nonatomic ,copy) NSString *stuRedFlowerId; + +/// string($date-time) 更新时间 +@property (nonatomic ,copy) NSString *updateTime; + +@end + +NS_ASSUME_NONNULL_END diff --git a/LekangGuard/TabMessage/Model/RedFlowerModel.m b/LekangGuard/TabMessage/Model/RedFlowerModel.m new file mode 100644 index 0000000..ef3898a --- /dev/null +++ b/LekangGuard/TabMessage/Model/RedFlowerModel.m @@ -0,0 +1,19 @@ +// +// RedFlowerModel.m +// LekangGuard +// +// Created by ecell on 2023/7/27. +// + +#import "RedFlowerModel.h" + +@implementation RedFlowerModel + ++ (NSDictionary *)modelCustomPropertyMapper +{ + return @{ + @"Id":@"id" + }; +} + +@end diff --git a/LekangGuard/TabMessage/VC/CommMessageDetailsViewController.m b/LekangGuard/TabMessage/VC/CommMessageDetailsViewController.m index 7ba388b..5bc88de 100644 --- a/LekangGuard/TabMessage/VC/CommMessageDetailsViewController.m +++ b/LekangGuard/TabMessage/VC/CommMessageDetailsViewController.m @@ -51,35 +51,35 @@ make.top.equalTo(textsLabel.mas_bottom).offset(30); }]; - [self setMessageRead]; +// [self setMessageRead]; } -#pragma mark 消息已读 -/// 消息已读 -- (void)setMessageRead -{ - [UICommon MessageUpload:@"加载中"]; - NSMutableDictionary *parameters = [NSMutableDictionary dictionary]; - NSString *url; - if (self.viewType == 0) - { - url = F(@"%@%@", IsReade_GET_URL,self.schModel.noticeId); - } - else - { - url = HomeworkIsReade_GET_URL; - [parameters setValue:self.jobModel.Id forKey:@"homeWorkId"]; - [parameters setValue:APIManager.sharedManager.userModel.userId forKey:@"stuOrFatherId"]; - } - [[[APIManager sharedManager] APGET:url parameters:parameters resultClass:BaseModel.class] subscribeNext:^(id _Nullable x) { - [UICommon HidenLoading]; - - } error:^(NSError * _Nullable error) { - NSDictionary *dic = error.userInfo; - [UICommon MessageErrorText:dic[NSLocalizedDescriptionKey]]; - }]; -} +//#pragma mark 消息已读 +///// 消息已读 +//- (void)setMessageRead +//{ +// [UICommon MessageUpload:@"加载中"]; +// NSMutableDictionary *parameters = [NSMutableDictionary dictionary]; +// NSString *url; +// if (self.viewType == 0) +// { +// url = F(@"%@%@", IsReade_GET_URL,self.schModel.noticeId); +// } +// else +// { +// url = HomeworkIsReade_GET_URL; +// [parameters setValue:self.jobModel.Id forKey:@"homeWorkId"]; +// [parameters setValue:APIManager.sharedManager.userModel.userId forKey:@"stuOrFatherId"]; +// } +// [[[APIManager sharedManager] APGET:url parameters:parameters resultClass:BaseModel.class] subscribeNext:^(id _Nullable x) { +// [UICommon HidenLoading]; +// +// } error:^(NSError * _Nullable error) { +// NSDictionary *dic = error.userInfo; +// [UICommon MessageErrorText:dic[NSLocalizedDescriptionKey]]; +// }]; +//} - (UIScrollView *)bgScrollView { diff --git a/LekangGuard/TabMessage/VC/MyChildViewController.h b/LekangGuard/TabMessage/VC/MyChildViewController.h new file mode 100644 index 0000000..49b4d54 --- /dev/null +++ b/LekangGuard/TabMessage/VC/MyChildViewController.h @@ -0,0 +1,16 @@ +// +// MyChildViewController.h +// LekangGuard +// +// Created by ecell on 2023/7/27. +// + +#import "BaseViewController.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface MyChildViewController : BaseViewController + +@end + +NS_ASSUME_NONNULL_END diff --git a/LekangGuard/TabMessage/VC/MyChildViewController.m b/LekangGuard/TabMessage/VC/MyChildViewController.m new file mode 100644 index 0000000..8ab0de3 --- /dev/null +++ b/LekangGuard/TabMessage/VC/MyChildViewController.m @@ -0,0 +1,152 @@ +// +// MyChildViewController.m +// LekangGuard +// +// Created by ecell on 2023/7/27. +// + +#import "MyChildViewController.h" +#import "CommMessageTableViewCell.h" +#import "CommMessageDetailsViewController.h" + +@interface MyChildViewController () + + +@property (nonatomic ,strong) CommonTableView *msgTable; + +@property (nonatomic ,assign) NSInteger page; + +@end + +@implementation MyChildViewController + +- (void)viewDidLoad { + [super viewDidLoad]; + // Do any additional setup after loading the view. + + self.page = 1; + self.view.backgroundColor = KKBackgroundGrey; + [self.view addSubview:self.msgTable]; + [self.msgTable mas_makeConstraints:^(MASConstraintMaker *make) { + make.edges.equalTo(self.view); + }]; + [UICommon MessageUpload:@"加载中"]; + [self getMessageList:TableisReload_h]; +} + +- (CommonTableView *)msgTable +{ + if (!_msgTable) + { + kWeakSelf(self) + _msgTable = [[CommonTableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain cellHeight:50 cellRow:0 isAdaptive:YES isLine:NO commonCell:CommMessageTableViewCell.class createCell:^(ZZTableViewCell * _Nonnull cells, NSIndexPath * _Nonnull indexPath) { + CommMessageTableViewCell *cell = (CommMessageTableViewCell *)cells; + cell.redModel = self.modelListArr[indexPath.row]; + + } selectedCell:^(UITableView * _Nonnull tableView, NSIndexPath * _Nonnull indexPath) { + RedFlowerModel *redModel = self.modelListArr[indexPath.row]; + if (redModel.receiveStatus == 0) + [weakself setMessageRead:redModel IndexPath:indexPath]; + + } DidscrollView:^(UIScrollView * _Nonnull scrollView) { + + }]; + _msgTable.backgroundColor = KKClearColor; + _msgTable.emptyDataSetSource = self; + _msgTable.emptyDataSetDelegate = self; + [_msgTable bindHeadRefreshHandler:^{ + [UICommon feedbackGenerator]; + [weakself getMessageList:TableisReload_h]; + } themeColor:KKMainColor refreshStyle:KafkaRefreshStyleReplicatorWoody]; + + [_msgTable bindFootRefreshHandler:^{ + [weakself getMessageList:TableisReload_f]; + } themeColor:KKMainColor refreshStyle:KafkaRefreshStyleReplicatorWoody]; + + } + return _msgTable; +} + + + +#pragma mark 获取校园通知 +/// 获取校园通知 +- (void)getMessageList:(TableisReload)isReload +{ + kWeakSelf(self) + if (isReload == TableisReload_h) + { + self.page = 1; + [self.modelListArr removeAllObjects]; + } + NSMutableDictionary *parameters = [NSMutableDictionary dictionary]; + [parameters setValue:@(self.page) forKey:@"current"]; + [parameters setValue:@(20) forKey:@"pageSize"]; + [parameters setValue:@(1) forKey:@"flag"]; + [[[APIManager sharedManager] APGET:ReadFlowerList_GET_URL parameters:parameters resultClass:BaseModel.class] subscribeNext:^(BaseModel *obj) { + [UICommon HidenLoading]; + if (ARRAYHASVALUE(obj.records)) + { + [weakself.msgTable.headRefreshControl endRefreshingWithAlertText:@"已为你加载最新数据~" completion:^{ + + }]; + [weakself.msgTable.footRefreshControl endRefreshing]; + [obj.records enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) { + + RedFlowerModel *model = [RedFlowerModel yy_modelWithJSON:obj]; + [self.modelListArr addObject:model]; + + }]; + weakself.page++; + weakself.msgTable.footRefreshControl.hidden = obj.records.count < KSizeNO ? YES : NO; + weakself.msgTable.cellRow = self.modelListArr.count; + [weakself.msgTable reloadData]; + } + + + } error:^(NSError * _Nullable error) { + NSDictionary *dic = error.userInfo; + [UICommon MessageErrorText:dic[NSLocalizedDescriptionKey]]; + }]; +} + + + +#pragma mark 消息已读 +/// 消息已读 +- (void)setMessageRead:(RedFlowerModel *)redModel IndexPath:(NSIndexPath *_Nonnull)indexPath +{ + NSMutableDictionary *parameters = [NSMutableDictionary dictionary]; + NSString *url = F(@"%@%@", ReadOwnFlowerStatus_GET_URL,redModel.Id); + [[[APIManager sharedManager] APGET:url parameters:parameters resultClass:BaseModel.class] subscribeNext:^(id _Nullable x) { + [UICommon HidenLoading]; + for (int i = 0; i < self.modelListArr.count; i++) + { + RedFlowerModel *model = self.modelListArr[i]; + if (model.Id == redModel.Id) + { + [self.modelListArr removeObject:model]; + redModel.receiveStatus = 1; + [self.modelListArr replaceObjectAtIndex:i withObject:redModel]; + break; + } + } + [self.msgTable reloadRowsAtIndexPaths:[NSArray arrayWithObjects:indexPath, nil] withRowAnimation:UITableViewRowAnimationNone]; + + } 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 diff --git a/LekangGuard/TabMessage/VC/OtherChildViewController.h b/LekangGuard/TabMessage/VC/OtherChildViewController.h new file mode 100644 index 0000000..6002f09 --- /dev/null +++ b/LekangGuard/TabMessage/VC/OtherChildViewController.h @@ -0,0 +1,16 @@ +// +// OtherChildViewController.h +// LekangGuard +// +// Created by ecell on 2023/7/27. +// + +#import "BaseViewController.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface OtherChildViewController : BaseViewController + +@end + +NS_ASSUME_NONNULL_END diff --git a/LekangGuard/TabMessage/VC/OtherChildViewController.m b/LekangGuard/TabMessage/VC/OtherChildViewController.m new file mode 100644 index 0000000..68c6706 --- /dev/null +++ b/LekangGuard/TabMessage/VC/OtherChildViewController.m @@ -0,0 +1,149 @@ +// +// OtherChildViewController.m +// LekangGuard +// +// Created by ecell on 2023/7/27. +// + +#import "OtherChildViewController.h" +#import "CommMessageTableViewCell.h" +#import "CommMessageDetailsViewController.h" + +@interface OtherChildViewController () + + +@property (nonatomic ,strong) CommonTableView *msgTable; + +@property (nonatomic ,assign) NSInteger page; + +@end + +@implementation OtherChildViewController + +- (void)viewDidLoad { + [super viewDidLoad]; + // Do any additional setup after loading the view. + + self.page = 1; + self.view.backgroundColor = KKBackgroundGrey; + [self.view addSubview:self.msgTable]; + [self.msgTable mas_makeConstraints:^(MASConstraintMaker *make) { + make.edges.equalTo(self.view); + }]; + [UICommon MessageUpload:@"加载中"]; + [self getMessageList:TableisReload_h]; +} + +- (CommonTableView *)msgTable +{ + if (!_msgTable) + { + kWeakSelf(self) + _msgTable = [[CommonTableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain cellHeight:50 cellRow:0 isAdaptive:YES isLine:NO commonCell:CommMessageTableViewCell.class createCell:^(ZZTableViewCell * _Nonnull cells, NSIndexPath * _Nonnull indexPath) { + CommMessageTableViewCell *cell = (CommMessageTableViewCell *)cells; + cell.redModel = self.modelListArr[indexPath.row]; + + } selectedCell:^(UITableView * _Nonnull tableView, NSIndexPath * _Nonnull indexPath) { + RedFlowerModel *redModel = self.modelListArr[indexPath.row]; + if (redModel.receiveStatus == 0) + [weakself setMessageRead:redModel IndexPath:indexPath]; + + } DidscrollView:^(UIScrollView * _Nonnull scrollView) { + + }]; + _msgTable.backgroundColor = KKClearColor; + _msgTable.emptyDataSetSource = self; + _msgTable.emptyDataSetDelegate = self; + [_msgTable bindHeadRefreshHandler:^{ + [UICommon feedbackGenerator]; + [weakself getMessageList:TableisReload_h]; + } themeColor:KKMainColor refreshStyle:KafkaRefreshStyleReplicatorWoody]; + + [_msgTable bindFootRefreshHandler:^{ + [weakself getMessageList:TableisReload_f]; + } themeColor:KKMainColor refreshStyle:KafkaRefreshStyleReplicatorWoody]; + + } + return _msgTable; +} + + + +#pragma mark 获取校园通知 +/// 获取校园通知 +- (void)getMessageList:(TableisReload)isReload +{ + kWeakSelf(self) + if (isReload == TableisReload_h) + { + self.page = 1; + [self.modelListArr removeAllObjects]; + } + NSMutableDictionary *parameters = [NSMutableDictionary dictionary]; + [parameters setValue:@(self.page) forKey:@"current"]; + [parameters setValue:@(20) forKey:@"pageSize"]; + [parameters setValue:@(0) forKey:@"flag"]; + [[[APIManager sharedManager] APGET:ReadFlowerList_GET_URL parameters:parameters resultClass:BaseModel.class] subscribeNext:^(BaseModel *obj) { + [UICommon HidenLoading]; + if (ARRAYHASVALUE(obj.records)) + { + [weakself.msgTable.headRefreshControl endRefreshingWithAlertText:@"已为你加载最新数据~" completion:^{ + + }]; + [weakself.msgTable.footRefreshControl endRefreshing]; + [obj.records enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) { + + RedFlowerModel *model = [RedFlowerModel yy_modelWithJSON:obj]; + [self.modelListArr addObject:model]; + + }]; + weakself.page++; + weakself.msgTable.footRefreshControl.hidden = obj.records.count < KSizeNO ? YES : NO; + weakself.msgTable.cellRow = self.modelListArr.count; + [weakself.msgTable reloadData]; + } + + + } error:^(NSError * _Nullable error) { + NSDictionary *dic = error.userInfo; + [UICommon MessageErrorText:dic[NSLocalizedDescriptionKey]]; + }]; +} + +#pragma mark 消息已读 +/// 消息已读 +- (void)setMessageRead:(RedFlowerModel *)redModel IndexPath:(NSIndexPath *_Nonnull)indexPath +{ + NSMutableDictionary *parameters = [NSMutableDictionary dictionary]; + NSString *url = F(@"%@%@", ReadOwnFlowerStatus_GET_URL,redModel.Id); + [[[APIManager sharedManager] APGET:url parameters:parameters resultClass:BaseModel.class] subscribeNext:^(id _Nullable x) { + [UICommon HidenLoading]; + for (int i = 0; i < self.modelListArr.count; i++) + { + RedFlowerModel *model = self.modelListArr[i]; + if (model.Id == redModel.Id) + { + [self.modelListArr removeObject:model]; + redModel.receiveStatus = 1; + [self.modelListArr replaceObjectAtIndex:i withObject:redModel]; + break; + } + } + [self.msgTable reloadRowsAtIndexPaths:[NSArray arrayWithObjects:indexPath, nil] withRowAnimation:UITableViewRowAnimationNone]; + + } 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 diff --git a/LekangGuard/TabMessage/VC/ReadFlowerViewController.h b/LekangGuard/TabMessage/VC/ReadFlowerViewController.h new file mode 100644 index 0000000..5983603 --- /dev/null +++ b/LekangGuard/TabMessage/VC/ReadFlowerViewController.h @@ -0,0 +1,21 @@ +// +// ReadFlowerViewController.h +// LekangGuard +// +// Created by ecell on 2023/7/27. +// + +#import "BaseViewController.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface ReadFlowerViewController : BaseViewController + +/** + 选择移动到哪个页面 + */ +@property (assign , nonatomic)NSInteger selectedIndex; + +@end + +NS_ASSUME_NONNULL_END diff --git a/LekangGuard/TabMessage/VC/ReadFlowerViewController.m b/LekangGuard/TabMessage/VC/ReadFlowerViewController.m new file mode 100644 index 0000000..da61327 --- /dev/null +++ b/LekangGuard/TabMessage/VC/ReadFlowerViewController.m @@ -0,0 +1,73 @@ +// +// ReadFlowerViewController.m +// LekangGuard +// +// Created by ecell on 2023/7/27. +// + +#import "ReadFlowerViewController.h" +#import "MCPageView.h" +#import "MyChildViewController.h" +#import "OtherChildViewController.h" + +@interface ReadFlowerViewController () +@property (nonatomic , strong) MCPageView * PageView; +@property (nonatomic ,strong) NSMutableArray *controllers; + +@end + +@implementation ReadFlowerViewController + +- (void)viewDidLoad { + [super viewDidLoad]; + // Do any additional setup after loading the view. + + self.zx_navTitle = GJText(@"小红花"); + self.controllers = [NSMutableArray array]; + + NSMutableArray *titles = [NSMutableArray array]; + [titles addObject:GJText(@"我的小孩")]; + [titles addObject:GJText(@"其他小孩")]; + MyChildViewController *vc = [MyChildViewController new]; + OtherChildViewController *vc1 = [OtherChildViewController 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]; +} + +- (void)MCPageView:(MCPageView *)MCPageView didSelectIndex:(NSInteger)Index +{ + NSLog(@"%ld",Index); + //MarketEntrustTableView *vc = self.controllers[Index]; + self.selectedIndex = Index; + + //self.viewPage = Index; +} + +/* +#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 diff --git a/LekangGuard/TabMessage/VC/SchAndJobMessageViewController.m b/LekangGuard/TabMessage/VC/SchAndJobMessageViewController.m index 69bb098..ada62b4 100644 --- a/LekangGuard/TabMessage/VC/SchAndJobMessageViewController.m +++ b/LekangGuard/TabMessage/VC/SchAndJobMessageViewController.m @@ -59,6 +59,8 @@ vc.jobModel = self.modelListArr[indexPath.row]; [self.navigationController pushViewController:vc animated:YES]; + [self setMessageRead:self.modelListArr[indexPath.row] IndexPath:indexPath]; + } DidscrollView:^(UIScrollView * _Nonnull scrollView) { }]; @@ -126,6 +128,67 @@ }]; } + +#pragma mark 消息已读 +/// 消息已读 +- (void)setMessageRead:(id)Models IndexPath:(NSIndexPath *_Nonnull)indexPath +{ + [UICommon MessageUpload:@"加载中"]; + NSMutableDictionary *parameters = [NSMutableDictionary dictionary]; + NSString *url; + if (self.viewType == 0) + { + SchModel *schModel = Models; + url = F(@"%@%@", IsReade_GET_URL,schModel.noticeId); + } + else + { + JobModel *jobModel = Models; + url = HomeworkIsReade_GET_URL; + [parameters setValue:jobModel.Id forKey:@"homeWorkId"]; + [parameters setValue:APIManager.sharedManager.userModel.userId forKey:@"stuOrFatherId"]; + } + [[[APIManager sharedManager] APGET:url parameters:parameters resultClass:BaseModel.class] subscribeNext:^(id _Nullable x) { + [UICommon HidenLoading]; + + for (int i = 0; i < self.modelListArr.count; i++) + { + if (self.viewType == 0) + { + SchModel *schModel = Models; + + SchModel *model = self.modelListArr[i]; + if (model.noticeId == schModel.noticeId) + { + [self.modelListArr removeObject:model]; + schModel.sendReadStatus = 3; + [self.modelListArr replaceObjectAtIndex:i withObject:schModel]; + break; + } + } + else + { + JobModel *jobModel = Models; + + JobModel *model = self.modelListArr[i]; + if (model.Id == jobModel.Id) + { + [self.modelListArr removeObject:model]; + jobModel.receiveStatus = 3; + [self.modelListArr replaceObjectAtIndex:i withObject:jobModel]; + break; + } + } + + } + [self.schMsgTable reloadRowsAtIndexPaths:[NSArray arrayWithObjects:indexPath, nil] withRowAnimation:UITableViewRowAnimationNone]; + + } error:^(NSError * _Nullable error) { + NSDictionary *dic = error.userInfo; + [UICommon MessageErrorText:dic[NSLocalizedDescriptionKey]]; + }]; +} + /* #pragma mark - Navigation diff --git a/LekangGuard/TabMessage/VC/TabMessageViewController.m b/LekangGuard/TabMessage/VC/TabMessageViewController.m index ceec705..7fe68c0 100644 --- a/LekangGuard/TabMessage/VC/TabMessageViewController.m +++ b/LekangGuard/TabMessage/VC/TabMessageViewController.m @@ -9,6 +9,7 @@ #import "TabMessageTableViewCell.h" #import "MessageViewController.h" #import "SchAndJobMessageViewController.h" +#import "ReadFlowerViewController.h" @interface TabMessageViewController () @@ -17,6 +18,10 @@ @property (nonatomic ,strong) NSArray *titleArr; @property (nonatomic ,strong) NSArray *imageArr; +@property (nonatomic ,strong) NSMutableArray *msgNumArr; + +@property (nonatomic ,strong) NSNumber *msgTotalCount;///消息未读总数 + @end @implementation TabMessageViewController @@ -26,14 +31,19 @@ // Do any additional setup after loading the view. self.zx_navTitle = @"消息"; self.view.backgroundColor = KKBackgroundGrey; - self.titleArr = @[@"校园通知",@"班级作业",@"设备消息"]; - self.imageArr = @[@"msg_sch_icon",@"msg_job_icon",@"msg_device_icon"]; + self.titleArr = @[@"校园通知",@"班级作业",@"设备消息",@"小红花"]; + self.imageArr = @[@"msg_sch_icon",@"msg_job_icon",@"msg_device_icon",@"msg_device_icon"]; [self.view addSubview:self.msgTable]; [self.msgTable mas_makeConstraints:^(MASConstraintMaker *make) { make.left.right.equalTo(self.view); make.top.equalTo(self.view).offset(iPhoneX_NavHeight); make.bottom.equalTo(self.view); }]; + + [[[NSNotificationCenter defaultCenter] rac_addObserverForName:@"XIAOHONGHUA" object:nil] subscribeNext:^(NSNotification *x) { + [self getHomeWorkCount]; + [self getReadFlowerCount]; + }]; } - (CommonTableView *)msgTable @@ -45,6 +55,7 @@ TabMessageTableViewCell *cell = (TabMessageTableViewCell *)cells; cell.titleStr = self.titleArr[indexPath.row]; cell.imageStr = self.imageArr[indexPath.row]; + cell.msgTotalCount = self.msgNumArr[indexPath.row]; } selectedCell:^(UITableView * _Nonnull tableView, NSIndexPath * _Nonnull indexPath) { if (indexPath.row < 2) @@ -60,6 +71,11 @@ vc.selectedIndex = 0; [self.navigationController pushViewController:vc animated:YES]; } + else + { + ReadFlowerViewController *vc = [[ReadFlowerViewController alloc] init]; + [self.navigationController pushViewController:vc animated:YES]; + } } DidscrollView:^(UIScrollView * _Nonnull scrollView) { @@ -70,6 +86,86 @@ return _msgTable; } +- (void)viewWillAppear:(BOOL)animated +{ + [super viewWillAppear:animated]; + [self getHomeWorkCount]; + [self getUnReadTotal]; + [self getReadFlowerCount]; +} + +#pragma mark 查询未读作业总数 +/// 查询未读作业总数 +- (void)getHomeWorkCount +{ + kWeakSelf(self) + NSMutableDictionary *parameters = [NSMutableDictionary dictionary]; + [[[APIManager sharedManager] APGET:HomeWorkCount_GET_URL parameters:parameters resultClass:nil] subscribeNext:^(id _Nullable x) { + [UICommon HidenLoading]; + NSNumber *campusCount = x[@"campusCount"]; + NSNumber *homeWokeCount = x[@"homeWokeCount"]; + [weakself.msgNumArr replaceObjectAtIndex:0 withObject:campusCount]; + [weakself.msgNumArr replaceObjectAtIndex:1 withObject:homeWokeCount]; + [weakself.msgTable reloadData]; + } error:^(NSError * _Nullable error) { + NSDictionary *dic = error.userInfo; + [UICommon MessageErrorText:dic[NSLocalizedDescriptionKey]]; + }]; +} + +#pragma mark 查询未读消息数 +/// 查询未读消息数 +- (void)getUnReadTotal +{ + kWeakSelf(self) + 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) { + weakself.msgTotalCount = obj[@"total"]; + + }]; + [weakself.msgNumArr replaceObjectAtIndex:2 withObject:weakself.msgTotalCount]; + [weakself.msgTable reloadData]; + } + } error:^(NSError * _Nullable error) { + NSDictionary *dic = error.userInfo; + [UICommon MessageErrorText:dic[NSLocalizedDescriptionKey]]; + }]; +} + +#pragma mark 查询小红花未读总数 +/// 查询小红花未读总数 +- (void)getReadFlowerCount +{ + kWeakSelf(self) + NSMutableDictionary *parameters = [NSMutableDictionary dictionary]; + [[[APIManager sharedManager] APGET:ReadFlowerCount_GET_URL parameters:parameters resultClass:nil] subscribeNext:^(id _Nullable x) { + [UICommon HidenLoading]; + NSNumber *redTotalCount = x[@"totalCount"]; + [weakself.msgNumArr replaceObjectAtIndex:3 withObject:redTotalCount]; + [weakself.msgTable reloadData]; + } error:^(NSError * _Nullable error) { + NSDictionary *dic = error.userInfo; + [UICommon MessageErrorText:dic[NSLocalizedDescriptionKey]]; + }]; +} + + +- (NSMutableArray *)msgNumArr +{ + if (!_msgNumArr) + { + _msgNumArr = [NSMutableArray new]; + [_msgNumArr addObject:@"0"]; + [_msgNumArr addObject:@"0"]; + [_msgNumArr addObject:@"0"]; + [_msgNumArr addObject:@"0"]; + } + return _msgNumArr; +} /* #pragma mark - Navigation diff --git a/LekangGuard/TabMessage/View/CommMessageTableViewCell.h b/LekangGuard/TabMessage/View/CommMessageTableViewCell.h index 06cd88b..85c15ac 100644 --- a/LekangGuard/TabMessage/View/CommMessageTableViewCell.h +++ b/LekangGuard/TabMessage/View/CommMessageTableViewCell.h @@ -17,6 +17,11 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic ,strong) JobModel *jobModel; +/// 小红花 +@property (nonatomic ,strong) RedFlowerModel *redModel; + + + @end NS_ASSUME_NONNULL_END diff --git a/LekangGuard/TabMessage/View/CommMessageTableViewCell.m b/LekangGuard/TabMessage/View/CommMessageTableViewCell.m index ae90a6b..284209c 100644 --- a/LekangGuard/TabMessage/View/CommMessageTableViewCell.m +++ b/LekangGuard/TabMessage/View/CommMessageTableViewCell.m @@ -36,6 +36,16 @@ return self; } +- (void)setRedModel:(RedFlowerModel *)redModel +{ + _redModel = redModel; + self.titleLabel.text = @"小红花奖励"; + self.textsLabel.text = F(@"%@因%@获得%ld朵小红花以兹鼓励.", redModel.rewardName,redModel.pushContent,redModel.flowerNumber); + self.commLabel.text = redModel.pushName; + self.timeLabel.text = redModel.createTime; + self.statusLabel.hidden = redModel.receiveStatus == 0 ? NO : YES; +} + - (void)setSchModel:(SchModel *)schModel { _schModel = schModel; diff --git a/LekangGuard/TabMessage/View/TabMessageTableViewCell.h b/LekangGuard/TabMessage/View/TabMessageTableViewCell.h index ff94b85..acbccfa 100644 --- a/LekangGuard/TabMessage/View/TabMessageTableViewCell.h +++ b/LekangGuard/TabMessage/View/TabMessageTableViewCell.h @@ -17,6 +17,12 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic ,strong) NSString *imageStr; + +@property (nonatomic ,strong) NSNumber *campusCount;///校园通知未读总数 +@property (nonatomic ,strong) NSNumber *homeWokeCount;///作业通知未读总数 +@property (nonatomic ,strong) NSNumber *redTotalCount;///小红花未读总数 +@property (nonatomic ,strong) NSNumber *msgTotalCount;///消息未读总数 + @end NS_ASSUME_NONNULL_END diff --git a/LekangGuard/TabMessage/View/TabMessageTableViewCell.m b/LekangGuard/TabMessage/View/TabMessageTableViewCell.m index 34b389e..58569f5 100644 --- a/LekangGuard/TabMessage/View/TabMessageTableViewCell.m +++ b/LekangGuard/TabMessage/View/TabMessageTableViewCell.m @@ -9,11 +9,15 @@ @interface TabMessageTableViewCell () +/// <#arguments#> +@property (nonatomic ,weak) UIView *bgView; @property (nonatomic ,weak) UIImageView *iconImg; @property (nonatomic ,weak) UILabel *titleLabel; +@property (nonatomic ,weak) UILabel *msgNumLabel; + @end @implementation TabMessageTableViewCell @@ -31,6 +35,23 @@ return self; } +-(void)setMsgTotalCount:(NSNumber *)msgTotalCount +{ + _msgTotalCount = msgTotalCount; + self.msgNumLabel.hidden = msgTotalCount.integerValue > 0 ? NO : YES; + self.msgNumLabel.text = F(@"%@", msgTotalCount); + if (msgTotalCount.integerValue > 0) + { + CGFloat ww = msgTotalCount.integerValue > 9 && msgTotalCount.integerValue < 100 ? 25 : msgTotalCount.integerValue > 99 ? 32 : 20; + [self.msgNumLabel mas_remakeConstraints:^(MASConstraintMaker *make) { + make.right.equalTo(self.bgView.mas_right).inset(15); + make.centerY.equalTo(self.bgView); + make.size.mas_equalTo(CGSizeMake(ww, 20)); + }]; + } +} + + - (void)setTitleStr:(NSString *)titleStr { _titleStr = titleStr; @@ -46,6 +67,7 @@ - (void)subCellView { UIView *bgView = [UICommon ui_view:CGRectZero backgroundColor:KKWhiteColorColor cornerRadius:10 borderWidth:0 borderColor:KKWhiteColorColor]; + self.bgView = bgView; [self.contentView addSubview:bgView]; [bgView mas_makeConstraints:^(MASConstraintMaker *make) { make.left.right.equalTo(self.contentView).inset(15); @@ -69,6 +91,20 @@ make.left.equalTo(iconImg.mas_right).offset(10); make.centerY.equalTo(bgView); }]; + + UILabel *msgNumLabel = [UICommon ui_label:CGRectZero lines:0 align:NSTextAlignmentCenter font:Font_(13) textColor:KKWhiteColorColor text:@"" Radius:10]; + + msgNumLabel.layer.borderWidth = 1.5; + msgNumLabel.layer.borderColor = KKWhiteColorColor.CGColor; + msgNumLabel.backgroundColor = RGB(254, 83, 71); + msgNumLabel.hidden = YES; + self.msgNumLabel = msgNumLabel; + [bgView addSubview:msgNumLabel]; + [msgNumLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.right.equalTo(bgView.mas_right).inset(15); + make.centerY.equalTo(bgView); + make.size.mas_equalTo(CGSizeMake(20, 20)); + }]; } - (void)awakeFromNib {