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
e81f69b1
Commit
e81f69b1
authored
Nov 16, 2017
by
houweibin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1,首页缓存问题
2,品牌商品页,根据是否有品牌图来判断是否显示品牌图区域 3,去掉所有品牌的获取缓存失败提示。
parent
2fb9f93c
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
31 additions
and
15 deletions
+31
-15
KWMBrandCaramelVC.m
iCemarose/Class/UI/Brand/KWMBrandCaramelVC.m
+15
-0
KWMSearchBrandVC.m
iCemarose/Class/UI/Brand/KWMSearchBrandVC.m
+9
-7
KWMCategoryVC.m
iCemarose/Class/UI/Category/KWMCategoryVC.m
+5
-3
KWMNewHomeVC.m
iCemarose/Class/UI/NewHome/KWMNewHomeVC.m
+2
-5
No files found.
iCemarose/Class/UI/Brand/KWMBrandCaramelVC.m
View file @
e81f69b1
...
@@ -65,9 +65,23 @@
...
@@ -65,9 +65,23 @@
// Do any additional setup after loading the view.
// Do any additional setup after loading the view.
[
self
initView
];
[
self
initView
];
[
self
initTableViewHeaderHidden
];
[
self
getCollection
:
_handle
];
[
self
getCollection
:
_handle
];
}
}
-
(
void
)
initTableViewHeaderHidden
{
//判断是否有品牌图,有就显示
if
(
self
.
collection
&&
self
.
collection
.
image
&&
self
.
collection
.
image
.
sourceURL
&&
!
[
KWMStringUtil
isEmpty
:
self
.
collection
.
image
.
sourceURL
.
absoluteString
]){
self
.
tbvBrandCaramel
.
tableHeaderView
.
frame
=
CGRectMake
(
0
,
0
,
UI_SCREEN_WIDTH
,
210
);
self
.
tbvBrandCaramel
.
tableHeaderView
.
hidden
=
NO
;
}
else
{
self
.
tbvBrandCaramel
.
tableHeaderView
.
frame
=
CGRectMake
(
0
,
0
,
0
,
0
);
self
.
tbvBrandCaramel
.
tableHeaderView
.
hidden
=
YES
;
}
}
-
(
void
)
setBackColor
{
-
(
void
)
setBackColor
{
colorArr
=
[
NSArray
arrayWithObjects
:
@"#D8A88D"
,
@"#A4C8C6"
,
@"#E6C995"
,
@"#718473"
,
@"#D7B48B"
,
nil
];
colorArr
=
[
NSArray
arrayWithObjects
:
@"#D8A88D"
,
@"#A4C8C6"
,
@"#E6C995"
,
@"#718473"
,
@"#D7B48B"
,
nil
];
int
num
=
arc4random_uniform
(
10
);
int
num
=
arc4random_uniform
(
10
);
...
@@ -313,6 +327,7 @@ static NSString *idStr = @"KWMBrandCaramelCell";
...
@@ -313,6 +327,7 @@ static NSString *idStr = @"KWMBrandCaramelCell";
}
}
-
(
void
)
setBrandData
{
-
(
void
)
setBrandData
{
[
self
initTableViewHeaderHidden
];
//图片
//图片
if
(
_collection
!=
nil
&&
_collection
.
image
!=
nil
){
if
(
_collection
!=
nil
&&
_collection
.
image
!=
nil
){
NSURL
*
url
=
[
_collection
.
image
sourceURL
];
NSURL
*
url
=
[
_collection
.
image
sourceURL
];
...
...
iCemarose/Class/UI/Brand/KWMSearchBrandVC.m
View file @
e81f69b1
...
@@ -322,14 +322,16 @@ static NSString *identify = @"KWMSearchBrandsCell";
...
@@ -322,14 +322,16 @@ static NSString *identify = @"KWMSearchBrandsCell";
[
weakSelf
.
tbvSearchBrand
reloadData
];
[
weakSelf
.
tbvSearchBrand
reloadData
];
};
};
void
(
^
cacheCallback
)(
KWMBrandsResult
*
)
=
^
(
KWMBrandsResult
*
result
){
void
(
^
cacheCallback
)(
KWMBrandsResult
*
)
=
^
(
KWMBrandsResult
*
result
){
if
([
weakSelf
hasCemaroseError
:
result
]){
// if([weakSelf hasCemaroseError:result]){
return
;
// return ;
// }
if
(
result
&&
result
.
brands
){
NSArray
*
indexArray
=
[[
result
.
brands
rx_filterWithBlock
:
^
BOOL
(
id
each
)
{
return
each
&&
each
!=
[
NSNull
null
];
}]
arrayWithPinYinFirstLetterFormat
];
_dataArray
=
[
NSMutableArray
arrayWithArray
:
indexArray
];
[
weakSelf
.
tbvSearchBrand
reloadData
];
}
}
NSArray
*
indexArray
=
[[
result
.
brands
rx_filterWithBlock
:
^
BOOL
(
id
each
)
{
return
each
&&
each
!=
[
NSNull
null
];
}]
arrayWithPinYinFirstLetterFormat
];
_dataArray
=
[
NSMutableArray
arrayWithArray
:
indexArray
];
[
weakSelf
.
tbvSearchBrand
reloadData
];
};
};
[
self
.
api
getAllBrand
:
nil
cacheCallback
:
cacheCallback
success
:
success
failure
:
failure
];
[
self
.
api
getAllBrand
:
nil
cacheCallback
:
cacheCallback
success
:
success
failure
:
failure
];
// [self showLoading];
// [self showLoading];
...
...
iCemarose/Class/UI/Category/KWMCategoryVC.m
View file @
e81f69b1
...
@@ -300,10 +300,12 @@
...
@@ -300,10 +300,12 @@
}
}
};
};
void
(
^
cacheCallback
)(
KWMBrandsResult
*
)
=
^
(
KWMBrandsResult
*
result
){
void
(
^
cacheCallback
)(
KWMBrandsResult
*
)
=
^
(
KWMBrandsResult
*
result
){
if
([
weakSelf
hasCemaroseError
:
result
]){
// if([weakSelf hasCemaroseError:result]){
return
;
// return ;
// }
if
(
result
&&
result
.
brands
){
self
.
allBrands
=
result
.
brands
;
}
}
self
.
allBrands
=
result
.
brands
;
};
};
[
self
.
api
getAllBrand
:
nil
cacheCallback
:
cacheCallback
success
:
success
failure
:
failure
];
[
self
.
api
getAllBrand
:
nil
cacheCallback
:
cacheCallback
success
:
success
failure
:
failure
];
}
}
...
...
iCemarose/Class/UI/NewHome/KWMNewHomeVC.m
View file @
e81f69b1
...
@@ -455,6 +455,7 @@ typedef enum{
...
@@ -455,6 +455,7 @@ typedef enum{
#pragma mark -cache
#pragma mark -cache
/** 因为homedata api的url是动态的,url上的时间戳随时间的改变,所以需要手动保存,和获取 **/
/** 因为homedata api的url是动态的,url上的时间戳随时间的改变,所以需要手动保存,和获取 **/
//缓存规则:网络请求数据照常,如果没网络,并且缓存有数据,会拿缓存的数据显示。
-
(
BOOL
)
isUseHomeDataCache
{
-
(
BOOL
)
isUseHomeDataCache
{
if
(
!
kIsNetwork
){
if
(
!
kIsNetwork
){
KWMHomeData
*
homeData
=
[
KWMPPCacheUtil
getHomeDataByCache
:
nil
urlKey
:
CACHE_KEY_getHomeDataWithSuccess
];
KWMHomeData
*
homeData
=
[
KWMPPCacheUtil
getHomeDataByCache
:
nil
urlKey
:
CACHE_KEY_getHomeDataWithSuccess
];
...
@@ -462,7 +463,6 @@ typedef enum{
...
@@ -462,7 +463,6 @@ typedef enum{
self
.
homeData
=
homeData
;
self
.
homeData
=
homeData
;
[
self
.
cvHome
reloadData
];
[
self
.
cvHome
reloadData
];
}
else
{
}
else
{
[
self
showToast
:
CACHE_KEY_FAIL_HINT
];
return
false
;
return
false
;
}
}
}
}
...
@@ -486,6 +486,7 @@ typedef enum{
...
@@ -486,6 +486,7 @@ typedef enum{
return
params
;
return
params
;
}
}
//缓存规则:网络请求数据照常,如果没网络,并且缓存有数据,会拿缓存的数据显示。
-
(
BOOL
)
isUseProductDataCache
:
(
NSDictionary
*
)
cacheKeyDictionary
valueKeyPath
:
(
NSString
*
)
valueKeyPath
page
:
(
NSUInteger
)
page
isHome
:
(
BOOL
)
isHome
{
-
(
BOOL
)
isUseProductDataCache
:
(
NSDictionary
*
)
cacheKeyDictionary
valueKeyPath
:
(
NSString
*
)
valueKeyPath
page
:
(
NSUInteger
)
page
isHome
:
(
BOOL
)
isHome
{
if
(
!
kIsNetwork
){
if
(
!
kIsNetwork
){
[
self
hideLoading
];
[
self
hideLoading
];
...
@@ -498,10 +499,6 @@ typedef enum{
...
@@ -498,10 +499,6 @@ typedef enum{
products
.
count
?
[
self
.
cvHome
.
mj_footer
endRefreshing
]
:
[
self
.
cvHome
.
mj_footer
endRefreshingWithNoMoreData
];
products
.
count
?
[
self
.
cvHome
.
mj_footer
endRefreshing
]
:
[
self
.
cvHome
.
mj_footer
endRefreshingWithNoMoreData
];
}
}
}
else
{
}
else
{
[
self
showToast
:
CACHE_KEY_FAIL_HINT
];
if
(
isHome
)
{
[
self
.
cvHome
.
mj_footer
endRefreshing
];
}
return
false
;
return
false
;
}
}
}
}
...
...
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