Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
I
ios1x
Overview
Overview
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cemarose
ios1x
Commits
3416b732
Commit
3416b732
authored
Nov 27, 2017
by
houweibin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
首页loading显示与隐藏调整为
与homedata api数据的获取相关
parent
8220b199
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
+4
-4
KWMNewHomeVC.m
iCemarose/Class/UI/NewHome/KWMNewHomeVC.m
+4
-4
No files found.
iCemarose/Class/UI/NewHome/KWMNewHomeVC.m
View file @
3416b732
...
...
@@ -339,15 +339,13 @@ typedef enum{
#pragma makr - api
-
(
void
)
requestProductWithHandle
:
(
NSString
*
)
handle
tags
:
(
NSArray
*
)
tags
valueKeyPath
:
(
NSString
*
)
valueKeyPath
{
[
self
showLoading
];
BOOL
isHome
=
[
handle
isEqualToString
:
@"products-list-app-homepage"
];
NSInteger
cpage
=
isHome
?
self
.
page
:
1
;
NSDictionary
*
parameters
=
[
self
getProductCacheKeyDictionary
:
cpage
tags
:
tags
handle
:
handle
];
if
(
!
self
.
isRefreshUI
){
BOOL
use
Home
DataCache
=
[
self
useProductDataCache
:
parameters
valueKeyPath
:
valueKeyPath
page
:
cpage
isHome
:
isHome
];
BOOL
use
Product
DataCache
=
[
self
useProductDataCache
:
parameters
valueKeyPath
:
valueKeyPath
page
:
cpage
isHome
:
isHome
];
}
[
self
.
client
getCollectionByHandle
:
handle
completion
:
^
(
BUYCollection
*
_Nullable
collection
,
NSError
*
_Nullable
error
)
{
[
self
hideLoading
];
if
(
!
error
)
{
[
self
.
client
getProductsPage
:
cpage
inCollection
:
collection
.
identifier
withTags
:
tags
sortOrder
:
BUYCollectionSortCollectionDefault
completion
:^
(
NSArray
<
BUYProduct
*>
*
_Nullable
products
,
NSUInteger
page
,
BOOL
reachedEnd
,
NSError
*
_Nullable
error
)
{
if
(
!
error
)
{
...
...
@@ -370,10 +368,12 @@ typedef enum{
-
(
void
)
loadHomeData
{
[
self
requestProductWithHandle
:
@"hot-sell-app"
tags
:
nil
valueKeyPath
:
@"recommendHeader.productArray"
];
[
self
showLoading
];
if
(
!
self
.
isRefreshUI
){
BOOL
useCache
=
[
self
useHomeDataCache
];
}
[
self
.
api
getHomeDataWithSuccess
:
^
(
NSURLSessionDataTask
*
task
,
KWMHomeDataResult
*
result
)
{
[
self
hideLoading
];
[
KWMPPCacheUtil
saveDataToCache
:
nil
urlKey
:
CACHE_KEY_getHomeDataWithSuccess
homeData
:
result
.
data
];
self
.
homeData
=
result
.
data
;
[
self
.
cvHome
reloadData
];
...
...
@@ -430,6 +430,7 @@ typedef enum{
-
(
BOOL
)
useHomeDataCache
{
KWMHomeData
*
homeData
=
[
KWMPPCacheUtil
getHomeDataByCache
:
nil
urlKey
:
CACHE_KEY_getHomeDataWithSuccess
];
if
(
homeData
){
[
self
hideLoading
];
self
.
homeData
=
homeData
;
[
self
.
cvHome
reloadData
];
return
true
;
...
...
@@ -458,7 +459,6 @@ typedef enum{
//缓存规则:网络请求数据照常,如果没网络,并且缓存有数据,会拿缓存的数据显示。
-
(
BOOL
)
useProductDataCache
:
(
NSDictionary
*
)
cacheKeyDictionary
valueKeyPath
:
(
NSString
*
)
valueKeyPath
page
:
(
NSUInteger
)
page
isHome
:
(
BOOL
)
isHome
{
if
(
!
kIsNetwork
||
page
==
1
){
[
self
hideLoading
];
NSArray
*
products
=
[
KWMPPCacheUtil
getProductDataByCache
:
cacheKeyDictionary
urlKey
:
CACHE_KEY_SDK_getCollectionByHandle_getProductsPage
];
if
(
products
&&
products
.
count
>
0
){
[
self
setValue
:
products
forKeyPath
:
valueKeyPath
];
...
...
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