Commit bfff262a by houweibin

1,product添加到wishlist时,name可能为nil的问题

2,搜索api问题
3,添加no more data提示
parent 4141588f
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
@property (nonatomic) NSArray *variants; @property (nonatomic) NSArray *variants;
@property (nonatomic) NSString *handle; @property (nonatomic) NSString *handle;
@property (nonatomic) NSArray *options; @property (nonatomic) NSArray *options;
@property (nonatomic) NSArray *images; @property (nonatomic) NSArray<Optional> *images;
@property (nonatomic) NSDictionary *image; @property (nonatomic) NSDictionary<Optional> *image;
@end @end
...@@ -21,11 +21,12 @@ ...@@ -21,11 +21,12 @@
if(data == nil){ if(data == nil){
return self; return self;
} }
for (int i = 0; i < data.count; ++i) { for (int i = 0; i < data.count; i++) {
if(data[i] == nil){ if(data[i] == nil){
break; break;
} }
KWMDataProduct *dataProduct = [[KWMDataProduct alloc] initWithDictionary:data[i] error:nil]; NSError *error = nil;
KWMDataProduct *dataProduct = [[KWMDataProduct alloc] initWithDictionary:data[i] error:&error];
NSArray *dataArray = data[i][@"variants"]; NSArray *dataArray = data[i][@"variants"];
......
...@@ -358,7 +358,7 @@ static NSString *idStr = @"KWMBrandCaramelCell"; ...@@ -358,7 +358,7 @@ static NSString *idStr = @"KWMBrandCaramelCell";
if(self.isSale){ if(self.isSale){
[tags addObject:@"sale"]; [tags addObject:@"sale"];
} }
[self.tbvBrandCaramel.mj_footer resetNoMoreData];
NSInteger tagetPage = self.currentPage.integerValue + 1; 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){ [self.client getProductsPage:tagetPage inCollection:collectionId withTags:tags sortOrder:collectionSort completion:^(NSArray *products,NSUInteger page, BOOL reachedEnd, NSError *error){
if (error) { if (error) {
......
...@@ -303,10 +303,13 @@ ...@@ -303,10 +303,13 @@
[tags addObject:cmodel.brand]; [tags addObject:cmodel.brand];
} }
[self.client getProductsPage:cpage inCollection:cmodel.collection_id withTags:tags sortOrder:cmodel.sort completion:^(NSArray *products,NSUInteger page, BOOL reachedEnd, NSError *error){ [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 = reachedEnd; weakSelf.cvRightProduct.mj_footer.hidden = false;
if (cmodel == self.selectedCategory) { if (cmodel == self.selectedCategory) {
[weakSelf.refreshUtil hideLoading]; [weakSelf.refreshUtil hideLoading];
} }
if(reachedEnd){
[weakSelf.cvRightProduct.mj_footer endRefreshingWithNoMoreData];
}
weakSelf.filterTab.userInteractionEnabled = true; weakSelf.filterTab.userInteractionEnabled = true;
if(error){ if(error){
...@@ -332,6 +335,7 @@ ...@@ -332,6 +335,7 @@
- (void)setSelectedCategory:(KWMCategoryModel *)selectedCategory { - (void)setSelectedCategory:(KWMCategoryModel *)selectedCategory {
_selectedCategory = selectedCategory; _selectedCategory = selectedCategory;
[self.cvRightProduct.mj_footer resetNoMoreData];
self.refreshUtil.page = _selectedCategory.page; self.refreshUtil.page = _selectedCategory.page;
self.refreshUtil.hasNextPage = YES; self.refreshUtil.hasNextPage = YES;
self.refreshUtil.dataList = _selectedCategory.products; self.refreshUtil.dataList = _selectedCategory.products;
......
...@@ -93,6 +93,7 @@ ...@@ -93,6 +93,7 @@
[weakSelf loadData]; [weakSelf loadData];
}); });
}]; }];
[footer setTitle:NO_MORE_DATA forState:MJRefreshStateNoMoreData];
footer.hidden = YES; footer.hidden = YES;
return footer; return footer;
} }
...@@ -218,8 +219,11 @@ ...@@ -218,8 +219,11 @@
if ([self hasNextPage]) { if ([self hasNextPage]) {
tableView.mj_footer.hidden = NO; tableView.mj_footer.hidden = NO;
[tableView.mj_footer resetNoMoreData];
}else{ }else{
tableView.mj_footer.hidden = YES; tableView.mj_footer.hidden = NO;
// tableView.mj_footer.hidden = YES;
[tableView.mj_footer endRefreshingWithNoMoreData];
} }
[tableView reloadData]; [tableView reloadData];
......
...@@ -143,7 +143,9 @@ typedef enum{ ...@@ -143,7 +143,9 @@ typedef enum{
[self.cvHome registerClass:[UICollectionReusableView class] forSupplementaryViewOfKind:CHTCollectionElementKindSectionHeader withReuseIdentifier:[KWMClothingSetsHeader kwmTag]]; [self.cvHome registerClass:[UICollectionReusableView class] forSupplementaryViewOfKind:CHTCollectionElementKindSectionHeader withReuseIdentifier:[KWMClothingSetsHeader kwmTag]];
[self.cvHome registerClass:[UICollectionReusableView class] forSupplementaryViewOfKind:CHTCollectionElementKindSectionHeader withReuseIdentifier:[KWMMenuHeader kwmTag]]; [self.cvHome registerClass:[UICollectionReusableView class] forSupplementaryViewOfKind:CHTCollectionElementKindSectionHeader withReuseIdentifier:[KWMMenuHeader kwmTag]];
self.cvHome.mj_footer = [MJRefreshAutoNormalFooter footerWithRefreshingTarget:self refreshingAction:@selector(loadMore)]; MJRefreshAutoNormalFooter *refreshFooter = [MJRefreshAutoNormalFooter footerWithRefreshingTarget:self refreshingAction:@selector(loadMore)];
[refreshFooter setTitle:NO_MORE_DATA forState:MJRefreshStateNoMoreData];
self.cvHome.mj_footer = refreshFooter;
} }
- (void) loadMore { - (void) loadMore {
......
...@@ -628,11 +628,13 @@ ...@@ -628,11 +628,13 @@
if(!customer || !self.variant){ if(!customer || !self.variant){
return; return;
} }
NSNumber *customerId = customer.identifier?:@(0);
NSString *customerName = customer.lastName?:@"";
BUYProduct *product = (self.color && self.color.product)?self.color.product:self.product; BUYProduct *product = (self.color && self.color.product)?self.color.product:self.product;
NSDictionary *parament = @{ NSDictionary *parament = @{
@"customer_id":customer.identifier.stringValue, @"customer_id":customerId.stringValue,
@"customer_email":customer.email, @"customer_email":customer.email,
@"customer_name":customer.lastName, @"customer_name":customerName,
@"product_title":product.title, @"product_title":product.title,
@"product_id":product.identifier.stringValue, @"product_id":product.identifier.stringValue,
@"variant_id":self.variant.identifier.stringValue, @"variant_id":self.variant.identifier.stringValue,
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#import "KWMBrandCaramelCell.h" #import "KWMBrandCaramelCell.h"
#import "KWMSearchFeedBackView.h" #import "KWMSearchFeedBackView.h"
#import "KWMNewProductVC.h" #import "KWMNewProductVC.h"
#import "MJRefresh.h"
@interface KWMSearchFeedbackVC ()<UITableViewDelegate,UITableViewDataSource,KWMSearchFeedBackViewDelegate,KWMBrandCaramelCellDelegate> @interface KWMSearchFeedbackVC ()<UITableViewDelegate,UITableViewDataSource,KWMSearchFeedBackViewDelegate,KWMBrandCaramelCellDelegate>
@property (nonatomic) KWMSearchFeedBackView *vSearchFB; @property (nonatomic) KWMSearchFeedBackView *vSearchFB;
...@@ -197,6 +198,7 @@ static NSString *idStr = @"KWMBrandCaramelCell"; ...@@ -197,6 +198,7 @@ static NSString *idStr = @"KWMBrandCaramelCell";
if (self.currentPage.integerValue == endPage && endPage != 0) { if (self.currentPage.integerValue == endPage && endPage != 0) {
[self showToast:@"已经是最后一页"]; [self showToast:@"已经是最后一页"];
[self hideLoading]; [self hideLoading];
[self.tbvSearch.mj_footer endRefreshingWithNoMoreData];
return; return;
} }
NSInteger tagetPage = self.currentPage.integerValue + 1; NSInteger tagetPage = self.currentPage.integerValue + 1;
...@@ -209,7 +211,10 @@ static NSString *idStr = @"KWMBrandCaramelCell"; ...@@ -209,7 +211,10 @@ static NSString *idStr = @"KWMBrandCaramelCell";
[weakSelf hideLoading]; [weakSelf hideLoading];
total = result.products.total.integerValue; total = result.products.total.integerValue;
endPage = result.products.lastPage.integerValue; endPage = result.products.lastPage.integerValue;
weakSelf.hasNextPage = tagetPage != endPage;
if(tagetPage == 1){
[weakSelf.dataList removeAllObjects];
}
[weakSelf appendDataList:result.productList setPage:tagetPage]; [weakSelf appendDataList:result.productList setPage:tagetPage];
_vSearchFB.lbGoodsNum.text = [NSString stringWithFormat:@"%lu商品",(unsigned long)total]; _vSearchFB.lbGoodsNum.text = [NSString stringWithFormat:@"%lu商品",(unsigned long)total];
......
...@@ -163,6 +163,7 @@ ...@@ -163,6 +163,7 @@
[weakSelf loadData]; [weakSelf loadData];
}); });
}]; }];
[footer setTitle:NO_MORE_DATA forState:MJRefreshStateNoMoreData];
footer.hidden = YES; footer.hidden = YES;
return footer; return footer;
} }
......
...@@ -56,6 +56,8 @@ ...@@ -56,6 +56,8 @@
#define QQAppId @"##" #define QQAppId @"##"
#define QQAppKey @"##" #define QQAppKey @"##"
#define NO_MORE_DATA @"------ 沒有啦 ------"
//正式的微信key //正式的微信key
#define WechatAppKey @"wx355a497b2a2dd6d5" #define WechatAppKey @"wx355a497b2a2dd6d5"
......
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