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
fbf76059
Commit
fbf76059
authored
Nov 16, 2017
by
lee
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of git.oschina.net:kollway-kollway/newcemarose
parents
f7d30dd5
f52543d4
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
97 additions
and
53 deletions
+97
-53
AppDelegate+Deeplink.m
iCemarose/Class/AppDelegate+Deeplink.m
+8
-2
KWMBrandCaramelVC.m
iCemarose/Class/UI/Brand/KWMBrandCaramelVC.m
+17
-2
KWMBrandVC.m
iCemarose/Class/UI/Brand/KWMBrandVC.m
+3
-1
KWMSearchBrandVC.m
iCemarose/Class/UI/Brand/KWMSearchBrandVC.m
+12
-8
KWMCategoryVC.m
iCemarose/Class/UI/Category/KWMCategoryVC.m
+6
-4
KWMHotSalesHeader.xib
iCemarose/Class/UI/NewHome/Cell/KWMHotSalesHeader.xib
+3
-3
KWMNewHomeVC.m
iCemarose/Class/UI/NewHome/KWMNewHomeVC.m
+20
-19
KWMSearchFeedbackVC.m
iCemarose/Class/UI/Product/KWMSearchFeedbackVC.m
+6
-3
KWMPPCacheUtil.m
iCemarose/Class/Util/KWMPPCacheUtil.m
+20
-9
KWMStringUtil.m
iCemarose/Class/Util/KWMStringUtil.m
+2
-2
No files found.
iCemarose/Class/AppDelegate+Deeplink.m
View file @
fbf76059
...
...
@@ -14,6 +14,7 @@
#import "KWMBlogDetailVC.h"
#import "KWMNewProductVC.h"
#import "KWMBrandCaramelVC.h"
#import "KWMStringUtil.h"
static
NSMutableDictionary
*
controllerCache
=
nil
;
...
...
@@ -47,11 +48,15 @@ static NSMutableDictionary *controllerCache = nil;
NSLog
(
@"trace tags %@"
,[
tags
componentsJoinedByString
:
@","
]);
NSArray
*
brands
=
@[
@"amelie-wang"
,
@"babywalker"
,
@"beau-loves"
,
@"billieblush"
,
@"billybandit"
,
@"bonpoint"
,
@"burberry"
,
@"caramel"
,
@"chloe"
,
@"collegien"
,
@"dolce-gabbana"
,
@"emile-et-ida"
,
@"fendi"
,
@"gucci"
,
@"hucklebones"
,
@"il-gufo"
,
@"indikidual"
,
@"karl-lagerfeld-kids"
,
@"kenzo"
,
@"lanvin"
,
@"little-marc-jacobs"
,
@"loud-apparel"
,
@"louis-louise"
,
@"louise-misha"
,
@"marie-chantal"
,
@"marni"
,
@"mini-melissa"
,
@"mini-rodini"
,
@"mischka-aoki"
,
@"moncler"
,
@"moschino"
,
@"msgm"
,
@"nailmatic"
,
@"nana-huchy"
,
@"noukies"
,
@"oeuf"
,
@"patachou"
,
@"paul-smith"
,
@"pepe"
,
@"sons-daughters-eyewear"
,
@"stella-mccartney-kids"
,
@"story-loris"
,
@"tartine-et-chocolat"
,
@"the-animals-observatory"
,
@"tiny-cottons"
,
@"veja"
,
@"young-versace"
,
@"zadig-voltaire"
];
NSDictionary
*
brandNames
=
@{
@"amelie-wang"
:
@"Amelie Wang"
,
@"babywalker"
:
@"Babywalker"
,
@"beau-loves"
:
@"Beau Loves"
,
@"billieblush"
:
@"Billieblush"
,
@"billybandit"
:
@"Billybandit"
,
@"bonpoint"
:
@"Bonpoint"
,
@"burberry"
:
@"Burberry"
,
@"caramel"
:
@"Caramel"
,
@"chloe"
:
@"Chloé"
,
@"dolce-gabbana"
:
@"Dolce & Gabbana"
,
@"emile-et-ida"
:
@"Emile et Ida"
,
@"fendi"
:
@"Fendi"
,
@"givenchy"
:
@"Givenchy"
,
@"gucci"
:
@"Gucci"
,
@"hucklebones"
:
@"Hucklebones"
,
@"il-gufo"
:
@"Il Gufo"
,
@"indikidual"
:
@"Indikidual"
,
@"karl-lagerfeld-kids"
:
@"Karl Lagerfeld Kids"
,
@"kenzo"
:
@"Kenzo"
,
@"lanvin"
:
@"Lanvin"
,
@"little-marc-jacobs"
:
@"Little Marc Jacobs"
,
@"loud-apparel"
:
@"Loud Apparel"
,
@"louis-louise"
:
@"Louis Louise"
,
@"louise-misha"
:
@"Louise Misha"
,
@"marie-chantal"
:
@"Marie-Chantal"
,
@"marni"
:
@"Marni"
,
@"mini-melissa"
:
@"Mini Melissa"
,
@"mini-rodini"
:
@"Mini Rodini"
,
@"mischka-aoki"
:
@"Mischka Aoki"
,
@"moncler"
:
@"Moncler"
,
@"moschino"
:
@"MOSCHINO"
,
@"msgm"
:
@"MSGM"
,
@"nailmatic"
:
@"Nailmatic"
,
@"nana-huchy"
:
@"Nana Huchy"
,
@"noukies"
:
@"Noukie's"
,
@"oeuf"
:
@"Oeuf"
,
@"patachou"
:
@"Patachou"
,
@"paul-smith"
:
@"Paul Smith"
,
@"pepe"
:
@"PèPè"
,
@"sons-daughters-eyewear"
:
@"Sons + Daughters Eyewear"
,
@"stella-mccartney-kids"
:
@"Stella McCartney Kids"
,
@"story-loris"
:
@"Story Loris"
,
@"tartine-et-chocolat"
:
@"Tartine et Chocolat"
,
@"the-animals-observatory"
:
@"The Animals Observatory"
,
@"tiny-cottons"
:
@"Tiny Cottons"
,
@"tip-toey-joey"
:
@"Tip Toey Joey"
,
@"veja"
:
@"Veja"
,
@"young-versace"
:
@"Young Versace"
,
@"zadig-voltaire"
:
@"Zadig & Voltaire"
};
//将handle的转化放到这里,转化之前将没转化过的handle存为标题
NSString
*
title
=
handle
;
handle
=
[[
KWMStringUtil
deleteOtherCharExceptLetterWithLine
:
handle
]
lowercaseString
];
if
([
brands
containsObject
:[
handle
lowercaseString
]])
{
KWMBrandCaramelVC
*
brandCaramelVC
=
[
KWMBrandCaramelVC
getNewInstance
];
brandCaramelVC
.
isSale
=
NO
;
brandCaramelVC
.
handle
=
handle
;
brandCaramelVC
.
brand
=
brandNames
[[
handle
lowercaseString
]];
//brandCaramelVC.brand = brandNames[[handle lowercaseString]];
brandCaramelVC
.
brand
=
title
;
brandCaramelVC
.
title
=
brandCaramelVC
.
brand
;
[
self
pushViewController
:
brandCaramelVC
];
[
controllerCache
setObject
:
brandCaramelVC
forKey
:
url
];
...
...
@@ -59,7 +64,8 @@ static NSMutableDictionary *controllerCache = nil;
KWMSelectedGoodsVC
*
selectedGoodsVC
=
(
KWMSelectedGoodsVC
*
)[
KWMBaseVC
findControllerBy
:[
KWMSelectedGoodsVC
kwmTag
]
fromStoryboard
:
@"New"
];
selectedGoodsVC
.
handle
=
handle
;
selectedGoodsVC
.
ctags
=
tags
;
selectedGoodsVC
.
title
=
parameters
[
@"title"
];
//selectedGoodsVC.title = parameters[@"title"];
selectedGoodsVC
.
title
=
title
;
[
self
pushViewController
:
selectedGoodsVC
];
[
controllerCache
setObject
:
selectedGoodsVC
forKey
:
url
];
}
...
...
iCemarose/Class/UI/Brand/KWMBrandCaramelVC.m
View file @
fbf76059
...
...
@@ -65,9 +65,23 @@
// Do any additional setup after loading the view.
[
self
initView
];
[
self
initTableViewHeaderHidden
];
[
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
;
return
;
}
self
.
tbvBrandCaramel
.
tableHeaderView
.
frame
=
CGRectMake
(
0
,
0
,
0
,
0
);
self
.
tbvBrandCaramel
.
tableHeaderView
.
hidden
=
YES
;
}
-
(
void
)
setBackColor
{
colorArr
=
[
NSArray
arrayWithObjects
:
@"#D8A88D"
,
@"#A4C8C6"
,
@"#E6C995"
,
@"#718473"
,
@"#D7B48B"
,
nil
];
int
num
=
arc4random_uniform
(
10
);
...
...
@@ -93,10 +107,10 @@
}
-
(
void
)
initHeaderView
{
self
.
barandSelectView
=
[[
KWMBarandSelectView
alloc
]
init
];
self
.
barandSelectView
.
count
=
[[
KWMShoppingCart
sharedInstance
]
count
].
integerValue
;
self
.
barandSelectView
.
lbBrand
.
text
=
[
_brand
uppercaseString
];
//self.barandSelectView.lbBrand.text = [_brand uppercaseString];
self
.
barandSelectView
.
lbBrand
.
text
=
_brand
;
self
.
barandSelectView
.
delegate
=
self
;
[
self
.
view
addSubview
:
_barandSelectView
];
[
self
initCustomTitleBarConstarints
:
self
.
barandSelectView
];
...
...
@@ -313,6 +327,7 @@ static NSString *idStr = @"KWMBrandCaramelCell";
}
-
(
void
)
setBrandData
{
[
self
initTableViewHeaderHidden
];
//图片
if
(
_collection
!=
nil
&&
_collection
.
image
!=
nil
){
NSURL
*
url
=
[
_collection
.
image
sourceURL
];
...
...
iCemarose/Class/UI/Brand/KWMBrandVC.m
View file @
fbf76059
...
...
@@ -191,7 +191,9 @@ static NSString *cellId = @"KWMBrandCell";
// brandCaramelVC.backColor = [UIColor sam_colorWithHex:colorStr];
//
// [self.navigationController pushViewController:brandCaramelVC animated:YES];
brand
=
[[
KWMStringUtil
deleteOtherCharExceptLetterWithLine
:
brand
]
lowercaseString
];
// brand = [[KWMStringUtil deleteOtherCharExceptLetterWithLine:brand] lowercaseString];
[
self
openURLWithString
:[
NSString
stringWithFormat
:
@"https://www.cemarose.cn/collections/%@"
,
brand
]];
}
else
{
//品牌搜索
...
...
iCemarose/Class/UI/Brand/KWMSearchBrandVC.m
View file @
fbf76059
...
...
@@ -246,7 +246,9 @@ static NSString *identify = @"KWMSearchBrandsCell";
NSDictionary
*
dict
=
self
.
dataArray
[
indexPath
.
section
];
brand
=
[
dict
[
@"content"
]
objectAtIndex
:
indexPath
.
row
];
}
NSString
*
str
=
[
KWMStringUtil
deleteOtherCharExceptLetterWithLine
:
brand
];
//NSString *str = [KWMStringUtil deleteOtherCharExceptLetterWithLine:brand];
NSString
*
str
=
brand
;
// NSLog(@"str: %@",str);
// //品牌介绍
// KWMBrandCaramelVC *brandCaramelVC = (KWMBrandCaramelVC *)[KWMBaseVC findControllerBy:[KWMBrandCaramelVC kwmTag] fromStoryboard:@"Brand"];
...
...
@@ -320,14 +322,16 @@ static NSString *identify = @"KWMSearchBrandsCell";
[
weakSelf
.
tbvSearchBrand
reloadData
];
};
void
(
^
cacheCallback
)(
KWMBrandsResult
*
)
=
^
(
KWMBrandsResult
*
result
){
if
([
weakSelf
hasCemaroseError
:
result
]){
return
;
// if([weakSelf hasCemaroseError:result]){
// 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 showLoading];
...
...
iCemarose/Class/UI/Category/KWMCategoryVC.m
View file @
fbf76059
...
...
@@ -108,7 +108,7 @@
@{
@"title"
:
@"连裤袜"
,
@"collection_id"
:
@"192437830"
,
@"image"
:
@"ic_type_pantyhose"
},
@{
@"title"
:
@"打底裤"
,
@"collection_id"
:
@"192435334"
,
@"image"
:
@"ic_type_leggings"
},
@{
@"title"
:
@"内衣"
,
@"collection_id"
:
@"333026694"
,
@"image"
:
@"ic_type_underwear"
},
@{
@"title"
:
@"雨衣"
,
@"collection_id"
:
@"423509068"
,
@"image"
:
@"ic_type_raincoat"
},
//
@{@"title":@"雨衣",@"collection_id":@"423509068",@"image":@"ic_type_raincoat"},
@{
@"title"
:
@"鞋子"
,
@"collection_id"
:
@"171856134"
,
@"image"
:
@"ic_type_shoe"
},
@{
@"title"
:
@"玩具"
,
@"collection_id"
:
@"332990918"
,
@"image"
:
@"ic_type_toy"
},
@{
@"title"
:
@"配件"
,
@"collection_id"
:
@"191376966"
,
@"image"
:
@"ic_type_Acc"
},
...
...
@@ -300,10 +300,12 @@
}
};
void
(
^
cacheCallback
)(
KWMBrandsResult
*
)
=
^
(
KWMBrandsResult
*
result
){
if
([
weakSelf
hasCemaroseError
:
result
]){
return
;
// if([weakSelf hasCemaroseError:result]){
// return ;
// }
if
(
result
&&
result
.
brands
){
self
.
allBrands
=
result
.
brands
;
}
self
.
allBrands
=
result
.
brands
;
};
[
self
.
api
getAllBrand
:
nil
cacheCallback
:
cacheCallback
success
:
success
failure
:
failure
];
}
...
...
iCemarose/Class/UI/NewHome/Cell/KWMHotSalesHeader.xib
View file @
fbf76059
...
...
@@ -5,7 +5,8 @@
</device>
<dependencies>
<deployment
identifier=
"iOS"
/>
<plugIn
identifier=
"com.apple.InterfaceBuilder.IBCocoaTouchPlugin"
version=
"13173"
/>
<plugIn
identifier=
"com.apple.InterfaceBuilder.IBCocoaTouchPlugin"
version=
"13174"
/>
<capability
name=
"Aspect ratio constraints"
minToolsVersion=
"5.1"
/>
<capability
name=
"documents saved in the Xcode 8 format"
minToolsVersion=
"8.0"
/>
</dependencies>
<customFonts
key=
"customFonts"
>
...
...
@@ -17,7 +18,6 @@
<placeholder
placeholderIdentifier=
"IBFilesOwner"
id=
"-1"
userLabel=
"File's Owner"
customClass=
"KWMHotSalesHeader"
>
<connections>
<outlet
property=
"bannerView"
destination=
"Ruv-UI-DGw"
id=
"USH-xg-KHp"
/>
<outlet
property=
"heightBannerView"
destination=
"NbW-Kh-s5O"
id=
"zdT-r2-QNE"
/>
<outlet
property=
"heightSingleShowView"
destination=
"SEw-Tw-g0a"
id=
"PcT-Pv-gcm"
/>
<outlet
property=
"singleShowView"
destination=
"UGY-II-IMu"
id=
"wxp-gP-PDh"
/>
<outlet
property=
"vView"
destination=
"iN0-l3-epB"
id=
"bI2-U9-soo"
/>
...
...
@@ -32,7 +32,7 @@
<rect
key=
"frame"
x=
"0.0"
y=
"0.0"
width=
"375"
height=
"190"
/>
<color
key=
"backgroundColor"
red=
"0.90588235289999997"
green=
"0.81960784310000001"
blue=
"0.74117647060000003"
alpha=
"1"
colorSpace=
"custom"
customColorSpace=
"sRGB"
/>
<constraints>
<constraint
firstAttribute=
"
height"
constant=
"190"
id=
"NbW-Kh-s5O
"
/>
<constraint
firstAttribute=
"
width"
secondItem=
"Ruv-UI-DGw"
secondAttribute=
"height"
multiplier=
"375:190"
id=
"wq7-qE-RyI
"
/>
</constraints>
</view>
<collectionView
clipsSubviews=
"YES"
multipleTouchEnabled=
"YES"
contentMode=
"scaleToFill"
scrollEnabled=
"NO"
showsHorizontalScrollIndicator=
"NO"
showsVerticalScrollIndicator=
"NO"
dataMode=
"none"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"UGY-II-IMu"
>
...
...
iCemarose/Class/UI/NewHome/KWMNewHomeVC.m
View file @
fbf76059
...
...
@@ -68,6 +68,7 @@ typedef enum{
@implementation
KWMNewHomeVC
{
CGFloat
heightAdHeader
;
CGFloat
heightClothingSets
;
CGFloat
heightHotSale
;
}
-
(
void
)
viewDidLoad
{
...
...
@@ -99,11 +100,12 @@ typedef enum{
// self.title = @"首页";
heightAdHeader
=
UI_SCREEN_WIDTH
*
275
/
375
;
heightClothingSets
=
UI_SCREEN_WIDTH
*
190
/
375
+
127
;
//127为图片外的布局高度
heightHotSale
=
UI_SCREEN_WIDTH
*
190
/
375
+
60
;
//60为图片外的布局高度
self
.
adHeader
=
[[
KWMAdHeader
alloc
]
initWithFrame
:
CGRectMake
(
0
,
0
,
UI_SCREEN_WIDTH
,
heightAdHeader
)];
self
.
menuHeader
=
[[
KWMMenuHeader
alloc
]
initWithFrame
:
CGRectMake
(
0
,
0
,
UI_SCREEN_WIDTH
,
100
)];
self
.
recommendHeader
=
[[
KWMRecommendHeader
alloc
]
initWithFrame
:
CGRectMake
(
0
,
0
,
UI_SCREEN_WIDTH
,
230
)];
self
.
clothingSetsHeader
=
[[
KWMClothingSetsHeader
alloc
]
initWithFrame
:
CGRectMake
(
0
,
0
,
UI_SCREEN_WIDTH
,
heightClothingSets
)];
self
.
hotSalesHeader
=
[[
KWMHotSalesHeader
alloc
]
initWithFrame
:
CGRectMake
(
0
,
0
,
UI_SCREEN_WIDTH
,
250
)];
self
.
hotSalesHeader
=
[[
KWMHotSalesHeader
alloc
]
initWithFrame
:
CGRectMake
(
0
,
0
,
UI_SCREEN_WIDTH
,
heightHotSale
)];
self
.
adHeader
.
delegate
=
self
;
self
.
menuHeader
.
delegate
=
self
;
...
...
@@ -291,7 +293,7 @@ typedef enum{
height
=
heightClothingSets
;
break
;
case
HeaderHotSales
:
height
=
self
.
hotSalesHeader
.
actrualHeight
;
height
=
heightHotSale
;
break
;
default
:
break
;
...
...
@@ -352,19 +354,19 @@ typedef enum{
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
isUseProductDataCache
:
parameters
valueKeyPath
:
valueKeyPath
page
:
cpage
isHome
:
isHome
]){
return
;
}
BOOL
isUseCache
=
[
self
isUseProductDataCache
:
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
)
{
[
KWMPPCacheUtil
saveDataToCache
:
parameters
urlKey
:
CACHE_KEY_SDK_getCollectionByHandle_getProductsPage
products
:
products
];
[
self
setValue
:
products
forKeyPath
:
valueKeyPath
];
[
self
.
cvHome
reloadData
];
if
(
!
isUseCache
){
[
self
setValue
:
products
forKeyPath
:
valueKeyPath
];
[
self
.
cvHome
reloadData
];
}
}
else
{
[
self
showError
:
error
];
//
[self showError:error];
}
if
(
isHome
)
{
self
.
page
=
self
.
page
+
1
;
...
...
@@ -397,15 +399,15 @@ typedef enum{
-
(
void
)
loadHomeData
{
[
self
requestProductWithHandle
:
@"hot-sell-app"
tags
:
nil
valueKeyPath
:
@"recommendHeader.productArray"
];
if
([
self
isUseHomeDataCache
]){
return
;
}
BOOL
isUseCache
=
[
self
isUseHomeDataCache
];
[
self
.
api
getHomeDataWithSuccess
:
^
(
NSURLSessionDataTask
*
task
,
KWMHomeDataResult
*
result
)
{
[
KWMPPCacheUtil
saveDataToCache
:
nil
urlKey
:
CACHE_KEY_getHomeDataWithSuccess
homeData
:
result
.
data
];
self
.
homeData
=
result
.
data
;
[
self
.
cvHome
reloadData
];
if
(
!
isUseCache
){
self
.
homeData
=
result
.
data
;
[
self
.
cvHome
reloadData
];
}
}
failure
:
^
(
NSURLSessionDataTask
*
task
,
NSError
*
error
)
{
[
self
showError
:
error
];
//
[self showError:error];
}];
}
...
...
@@ -453,6 +455,7 @@ typedef enum{
#pragma mark -cache
/** 因为homedata api的url是动态的,url上的时间戳随时间的改变,所以需要手动保存,和获取 **/
//缓存规则:网络请求数据照常,如果没网络,并且缓存有数据,会拿缓存的数据显示。
-
(
BOOL
)
isUseHomeDataCache
{
if
(
!
kIsNetwork
){
KWMHomeData
*
homeData
=
[
KWMPPCacheUtil
getHomeDataByCache
:
nil
urlKey
:
CACHE_KEY_getHomeDataWithSuccess
];
...
...
@@ -460,7 +463,7 @@ typedef enum{
self
.
homeData
=
homeData
;
[
self
.
cvHome
reloadData
];
}
else
{
[
self
showToast
:
CACHE_KEY_FAIL_HINT
]
;
return
false
;
}
}
return
!
kIsNetwork
;
...
...
@@ -483,6 +486,7 @@ typedef enum{
return
params
;
}
//缓存规则:网络请求数据照常,如果没网络,并且缓存有数据,会拿缓存的数据显示。
-
(
BOOL
)
isUseProductDataCache
:
(
NSDictionary
*
)
cacheKeyDictionary
valueKeyPath
:
(
NSString
*
)
valueKeyPath
page
:
(
NSUInteger
)
page
isHome
:
(
BOOL
)
isHome
{
if
(
!
kIsNetwork
){
[
self
hideLoading
];
...
...
@@ -495,10 +499,7 @@ typedef enum{
products
.
count
?
[
self
.
cvHome
.
mj_footer
endRefreshing
]
:
[
self
.
cvHome
.
mj_footer
endRefreshingWithNoMoreData
];
}
}
else
{
[
self
showToast
:
CACHE_KEY_FAIL_HINT
];
if
(
isHome
)
{
[
self
.
cvHome
.
mj_footer
endRefreshing
];
}
return
false
;
}
}
return
!
kIsNetwork
;
...
...
iCemarose/Class/UI/Product/KWMSearchFeedbackVC.m
View file @
fbf76059
...
...
@@ -11,6 +11,7 @@
#import "KWMSearchFeedBackView.h"
#import "KWMNewProductVC.h"
#import "MJRefresh.h"
#import "KWMStringUtil.h"
@interface
KWMSearchFeedbackVC
()
<
UITableViewDelegate
,
UITableViewDataSource
,
KWMSearchFeedBackViewDelegate
,
KWMBrandCaramelCellDelegate
>
@property
(
nonatomic
)
KWMSearchFeedBackView
*
vSearchFB
;
...
...
@@ -52,8 +53,8 @@
}
-
(
void
)
reLoadData
{
//
[self getSearchProduct];
self
.
currentPage
=
@0
;
[
self
getSearchProduct
];
}
static
NSString
*
idStr
=
@"KWMBrandCaramelCell"
;
-
(
void
)
viewDidLoad
{
...
...
@@ -189,7 +190,9 @@ static NSString *idStr = @"KWMBrandCaramelCell";
//搜索API
-
(
void
)
getSearchProduct
{
if
([
KWMStringUtil
isEmpty
:
_searchText
]){
return
;
}
if
([[
_searchText
lowercaseString
]
isEqualToString
:
@"bonpoint"
])
{
self
.
vNoGoods
.
hidden
=
NO
;
return
;
...
...
iCemarose/Class/Util/KWMPPCacheUtil.m
View file @
fbf76059
...
...
@@ -84,12 +84,17 @@
// NSDictionary *saveDict = collection.JSONDictionary;
// [PPNetworkCache setHttpCache:saveDict URL:urlKey parameters:cacheKeyDictionary];
// }
if
(
collection
){
NSString
*
imageString
=
collection
.
image
.
sourceURL
.
absoluteString
;
NSDictionary
*
collectionData
=
@{
@"image"
:
imageString
,
@"identifier"
:
collection
.
identifier
.
stringValue
,
if
(
collection
&&
collection
.
identifier
){
NSMutableDictionary
*
collectionData
=
@{
@"identifier"
:
collection
.
identifier
.
stringValue
,
@"description"
:
collection
.
htmlDescription
,
};
}.
mutableCopy
;;
if
(
collection
.
image
&&
collection
.
image
.
sourceURL
)
{
NSString
*
imageString
=
collection
.
image
.
sourceURL
.
absoluteString
;
collectionData
[
@"image"
]
=
imageString
;
}
if
(
collection
.
htmlDescription
){
collectionData
[
@"description"
]
=
collection
.
htmlDescription
;
}
[
PPNetworkCache
setHttpCache
:
collectionData
URL
:
urlKey
parameters
:
cacheKeyDictionary
];
}
}
...
...
@@ -100,10 +105,16 @@
// BUYCollection *collection = (BUYCollection *)[[BUYModelManager modelManager] buy_objectWithEntityName:[BUYCollection entityName] JSONDictionary:cacheDictionary];
// return collection;
BUYCollection
*
collection
=
[[
BUYCollection
alloc
]
init
];
collection
.
image
=
[[
BUYImageLink
alloc
]
init
];
NSString
*
imageString
=
cacheDictionary
[
@"image"
];
collection
.
image
.
sourceURL
=
[[
NSURL
alloc
]
initWithString
:
imageString
];
collection
.
htmlDescription
=
cacheDictionary
[
@"description"
];
if
(
cacheDictionary
[
@"image"
]){
collection
.
image
=
[[
BUYImageLink
alloc
]
init
];
NSString
*
imageString
=
cacheDictionary
[
@"image"
];
collection
.
image
.
sourceURL
=
[[
NSURL
alloc
]
initWithString
:
imageString
];
}
if
(
cacheDictionary
[
@"description"
]){
collection
.
htmlDescription
=
cacheDictionary
[
@"description"
];
}
else
{
collection
.
htmlDescription
=
@""
;
}
NSString
*
idString
=
cacheDictionary
[
@"identifier"
];
collection
.
identifier
=
@
([
idString
integerValue
]);
return
collection
;
...
...
iCemarose/Class/Util/KWMStringUtil.m
View file @
fbf76059
...
...
@@ -411,8 +411,8 @@ static NSDateFormatter *monthDayFormatter;
return
rect
.
size
;
}
//删除出字母以外的字符补充为@"-"
static
NSString
*
kEnglishNum
=
@"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"
;
//删除出字母以
及“-”以
外的字符补充为@"-"
static
NSString
*
kEnglishNum
=
@"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
-
"
;
+
(
NSString
*
)
deleteOtherCharExceptLetterWithLine
:(
NSString
*
)
str
{
NSString
*
changeStr
=
[
str
stringByReplacingOccurrencesOfString
:
@"é"
withString
:
@"e"
];
...
...
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