Commit 3a6a3a66 by lee

fix bug

parent 4f1fd299
...@@ -35,9 +35,9 @@ ...@@ -35,9 +35,9 @@
__weak KWMBasePageVC *weakSelf = self; __weak KWMBasePageVC *weakSelf = self;
KWMLoadingHeader *header = [KWMLoadingHeader headerWithRefreshingBlock:^{ KWMLoadingHeader *header = [KWMLoadingHeader headerWithRefreshingBlock:^{
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ // dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[weakSelf reLoadData]; [weakSelf reLoadData];
}); // });
}]; }];
// header.lastUpdatedTimeLabel.hidden = YES; // header.lastUpdatedTimeLabel.hidden = YES;
// header.stateLabel.hidden = YES; // header.stateLabel.hidden = YES;
......
...@@ -187,7 +187,9 @@ typedef enum{ ...@@ -187,7 +187,9 @@ typedef enum{
} }
-(void)kwm_onClickHotSalesAd:(KWMAdvertisement *)ad { -(void)kwm_onClickHotSalesAd:(KWMAdvertisement *)ad {
if (![KWMStringUtil isBlank:ad.url]) {
[self openURLWithString:ad.url]; [self openURLWithString:ad.url];
}
} }
-(void)kwm_onClickFocusImage { -(void)kwm_onClickFocusImage {
...@@ -198,7 +200,9 @@ typedef enum{ ...@@ -198,7 +200,9 @@ typedef enum{
-(void)kwm_gotoClothingSetsPage{ -(void)kwm_gotoClothingSetsPage{
// [self openURLWithString:[NSString stringWithFormat:@"https://cemarose.myshopify.com/collections/%@",self.clotingSetsHandle]]; // [self openURLWithString:[NSString stringWithFormat:@"https://cemarose.myshopify.com/collections/%@",self.clotingSetsHandle]];
if (![KWMStringUtil isBlank:self.homeData.clothing_sets.url]) {
[self openURLWithString:self.homeData.clothing_sets.url]; [self openURLWithString:self.homeData.clothing_sets.url];
}
} }
#pragma mark - KWMRecommendDelegate KWMClothingSetsDelegate KWMHotSalesDelegate #pragma mark - KWMRecommendDelegate KWMClothingSetsDelegate KWMHotSalesDelegate
......
...@@ -109,6 +109,36 @@ static NSString *idStr = @"KWMBrandCaramelCell"; ...@@ -109,6 +109,36 @@ static NSString *idStr = @"KWMBrandCaramelCell";
} }
tags = [NSArray arrayWithObjects:tag, nil]; tags = [NSArray arrayWithObjects:tag, nil];
} }
NSMutableDictionary *sf = [NSMutableDictionary new];
for (NSString *tag in self.ctags) {
for (KWMFilter *kf in self.filterView.allTags) {
NSString * key = nil;
for (NSString *it in kf.tags) {
if ([[KWMFilterUtil transformTag:nil tag:it] isEqualToString:tag]) {
key = it;
break;
}
}
if (key) {
if (sf[kf.group]) {
[sf[kf.group] addObject:key];
}else{
[sf setValue:[[NSMutableArray alloc] initWithObjects:key, nil] forKey:kf.group];
}
break;
}
}
}
if ([sf count]) {
[self.filterView setSelectedTags:[[[sf allKeys] rx_mapWithBlock:^id(id each) {
KWMFilter *r = [[KWMFilter alloc] init];
r.group = each;
r.tags = sf[each];
return r;
}] mutableCopy]];
}
NSArray *products = [self.userDao getCollectionCache:collectionId tags:tags]; NSArray *products = [self.userDao getCollectionCache:collectionId tags:tags];
if(products && products.count>0){ if(products && products.count>0){
...@@ -148,7 +178,7 @@ static NSString *idStr = @"KWMBrandCaramelCell"; ...@@ -148,7 +178,7 @@ static NSString *idStr = @"KWMBrandCaramelCell";
-(void)kwm_onFilterFinish:(KWMFilterView *)filterView{ -(void)kwm_onFilterFinish:(KWMFilterView *)filterView{
self.filterView.hidden = YES; self.filterView.hidden = YES;
[self.filterTab close]; [self.filterTab close];
[self reLoadData]; // [self reLoadData];
[self.tbvSelectedGoods.mj_header beginRefreshing]; [self.tbvSelectedGoods.mj_header beginRefreshing];
[self.tbvSelectedGoods setContentOffset:CGPointMake(0,0) animated:YES]; [self.tbvSelectedGoods setContentOffset:CGPointMake(0,0) animated:YES];
} }
...@@ -270,7 +300,11 @@ static NSString *idStr = @"KWMBrandCaramelCell"; ...@@ -270,7 +300,11 @@ static NSString *idStr = @"KWMBrandCaramelCell";
}; };
if (self.handle) { if (self.handle) {
[self.client getCollectionByHandle:self.handle completion:^(BUYCollection * _Nullable collection, NSError * _Nullable error) { [self.client getCollectionByHandle:self.handle completion:^(BUYCollection * _Nullable collection, NSError * _Nullable error) {
[self.client getProductsPage:tagetPage inCollection:collection.identifier withTags:self.ctags sortOrder:self.filterView.selectedSort completion:completion]; NSArray * tags = [KWMFilterUtil getTagsByFilterArray:self.filterView.selectedTags];
if ([tags count] <= 0) {
tags = self.ctags;
}
[self.client getProductsPage:tagetPage inCollection:collection.identifier withTags:tags sortOrder:self.filterView.selectedSort completion:completion];
}]; }];
// [self.client getProductsPage:tagetPage inCollection:nil withTags:self.ctags sortOrder:self.filterView.selectedSort completion:completion]; // [self.client getProductsPage:tagetPage inCollection:nil withTags:self.ctags sortOrder:self.filterView.selectedSort completion:completion];
return; return;
...@@ -310,5 +344,4 @@ static NSString *idStr = @"KWMBrandCaramelCell"; ...@@ -310,5 +344,4 @@ static NSString *idStr = @"KWMBrandCaramelCell";
[self.client getProductsPage:tagetPage inCollection:collectionId withTags:tags sortOrder:collectionSort completion:completion]; [self.client getProductsPage:tagetPage inCollection:collectionId withTags:tags sortOrder:collectionSort completion:completion];
} }
@end @end
...@@ -30,6 +30,8 @@ typedef NS_ENUM(NSInteger, KWMFilterMode) { ...@@ -30,6 +30,8 @@ typedef NS_ENUM(NSInteger, KWMFilterMode) {
@interface KWMFilterView : UIView<UICollectionViewDelegate,UICollectionViewDataSource> @interface KWMFilterView : UIView<UICollectionViewDelegate,UICollectionViewDataSource>
@property(nonatomic) NSArray<KWMFilter *>*filterData;
@property(nonatomic) KWMFilterMode filterMode; @property(nonatomic) KWMFilterMode filterMode;
@property(nonatomic) NSMutableArray<KWMFilter *> *selectedTags; @property(nonatomic) NSMutableArray<KWMFilter *> *selectedTags;
......
...@@ -26,7 +26,7 @@ static NSString *filterDataString = @"[{\"group\":\"SEASON\",\"tags\":[\"Autumn/ ...@@ -26,7 +26,7 @@ static NSString *filterDataString = @"[{\"group\":\"SEASON\",\"tags\":[\"Autumn/
@end @end
@implementation KWMFilterView{ @implementation KWMFilterView{
NSArray<KWMFilter *>*filterData;
NSArray *sortData; NSArray *sortData;
...@@ -82,7 +82,7 @@ static NSString *filterDataString = @"[{\"group\":\"SEASON\",\"tags\":[\"Autumn/ ...@@ -82,7 +82,7 @@ static NSString *filterDataString = @"[{\"group\":\"SEASON\",\"tags\":[\"Autumn/
[mutableArray addObject:result]; [mutableArray addObject:result];
} }
} }
filterData = [mutableArray copy]; self.filterData = [mutableArray copy];
} }
-(void)initSortData{ -(void)initSortData{
...@@ -157,12 +157,12 @@ static NSString *filterDataString = @"[{\"group\":\"SEASON\",\"tags\":[\"Autumn/ ...@@ -157,12 +157,12 @@ static NSString *filterDataString = @"[{\"group\":\"SEASON\",\"tags\":[\"Autumn/
#pragma mark - UICollectionViewDataSource #pragma mark - UICollectionViewDataSource
-(NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView{ -(NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView{
NSInteger count = self.filterMode == ModeFilter?filterData.count:1; NSInteger count = self.filterMode == ModeFilter?self.filterData.count:1;
return count; return count;
} }
-(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{ -(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
NSUInteger count = self.filterMode == ModeFilter?filterData[section].tags.count:4; NSUInteger count = self.filterMode == ModeFilter?self.filterData[section].tags.count:4;
return count; return count;
} }
...@@ -170,7 +170,7 @@ static NSString *filterDataString = @"[{\"group\":\"SEASON\",\"tags\":[\"Autumn/ ...@@ -170,7 +170,7 @@ static NSString *filterDataString = @"[{\"group\":\"SEASON\",\"tags\":[\"Autumn/
KWMFilterViewCell *filterCell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([KWMFilterViewCell class]) forIndexPath:indexPath]; KWMFilterViewCell *filterCell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([KWMFilterViewCell class]) forIndexPath:indexPath];
//更新cell //更新cell
if(self.filterMode == ModeFilter){ if(self.filterMode == ModeFilter){
KWMFilter *filter = filterData[indexPath.section]; KWMFilter *filter = self.filterData[indexPath.section];
NSString *tag = filter.tags[indexPath.row]; NSString *tag = filter.tags[indexPath.row];
filterCell.text = tag; filterCell.text = tag;
filterCell.isSelectedFilter = [self isSelectedTag:filter tag:tag]; filterCell.isSelectedFilter = [self isSelectedTag:filter tag:tag];
...@@ -189,7 +189,7 @@ static NSString *filterDataString = @"[{\"group\":\"SEASON\",\"tags\":[\"Autumn/ ...@@ -189,7 +189,7 @@ static NSString *filterDataString = @"[{\"group\":\"SEASON\",\"tags\":[\"Autumn/
//获得cell要显示的文字 //获得cell要显示的文字
NSString *text = @""; NSString *text = @"";
if(self.filterMode == ModeFilter){ if(self.filterMode == ModeFilter){
KWMFilter *filter = filterData[indexPath.section]; KWMFilter *filter = self.filterData[indexPath.section];
text = filter.tags[indexPath.row]; text = filter.tags[indexPath.row];
} }
//获得字体,计算文字显示所需高度 //获得字体,计算文字显示所需高度
...@@ -225,7 +225,7 @@ static NSString *filterDataString = @"[{\"group\":\"SEASON\",\"tags\":[\"Autumn/ ...@@ -225,7 +225,7 @@ static NSString *filterDataString = @"[{\"group\":\"SEASON\",\"tags\":[\"Autumn/
} }
//更新label //更新label
if(self.filterMode == ModeFilter){ if(self.filterMode == ModeFilter){
KWMFilter *filter = filterData[indexPath.section]; KWMFilter *filter = self.filterData[indexPath.section];
headerLabel.text = filter.group; headerLabel.text = filter.group;
}else{ }else{
headerLabel.text = @"排序"; headerLabel.text = @"排序";
...@@ -236,7 +236,7 @@ static NSString *filterDataString = @"[{\"group\":\"SEASON\",\"tags\":[\"Autumn/ ...@@ -236,7 +236,7 @@ static NSString *filterDataString = @"[{\"group\":\"SEASON\",\"tags\":[\"Autumn/
-(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath{ -(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath{
if(self.filterMode == ModeFilter){ if(self.filterMode == ModeFilter){
KWMFilter *filter = filterData[indexPath.section]; KWMFilter *filter = self.filterData[indexPath.section];
NSString *tag = filter.tags[indexPath.row]; NSString *tag = filter.tags[indexPath.row];
[self refreshSelectedTags:filter tag:tag]; [self refreshSelectedTags:filter tag:tag];
......
...@@ -17,6 +17,8 @@ ...@@ -17,6 +17,8 @@
@property(nonatomic) NSMutableArray<KWMFilter *> *selectedTags; @property(nonatomic) NSMutableArray<KWMFilter *> *selectedTags;
@property(nonatomic) NSArray<KWMFilter *> *allTags;
@property(nonatomic) BUYCollectionSort selectedSort; @property(nonatomic) BUYCollectionSort selectedSort;
-(void)show; -(void)show;
......
...@@ -65,6 +65,14 @@ ...@@ -65,6 +65,14 @@
return self.filterView.selectedTags; return self.filterView.selectedTags;
} }
-(void)setSelectedTags:(NSMutableArray<KWMFilter *> *)selectedTags {
self.filterView.selectedTags = selectedTags;
}
-(NSArray<KWMFilter *> *)allTags {
return self.filterView.filterData;
}
-(void)onClickBlank:(id)sender{ -(void)onClickBlank:(id)sender{
if(self.delegate && [self.delegate respondsToSelector:@selector(kwm_onClickFilterBlank:)]){ if(self.delegate && [self.delegate respondsToSelector:@selector(kwm_onClickFilterBlank:)]){
[self.delegate kwm_onClickFilterBlank:self.filterView]; [self.delegate kwm_onClickFilterBlank:self.filterView];
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
<key>CFBundlePackageType</key> <key>CFBundlePackageType</key>
<string>APPL</string> <string>APPL</string>
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
<string>1.5.4</string> <string>1.5.5</string>
<key>CFBundleSignature</key> <key>CFBundleSignature</key>
<string>????</string> <string>????</string>
<key>CFBundleURLTypes</key> <key>CFBundleURLTypes</key>
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
</dict> </dict>
</array> </array>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>2017080814</string> <string>2017080821</string>
<key>ITSAppUsesNonExemptEncryption</key> <key>ITSAppUsesNonExemptEncryption</key>
<false/> <false/>
<key>LSApplicationQueriesSchemes</key> <key>LSApplicationQueriesSchemes</key>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment