Commit 3a6a3a66 by lee

fix bug

parent 4f1fd299
......@@ -35,9 +35,9 @@
__weak KWMBasePageVC *weakSelf = self;
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];
});
// });
}];
// header.lastUpdatedTimeLabel.hidden = YES;
// header.stateLabel.hidden = YES;
......
......@@ -187,7 +187,9 @@ typedef enum{
}
-(void)kwm_onClickHotSalesAd:(KWMAdvertisement *)ad {
[self openURLWithString:ad.url];
if (![KWMStringUtil isBlank:ad.url]) {
[self openURLWithString:ad.url];
}
}
-(void)kwm_onClickFocusImage {
......@@ -198,7 +200,9 @@ typedef enum{
-(void)kwm_gotoClothingSetsPage{
// [self openURLWithString:[NSString stringWithFormat:@"https://cemarose.myshopify.com/collections/%@",self.clotingSetsHandle]];
[self openURLWithString:self.homeData.clothing_sets.url];
if (![KWMStringUtil isBlank:self.homeData.clothing_sets.url]) {
[self openURLWithString:self.homeData.clothing_sets.url];
}
}
#pragma mark - KWMRecommendDelegate KWMClothingSetsDelegate KWMHotSalesDelegate
......
......@@ -109,6 +109,36 @@ static NSString *idStr = @"KWMBrandCaramelCell";
}
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];
if(products && products.count>0){
......@@ -148,7 +178,7 @@ static NSString *idStr = @"KWMBrandCaramelCell";
-(void)kwm_onFilterFinish:(KWMFilterView *)filterView{
self.filterView.hidden = YES;
[self.filterTab close];
[self reLoadData];
// [self reLoadData];
[self.tbvSelectedGoods.mj_header beginRefreshing];
[self.tbvSelectedGoods setContentOffset:CGPointMake(0,0) animated:YES];
}
......@@ -270,7 +300,11 @@ static NSString *idStr = @"KWMBrandCaramelCell";
};
if (self.handle) {
[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];
return;
......@@ -310,5 +344,4 @@ static NSString *idStr = @"KWMBrandCaramelCell";
[self.client getProductsPage:tagetPage inCollection:collectionId withTags:tags sortOrder:collectionSort completion:completion];
}
@end
......@@ -30,6 +30,8 @@ typedef NS_ENUM(NSInteger, KWMFilterMode) {
@interface KWMFilterView : UIView<UICollectionViewDelegate,UICollectionViewDataSource>
@property(nonatomic) NSArray<KWMFilter *>*filterData;
@property(nonatomic) KWMFilterMode filterMode;
@property(nonatomic) NSMutableArray<KWMFilter *> *selectedTags;
......
......@@ -26,7 +26,7 @@ static NSString *filterDataString = @"[{\"group\":\"SEASON\",\"tags\":[\"Autumn/
@end
@implementation KWMFilterView{
NSArray<KWMFilter *>*filterData;
NSArray *sortData;
......@@ -82,7 +82,7 @@ static NSString *filterDataString = @"[{\"group\":\"SEASON\",\"tags\":[\"Autumn/
[mutableArray addObject:result];
}
}
filterData = [mutableArray copy];
self.filterData = [mutableArray copy];
}
-(void)initSortData{
......@@ -157,12 +157,12 @@ static NSString *filterDataString = @"[{\"group\":\"SEASON\",\"tags\":[\"Autumn/
#pragma mark - UICollectionViewDataSource
-(NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView{
NSInteger count = self.filterMode == ModeFilter?filterData.count:1;
NSInteger count = self.filterMode == ModeFilter?self.filterData.count:1;
return count;
}
-(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;
}
......@@ -170,7 +170,7 @@ static NSString *filterDataString = @"[{\"group\":\"SEASON\",\"tags\":[\"Autumn/
KWMFilterViewCell *filterCell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([KWMFilterViewCell class]) forIndexPath:indexPath];
//更新cell
if(self.filterMode == ModeFilter){
KWMFilter *filter = filterData[indexPath.section];
KWMFilter *filter = self.filterData[indexPath.section];
NSString *tag = filter.tags[indexPath.row];
filterCell.text = tag;
filterCell.isSelectedFilter = [self isSelectedTag:filter tag:tag];
......@@ -189,7 +189,7 @@ static NSString *filterDataString = @"[{\"group\":\"SEASON\",\"tags\":[\"Autumn/
//获得cell要显示的文字
NSString *text = @"";
if(self.filterMode == ModeFilter){
KWMFilter *filter = filterData[indexPath.section];
KWMFilter *filter = self.filterData[indexPath.section];
text = filter.tags[indexPath.row];
}
//获得字体,计算文字显示所需高度
......@@ -225,7 +225,7 @@ static NSString *filterDataString = @"[{\"group\":\"SEASON\",\"tags\":[\"Autumn/
}
//更新label
if(self.filterMode == ModeFilter){
KWMFilter *filter = filterData[indexPath.section];
KWMFilter *filter = self.filterData[indexPath.section];
headerLabel.text = filter.group;
}else{
headerLabel.text = @"排序";
......@@ -236,7 +236,7 @@ static NSString *filterDataString = @"[{\"group\":\"SEASON\",\"tags\":[\"Autumn/
-(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath{
if(self.filterMode == ModeFilter){
KWMFilter *filter = filterData[indexPath.section];
KWMFilter *filter = self.filterData[indexPath.section];
NSString *tag = filter.tags[indexPath.row];
[self refreshSelectedTags:filter tag:tag];
......
......@@ -17,6 +17,8 @@
@property(nonatomic) NSMutableArray<KWMFilter *> *selectedTags;
@property(nonatomic) NSArray<KWMFilter *> *allTags;
@property(nonatomic) BUYCollectionSort selectedSort;
-(void)show;
......
......@@ -65,6 +65,14 @@
return self.filterView.selectedTags;
}
-(void)setSelectedTags:(NSMutableArray<KWMFilter *> *)selectedTags {
self.filterView.selectedTags = selectedTags;
}
-(NSArray<KWMFilter *> *)allTags {
return self.filterView.filterData;
}
-(void)onClickBlank:(id)sender{
if(self.delegate && [self.delegate respondsToSelector:@selector(kwm_onClickFilterBlank:)]){
[self.delegate kwm_onClickFilterBlank:self.filterView];
......
......@@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.5.4</string>
<string>1.5.5</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleURLTypes</key>
......@@ -56,7 +56,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>2017080814</string>
<string>2017080821</string>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<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