公司电脑
1 year ago
23 changed files with 839 additions and 153 deletions
Binary file not shown.
@ -0,0 +1,56 @@
@@ -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 |
@ -0,0 +1,19 @@
@@ -0,0 +1,19 @@
|
||||
// |
||||
// RedFlowerModel.m |
||||
// LekangGuard |
||||
// |
||||
// Created by ecell on 2023/7/27. |
||||
// |
||||
|
||||
#import "RedFlowerModel.h" |
||||
|
||||
@implementation RedFlowerModel |
||||
|
||||
+ (NSDictionary<NSString *, id> *)modelCustomPropertyMapper |
||||
{ |
||||
return @{ |
||||
@"Id":@"id" |
||||
}; |
||||
} |
||||
|
||||
@end |
@ -0,0 +1,16 @@
@@ -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 |
@ -0,0 +1,152 @@
@@ -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 ()<DZNEmptyDataSetSource,DZNEmptyDataSetDelegate> |
||||
|
||||
|
||||
@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 |
@ -0,0 +1,16 @@
@@ -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 |
@ -0,0 +1,149 @@
@@ -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 ()<DZNEmptyDataSetSource,DZNEmptyDataSetDelegate> |
||||
|
||||
|
||||
@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 |
@ -0,0 +1,21 @@
@@ -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 |
@ -0,0 +1,73 @@
@@ -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 ()<MCPageViewDelegate> |
||||
@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 |
Loading…
Reference in new issue