-
Notifications
You must be signed in to change notification settings - Fork 1.3k
/
Copy pathEABasePageModel.m
45 lines (39 loc) · 1.06 KB
/
EABasePageModel.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
//
// EABasePageModel.m
// Coding_iOS
//
// Created by Easeeeeeeeee on 2018/3/22.
// Copyright © 2018年 Coding. All rights reserved.
//
#import "EABasePageModel.h"
@implementation EABasePageModel
- (instancetype)init
{
self = [super init];
if (self) {
_propertyArrayMap = @{
// @"list": @"CodeBranchOrTag",
};
_canLoadMore = YES;
_isLoading = _willLoadMore = NO;
_page = @1;
_pageSize = @20;
}
return self;
}
- (NSMutableDictionary *)toParams{
return @{@"page" : (_willLoadMore? @(_page.intValue +1): @1),
@"pageSize" : _pageSize}.mutableCopy;
}
- (void)configWithObj:(EABasePageModel *)resultA{
self.page = resultA.page;
self.totalPage = resultA.totalPage;
self.totalRow = resultA.totalRow;
if (_willLoadMore) {
[self.list addObjectsFromArray:resultA.list];
}else{
self.list = [NSMutableArray arrayWithArray:resultA.list];
}
self.canLoadMore = self.page.intValue < self.totalPage.intValue;
}
@end