Commit 050f30f1 by houweibin
parents af1531be 1ed601f7
......@@ -16,7 +16,7 @@ pod 'TOWebViewController'
#pod 'AFNetworking','~> 3.1'
pod 'PPNetworkHelper'
pod 'JSONModel','~> 1.2.0'
pod 'JSONModel','~> 1.7.0'
pod 'SDWebImage','~> 3.7.1'
pod 'SAMCategories', '~> 0.5.1'
pod 'SAMTextView', '~> 0.2.1'
......
......@@ -346,6 +346,9 @@
C0F586AE1E279574001248E2 /* KWMBottomView.xib in Resources */ = {isa = PBXBuildFile; fileRef = C0F586AD1E279574001248E2 /* KWMBottomView.xib */; };
C0FBD88E1F049D510009E375 /* KWMOrderPaid.m in Sources */ = {isa = PBXBuildFile; fileRef = C0FBD88D1F049D510009E375 /* KWMOrderPaid.m */; };
C0FC278E1D9B73B000C5CFFE /* KWMGiftCardCell.m in Sources */ = {isa = PBXBuildFile; fileRef = C0FC278D1D9B73B000C5CFFE /* KWMGiftCardCell.m */; };
DA4E36921F1613C70007E4D0 /* KWMHomeDataResult.m in Sources */ = {isa = PBXBuildFile; fileRef = DA4E36911F1613C70007E4D0 /* KWMHomeDataResult.m */; };
DA4E36951F1726B80007E4D0 /* UIViewController+HTTP.m in Sources */ = {isa = PBXBuildFile; fileRef = DA4E36941F1726B80007E4D0 /* UIViewController+HTTP.m */; };
DA4E36981F17729C0007E4D0 /* KWMCategoryModel.m in Sources */ = {isa = PBXBuildFile; fileRef = DA4E36971F17729C0007E4D0 /* KWMCategoryModel.m */; };
DAB6431A1F04CFE5002CD7FE /* AppDelegate+Deeplink.m in Sources */ = {isa = PBXBuildFile; fileRef = DAB643191F04CFE5002CD7FE /* AppDelegate+Deeplink.m */; };
/* End PBXBuildFile section */
......@@ -962,6 +965,12 @@
C0FBD88D1F049D510009E375 /* KWMOrderPaid.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KWMOrderPaid.m; sourceTree = "<group>"; };
C0FC278C1D9B73B000C5CFFE /* KWMGiftCardCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KWMGiftCardCell.h; sourceTree = "<group>"; };
C0FC278D1D9B73B000C5CFFE /* KWMGiftCardCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KWMGiftCardCell.m; sourceTree = "<group>"; };
DA4E36901F1613C70007E4D0 /* KWMHomeDataResult.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KWMHomeDataResult.h; sourceTree = "<group>"; };
DA4E36911F1613C70007E4D0 /* KWMHomeDataResult.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KWMHomeDataResult.m; sourceTree = "<group>"; };
DA4E36931F1726B80007E4D0 /* UIViewController+HTTP.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIViewController+HTTP.h"; sourceTree = "<group>"; };
DA4E36941F1726B80007E4D0 /* UIViewController+HTTP.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIViewController+HTTP.m"; sourceTree = "<group>"; };
DA4E36961F17729C0007E4D0 /* KWMCategoryModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KWMCategoryModel.h; sourceTree = "<group>"; };
DA4E36971F17729C0007E4D0 /* KWMCategoryModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KWMCategoryModel.m; sourceTree = "<group>"; };
DAB643181F04CFE5002CD7FE /* AppDelegate+Deeplink.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "AppDelegate+Deeplink.h"; sourceTree = "<group>"; };
DAB643191F04CFE5002CD7FE /* AppDelegate+Deeplink.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "AppDelegate+Deeplink.m"; sourceTree = "<group>"; };
/* End PBXFileReference section */
......@@ -1056,6 +1065,8 @@
807806861D7566DD00FD2841 /* NSString+PinYin.m */,
9B8298E41EF237FC00743438 /* NSDecimalNumber+Currency.h */,
9B8298E51EF237FC00743438 /* NSDecimalNumber+Currency.m */,
DA4E36931F1726B80007E4D0 /* UIViewController+HTTP.h */,
DA4E36941F1726B80007E4D0 /* UIViewController+HTTP.m */,
);
path = Classify;
sourceTree = "<group>";
......@@ -1387,6 +1398,8 @@
C043927F1F0F9A3D0027ABA3 /* KWMHotSales.m */,
C07267831F1616E500C5A869 /* KWMColor.h */,
C07267841F1616E500C5A869 /* KWMColor.m */,
DA4E36961F17729C0007E4D0 /* KWMCategoryModel.h */,
DA4E36971F17729C0007E4D0 /* KWMCategoryModel.m */,
);
path = Model;
sourceTree = "<group>";
......@@ -1914,6 +1927,8 @@
9BE61CFA1ECD56E70031D21E /* KWMDictioaryResult.m */,
9BE61CFF1ECD71610031D21E /* KWMCartResult.h */,
9BE61D001ECD71610031D21E /* KWMCartResult.m */,
DA4E36901F1613C70007E4D0 /* KWMHomeDataResult.h */,
DA4E36911F1613C70007E4D0 /* KWMHomeDataResult.m */,
);
path = Cemarose;
sourceTree = "<group>";
......@@ -2515,6 +2530,7 @@
9BE61CFB1ECD56E70031D21E /* KWMDictioaryResult.m in Sources */,
C034E6D81D6AEF1B006EE129 /* KWMImageUtil.m in Sources */,
C0A6B3BE1F01FC5300D85673 /* KWMFirstDetailView.m in Sources */,
DA4E36981F17729C0007E4D0 /* KWMCategoryModel.m in Sources */,
C048B8E21EF3C04B000DA7AF /* KWMBeforePayData.m in Sources */,
C03846941DB89EEB008C3BAB /* KWMCemaroseResult.m in Sources */,
C04834411F13350F00A5BFB4 /* KWMRecommendHeader.m in Sources */,
......@@ -2686,6 +2702,7 @@
805C04381DD1FA7100ACC071 /* KWMBrandsTypeResult.m in Sources */,
C034E6DA1D6AEF1B006EE129 /* KWMTextFieldUtil.m in Sources */,
C0F5868D1E24F821001248E2 /* SHorizontalView.m in Sources */,
DA4E36921F1613C70007E4D0 /* KWMHomeDataResult.m in Sources */,
C034E7041D6AF205006EE129 /* RTSpinKitView.m in Sources */,
C0CCB3B91EEA579900BC2FB8 /* KWMFilterView.m in Sources */,
C05910941E34A729002990B3 /* KWMNewGiftCardCell.m in Sources */,
......@@ -2694,6 +2711,7 @@
C034E8411D6B10A0006EE129 /* CALayer+Transition.m in Sources */,
C077966F1EEAA2BE00CD6859 /* KWMFilterUtil.m in Sources */,
C034E8631D6B10A0006EE129 /* PBSaveBtn.m in Sources */,
DA4E36951F1726B80007E4D0 /* UIViewController+HTTP.m in Sources */,
807AF4A71DC984950000A326 /* KWMProducts.m in Sources */,
C0F5868A1E24F820001248E2 /* KWMSelectedGoodsVC.m in Sources */,
C034E8661D6B10A0006EE129 /* PhotoItemView.m in Sources */,
......
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="12121" systemVersion="16F73" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="n8p-We-k4e">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="12120" systemVersion="16F73" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="n8p-We-k4e">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12089"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12088"/>
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
......@@ -718,7 +718,7 @@
<scene sceneID="bOf-dv-ZzC">
<objects>
<navigationController id="u8P-hB-9hk" userLabel="首页tab" sceneMemberID="viewController">
<tabBarItem key="tabBarItem" title="Item" id="XwP-f8-O3G"/>
<tabBarItem key="tabBarItem" title="首页" id="XwP-f8-O3G"/>
<navigationBar key="navigationBar" contentMode="scaleToFill" id="RA9-LY-7Yg">
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
<autoresizingMask key="autoresizingMask"/>
......@@ -734,7 +734,7 @@
<!--首页-->
<scene sceneID="iDT-Ta-igF">
<objects>
<viewController storyboardIdentifier="KWMHomeVC" automaticallyAdjustsScrollViewInsets="NO" useStoryboardIdentifierAsRestorationIdentifier="YES" id="NBO-61-l1q" userLabel="首页" customClass="KWMHomeVC" sceneMemberID="viewController">
<viewController storyboardIdentifier="KWMHomeVC" automaticallyAdjustsScrollViewInsets="NO" hidesBottomBarWhenPushed="YES" useStoryboardIdentifierAsRestorationIdentifier="YES" id="NBO-61-l1q" userLabel="首页" customClass="KWMHomeVC" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="f00-jP-fyg"/>
<viewControllerLayoutGuide type="bottom" id="etP-Nh-Q2m"/>
......@@ -776,14 +776,13 @@
</mask>
</variation>
</view>
<navigationItem key="navigationItem" id="2Ib-m2-1Tz"/>
<connections>
<outlet property="tbvBlog" destination="lb3-DY-TZq" id="t0G-sz-ZbP"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="GVM-zj-f6B" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="-346" y="1361"/>
<point key="canvasLocation" x="-1615" y="1361"/>
</scene>
<!--商品-->
<scene sceneID="KxV-Rs-wmH">
......@@ -1010,7 +1009,7 @@
</constraints>
</view>
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" showsVerticalScrollIndicator="NO" dataMode="prototypes" style="grouped" separatorStyle="default" rowHeight="44" sectionHeaderHeight="18" sectionFooterHeight="18" translatesAutoresizingMaskIntoConstraints="NO" id="kMh-Eo-ATi">
<rect key="frame" x="0.0" y="167" width="375" height="451"/>
<rect key="frame" x="0.0" y="167" width="375" height="500"/>
<color key="backgroundColor" red="0.93725490199999995" green="0.93725490199999995" blue="0.95686274510000002" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<connections>
<outlet property="dataSource" destination="jDD-sy-yjq" id="svg-5f-Kbf"/>
......
//
// KWMHomeDataResult.h
// iCemarose
//
// Created by Sanchew on 2017/7/12.
// Copyright © 2017年 kollway. All rights reserved.
//
#import "KWMCemaroseResult.h"
#import "KWMHomeData.h"
@interface KWMHomeDataResult : KWMCemaroseResult
@property (nonatomic, strong) KWMHomeData *data;
@end
//
// KWMHomeDataResult.m
// iCemarose
//
// Created by Sanchew on 2017/7/12.
// Copyright © 2017年 kollway. All rights reserved.
//
#import "KWMHomeDataResult.h"
@implementation KWMHomeDataResult
- (instancetype)initWithDictionary:(NSDictionary *)dict error:(NSError **)err {
if (self = [super init]) {
self.data = [[KWMHomeData alloc] initWithDictionary:dict error:nil];
// NSArray *dataArray = dict[@"items"];
// if(dataArray){
// self.items = [self buildListData:[KWMShopCartModel class] jsonDictionary:dataArray];
// }
}
return self;
}
- (instancetype)initWithDictionary:(NSDictionary *)dict modelClass:(Class)modelClass error:(NSError *__autoreleasing *)err {
if (self = [self initWithDictionary:dict error:err]) {
}
return self;
}
@end
......@@ -35,7 +35,7 @@
#import "KWMWechatPayData.h"
#import "KWMOrderPaid.h"
#import "KWMWish.h"
#import "KWMHomeDataResult.h"
......@@ -161,6 +161,17 @@
failure:(void(^)(NSURLSessionDataTask *task,NSError *error))failure;
/**
* 首页板块数据
*
* @param success <#success description#>
* @param failure <#failure description#>
*
* @return <#return value description#>
*/
- (NSURLSessionDataTask *) getHomeDataWithSuccess:(void(^)(NSURLSessionDataTask *task,KWMHomeDataResult *result))success
failure:(void(^)(NSURLSessionDataTask *task,NSError *error))failure;
/**
* 商品——新品API
* @return NSURLSessionDataTask
*/
......
......@@ -24,6 +24,8 @@
#import <SAMKeychain/SAMKeychain.h>
#import "KWMUserModel.h"
#import "KWMHttpUtil.h"
#import "KWMHomeDataResult.h"
#import <PPNetworkHelper/PPNetworkHelper.h>
......@@ -354,6 +356,7 @@ static NSString *const passwordTest = @"9e84aae218c57cdf0762763c4cf5a651";
return task;
}
- (NSURLSessionDataTask *)startSessionTask:(KWMHTTPMethod)httpMethod
apiPath:(NSString *)apiPath
parameters:(NSDictionary *)parameters
......@@ -679,6 +682,11 @@ static NSString *const passwordTest = @"9e84aae218c57cdf0762763c4cf5a651";
failure:failure];
}
- (NSURLSessionDataTask *)getHomeDataWithSuccess:(void (^)(NSURLSessionDataTask *, KWMHomeDataResult *))success failure:(void (^)(NSURLSessionDataTask *, NSError *))failure {
NSString *apiPath = @"https://ogbgohpla.qnssl.com/App.Home.json?1";
return [self startSessionTask:KWMHTTPMethodGET apiPath:apiPath parameters:nil result:[KWMHomeDataResult class] model:nil success:success failure:failure];
}
/**
......
......@@ -11,15 +11,19 @@
#import "AppDelegate.h"
#import "KWMProductDetailVC.h"
#import "KWMSelectedGoodsVC.h"
#import "KWMBlogDetailVC.h"
@implementation AppDelegate (Deeplink)
- (void)registerRouter {
JLRoutes *routes = [JLRoutes routesForScheme:@"cemarose"];
[routes addRoute:@"/collections/*" handler:^BOOL(NSDictionary<NSString *,id> * _Nonnull parameters) {
[routes addRoute:@"/collections/:handle/*" handler:^BOOL(NSDictionary<NSString *,id> * _Nonnull parameters) {
NSArray *tags = parameters[JLRouteWildcardComponentsKey];
tags = tags.count > 0 ? [tags[0] componentsSeparatedByString:@"+"] : nil;
// NSArray *tags = [parameters[JLRouteWildcardComponentsKey] componentsSeparatedByString:@"+"];
NSLog(@"trace tags %@",[tags componentsJoinedByString:@","]);
KWMSelectedGoodsVC * selectedGoodsVC = (KWMSelectedGoodsVC *)[KWMBaseVC findControllerBy:[KWMSelectedGoodsVC kwmTag] fromStoryboard:@"New"];
selectedGoodsVC.handle = parameters[@"handle"];
selectedGoodsVC.ctags = tags;
[[AppDelegate mainViewController].selectedViewController pushViewController:selectedGoodsVC animated:YES];
return YES;
......@@ -33,6 +37,12 @@
[[AppDelegate mainViewController].selectedViewController pushViewController:productDetailVC animated:YES];
return YES;
}];
[routes addRoute:@"/blogs/:blog/:handle" handler:^BOOL(NSDictionary<NSString *,id> * _Nonnull parameters) {
KWMBlogDetailVC *blogDetailVC = (KWMBlogDetailVC *)[KWMBlogDetailVC findControllerBy:@"KWMBlogDetailVC" fromStoryboard:@"Home"];
blogDetailVC.handle = parameters[@"handle"];
[[AppDelegate mainViewController].selectedViewController pushViewController:blogDetailVC animated:YES];
return YES;
}];
}
- (BOOL)handleURL:(NSURL *)url {
......
//
// UIViewController+HTTP.h
// iCemarose
//
// Created by Sanchew on 2017/7/13.
// Copyright © 2017年 kollway. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface UIViewController (HTTP)
- (void) openURLWithString:(NSString *) URLString;
@end
//
// UIViewController+HTTP.m
// iCemarose
//
// Created by Sanchew on 2017/7/13.
// Copyright © 2017年 kollway. All rights reserved.
//
#import "UIViewController+HTTP.h"
#import <JLRoutes/JLRoutes.h>
#import <RegexKitLite/RegexKitLite.h>
#import <TOWebViewController/TOWebViewController.h>
#import "AppDelegate.h"
@implementation UIViewController (HTTP)
- (void)openURLWithString:(NSString *)URLString {
UIApplication *application = [UIApplication sharedApplication];
NSURL *url = [[NSURL alloc] initWithString:[URLString stringByReplacingOccurrencesOfRegex:@"^https?" withString:@"cemarose"]];
if ([JLRoutes canRouteURL:url]) {
[JLRoutes routeURL:url];
// }else if ([application respondsToSelector:@selector(openURL:options:completionHandler:)]) {
// [application openURL:[NSURL URLWithString:URLString] options:@{} completionHandler:nil];
} else {
// [application openURL:[NSURL URLWithString:URLString]];
TOWebViewController *wv = [[TOWebViewController alloc] initWithURLString:URLString];
[[AppDelegate mainViewController].selectedViewController pushViewController:wv animated:YES];
}
}
@end
......@@ -8,7 +8,7 @@
#import "KWMBaseModel.h"
@interface KWMAdvertisement : KWMBaseModel
@interface KWMAdvertisement :JSONModel
//标题
@property (nonatomic) NSString *title;
......
//
// KWMCategoryModel.h
// iCemarose
//
// Created by Sanchew on 2017/7/13.
// Copyright © 2017年 kollway. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <Mobile-Buy-SDK/Buy/BUYClient+Storefront.h>
#import "KWMFilter.h"
@interface KWMCategoryModel : NSObject
@property (nonatomic) NSString* title;
@property (nonatomic) NSNumber* collection_id;
@property (nonatomic) NSString* image;
@property (nonatomic) NSInteger page;
@property (nonatomic) NSMutableArray *products;
@property (nonatomic) BUYCollectionSort sort;
@property (nonatomic) NSMutableArray<KWMFilter *> *filters;
@property (nonatomic) NSString *brand;
@end
//
// KWMCategoryModel.m
// iCemarose
//
// Created by Sanchew on 2017/7/13.
// Copyright © 2017年 kollway. All rights reserved.
//
#import "KWMCategoryModel.h"
@implementation KWMCategoryModel
@end
......@@ -10,12 +10,14 @@
#import "KWMAdvertisement.h"
#import "KWMHotSales.h"
@interface KWMHomeData : KWMBaseModel
@protocol KWMAdvertisement;
@property (nonatomic) NSArray *adBanner;
@interface KWMHomeData : JSONModel
@property (nonatomic) KWMAdvertisement *clothingSets;
@property (nonatomic) NSArray <KWMAdvertisement> *ad_banner;
@property (nonatomic) KWMHotSales *hotSales;
@property (nonatomic) KWMAdvertisement *clothing_sets;
@property (nonatomic) KWMHotSales *hot_sales;
@end
......@@ -8,9 +8,9 @@
#import "KWMBaseModel.h"
@interface KWMHotSales : KWMBaseModel
@interface KWMHotSales :JSONModel
//大图商品数量
@property (nonatomic) NSNumber *singleShowCount;
@property (nonatomic) NSNumber *single_show_count;
@end
......@@ -7,7 +7,10 @@
//
#import <UIKit/UIKit.h>
#import "KWMCategoryModel.h"
@interface KWMLeftCategoryCell : UITableViewCell
- (void) fillData:(KWMCategoryModel *) model;
@end
......@@ -25,6 +25,11 @@
self.selectedBackgroundView.backgroundColor = [UIColor sam_colorWithHex:@"#F4F5F7"];
}
- (void)fillData:(KWMCategoryModel *)model {
_lbTitle.text = model.title;
_ivCategory.image = [UIImage imageNamed:model.image];
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
UIColor *textColor = selected?[UIColor sam_colorWithHex:@"#F1929A"]:[UIColor sam_colorWithHex:@"#545454"];
......
......@@ -17,6 +17,8 @@
#import "KWMFilterUtil.h"
#import "MJRefresh.h"
//#import <RXCollections/RXCollection.h>
@interface KWMCategoryVC ()
......@@ -33,11 +35,15 @@
@property (nonatomic) NSArray *allBrands;
@property(nonatomic) BUYCollectionSort sort;
//@property(nonatomic) BUYCollectionSort sort;
//@property(nonatomic) NSMutableArray<KWMFilter *> *selectFilters;
@property(nonatomic) NSMutableArray<KWMFilter *> *selectFilters;
//@property(nonatomic) NSString *selectBrands;
@property(nonatomic) NSString *selectBrands;
@property(nonatomic) NSArray<KWMCategoryModel *>* categories;
@property (nonatomic) KWMCategoryModel *selectedCategory;
@end
......@@ -50,10 +56,11 @@
- (void)viewDidLoad {
[super viewDidLoad];
[self initData];
[self initView];
[self requestAllBrandsApi];
[self.refreshUtil reLoadData];
[self.cvRightProduct.mj_header beginRefreshing];
// [self.refreshUtil reLoadData];
// [self.cvRightProduct.mj_header beginRefreshing];
}
-(KWMCollectionRefreshUtil *)refreshUtil{
......@@ -66,13 +73,43 @@
return _refreshUtil;
}
-(void) initData {
self.categories = [@[
@{@"title":@"上装",@"collection_id":@"192437702",@"image":@""},
@{@"title":@"连体衣",@"collection_id":@"192438342",@"image":@""},
@{@"title":@"外套",@"collection_id":@"192438790",@"image":@""},
@{@"title":@"裙子",@"collection_id":@"191377286",@"image":@""},
@{@"title":@"裤子",@"collection_id":@"333026630",@"image":@""},
@{@"title":@"短裙",@"collection_id":@"192434950",@"image":@""},
@{@"title":@"套装",@"collection_id":@"192438150",@"image":@""},
@{@"title":@"泳衣",@"collection_id":@"333026438",@"image":@""},
@{@"title":@"连裤袜",@"collection_id":@"192437830",@"image":@""},
@{@"title":@"打底裤",@"collection_id":@"192435334",@"image":@""},
@{@"title":@"内衣",@"collection_id":@"333026694",@"image":@""},
@{@"title":@"雨衣",@"collection_id":@"423509068",@"image":@""},
@{@"title":@"鞋子",@"collection_id":@"171856134",@"image":@""},
@{@"title":@"玩具",@"collection_id":@"332990918",@"image":@""},
@{@"title":@"饰品",@"collection_id":@"191376966",@"image":@""},
] rx_mapWithBlock:^id(id each) {
KWMCategoryModel *m = [KWMCategoryModel new];
m.title = each[@"title"];
m.collection_id = @([each[@"collection_id"] integerValue]);
m.image = each[@"image"];
m.page = 1;
m.products = [NSMutableArray new];
m.sort = BUYCollectionSortCollectionDefault;
return m;
}];
self.selectedCategory = self.categories.firstObject;
}
-(void)initView{
[self initTitleView];
[self initTbvLeft];
[self initCvRight];
self.sort = BUYCollectionSortCreatedDescending;
self.selectBrands = @"";
// self.sort = BUYCollectionSortCollectionDefault;
// self.selectBrands = @"";
}
-(void)initTbvLeft{
......@@ -96,17 +133,22 @@
#pragma mark - UITableViewDataSource
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
KWMLeftCategoryCell *categoryCell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([KWMLeftCategoryCell class]) forIndexPath:indexPath];
[categoryCell fillData:self.categories[indexPath.item]];
return categoryCell;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
return 20;
return self.categories.count;
}
-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
return 0.01;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
self.selectedCategory = self.categories[indexPath.row];
}
#pragma mark - UICollectionViewDataSource
-(UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
KWMRightProductCell *productCell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([KWMRightProductCell class]) forIndexPath:indexPath];
......@@ -139,7 +181,11 @@
#pragma mark - KWMCollectionRefreshDelegate
-(void)refreshUtil:(KWMCollectionRefreshUtil *)util onLoad:(NSInteger)page{
[self requestProducts:page];
if (page == 0) {
[self requestProducts:1];
}else{
[self requestProducts:self.selectedCategory.page + 1];
}
}
#pragma mark - CategoryFilterTabDelegate
......@@ -149,14 +195,14 @@
KWMBrandFilterVC *brandFilterVC = (KWMBrandFilterVC *)[KWMBaseVC findControllerBy:[KWMBrandFilterVC kwmTag] fromStoryboard:@"Category"];
brandFilterVC.brandArray = self.allBrands;
brandFilterVC.delegate = self;
brandFilterVC.selectBrand = self.selectBrands;
brandFilterVC.selectBrand = self.selectedCategory.brand;
tragetVC = brandFilterVC;
}else{
KWMProductFilterVC *productFilterVC = (KWMProductFilterVC *)[KWMBaseVC findControllerBy:[KWMProductFilterVC kwmTag] fromStoryboard:@"Category"];
productFilterVC.filterMode = filterMode;
productFilterVC.delegate = self;
productFilterVC.selectedSort = self.sort;
productFilterVC.selectedTags = self.selectFilters;
productFilterVC.selectedSort = self.selectedCategory.sort;
productFilterVC.selectedTags = self.selectedCategory.filters;
tragetVC = productFilterVC;
}
CGSize size = [UIScreen mainScreen].bounds.size;
......@@ -165,8 +211,9 @@
#pragma mark -
-(void)kwm_onCompleProductFilter:(KWMFilterView *)filterView{
self.selectFilters = filterView.selectedTags;
self.sort = filterView.selectedSort;
// self.selectFilters = filterView.selectedTags;
self.selectedCategory.filters = filterView.selectedTags;
self.selectedCategory.sort = filterView.selectedSort;
[self.filterTab close];
[self.refreshUtil reLoadData];
[self.cvRightProduct.mj_header beginRefreshing];
......@@ -179,7 +226,8 @@
#pragma mark -
-(void)kwm_onCompleteBrandFilter:(NSString *)selectBrand{
self.selectBrands = selectBrand;
// self.selectBrands = selectBrand;
self.selectedCategory.brand = selectBrand;
[self.filterTab close];
[self.refreshUtil reLoadData];
[self.cvRightProduct.mj_header beginRefreshing];
......@@ -206,30 +254,60 @@
}
#pragma mark - API BUYClient+Storefront.h
-(void)requestProducts:(NSInteger)page{
-(void)requestProducts:(NSInteger)cpage{
__weak KWMCategoryVC *weakSelf = self;
self.filterTab.userInteractionEnabled = false;
NSMutableArray *tags = [KWMFilterUtil getTagsByFilterArray:self.selectFilters];
if(![KWMStringUtil isEmpty:self.selectBrands]){
[tags addObject:self.selectBrands];
KWMCategoryModel *cmodel = self.selectedCategory;
NSMutableArray *tags = [KWMFilterUtil getTagsByFilterArray:cmodel.filters];
if(cmodel.brand){
[tags addObject:cmodel.brand];
}
[self.client getProductsPage:page inCollection:@(Collection_All_ID) withTags:tags sortOrder:self.sort completion:^(NSArray *products,NSUInteger page, BOOL reachedEnd, NSError *error){
[weakSelf.refreshUtil hideLoading];
[self.client getProductsPage:cpage inCollection:cmodel.collection_id withTags:tags sortOrder:cmodel.sort completion:^(NSArray *products,NSUInteger page, BOOL reachedEnd, NSError *error){
if (cmodel == self.selectedCategory) {
[weakSelf.refreshUtil hideLoading];
}
weakSelf.filterTab.userInteractionEnabled = true;
if(error){
[weakSelf showError:error];
}
else{
weakSelf.refreshUtil.page = page;
weakSelf.refreshUtil.hasNextPage = !reachedEnd;
[weakSelf.refreshUtil appendDataList:products];
// weakSelf.refreshUtil.page = page;
cmodel.page = page;
// weakSelf.refreshUtil.hasNextPage = !reachedEnd;
// [weakSelf.refreshUtil appendDataList:products];
if (cpage == 1) {
[cmodel.products removeAllObjects];
}
[cmodel.products addObjectsFromArray:products];
if (cmodel == weakSelf.selectedCategory) {
[weakSelf.cvRightProduct reloadData];
}
}
}];
}
#pragma mark - setter
- (void)setSelectedCategory:(KWMCategoryModel *)selectedCategory {
_selectedCategory = selectedCategory;
self.refreshUtil.page = _selectedCategory.page;
self.refreshUtil.hasNextPage = YES;
self.refreshUtil.dataList = _selectedCategory.products;
[self.cvRightProduct reloadData];
if (_selectedCategory.products.count == 0) {
// [self requestProducts:1];
// [self.refreshUtil reLoadData];
if ([self.cvRightProduct.mj_header isRefreshing]) {
[self requestProducts:1];
}else{
[self.cvRightProduct.mj_header beginRefreshing];
}
}else if([self.cvRightProduct.mj_header isRefreshing]) {
[self.cvRightProduct.mj_header endRefreshing];
}
// [self.cvRightProduct reloadData];
}
@end
......@@ -44,7 +44,7 @@
case BUYCollectionSortPriceAscending:
return 3;
default:
return 0;
return -1;
}
}
......
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="12118" systemVersion="16A323" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="12120" systemVersion="16F73" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12086"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12088"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
......@@ -32,7 +32,7 @@
<rect key="frame" x="0.0" y="0.0" width="375" height="648"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="ic_ home_content_title" translatesAutoresizingMaskIntoConstraints="NO" id="6b3-4L-fqj">
<imageView hidden="YES" userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="ic_ home_content_title" translatesAutoresizingMaskIntoConstraints="NO" id="6b3-4L-fqj">
<rect key="frame" x="20" y="10" width="14" height="9"/>
<constraints>
<constraint firstAttribute="height" constant="9" id="SlC-wh-5e0"/>
......@@ -40,17 +40,17 @@
</constraints>
</imageView>
<webView contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="XjH-A0-ATq">
<rect key="frame" x="0.0" y="83.5" width="375" height="564.5"/>
<rect key="frame" x="0.0" y="34" width="375" height="614"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</webView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="35I-9E-t9l">
<rect key="frame" x="20" y="23" width="325" height="32.5"/>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="35I-9E-t9l">
<rect key="frame" x="20" y="23" width="325" height="0.0"/>
<fontDescription key="fontDescription" name="PingFangSC-Regular" family="PingFang SC" pointSize="23"/>
<color key="textColor" red="0.29803921568627451" green="0.34901960784313724" blue="0.40000000000000002" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="gjF-Th-7MU">
<rect key="frame" x="20" y="66.5" width="345" height="17"/>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="gjF-Th-7MU">
<rect key="frame" x="20" y="34" width="345" height="0.0"/>
<fontDescription key="fontDescription" name="PingFangSC-Regular" family="PingFang SC" pointSize="12"/>
<color key="textColor" red="0.29803921570000003" green="0.34901960780000002" blue="0.40000000000000002" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
......@@ -83,6 +83,7 @@
</constraints>
</view>
<connections>
<outlet property="flagImg" destination="6b3-4L-fqj" id="Zw9-1P-Fjp"/>
<outlet property="lbTitle" destination="35I-9E-t9l" id="zpt-Oq-Rhh"/>
<outlet property="publishTime" destination="gjF-Th-7MU" id="HE9-1B-5Yl"/>
<outlet property="tbvArticle" destination="XdN-GP-LIS" id="3qw-6w-72k"/>
......
......@@ -16,5 +16,8 @@
@property (weak, nonatomic) IBOutlet UILabel *lbTitle;
@property (weak, nonatomic) IBOutlet UILabel *publishTime;
@property (weak, nonatomic) IBOutlet UIView *vHeader;
@property (weak, nonatomic) IBOutlet UIImageView *flagImg;
@property (nonatomic) KWMArticlesResult *article;
@property (nonatomic) NSString *handle;
@end
......@@ -23,15 +23,36 @@
// Do any additional setup after loading the view
self.title = @"正文";
self.automaticallyAdjustsScrollViewInsets = NO;
if (!self.handle) {
[self initData];
}else{
[self requestData];
}
}
- (void) requestData {
[self showLoading];
[self.api getAllBlog:@{@"handle":self.handle} success:^(NSURLSessionDataTask *task, KWMBlogResult *result) {
[self hideLoading];
self.article = result.blogs.firstObject;
[self initData];
} failure:^(NSURLSessionDataTask *task, NSError *error) {
[self showError:error];
NSLog(@"error:%@",error);
self.view.hidden = NO;
}];
}
- (void) initData {
self.flagImg.hidden = NO;
self.wbArticle.delegate = self;
self.wbArticle.scrollView.scrollEnabled = NO;
self.lbTitle.text = _article.title;
self.publishTime.text = [self returnTimeStr:_article.published_at];
self.tbvArticle.backgroundColor = [UIColor clearColor];
self.tbvArticle.separatorStyle = UITableViewCellSeparatorStyleNone;
[self initWebView];
}
......
......@@ -43,6 +43,7 @@
[super viewDidLoad];
_dataArr = [NSArray array];
[self requestBlogAPI];
// FIXME: mo to main
[self.api loginWebSuccess:nil failure:nil];
}
......@@ -70,19 +71,19 @@
- (void)viewWillAppear:(BOOL)animated{
[super viewWillAppear:animated];
[self.navigationController setNavigationBarHidden:YES];
[self initHeaderView];
if (_searchBar) {
NSInteger count = [[KWMShoppingCart sharedInstance] count].integerValue;
_searchBar.count = count;
}
[_searchBar resumeView];
[self.navigationController setNavigationBarHidden:NO];
// [self initHeaderView];
// if (_searchBar) {
// NSInteger count = [[KWMShoppingCart sharedInstance] count].integerValue;
// _searchBar.count = count;
// }
// [_searchBar resumeView];
}
- (void)viewWillDisappear:(BOOL)animated{
[super viewWillDisappear:animated];
[self.navigationController setNavigationBarHidden:YES];
[_searchBar removeFromSuperview];
// [self.navigationController setNavigationBarHidden:YES];
// [_searchBar removeFromSuperview];
}
- (void)didReceiveMemoryWarning {
......@@ -91,7 +92,7 @@
-(void)awakeFromNib{
[super awakeFromNib];
self.title = @"首页";
self.title = @"发现新鲜";
}
//请求api
......
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="12120" systemVersion="16E195" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="12120" systemVersion="16F73" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
......@@ -30,8 +30,8 @@
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="总计:¥" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="z8Q-AY-djl">
<rect key="frame" x="273" y="7" width="34.5" height="17"/>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="总计:" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="z8Q-AY-djl">
<rect key="frame" x="280" y="7" width="27.5" height="17"/>
<fontDescription key="fontDescription" name="PingFangSC-Regular" family="PingFang SC" pointSize="12"/>
<color key="textColor" red="0.94509803920000002" green="0.57254901960000004" blue="0.60392156860000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
......@@ -190,7 +190,7 @@
<outlet property="vContent" destination="ijW-ut-DIo" id="ibM-ZX-F0E"/>
<outlet property="vHeader" destination="9GU-8G-dS5" id="esp-Xp-6d3"/>
</connections>
<point key="canvasLocation" x="54" y="-116"/>
<point key="canvasLocation" x="53.5" y="-116"/>
</tableViewCell>
</objects>
<resources>
......
......@@ -108,5 +108,9 @@
return self.productArray?self.productArray.count:0;
}
-(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
[self.delegate kwm_onClickProduct:self.productArray[indexPath.item]];
}
@end
......@@ -11,13 +11,13 @@
#import "UIImageView+WebCache.h"
#import "KWMNewHomeCell.h"
@interface KWMHotSalesHeader()
@interface KWMHotSalesHeader()<UICollectionViewDelegate,UICollectionViewDataSource,UICollectionViewDelegateFlowLayout>
@property (nonatomic,weak) IBOutlet UIView *vView;
@property (nonatomic,weak) IBOutlet KWMBannerView *bannerView;
@property (nonatomic,weak) IBOutlet UIView *singleShowView;
@property (nonatomic,weak) IBOutlet UICollectionView *singleShowView;
@property (nonatomic,weak) IBOutlet NSLayoutConstraint *heightBannerView;
......@@ -69,6 +69,14 @@
}
-(void)initView{
UINib *nib = [UINib nibWithNibName:@"KWMNewHomeCell" bundle:nil];
[self.singleShowView registerNib:nib forCellWithReuseIdentifier:@"KWMNewHomeCell"];
// [self.singleShowView registerNib:nib forCellReuseIdentifier:@"KWMNewHomeCell"];
// [self.singleShowView registerNib:[[[NSBundle mainBundle]loadNibNamed:@"KWMNewHomeCell" owner:self options:nil] firstObject] forCellReuseIdentifier:@"KWMNewHomeCell"];
self.singleShowView.delegate = self;
self.singleShowView.dataSource = self;
// self.singleShowView.collectionViewLayout.collectionViewContentSize = CGSizeMake(UI_SCREEN_WIDTH - 16, UI_SCREEN_WIDTH + 58);
// self.singleShowView.collectionViewLayout = [UICollectionViewLayout alloc]
self.bannerView.delegate = self;
self.heightBannerView.constant = 0;
self.heightSingleShowView.constant = 0;
......@@ -98,19 +106,42 @@
NSInteger itemWidth = UI_SCREEN_WIDTH - 16;
NSInteger itemHeight = UI_SCREEN_WIDTH + 58;
for(int i=0;i<singleShowArray.count;i++){
BUYProduct *product = [singleShowArray objectAtIndex:i];
NSArray *nib = [[NSBundle mainBundle]loadNibNamed:@"KWMNewHomeCell" owner:self options:nil];
KWMNewHomeCell *homeCell = [nib objectAtIndex:0];
homeCell.frame = CGRectMake(8, itemHeight*i, itemWidth, itemHeight);
homeCell.singleShow = YES;
homeCell.tag = i;
homeCell.product = product;
[self.singleShowView addSubview:homeCell];
}
// for(int i=0;i<singleShowArray.count;i++){
// BUYProduct *product = [singleShowArray objectAtIndex:i];
// NSArray *nib = [[NSBundle mainBundle]loadNibNamed:@"KWMNewHomeCell" owner:self options:nil];
// KWMNewHomeCell *homeCell = [nib objectAtIndex:0];
// homeCell.frame = CGRectMake(8, itemHeight*i, itemWidth, itemHeight);
// homeCell.singleShow = YES;
// homeCell.tag = i;
// homeCell.product = product;
//
// [self.singleShowView addSubview:homeCell];
// }
self.heightSingleShowView.constant = itemHeight*singleShowArray.count;
}
#pragma mark - UICollectionViewDataSource & UICollectionViewDelegate
-(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
return self.singleShowArray.count;
}
-(UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
KWMNewHomeCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"KWMNewHomeCell" forIndexPath:indexPath];
cell.singleShow = YES;
cell.product = self.singleShowArray[indexPath.item];
return cell;
}
-(CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath {
return CGSizeMake(UI_SCREEN_WIDTH - 16, UI_SCREEN_WIDTH + 58);
}
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
[self.delegate kwm_onClickProduct:self.singleShowArray[indexPath.item]];
}
#pragma mark - KWMBannerViewDelegate
-(UIView *)bannerView:(KWMBannerView *)bannerView reusingView:(UIView *)reusingView pageAtIndex:(NSInteger)index{
UIView *itemView = reusingView?reusingView:nil;
......
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="12121" systemVersion="16F73" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="12120" systemVersion="16F73" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12089"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12088"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
......@@ -13,8 +13,8 @@
<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="7LG-U7-451" id="9MA-ha-ZlO"/>
<outlet property="singleShowView" destination="Dwm-lO-Zce" id="DKc-lA-7U0"/>
<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"/>
</connections>
</placeholder>
......@@ -67,25 +67,31 @@
<constraint firstAttribute="height" constant="190" id="NbW-Kh-s5O"/>
</constraints>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Dwm-lO-Zce" userLabel="singleShowView">
<collectionView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" scrollEnabled="NO" showsHorizontalScrollIndicator="NO" showsVerticalScrollIndicator="NO" dataMode="none" translatesAutoresizingMaskIntoConstraints="NO" id="UGY-II-IMu">
<rect key="frame" x="0.0" y="250" width="375" height="0.0"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="height" id="7LG-U7-451"/>
<constraint firstAttribute="height" id="SEw-Tw-g0a"/>
</constraints>
</view>
<collectionViewFlowLayout key="collectionViewLayout" minimumLineSpacing="10" minimumInteritemSpacing="10" id="Bjo-LO-kzZ">
<size key="itemSize" width="50" height="50"/>
<size key="headerReferenceSize" width="0.0" height="0.0"/>
<size key="footerReferenceSize" width="0.0" height="0.0"/>
<inset key="sectionInset" minX="0.0" minY="0.0" maxX="0.0" maxY="0.0"/>
</collectionViewFlowLayout>
</collectionView>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="trailing" secondItem="UGY-II-IMu" secondAttribute="trailing" id="6ji-Iq-sFG"/>
<constraint firstItem="Ruv-UI-DGw" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" id="9fw-Ph-Q4P"/>
<constraint firstItem="Ruv-UI-DGw" firstAttribute="top" secondItem="d0n-L5-xP1" secondAttribute="bottom" id="BTm-DX-XK4"/>
<constraint firstAttribute="trailing" secondItem="Ruv-UI-DGw" secondAttribute="trailing" id="RLP-eB-Asb"/>
<constraint firstItem="UGY-II-IMu" firstAttribute="top" secondItem="Ruv-UI-DGw" secondAttribute="bottom" id="VJK-eY-4rm"/>
<constraint firstItem="d0n-L5-xP1" firstAttribute="top" secondItem="iN0-l3-epB" secondAttribute="top" constant="10" id="aWf-1E-iKC"/>
<constraint firstItem="d0n-L5-xP1" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" id="g82-sr-LTG"/>
<constraint firstAttribute="trailing" secondItem="d0n-L5-xP1" secondAttribute="trailing" id="iHt-uY-XiY"/>
<constraint firstAttribute="trailing" secondItem="Dwm-lO-Zce" secondAttribute="trailing" id="q59-1g-wOJ"/>
<constraint firstItem="Dwm-lO-Zce" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" id="vxZ-CO-Z64"/>
<constraint firstItem="Dwm-lO-Zce" firstAttribute="top" secondItem="Ruv-UI-DGw" secondAttribute="bottom" id="y5m-bf-H2m"/>
<constraint firstItem="UGY-II-IMu" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" id="whN-vO-ZIi"/>
</constraints>
<nil key="simulatedStatusBarMetrics"/>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
......
......@@ -50,5 +50,17 @@
self.vView.frame = CGRectMake(0, 0, self.frame.size.width, self.frame.size.height);
[self addSubview:self.vView];
}
- (IBAction)newAction:(id)sender {
[self.delegate kwm_onClickHotMenu];
}
- (IBAction)discoverAction:(id)sender {
[self.delegate kwm_onClickNewMenu];
}
- (IBAction)likeAction:(id)sender {
[self.delegate kwm_onClickWishMenu];
}
- (IBAction)serverAction:(id)sender {
[self.delegate kwm_onClickDeliveryMenu];
}
@end
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="12121" systemVersion="16F73" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="12120" systemVersion="16F73" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12089"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12088"/>
<capability name="Aspect ratio constraints" minToolsVersion="5.1"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" tag="1111" contentMode="center" id="gTV-IL-0wX" customClass="KWMNewHomeCell">
<collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" tag="1111" contentMode="center" reuseIdentifier="KWMNewHomeCell" id="gTV-IL-0wX" customClass="KWMNewHomeCell">
<rect key="frame" x="0.0" y="0.0" width="184" height="242"/>
<autoresizingMask key="autoresizingMask"/>
<view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center">
......
......@@ -36,6 +36,11 @@
[self requestWishList];
}
-(void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
[self.navigationController setNavigationBarHidden:NO];
}
- (void)initView{
self.title = @"我喜欢的";
[self.tbvWish registerNib:[UINib nibWithNibName:NSStringFromClass([KWMWishCell class]) bundle:nil] forCellReuseIdentifier:NSStringFromClass([KWMWishCell class])];
......
......@@ -33,6 +33,10 @@
@property (nonatomic) BOOL isLoading;
/**
* deeplink handle
*/
@property (strong, nonatomic) NSString *handle;
/**
* deeplink tags
*/
@property (strong, nonatomic) NSArray<NSString *>*ctags;
......
......@@ -45,15 +45,16 @@ static NSString *idStr = @"KWMBrandCaramelCell";
[super viewDidLoad];
[self initView];
[self reLoadData];
// [self reLoadData];
}
- (void)initView{
self.hasNextPage = NO;
self.collectionSort = BUYCollectionSortCreatedDescending;
if (self.ctags) {
self.title = self.ctags.firstObject.capitalizedString;
if (self.handle) {
self.title = self.handle.capitalizedString;
}else if(self.productType != nil){
//初始化双行标题栏
NSString *mTitle;
......@@ -266,8 +267,8 @@ static NSString *idStr = @"KWMBrandCaramelCell";
NSLog(@"Error fetching products: %@", error);
}
};
if (self.ctags) {
[self.client getCollectionByHandle:self.ctags.lastObject completion:^(BUYCollection * _Nullable collection, NSError * _Nullable error) {
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];
}];
// [self.client getProductsPage:tagetPage inCollection:nil withTags:self.ctags sortOrder:self.filterView.selectedSort completion:completion];
......
......@@ -168,8 +168,9 @@
}
- (void)reLoadData {
self.page = 0;
[self loadData];
// self.page = 0;
// [self loadData];
[self.delegate refreshUtil:self onLoad:0];
}
-(void)clearData{
......@@ -179,7 +180,7 @@
}
- (void)loadData {
[self.delegate refreshUtil:self onLoad:self.page+1];
[self.delegate refreshUtil:self onLoad:1];
}
......
......@@ -86,6 +86,7 @@ static NSString *filterDataString = @"[{\"group\":\"SEASON\",\"tags\":[\"Spring/
}
-(void)initSortData{
self.selectedSortPosition = -1;
sortStringData = @[@"新-旧款",@"旧-新款",@"高-低价",@"低-高价"];
}
......@@ -100,7 +101,7 @@ static NSString *filterDataString = @"[{\"group\":\"SEASON\",\"tags\":[\"Spring/
case 3:
return BUYCollectionSortPriceAscending;
default:
return BUYCollectionSortCreatedDescending;
return BUYCollectionSortCollectionDefault;
}
}
......
......@@ -10,6 +10,7 @@
@protocol KWMSearchBarDelegate <NSObject>
@optional
- (void)kwm_startSearch;
- (void)kwm_onClickSearch:(NSString *)content;
- (void)kwm_onClickShopCar;
......
......@@ -11,6 +11,8 @@
#import "KWMAPIManager.h"
#import <MagicalRecord/MagicalRecord.h>
#import "NSDecimalNumber+Currency.h"
#import "UIViewController+HTTP.h"
#import <RXCollections/RXCollection.h>
#ifndef Header_Prefix_h
#define Header_Prefix_h
......
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