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
737cd3ae
Commit
737cd3ae
authored
Sep 25, 2017
by
lee
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
u'
parent
d148bf5c
Show whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
157 additions
and
55 deletions
+157
-55
AppDelegate.m
iCemarose/AppDelegate.m
+2
-1
LaunchScreen.storyboard
iCemarose/Base.lproj/LaunchScreen.storyboard
+1
-1
KWMProductResult.h
iCemarose/Class/Api/Cemarose/KWMProductResult.h
+2
-0
KWMProductResult.m
iCemarose/Class/Api/Cemarose/KWMProductResult.m
+6
-0
KWMAPIManager.h
iCemarose/Class/Api/KWMAPIManager.h
+3
-0
KWMAPIManager.m
iCemarose/Class/Api/KWMAPIManager.m
+5
-0
AppDelegate+Deeplink.m
iCemarose/Class/AppDelegate+Deeplink.m
+15
-2
KWMCategoryModel.h
iCemarose/Class/Model/KWMCategoryModel.h
+1
-0
KWMProduct.h
iCemarose/Class/Model/KWMProduct.h
+1
-0
KWMVariants.h
iCemarose/Class/Model/KWMVariants.h
+1
-0
KWMBrandCaramelVC.m
iCemarose/Class/UI/Brand/KWMBrandCaramelVC.m
+10
-2
KWMBrandVC.m
iCemarose/Class/UI/Brand/KWMBrandVC.m
+11
-9
KWMSearchBrandVC.m
iCemarose/Class/UI/Brand/KWMSearchBrandVC.m
+9
-8
KWMCategoryVC.m
iCemarose/Class/UI/Category/KWMCategoryVC.m
+14
-1
KWMHomeVC.m
iCemarose/Class/UI/Home/KWMHomeVC.m
+7
-7
KWMBasePageVC.m
iCemarose/Class/UI/KWMBasePageVC.m
+3
-3
KWMNewProductVC.m
iCemarose/Class/UI/NewProduct/KWMNewProductVC.m
+28
-2
KWMShopCartVC.m
iCemarose/Class/UI/ShopCart/KWMShopCartVC.m
+34
-15
Header-Prefix.h
iCemarose/Header-Prefix.h
+2
-2
Info.plist
iCemarose/Info.plist
+2
-2
No files found.
iCemarose/AppDelegate.m
View file @
737cd3ae
...
...
@@ -57,7 +57,8 @@
//去掉返回按钮的文字
[[
UIBarButtonItem
appearance
]
setBackButtonTitlePositionAdjustment
:
UIOffsetMake
(
-
UI_SCREEN_WIDTH
,
-
UI_SCREEN_HEITHT
)
forBarMetrics
:
UIBarMetricsDefault
];
// [[UIBarButtonItem appearance] setBackButtonTitlePositionAdjustment:UIOffsetMake(-UI_SCREEN_WIDTH, -UI_SCREEN_HEITHT) forBarMetrics:UIBarMetricsDefault];
[[
UIBarButtonItem
appearance
]
setBackButtonTitlePositionAdjustment
:
UIOffsetMake
(
-
200
,
0
)
forBarMetrics
:
UIBarMetricsDefault
];
//修改系统的backbutton的图片
[
UINavigationBar
appearance
].
backIndicatorTransitionMaskImage
=
[
UIImage
imageNamed
:
@"btn_nav_back"
];
[
UINavigationBar
appearance
].
backIndicatorImage
=
[
UIImage
imageNamed
:
@"btn_nav_back"
];
...
...
iCemarose/Base.lproj/LaunchScreen.storyboard
View file @
737cd3ae
...
...
@@ -35,7 +35,7 @@
<constraint
firstAttribute=
"height"
constant=
"24"
id=
"x1H-Jw-5lD"
/>
</constraints>
</imageView>
<label
opaque=
"NO"
userInteractionEnabled=
"NO"
contentMode=
"left"
horizontalHuggingPriority=
"251"
verticalHuggingPriority=
"251"
text=
"v 1.5.
7
"
textAlignment=
"natural"
lineBreakMode=
"tailTruncation"
baselineAdjustment=
"alignBaselines"
adjustsFontSizeToFit=
"NO"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"ytF-B2-drm"
>
<label
opaque=
"NO"
userInteractionEnabled=
"NO"
contentMode=
"left"
horizontalHuggingPriority=
"251"
verticalHuggingPriority=
"251"
text=
"v 1.5.
8
"
textAlignment=
"natural"
lineBreakMode=
"tailTruncation"
baselineAdjustment=
"alignBaselines"
adjustsFontSizeToFit=
"NO"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"ytF-B2-drm"
>
<rect
key=
"frame"
x=
"168"
y=
"631"
width=
"39"
height=
"16"
/>
<fontDescription
key=
"fontDescription"
type=
"system"
pointSize=
"13"
/>
<color
key=
"textColor"
red=
"0.40000000000000002"
green=
"0.40000000000000002"
blue=
"0.40000000000000002"
alpha=
"1"
colorSpace=
"calibratedRGB"
/>
...
...
iCemarose/Class/Api/Cemarose/KWMProductResult.h
View file @
737cd3ae
...
...
@@ -12,4 +12,6 @@
@property
(
nonatomic
)
id
<
Optional
>
product
;
@property
(
nonatomic
)
NSArray
<
Optional
>
*
products
;
@end
iCemarose/Class/Api/Cemarose/KWMProductResult.m
View file @
737cd3ae
...
...
@@ -19,6 +19,12 @@
if
(
dataDictionary
){
self
.
product
=
[
self
buildData
:
modelClass
jsonDictionary
:
dataDictionary
];
}
NSMutableArray
*
datas
=
[
NSMutableArray
new
];
for
(
id
d
in
dict
[
@"products"
])
{
[
datas
addObject
:[
self
buildData
:
modelClass
jsonDictionary
:
d
]];
}
self
.
products
=
datas
;
}
return
self
;
...
...
iCemarose/Class/Api/KWMAPIManager.h
View file @
737cd3ae
...
...
@@ -241,6 +241,9 @@
success
:(
void
(
^
)(
NSURLSessionDataTask
*
task
,
KWMProductResult
*
result
))
success
failure
:(
void
(
^
)(
NSURLSessionDataTask
*
task
,
NSError
*
error
))
failure
;
-
(
NSURLSessionDataTask
*
)
getAdminProductsById
:(
NSArray
*
)
ids
success
:
(
void
(
^
)(
NSURLSessionDataTask
*
task
,
KWMProductResult
*
result
))
success
failure
:
(
void
(
^
)(
NSURLSessionDataTask
*
task
,
NSError
*
error
))
failure
;
/**
* 取消订单api
* amount 退款金额 (default: false)(十进制:21.20)If set, Shopify will attempt to void/refund the payment depending on the status.
...
...
iCemarose/Class/Api/KWMAPIManager.m
View file @
737cd3ae
...
...
@@ -776,6 +776,11 @@ static NSString *const passwordTest = @"9e84aae218c57cdf0762763c4cf5a651";
failure
:
failure
];
}
-
(
NSURLSessionDataTask
*
)
getAdminProductsById
:
(
NSArray
*
)
ids
success
:
(
void
(
^
)(
NSURLSessionDataTask
*
,
KWMProductResult
*
))
success
failure
:
(
void
(
^
)(
NSURLSessionDataTask
*
,
NSError
*
))
failure
{
NSString
*
apiPath
=
[[
NSString
alloc
]
initWithFormat
:
@"https://%@/admin/products.json"
,
Shopify_SHOP_DOMAIN
];
return
[
self
startSessionTask
:
KWMHTTPMethodGET
apiPath
:
apiPath
parameters
:
@{
@"ids"
:
[
ids
componentsJoinedByString
:
@","
]}
result
:
[
KWMProductResult
class
]
model
:
[
KWMProduct
class
]
success
:
success
failure
:
failure
];
}
/**
* 取消订单api
* @param amount 退款金额 (default: false)(十进制:21.20)If set, Shopify will attempt to void/refund the payment depending on the status.
...
...
iCemarose/Class/AppDelegate+Deeplink.m
View file @
737cd3ae
...
...
@@ -15,6 +15,8 @@
#import "KWMNewProductVC.h"
#import "KWMBrandCaramelVC.h"
static
NSMutableDictionary
*
controllerCache
=
nil
;
@implementation
AppDelegate
(
Deeplink
)
-
(
UINavigationController
*
)
navigationController
{
...
...
@@ -29,25 +31,36 @@
// JLRoutes *routes = [JLRoutes routesForScheme:@"cemarose"];
JLRoutes
*
routes
=
[
JLRoutes
globalRoutes
];
[
routes
addRoute
:
@"/collections/:handle/*"
handler
:
^
BOOL
(
NSDictionary
<
NSString
*
,
id
>
*
_Nonnull
parameters
)
{
if
(
!
controllerCache
)
{
controllerCache
=
[
NSMutableDictionary
new
];
}
NSString
*
url
=
parameters
[
JLRouteURLKey
];
if
([
controllerCache
objectForKey
:
url
])
{
id
vc
=
controllerCache
[
url
];
[
self
pushViewController
:
vc
];
return
YES
;
}
NSArray
*
tags
=
parameters
[
JLRouteWildcardComponentsKey
];
NSString
*
handle
=
parameters
[
@"handle"
];
tags
=
tags
.
count
>
0
?
[
tags
[
0
]
componentsSeparatedByString
:
@"+"
]
:
nil
;
// NSArray *tags = [parameters[JLRouteWildcardComponentsKey] componentsSeparatedByString:@"+"];
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"
};
if
([
brands
containsObject
:
handle
])
{
KWMBrandCaramelVC
*
brandCaramelVC
=
[
KWMBrandCaramelVC
getNewInstance
];
brandCaramelVC
.
isSale
=
NO
;
brandCaramelVC
.
handle
=
handle
;
brandCaramelVC
.
brand
=
handle
;
brandCaramelVC
.
brand
=
brandNames
[
handle
]
;
[
self
pushViewController
:
brandCaramelVC
];
[
controllerCache
setObject
:
brandCaramelVC
forKey
:
url
];
}
else
{
KWMSelectedGoodsVC
*
selectedGoodsVC
=
(
KWMSelectedGoodsVC
*
)[
KWMBaseVC
findControllerBy
:[
KWMSelectedGoodsVC
kwmTag
]
fromStoryboard
:
@"New"
];
selectedGoodsVC
.
handle
=
handle
;
selectedGoodsVC
.
ctags
=
tags
;
selectedGoodsVC
.
title
=
parameters
[
@"title"
];
[
self
pushViewController
:
selectedGoodsVC
];
[
controllerCache
setObject
:
selectedGoodsVC
forKey
:
url
];
}
return
YES
;
}];
...
...
iCemarose/Class/Model/KWMCategoryModel.h
View file @
737cd3ae
...
...
@@ -21,5 +21,6 @@
@property
(
nonatomic
)
BUYCollectionSort
sort
;
@property
(
nonatomic
)
NSMutableArray
<
KWMFilter
*>
*
filters
;
@property
(
nonatomic
)
NSString
*
brand
;
@property
(
nonatomic
)
CGFloat
offsetY
;
@end
iCemarose/Class/Model/KWMProduct.h
View file @
737cd3ae
...
...
@@ -11,6 +11,7 @@
@interface
KWMProduct
:
KWMBaseModel
@property
(
nonatomic
)
NSNumber
*
id
;
//標題
@property
(
nonatomic
)
NSString
*
title
;
...
...
iCemarose/Class/Model/KWMVariants.h
View file @
737cd3ae
...
...
@@ -13,6 +13,7 @@
@interface
KWMVariants
:
KWMBaseModel
@property
(
nonatomic
)
NSNumber
*
id
;
//规格标题
@property
(
nonatomic
)
NSString
*
title
;
//库存
...
...
iCemarose/Class/UI/Brand/KWMBrandCaramelVC.m
View file @
737cd3ae
...
...
@@ -358,7 +358,9 @@ static NSString *idStr = @"KWMBrandCaramelCell";
if
(
self
.
isSale
){
[
tags
addObject
:
@"sale"
];
}
if
(
self
.
currentPage
==
0
)
{
[
self
.
tbvBrandCaramel
.
mj_footer
resetNoMoreData
];
}
NSInteger
tagetPage
=
self
.
currentPage
.
integerValue
+
1
;
[
self
.
client
getProductsPage
:
tagetPage
inCollection
:
collectionId
withTags
:
tags
sortOrder
:
collectionSort
completion
:^
(
NSArray
*
products
,
NSUInteger
page
,
BOOL
reachedEnd
,
NSError
*
error
){
if
(
error
)
{
...
...
@@ -369,15 +371,21 @@ static NSString *idStr = @"KWMBrandCaramelCell";
[
weakSelf
.
dataList
removeAllObjects
];
[
self
.
tbvBrandCaramel
reloadData
];
}
else
if
(
error
==
nil
&&
products
)
{
//
if
(
tagetPage
==
1
&&
(
tags
.
count
==
0
||
(
tags
.
count
==
1
&&
weakSelf
.
isSale
))
){
[
weakSelf
.
userDao
saveCollectionCache
:
products
collectionId
:
collectionId
tags
:
tags
];
}
//
weakSelf
.
hasNextPage
=
!
reachedEnd
;
[
weakSelf
appendDataList
:
products
setPage
:
page
];
weakSelf
.
vNoneGoods
.
hidden
=
YES
;
[
self
.
tbvBrandCaramel
reloadData
];
// [weakSelf.dataList addObjectsFromArray:products];
// [weakSelf.tbvBrandCaramel.mj_header endRefreshing];
// [weakSelf.tbvBrandCaramel.mj_footer endRefreshing];
// [weakSelf.tbvBrandCaramel reloadData];
}
[
weakSelf
hideLoading
];
}];
...
...
iCemarose/Class/UI/Brand/KWMBrandVC.m
View file @
737cd3ae
...
...
@@ -174,19 +174,21 @@ static NSString *cellId = @"KWMBrandCell";
if
(
indexPath
.
row
)
{
// KWMBrandsTypeModel *brands = [bransType objectAtIndex:indexPath.row - 1];
//品牌介绍
KWMBrandCaramelVC
*
brandCaramelVC
=
(
KWMBrandCaramelVC
*
)[
KWMBaseVC
findControllerBy
:[
KWMBrandCaramelVC
kwmTag
]
fromStoryboard
:
@"Brand"
];
brandCaramelVC
.
isSale
=
NO
;
//
KWMBrandCaramelVC *brandCaramelVC = (KWMBrandCaramelVC *)[KWMBaseVC findControllerBy:[KWMBrandCaramelVC kwmTag] fromStoryboard:@"Brand"];
//
brandCaramelVC.isSale = NO;
// brandCaramelVC.handle = [KWMStringUtil deleteOtherCharExceptLetterWithLine:brands.designers];
// brandCaramelVC.brand = brands.designers;
NSString
*
brand
=
[
bransType
objectAtIndex
:
indexPath
.
row
-
1
];
brandCaramelVC
.
handle
=
[
KWMStringUtil
deleteOtherCharExceptLetterWithLine
:
brand
];
brandCaramelVC
.
brand
=
brand
;
NSString
*
colorStr
=
[
colorArr
objectAtIndex
:(
indexPath
.
row
)
%
(
colorArr
.
count
)];
brandCaramelVC
.
backColor
=
[
UIColor
sam_colorWithHex
:
colorStr
];
[
self
.
navigationController
pushViewController
:
brandCaramelVC
animated
:
YES
];
// brandCaramelVC.handle = [KWMStringUtil deleteOtherCharExceptLetterWithLine:brand];
// brandCaramelVC.brand = brand;
//
// NSString *colorStr = [colorArr objectAtIndex:(indexPath.row)%(colorArr.count)];
// brandCaramelVC.backColor = [UIColor sam_colorWithHex:colorStr];
//
// [self.navigationController pushViewController:brandCaramelVC animated:YES];
brand
=
[[
KWMStringUtil
deleteOtherCharExceptLetterWithLine
:
brand
]
lowercaseString
];
[
self
openURLWithString
:[
NSString
stringWithFormat
:
@"https://www.cemarose.cn/collections/%@"
,
brand
]];
}
else
{
//品牌搜索
KWMSearchBrandVC
*
searchBrandVC
=
(
KWMSearchBrandVC
*
)[
KWMBaseVC
findControllerBy
:[
KWMSearchBrandVC
kwmTag
]
fromStoryboard
:
@"Brand"
];
...
...
iCemarose/Class/UI/Brand/KWMSearchBrandVC.m
View file @
737cd3ae
...
...
@@ -238,14 +238,15 @@ static NSString *identify = @"KWMSearchBrandsCell";
brand
=
[
dict
[
@"content"
]
objectAtIndex
:
indexPath
.
row
];
}
NSString
*
str
=
[
KWMStringUtil
deleteOtherCharExceptLetterWithLine
:
brand
];
NSLog
(
@"str: %@"
,
str
);
//品牌介绍
KWMBrandCaramelVC
*
brandCaramelVC
=
(
KWMBrandCaramelVC
*
)[
KWMBaseVC
findControllerBy
:[
KWMBrandCaramelVC
kwmTag
]
fromStoryboard
:
@"Brand"
];
brandCaramelVC
.
handle
=
str
;
brandCaramelVC
.
brand
=
brand
;
brandCaramelVC
.
isSale
=
NO
;
[
tableView
deselectRowAtIndexPath
:
indexPath
animated
:
YES
];
[
self
.
navigationController
pushViewController
:
brandCaramelVC
animated
:
YES
];
// NSLog(@"str: %@",str);
// //品牌介绍
// KWMBrandCaramelVC *brandCaramelVC = (KWMBrandCaramelVC *)[KWMBaseVC findControllerBy:[KWMBrandCaramelVC kwmTag] fromStoryboard:@"Brand"];
// brandCaramelVC.handle = str;
// brandCaramelVC.brand = brand;
// brandCaramelVC.isSale = NO;
// [tableView deselectRowAtIndexPath:indexPath animated:YES];
// [self.navigationController pushViewController:brandCaramelVC animated:YES];
[
self
openURLWithString
:[
NSString
stringWithFormat
:
@"https://www.cemarose.com/collections/%@"
,
str
]];
}
#pragma mark---tableView索引相关设置----
...
...
iCemarose/Class/UI/Category/KWMCategoryVC.m
View file @
737cd3ae
...
...
@@ -185,6 +185,8 @@
}
-
(
void
)
tableView
:
(
UITableView
*
)
tableView
didSelectRowAtIndexPath
:
(
NSIndexPath
*
)
indexPath
{
// [self.cvRightProduct.mj_header endRefreshing];
// [self.cvRightProduct.mj_footer endRefreshing];
self
.
selectedCategory
=
self
.
categories
[
indexPath
.
row
];
}
...
...
@@ -305,7 +307,13 @@
[
self
.
client
getProductsPage
:
cpage
inCollection
:
cmodel
.
collection_id
withTags
:
tags
sortOrder
:
cmodel
.
sort
completion
:^
(
NSArray
*
products
,
NSUInteger
page
,
BOOL
reachedEnd
,
NSError
*
error
){
weakSelf
.
cvRightProduct
.
mj_footer
.
hidden
=
false
;
if
(
cmodel
==
self
.
selectedCategory
)
{
[
weakSelf
.
refreshUtil
hideLoading
];
// [weakSelf.refreshUtil hideLoading];
if
([
weakSelf
.
cvRightProduct
.
mj_header
isRefreshing
])
{
[
weakSelf
.
cvRightProduct
.
mj_header
endRefreshing
];
}
if
([
weakSelf
.
cvRightProduct
.
mj_footer
isRefreshing
])
{
[
weakSelf
.
cvRightProduct
.
mj_footer
endRefreshing
];
}
}
if
(
reachedEnd
){
[
weakSelf
.
cvRightProduct
.
mj_footer
endRefreshingWithNoMoreData
];
...
...
@@ -334,7 +342,12 @@
#pragma mark - setter
-
(
void
)
setSelectedCategory
:
(
KWMCategoryModel
*
)
selectedCategory
{
_selectedCategory
.
offsetY
=
self
.
cvRightProduct
.
contentOffset
.
y
<
0
?
0
:
self
.
cvRightProduct
.
contentOffset
.
y
;
_selectedCategory
=
selectedCategory
;
dispatch_after
(
dispatch_time
(
DISPATCH_TIME_NOW
,
(
int64_t
)(
0
*
NSEC_PER_SEC
)),
dispatch_get_main_queue
(),
^
{
self
.
cvRightProduct
.
contentOffset
=
CGPointMake
(
0
,
selectedCategory
.
offsetY
);
});
// self.cvRightProduct.contentOffset = CGPointMake(0, selectedCategory.offsetY);
[
self
.
cvRightProduct
.
mj_footer
resetNoMoreData
];
self
.
refreshUtil
.
page
=
_selectedCategory
.
page
;
self
.
refreshUtil
.
hasNextPage
=
YES
;
...
...
iCemarose/Class/UI/Home/KWMHomeVC.m
View file @
737cd3ae
...
...
@@ -31,13 +31,13 @@
}
-
(
void
)
viewDidLoad
{
KWMUserModel
*
user
=
[
KWMUserModel
shareUser
];
if
(
user
.
status
!=
1
)
{
//登录
KWMLoginVC
*
loginVc
=
(
KWMLoginVC
*
)[
KWMBaseVC
findControllerBy
:[
KWMLoginVC
kwmTag
]
fromStoryboard
:
@"Login"
];
UINavigationController
*
nav
=
[[
UINavigationController
alloc
]
initWithRootViewController
:
loginVc
];
[
self
presentViewController
:
nav
animated
:
YES
completion
:
nil
];
}
//
KWMUserModel *user = [KWMUserModel shareUser];
//
if (user.status != 1) {
//
//登录
//
KWMLoginVC *loginVc = (KWMLoginVC *)[KWMBaseVC findControllerBy:[KWMLoginVC kwmTag] fromStoryboard:@"Login"];
//
UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:loginVc];
//
[self presentViewController:nav animated:YES completion:nil];
//
}
[
super
viewDidLoad
];
...
...
iCemarose/Class/UI/KWMBasePageVC.m
View file @
737cd3ae
...
...
@@ -81,7 +81,6 @@
tableView
.
mj_header
=
header
;
tableView
.
mj_header
.
automaticallyChangeAlpha
=
YES
;
tableView
.
mj_footer
=
[
self
createFooter
];
}
...
...
@@ -89,9 +88,10 @@
__weak
KWMBasePageVC
*
weakSelf
=
self
;
MJRefreshAutoNormalFooter
*
footer
=
[
MJRefreshAutoNormalFooter
footerWithRefreshingBlock
:
^
{
dispatch_after
(
dispatch_time
(
DISPATCH_TIME_NOW
,
(
int64_t
)(
2
.
0
*
NSEC_PER_SEC
)),
dispatch_get_main_queue
(),
^
{
// 完全不知道为什么要延时2秒 现在去掉完全是浪费时间
// dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[
weakSelf
loadData
];
});
//
});
}];
[
footer
setTitle
:
NO_MORE_DATA
forState
:
MJRefreshStateNoMoreData
];
footer
.
hidden
=
YES
;
...
...
iCemarose/Class/UI/NewProduct/KWMNewProductVC.m
View file @
737cd3ae
...
...
@@ -226,9 +226,35 @@
[
self
kwm_onClickSizeBtn
];
return
;
}
[
self
showLoading
];
__weak
KWMNewProductVC
*
this
=
self
;
[
self
addShopWithVariantId
:
self
.
variant
.
identifier
quantity
:
self
.
count
variant
:
self
.
variant
buyNow
:
buyNow
callback
:^
(
BOOL
success
)
{
// TODO: this
NSArray
<
KWMShopCartModel
*>
*
items
=
[[
KWMShoppingCart
sharedInstance
]
items
];
KWMShopCartModel
*
item
=
nil
;
for
(
KWMShopCartModel
*
it
in
items
)
{
if
(
it
.
identifier
.
integerValue
==
self
.
variant
.
identifier
.
integerValue
)
{
item
=
it
;
break
;
}
}
NSInteger
quantity
=
self
.
count
;
KWMVariants
*
variant
=
nil
;
for
(
KWMVariants
*
it
in
self
.
adminProduct
.
variants
)
{
if
(
it
.
id
.
integerValue
==
self
.
variant
.
identifier
.
integerValue
)
{
variant
=
it
;
break
;
}
}
if
(
item
.
quantity
+
quantity
>
variant
.
inventoryQuantity
.
integerValue
)
{
quantity
=
variant
.
inventoryQuantity
.
integerValue
-
item
.
quantity
;
if
(
quantity
<=
0
&&
!
buyNow
)
{
[
self
showToast
:
@"无库存"
];
return
;
}
else
{
[
self
showToast
:
@"库存不足"
];
}
}
[
self
showLoading
];
[
self
addShopWithVariantId
:
self
.
variant
.
identifier
quantity
:
quantity
variant
:
self
.
variant
buyNow
:
buyNow
callback
:^
(
BOOL
success
)
{
[
this
hideLoading
];
if
(
success
)
{
if
(
!
buyNow
){
...
...
iCemarose/Class/UI/ShopCart/KWMShopCartVC.m
View file @
737cd3ae
...
...
@@ -66,11 +66,15 @@
return
each
.
product_id
;
}];
if
(
ids
&&
ids
.
count
>
0
)
{
[
this
.
client
getProductsByIds
:
ids
completion
:
^
(
NSArray
<
BUYProduct
*>
*
_Nullable
products
,
NSError
*
_Nullable
error
)
{
[
this
.
api
getAdminProductsById
:
ids
success
:
^
(
NSURLSessionDataTask
*
task
,
KWMProductResult
*
result
)
{
[
this
hideLoading
];
// [this refresh];
[
this
checkInStockWithItems
:
cart
.
items
products
:
products
];
}];
[
this
checkInStockWithItems
:
cart
.
items
products
:
result
.
products
];
}
failure
:
nil
];
// [this.client getProductsByIds:ids completion:^(NSArray<BUYProduct *> * _Nullable products, NSError * _Nullable error) {
// [this hideLoading];
//// [this refresh];
// [this checkInStockWithItems:cart.items products:products];
// }];
}
else
{
[
this
hideLoading
];
[
this
refresh
];
...
...
@@ -78,10 +82,16 @@
}];
}
-
(
void
)
checkInStockWithItems
:
(
NSArray
<
KWMShopCartModel
*>
*
)
items
products
:
(
NSArray
<
BUY
Product
*>
*
)
products
{
-
(
void
)
checkInStockWithItems
:
(
NSArray
<
KWMShopCartModel
*>
*
)
items
products
:
(
NSArray
<
KWM
Product
*>
*
)
products
{
self
.
soldout
=
[
NSMutableArray
new
];
for
(
id
item
in
items
)
{
if
(
!
[
self
checkInStockWithItem
:
item
products
:
products
])
{
for
(
KWMShopCartModel
*
item
in
items
)
{
NSInteger
quantity
=
0
;
if
((
quantity
=
[
self
checkInStockWithItem
:
item
products
:
products
])
<
0
)
{
NSInteger
has
=
item
.
quantity
+
quantity
;
if
(
has
<
0
)
{
has
=
0
;
}
item
.
quantity
=
has
;
[
self
.
soldout
addObject
:
item
];
}
}
...
...
@@ -95,10 +105,12 @@
NSArray
*
ids
=
[
self
.
soldout
rx_mapWithBlock
:
^
id
(
KWMShopCartModel
*
each
)
{
return
each
.
identifier
;
}];
NSArray
*
qus
=
[
ids
rx_mapWithBlock
:
^
(
id
it
){
return
@
(
0
);
}];
NSArray
*
qus
=
[
self
.
soldout
rx_mapWithBlock
:
^
(
KWMShopCartModel
*
it
){
return
@
(
it
.
quantity
);
}];
__weak
typeof
(
self
)
this
=
self
;
[
self
showLoading
];
[[
KWMShoppingCart
sharedInstance
]
updateProductWithVariantIds
:
ids
quantitties
:
qus
callback
:^
(
NSError
*
error
,
KWMCartResult
*
cart
)
{
[[
KWMShoppingCart
sharedInstance
]
setSync
:
NO
];
[
this
hideLoading
];
[
this
refresh
];
if
(
buttonIndex
==
1
)
{
[
this
addSoldOutProductToWishlist
];
...
...
@@ -132,17 +144,24 @@
}
-
(
BOOL
)
checkInStockWithItem
:
(
KWMShopCartModel
*
)
item
products
:
(
NSArray
<
BUY
Product
*>
*
)
products
{
for
(
BUY
Product
*
p
in
products
)
{
if
(
item
.
product_id
.
integerValue
==
p
.
id
entifier
.
integerValue
)
{
for
(
BUYProductVariant
*
v
in
p
.
variants
)
{
if
(
[
item
.
size
isEqualToString
:
v
.
title
]
&&
v
.
available
Value
)
{
return
YES
;
-
(
NSInteger
)
checkInStockWithItem
:
(
KWMShopCartModel
*
)
item
products
:
(
NSArray
<
KWM
Product
*>
*
)
products
{
for
(
KWM
Product
*
p
in
products
)
{
if
(
item
.
product_id
.
integerValue
==
p
.
id
.
integerValue
)
{
for
(
KWMVariants
*
v
in
p
.
variants
)
{
if
(
item
.
identifier
.
integerValue
==
v
.
id
.
integer
Value
)
{
return
v
.
inventoryQuantity
.
integerValue
-
item
.
quantity
;
}
}
}
// if (item.product_id.integerValue == p.identifier.integerValue) {
// for (BUYProductVariant *v in p.variants) {
// if ([item.size isEqualToString:v.title] && v.availableValue) {
// return YES;
// }
// }
// }
}
return
NO
;
return
0
;
}
-
(
NSInteger
)
tableView
:
(
UITableView
*
)
tableView
numberOfRowsInSection
:
(
NSInteger
)
section
{
...
...
iCemarose/Header-Prefix.h
View file @
737cd3ae
...
...
@@ -71,7 +71,7 @@
#define TestModel @"YES"
//额外api domain
#define Additional_API_DOMAIN @"liang.tofnews.com"
//
#define Additional_API_DOMAIN @"liang.tofnews.com"
#define WishList_API_DOMAIN @"test.cemarose.com"
...
...
@@ -87,7 +87,7 @@
//正式
#define TestModel @"NO"
#define Additional_API_DOMAIN @"apps.cemarose.com"
//
#define Additional_API_DOMAIN @"apps.cemarose.com"
#define WishList_API_DOMAIN @"apps.cemarose.com"
...
...
iCemarose/Info.plist
View file @
737cd3ae
...
...
@@ -15,7 +15,7 @@
<
k
e
y
>
CFBundlePackageType
<
/k
e
y
>
<
string
>
APPL
<
/string
>
<
k
e
y
>
CFBundleShortVersionString
<
/k
e
y
>
<
string
>
1.5.
7
<
/string
>
<
string
>
1.5.
8
<
/string
>
<
k
e
y
>
CFBundleSignature
<
/k
e
y
>
<
string
>
????
<
/string
>
<
k
e
y
>
CFBundleURLTypes
<
/k
e
y
>
...
...
@@ -56,7 +56,7 @@
<
/
d
i
c
t
>
<
/
a
rr
a
y
>
<
k
e
y
>
CFBundleVersion
<
/k
e
y
>
<
string
>
1.5.
7.4
<
/string
>
<
string
>
1.5.
8.3
<
/string
>
<
k
e
y
>
ITSAppUsesNonExemptEncryption
<
/k
e
y
>
<
fa
ls
e
/
>
<
k
e
y
>
LSApplicationQueriesSchemes
<
/k
e
y
>
...
...
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