Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
GMBase
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gengmeiios
GMBase
Commits
c00e2f4f
Commit
c00e2f4f
authored
Aug 25, 2020
by
jz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加 page
parent
eab6bb69
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
1 deletion
+9
-1
WMFetchDataViewModel.h
GMBase/Classes/WMFetchDataViewModel.h
+3
-0
WMFetchDataViewModel.m
GMBase/Classes/WMFetchDataViewModel.m
+6
-1
No files found.
GMBase/Classes/WMFetchDataViewModel.h
View file @
c00e2f4f
...
...
@@ -98,6 +98,9 @@
/** @brief 获取http数据分页第一页起始位置,默认为0,下一页为startNum+每页的数据条数(默认为10) */
@property
(
nonatomic
,
assign
)
NSInteger
startNum
;
/** @brief 获取http数据分页第一页起始位置,默认为1,下一页为pag 1 */
@property
(
nonatomic
,
assign
)
NSInteger
page
;
/** @brief 获取http数据,每页获取数据(默认为10) */
@property
(
nonatomic
,
assign
)
NSInteger
count
;
...
...
GMBase/Classes/WMFetchDataViewModel.m
View file @
c00e2f4f
...
...
@@ -19,6 +19,7 @@
_dataArray
=
[[
NSMutableArray
alloc
]
init
];
_startNum
=
0
;
_page
=
1
;
_params
=
nil
;
_count
=
10
;
_deduplicationDic
=
[
NSMutableDictionary
dictionary
];
...
...
@@ -37,7 +38,8 @@
*/
-
(
void
)
buildParams
{
_params
=
@{
@"start_num"
:
@
(
self
.
startNum
),
@"count"
:
@
(
self
.
count
)};
@"count"
:
@
(
self
.
count
)
};
}
-
(
BOOL
)
shouldClearDataForResponse
:
(
id
)
response
{
...
...
@@ -100,6 +102,7 @@
// 因为 clearData 可能会被外部调用,所以 self.startNum = 0 要确认执行,不能少
self
.
startNum
=
0
;
_deleteCount
=
0
;
_page
=
1
;
[
self
.
dataArray
removeAllObjects
];
[
_deduplicationDic
removeAllObjects
];
}
...
...
@@ -107,12 +110,14 @@
-
(
void
)
handleHeaderRefreshing
{
self
.
startNum
=
0
;
self
.
page
=
1
;
[
self
fetchRemoteData
];
}
-
(
void
)
handleFooterRereshing
{
self
.
startNum
=
self
.
dataArray
.
count
+
_deleteCount
;
self
.
page
+=
1
;
[
self
fetchRemoteData
];
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment