diff --git a/ShenQi.xcodeproj/xcshareddata/xcschemes/SQNoti.xcscheme b/ShenQi.xcodeproj/xcshareddata/xcschemes/SQNoti.xcscheme
index 205cc81..bd75b11 100644
--- a/ShenQi.xcodeproj/xcshareddata/xcschemes/SQNoti.xcscheme
+++ b/ShenQi.xcodeproj/xcshareddata/xcschemes/SQNoti.xcscheme
@@ -30,7 +30,7 @@
@@ -61,7 +61,7 @@
@@ -80,7 +80,7 @@
diff --git a/ShenQi.xcodeproj/xcshareddata/xcschemes/ShenQi.xcscheme b/ShenQi.xcodeproj/xcshareddata/xcschemes/ShenQi.xcscheme
index 5cb1fe4..5236f3d 100644
--- a/ShenQi.xcodeproj/xcshareddata/xcschemes/ShenQi.xcscheme
+++ b/ShenQi.xcodeproj/xcshareddata/xcschemes/ShenQi.xcscheme
@@ -15,7 +15,7 @@
@@ -31,7 +31,7 @@
@@ -62,7 +62,7 @@
diff --git a/ShenQi.xcworkspace/xcuserdata/a123.xcuserdatad/UserInterfaceState.xcuserstate b/ShenQi.xcworkspace/xcuserdata/a123.xcuserdatad/UserInterfaceState.xcuserstate
index 9953199..62dd960 100644
Binary files a/ShenQi.xcworkspace/xcuserdata/a123.xcuserdatad/UserInterfaceState.xcuserstate and b/ShenQi.xcworkspace/xcuserdata/a123.xcuserdatad/UserInterfaceState.xcuserstate differ
diff --git a/ShenQi/AppDelegate.m b/ShenQi/AppDelegate.m
index b7d8056..4153a21 100644
--- a/ShenQi/AppDelegate.m
+++ b/ShenQi/AppDelegate.m
@@ -21,6 +21,7 @@
#import "MainOldViewController.h"
#import "LaunchViewController.h"
+#import "NotiCenterViewController.h"
@interface AppDelegate ()
@@ -223,6 +224,11 @@
NSString *jumpUrl = [messageNotiDic objectForKey:@"jumpUrl"];
NSInteger pushId = [[messageNotiDic objectForKey:@"pushId"] longValue];
+ NotiCenterViewController *notiCenterViewController = [[NotiCenterViewController alloc] initWithNibName:@"NotiCenterViewController" bundle:nil];
+ notiCenterViewController.modalPresentationStyle = UIModalPresentationFullScreen;
+ notiCenterViewController.pushId = pushId;
+ [self.window.rootViewController presentViewController:notiCenterViewController animated:NO completion:nil];
+
// 上传点击 pushId
if (pushId > 0) {
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:PushStatisticsURL]];
@@ -238,6 +244,7 @@
}];
[dataTask resume];
}
+ /*
if (type == 2 && !ISNULLSTR(image)) {
dispatch_async(dispatch_get_main_queue(), ^{
NSURL *url = [NSURL URLWithString:image];
@@ -266,6 +273,7 @@
[self.window.rootViewController presentViewController:view animated:YES completion:^{}];
});
}
+ */
}
}
}
diff --git a/ShenQi/NotiCenterImageTableViewCell.m b/ShenQi/NotiCenterImageTableViewCell.m
index 632901f..7b04967 100644
--- a/ShenQi/NotiCenterImageTableViewCell.m
+++ b/ShenQi/NotiCenterImageTableViewCell.m
@@ -26,7 +26,7 @@
NSURL *url = [NSURL URLWithString:self.list.image];
self.contentLabel.text = self.list.content;
self.imageHeightConstraint.constant = self.list.imageHeight;
- [self.contentImageView sd_setImageWithURL:url];
+ [self.contentImageView sd_setImageWithURL:url placeholderImage:[UIImage imageNamed:@"zhanwei"]];
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
diff --git a/ShenQi/NotiCenterTableViewCell.m b/ShenQi/NotiCenterTableViewCell.m
index b59ccec..8897320 100644
--- a/ShenQi/NotiCenterTableViewCell.m
+++ b/ShenQi/NotiCenterTableViewCell.m
@@ -36,7 +36,7 @@
}
UIFont *textFont = [UIFont boldSystemFontOfSize:15];
CGFloat width = [self.typeLabel.text boundingRectWithSize:CGSizeMake(MAXFLOAT, 30) options:NSStringDrawingTruncatesLastVisibleLine | NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading attributes:@{NSFontAttributeName: textFont} context:nil].size.width;
- self.widthConstraint.constant = width+20;
+ self.widthConstraint.constant = width+10;
self.dateLabel.text = self.list.createTime;
self.titleLabel.text = self.list.title;
}
diff --git a/ShenQi/NotiCenterViewController.h b/ShenQi/NotiCenterViewController.h
index c437965..3d2450e 100644
--- a/ShenQi/NotiCenterViewController.h
+++ b/ShenQi/NotiCenterViewController.h
@@ -11,6 +11,8 @@ NS_ASSUME_NONNULL_BEGIN
@interface NotiCenterViewController : UIViewController
+@property (nonatomic, assign) NSInteger pushId;
+
@end
NS_ASSUME_NONNULL_END
diff --git a/ShenQi/NotiCenterViewController.m b/ShenQi/NotiCenterViewController.m
index 237c148..1aeb338 100644
--- a/ShenQi/NotiCenterViewController.m
+++ b/ShenQi/NotiCenterViewController.m
@@ -17,6 +17,7 @@
#import
#import "DataModels.h"
#import "UIButton+DSButtonBlock.h"
+#import
#import "MainOldViewController.h"
@@ -32,6 +33,8 @@ static NSString *linkidentifier = @"NotiCenterJumpLinkTableViewCell";
@property (nonatomic, strong) NSString *mainUserId;
@property (nonatomic, strong) NSMutableArray *notiArray;
+@property (nonatomic, assign) NSInteger page;
+
@end
@implementation NotiCenterViewController
@@ -56,16 +59,22 @@ static NSString *linkidentifier = @"NotiCenterJumpLinkTableViewCell";
[self.tableView registerNib:[UINib nibWithNibName:@"NotiCenterContentTableViewCell" bundle:nil] forCellReuseIdentifier:contentidentifier];
[self.tableView registerNib:[UINib nibWithNibName:@"NotiCenterImageTableViewCell" bundle:nil] forCellReuseIdentifier:imageidentifier];
[self.tableView registerNib:[UINib nibWithNibName:@"NotiCenterJumpLinkTableViewCell" bundle:nil] forCellReuseIdentifier:linkidentifier];
+ self.tableView.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
+ self.notiArray = @[].mutableCopy;
+ self.page = 1;
+ [self refreshDatasource];
+ }];
self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
self.tableView.tableFooterView = [UIView new];
self.notiArray = @[].mutableCopy;
- [self setupDatasource];
+ self.page = 1;
+ [self refreshDatasource];
}
--(void)setupDatasource
+-(void)refreshDatasource
{
- NSString *urlstring = [NSString stringWithFormat:@"%@?userId=%@&page=1&size=100",PushRecordsURL,self.mainUserId];
+ NSString *urlstring = [NSString stringWithFormat:@"%@?userId=%@&page=%ld&size=20",PushRecordsURL,self.mainUserId,(long)self.page];
NSURL *url = [NSURL URLWithString:urlstring];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
@@ -85,17 +94,28 @@ static NSString *linkidentifier = @"NotiCenterJumpLinkTableViewCell";
}else{
if (ISNULL(error) && !ISNULL(responseObject) && [[responseObject objectForKey:@"code"] integerValue] == 1) {
PushRecordDataModel *model = [[PushRecordDataModel alloc] initWithDictionary:responseObject];
- for (PushRecordList *list in self.notiArray) {
+ for (PushRecordList *list in model.data.list) {
if (list.type == 2) {
list.imageHeight = SCREEN_WIDTH-30;
}
}
[self.notiArray addObjectsFromArray:model.data.list];
+ if (model.data.list.count == 20) {
+ self.tableView.mj_footer = [MJRefreshBackNormalFooter footerWithRefreshingBlock:^{
+ self.page++;
+ [self refreshDatasource];
+ }];
+ }else{
+ self.tableView.mj_footer = nil;
+ }
[self.tableView reloadData];
[self refreshImageDatasource];
+ [self scrollViewToRecordIDSection];
}
}
}
+ [self.tableView.mj_header endRefreshing];
+ [self.tableView.mj_footer endRefreshing];
});
}];
[dataTask resume];
@@ -103,16 +123,35 @@ static NSString *linkidentifier = @"NotiCenterJumpLinkTableViewCell";
-(void)refreshImageDatasource
{
- for (PushRecordList *list in self.notiArray) {
+ for (NSInteger i=0; i 0) {
+ for (NSInteger i=0; i