Commit 4607f7d4 authored by Sandy's avatar Sandy

增加商品列表对象属性、更多热门标签、更多热门品牌界面搭建

parent 6e8c7fc8
This diff is collapsed.
{
"images" : [
{
"idiom" : "universal",
"filename" : "allCategory.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "allCategory@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "hotTagIcon.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "hotTagIcon@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
//
// CommotityListBrand.h
//
// Created by Z on 16/4/11
// Created by Z on 16/4/27
// Copyright (c) 2016 __MyCompanyName__. All rights reserved.
//
#import <Foundation/Foundation.h>
@class CommotityListLastModifyInfo, CommotityListCreateInfo;
@interface CommotityListBrand : NSObject <NSCoding, NSCopying>
@property (nonatomic, strong) NSString *name;
@property (nonatomic, strong) NSString *uuid;
@property (nonatomic, strong) NSString *brandDescription;
@property (nonatomic, strong) NSString *state;
@property (nonatomic, assign) double version;
@property (nonatomic, strong) NSString *domain;
@property (nonatomic, strong) CommotityListLastModifyInfo *lastModifyInfo;
@property (nonatomic, strong) NSString *code;
@property (nonatomic, strong) NSString *location;
@property (nonatomic, assign) double order;
@property (nonatomic, strong) NSString *logo;
@property (nonatomic, strong) CommotityListCreateInfo *createInfo;
@property (nonatomic, strong) NSString *website;
@property (nonatomic, strong) NSString *name;
+ (instancetype)modelObjectWithDictionary:(NSDictionary *)dict;
- (instancetype)initWithDictionary:(NSDictionary *)dict;
......
//
// CommotityListBrand.m
//
// Created by Z on 16/4/11
// Created by Z on 16/4/27
// Copyright (c) 2016 __MyCompanyName__. All rights reserved.
//
#import "CommotityListBrand.h"
#import "CommotityListLastModifyInfo.h"
#import "CommotityListCreateInfo.h"
NSString *const kCommotityListBrandName = @"name";
NSString *const kCommotityListBrandUuid = @"uuid";
NSString *const kCommotityListBrandDescription = @"description";
NSString *const kCommotityListBrandState = @"state";
NSString *const kCommotityListBrandVersion = @"version";
NSString *const kCommotityListBrandDomain = @"domain";
NSString *const kCommotityListBrandLastModifyInfo = @"lastModifyInfo";
NSString *const kCommotityListBrandCode = @"code";
NSString *const kCommotityListBrandLocation = @"location";
NSString *const kCommotityListBrandOrder = @"order";
NSString *const kCommotityListBrandLogo = @"logo";
NSString *const kCommotityListBrandCreateInfo = @"createInfo";
NSString *const kCommotityListBrandWebsite = @"website";
NSString *const kCommotityListBrandName = @"name";
@interface CommotityListBrand ()
......@@ -33,19 +21,9 @@ NSString *const kCommotityListBrandName = @"name";
@implementation CommotityListBrand
@synthesize name = _name;
@synthesize uuid = _uuid;
@synthesize brandDescription = _brandDescription;
@synthesize state = _state;
@synthesize version = _version;
@synthesize domain = _domain;
@synthesize lastModifyInfo = _lastModifyInfo;
@synthesize code = _code;
@synthesize location = _location;
@synthesize order = _order;
@synthesize logo = _logo;
@synthesize createInfo = _createInfo;
@synthesize website = _website;
@synthesize name = _name;
+ (instancetype)modelObjectWithDictionary:(NSDictionary *)dict
......@@ -60,19 +38,9 @@ NSString *const kCommotityListBrandName = @"name";
// This check serves to make sure that a non-NSDictionary object
// passed into the model class doesn't break the parsing.
if(self && [dict isKindOfClass:[NSDictionary class]]) {
self.name = [self objectOrNilForKey:kCommotityListBrandName fromDictionary:dict];
self.uuid = [self objectOrNilForKey:kCommotityListBrandUuid fromDictionary:dict];
self.brandDescription = [self objectOrNilForKey:kCommotityListBrandDescription fromDictionary:dict];
self.state = [self objectOrNilForKey:kCommotityListBrandState fromDictionary:dict];
self.version = [[self objectOrNilForKey:kCommotityListBrandVersion fromDictionary:dict] doubleValue];
self.domain = [self objectOrNilForKey:kCommotityListBrandDomain fromDictionary:dict];
self.lastModifyInfo = [CommotityListLastModifyInfo modelObjectWithDictionary:[dict objectForKey:kCommotityListBrandLastModifyInfo]];
self.code = [self objectOrNilForKey:kCommotityListBrandCode fromDictionary:dict];
self.location = [self objectOrNilForKey:kCommotityListBrandLocation fromDictionary:dict];
self.order = [[self objectOrNilForKey:kCommotityListBrandOrder fromDictionary:dict] doubleValue];
self.logo = [self objectOrNilForKey:kCommotityListBrandLogo fromDictionary:dict];
self.createInfo = [CommotityListCreateInfo modelObjectWithDictionary:[dict objectForKey:kCommotityListBrandCreateInfo]];
self.website = [self objectOrNilForKey:kCommotityListBrandWebsite fromDictionary:dict];
self.name = [self objectOrNilForKey:kCommotityListBrandName fromDictionary:dict];
}
......@@ -83,19 +51,9 @@ NSString *const kCommotityListBrandName = @"name";
- (NSDictionary *)dictionaryRepresentation
{
NSMutableDictionary *mutableDict = [NSMutableDictionary dictionary];
[mutableDict setValue:self.name forKey:kCommotityListBrandName];
[mutableDict setValue:self.uuid forKey:kCommotityListBrandUuid];
[mutableDict setValue:self.brandDescription forKey:kCommotityListBrandDescription];
[mutableDict setValue:self.state forKey:kCommotityListBrandState];
[mutableDict setValue:[NSNumber numberWithDouble:self.version] forKey:kCommotityListBrandVersion];
[mutableDict setValue:self.domain forKey:kCommotityListBrandDomain];
[mutableDict setValue:[self.lastModifyInfo dictionaryRepresentation] forKey:kCommotityListBrandLastModifyInfo];
[mutableDict setValue:self.code forKey:kCommotityListBrandCode];
[mutableDict setValue:self.location forKey:kCommotityListBrandLocation];
[mutableDict setValue:[NSNumber numberWithDouble:self.order] forKey:kCommotityListBrandOrder];
[mutableDict setValue:self.logo forKey:kCommotityListBrandLogo];
[mutableDict setValue:[self.createInfo dictionaryRepresentation] forKey:kCommotityListBrandCreateInfo];
[mutableDict setValue:self.website forKey:kCommotityListBrandWebsite];
[mutableDict setValue:self.name forKey:kCommotityListBrandName];
return [NSDictionary dictionaryWithDictionary:mutableDict];
}
......@@ -119,38 +77,18 @@ NSString *const kCommotityListBrandName = @"name";
{
self = [super init];
self.name = [aDecoder decodeObjectForKey:kCommotityListBrandName];
self.uuid = [aDecoder decodeObjectForKey:kCommotityListBrandUuid];
self.brandDescription = [aDecoder decodeObjectForKey:kCommotityListBrandDescription];
self.state = [aDecoder decodeObjectForKey:kCommotityListBrandState];
self.version = [aDecoder decodeDoubleForKey:kCommotityListBrandVersion];
self.domain = [aDecoder decodeObjectForKey:kCommotityListBrandDomain];
self.lastModifyInfo = [aDecoder decodeObjectForKey:kCommotityListBrandLastModifyInfo];
self.code = [aDecoder decodeObjectForKey:kCommotityListBrandCode];
self.location = [aDecoder decodeObjectForKey:kCommotityListBrandLocation];
self.order = [aDecoder decodeDoubleForKey:kCommotityListBrandOrder];
self.logo = [aDecoder decodeObjectForKey:kCommotityListBrandLogo];
self.createInfo = [aDecoder decodeObjectForKey:kCommotityListBrandCreateInfo];
self.website = [aDecoder decodeObjectForKey:kCommotityListBrandWebsite];
self.name = [aDecoder decodeObjectForKey:kCommotityListBrandName];
return self;
}
- (void)encodeWithCoder:(NSCoder *)aCoder
{
[aCoder encodeObject:_name forKey:kCommotityListBrandName];
[aCoder encodeObject:_uuid forKey:kCommotityListBrandUuid];
[aCoder encodeObject:_brandDescription forKey:kCommotityListBrandDescription];
[aCoder encodeObject:_state forKey:kCommotityListBrandState];
[aCoder encodeDouble:_version forKey:kCommotityListBrandVersion];
[aCoder encodeObject:_domain forKey:kCommotityListBrandDomain];
[aCoder encodeObject:_lastModifyInfo forKey:kCommotityListBrandLastModifyInfo];
[aCoder encodeObject:_code forKey:kCommotityListBrandCode];
[aCoder encodeObject:_location forKey:kCommotityListBrandLocation];
[aCoder encodeDouble:_order forKey:kCommotityListBrandOrder];
[aCoder encodeObject:_logo forKey:kCommotityListBrandLogo];
[aCoder encodeObject:_createInfo forKey:kCommotityListBrandCreateInfo];
[aCoder encodeObject:_website forKey:kCommotityListBrandWebsite];
[aCoder encodeObject:_name forKey:kCommotityListBrandName];
}
- (id)copyWithZone:(NSZone *)zone
......@@ -159,19 +97,9 @@ NSString *const kCommotityListBrandName = @"name";
if (copy) {
copy.name = [self.name copyWithZone:zone];
copy.uuid = [self.uuid copyWithZone:zone];
copy.brandDescription = [self.brandDescription copyWithZone:zone];
copy.state = [self.state copyWithZone:zone];
copy.version = self.version;
copy.domain = [self.domain copyWithZone:zone];
copy.lastModifyInfo = [self.lastModifyInfo copyWithZone:zone];
copy.code = [self.code copyWithZone:zone];
copy.location = [self.location copyWithZone:zone];
copy.order = self.order;
copy.logo = [self.logo copyWithZone:zone];
copy.createInfo = [self.createInfo copyWithZone:zone];
copy.website = [self.website copyWithZone:zone];
copy.name = [self.name copyWithZone:zone];
}
return copy;
......
//
// CommotityListCategory.h
//
// Created by Z on 16/4/11
// Created by Z on 16/4/27
// Copyright (c) 2016 __MyCompanyName__. All rights reserved.
//
#import <Foundation/Foundation.h>
@class CommotityListUpper, CommotityListLastModifyInfo, CommotityListCreateInfo;
@interface CommotityListCategory : NSObject <NSCoding, NSCopying>
@property (nonatomic, strong) NSString *name;
@property (nonatomic, strong) NSString *uuid;
@property (nonatomic, strong) NSString *categoryDescription;
@property (nonatomic, strong) NSString *state;
@property (nonatomic, assign) double version;
@property (nonatomic, strong) CommotityListUpper *upper;
@property (nonatomic, strong) NSString *domain;
@property (nonatomic, strong) NSString *path;
@property (nonatomic, strong) CommotityListLastModifyInfo *lastModifyInfo;
@property (nonatomic, strong) NSString *code;
@property (nonatomic, assign) double order;
@property (nonatomic, assign) double level;
@property (nonatomic, strong) NSString *pictures;
@property (nonatomic, strong) CommotityListCreateInfo *createInfo;
@property (nonatomic, strong) NSString *name;
+ (instancetype)modelObjectWithDictionary:(NSDictionary *)dict;
- (instancetype)initWithDictionary:(NSDictionary *)dict;
......
//
// CommotityListCategory.m
//
// Created by Z on 16/4/11
// Created by Z on 16/4/27
// Copyright (c) 2016 __MyCompanyName__. All rights reserved.
//
#import "CommotityListCategory.h"
#import "CommotityListUpper.h"
#import "CommotityListLastModifyInfo.h"
#import "CommotityListCreateInfo.h"
NSString *const kCommotityListCategoryName = @"name";
NSString *const kCommotityListCategoryUuid = @"uuid";
NSString *const kCommotityListCategoryDescription = @"description";
NSString *const kCommotityListCategoryState = @"state";
NSString *const kCommotityListCategoryVersion = @"version";
NSString *const kCommotityListCategoryUpper = @"upper";
NSString *const kCommotityListCategoryDomain = @"domain";
NSString *const kCommotityListCategoryPath = @"path";
NSString *const kCommotityListCategoryLastModifyInfo = @"lastModifyInfo";
NSString *const kCommotityListCategoryCode = @"code";
NSString *const kCommotityListCategoryOrder = @"order";
NSString *const kCommotityListCategoryLevel = @"level";
NSString *const kCommotityListCategoryPictures = @"pictures";
NSString *const kCommotityListCategoryCreateInfo = @"createInfo";
NSString *const kCommotityListCategoryName = @"name";
@interface CommotityListCategory ()
......@@ -35,20 +21,9 @@ NSString *const kCommotityListCategoryName = @"name";
@implementation CommotityListCategory
@synthesize name = _name;
@synthesize uuid = _uuid;
@synthesize categoryDescription = _categoryDescription;
@synthesize state = _state;
@synthesize version = _version;
@synthesize upper = _upper;
@synthesize domain = _domain;
@synthesize path = _path;
@synthesize lastModifyInfo = _lastModifyInfo;
@synthesize code = _code;
@synthesize order = _order;
@synthesize level = _level;
@synthesize pictures = _pictures;
@synthesize createInfo = _createInfo;
@synthesize name = _name;
+ (instancetype)modelObjectWithDictionary:(NSDictionary *)dict
......@@ -63,20 +38,9 @@ NSString *const kCommotityListCategoryName = @"name";
// This check serves to make sure that a non-NSDictionary object
// passed into the model class doesn't break the parsing.
if(self && [dict isKindOfClass:[NSDictionary class]]) {
self.name = [self objectOrNilForKey:kCommotityListCategoryName fromDictionary:dict];
self.uuid = [self objectOrNilForKey:kCommotityListCategoryUuid fromDictionary:dict];
self.categoryDescription = [self objectOrNilForKey:kCommotityListCategoryDescription fromDictionary:dict];
self.state = [self objectOrNilForKey:kCommotityListCategoryState fromDictionary:dict];
self.version = [[self objectOrNilForKey:kCommotityListCategoryVersion fromDictionary:dict] doubleValue];
self.upper = [CommotityListUpper modelObjectWithDictionary:[dict objectForKey:kCommotityListCategoryUpper]];
self.domain = [self objectOrNilForKey:kCommotityListCategoryDomain fromDictionary:dict];
self.path = [self objectOrNilForKey:kCommotityListCategoryPath fromDictionary:dict];
self.lastModifyInfo = [CommotityListLastModifyInfo modelObjectWithDictionary:[dict objectForKey:kCommotityListCategoryLastModifyInfo]];
self.code = [self objectOrNilForKey:kCommotityListCategoryCode fromDictionary:dict];
self.order = [[self objectOrNilForKey:kCommotityListCategoryOrder fromDictionary:dict] doubleValue];
self.level = [[self objectOrNilForKey:kCommotityListCategoryLevel fromDictionary:dict] doubleValue];
self.pictures = [self objectOrNilForKey:kCommotityListCategoryPictures fromDictionary:dict];
self.createInfo = [CommotityListCreateInfo modelObjectWithDictionary:[dict objectForKey:kCommotityListCategoryCreateInfo]];
self.name = [self objectOrNilForKey:kCommotityListCategoryName fromDictionary:dict];
}
......@@ -87,20 +51,9 @@ NSString *const kCommotityListCategoryName = @"name";
- (NSDictionary *)dictionaryRepresentation
{
NSMutableDictionary *mutableDict = [NSMutableDictionary dictionary];
[mutableDict setValue:self.name forKey:kCommotityListCategoryName];
[mutableDict setValue:self.uuid forKey:kCommotityListCategoryUuid];
[mutableDict setValue:self.categoryDescription forKey:kCommotityListCategoryDescription];
[mutableDict setValue:self.state forKey:kCommotityListCategoryState];
[mutableDict setValue:[NSNumber numberWithDouble:self.version] forKey:kCommotityListCategoryVersion];
[mutableDict setValue:[self.upper dictionaryRepresentation] forKey:kCommotityListCategoryUpper];
[mutableDict setValue:self.domain forKey:kCommotityListCategoryDomain];
[mutableDict setValue:self.path forKey:kCommotityListCategoryPath];
[mutableDict setValue:[self.lastModifyInfo dictionaryRepresentation] forKey:kCommotityListCategoryLastModifyInfo];
[mutableDict setValue:self.code forKey:kCommotityListCategoryCode];
[mutableDict setValue:[NSNumber numberWithDouble:self.order] forKey:kCommotityListCategoryOrder];
[mutableDict setValue:[NSNumber numberWithDouble:self.level] forKey:kCommotityListCategoryLevel];
[mutableDict setValue:self.pictures forKey:kCommotityListCategoryPictures];
[mutableDict setValue:[self.createInfo dictionaryRepresentation] forKey:kCommotityListCategoryCreateInfo];
[mutableDict setValue:self.name forKey:kCommotityListCategoryName];
return [NSDictionary dictionaryWithDictionary:mutableDict];
}
......@@ -124,40 +77,18 @@ NSString *const kCommotityListCategoryName = @"name";
{
self = [super init];
self.name = [aDecoder decodeObjectForKey:kCommotityListCategoryName];
self.uuid = [aDecoder decodeObjectForKey:kCommotityListCategoryUuid];
self.categoryDescription = [aDecoder decodeObjectForKey:kCommotityListCategoryDescription];
self.state = [aDecoder decodeObjectForKey:kCommotityListCategoryState];
self.version = [aDecoder decodeDoubleForKey:kCommotityListCategoryVersion];
self.upper = [aDecoder decodeObjectForKey:kCommotityListCategoryUpper];
self.domain = [aDecoder decodeObjectForKey:kCommotityListCategoryDomain];
self.path = [aDecoder decodeObjectForKey:kCommotityListCategoryPath];
self.lastModifyInfo = [aDecoder decodeObjectForKey:kCommotityListCategoryLastModifyInfo];
self.code = [aDecoder decodeObjectForKey:kCommotityListCategoryCode];
self.order = [aDecoder decodeDoubleForKey:kCommotityListCategoryOrder];
self.level = [aDecoder decodeDoubleForKey:kCommotityListCategoryLevel];
self.pictures = [aDecoder decodeObjectForKey:kCommotityListCategoryPictures];
self.createInfo = [aDecoder decodeObjectForKey:kCommotityListCategoryCreateInfo];
self.name = [aDecoder decodeObjectForKey:kCommotityListCategoryName];
return self;
}
- (void)encodeWithCoder:(NSCoder *)aCoder
{
[aCoder encodeObject:_name forKey:kCommotityListCategoryName];
[aCoder encodeObject:_uuid forKey:kCommotityListCategoryUuid];
[aCoder encodeObject:_categoryDescription forKey:kCommotityListCategoryDescription];
[aCoder encodeObject:_state forKey:kCommotityListCategoryState];
[aCoder encodeDouble:_version forKey:kCommotityListCategoryVersion];
[aCoder encodeObject:_upper forKey:kCommotityListCategoryUpper];
[aCoder encodeObject:_domain forKey:kCommotityListCategoryDomain];
[aCoder encodeObject:_path forKey:kCommotityListCategoryPath];
[aCoder encodeObject:_lastModifyInfo forKey:kCommotityListCategoryLastModifyInfo];
[aCoder encodeObject:_code forKey:kCommotityListCategoryCode];
[aCoder encodeDouble:_order forKey:kCommotityListCategoryOrder];
[aCoder encodeDouble:_level forKey:kCommotityListCategoryLevel];
[aCoder encodeObject:_pictures forKey:kCommotityListCategoryPictures];
[aCoder encodeObject:_createInfo forKey:kCommotityListCategoryCreateInfo];
[aCoder encodeObject:_name forKey:kCommotityListCategoryName];
}
- (id)copyWithZone:(NSZone *)zone
......@@ -166,20 +97,9 @@ NSString *const kCommotityListCategoryName = @"name";
if (copy) {
copy.name = [self.name copyWithZone:zone];
copy.uuid = [self.uuid copyWithZone:zone];
copy.categoryDescription = [self.categoryDescription copyWithZone:zone];
copy.state = [self.state copyWithZone:zone];
copy.version = self.version;
copy.upper = [self.upper copyWithZone:zone];
copy.domain = [self.domain copyWithZone:zone];
copy.path = [self.path copyWithZone:zone];
copy.lastModifyInfo = [self.lastModifyInfo copyWithZone:zone];
copy.code = [self.code copyWithZone:zone];
copy.order = self.order;
copy.level = self.level;
copy.pictures = [self.pictures copyWithZone:zone];
copy.createInfo = [self.createInfo copyWithZone:zone];
copy.name = [self.name copyWithZone:zone];
}
return copy;
......
//
// CommotityListCreateInfo.h
//
// Created by Z on 16/4/11
// Copyright (c) 2016 __MyCompanyName__. All rights reserved.
//
#import <Foundation/Foundation.h>
@class CommotityListOperator;
@interface CommotityListCreateInfo : NSObject <NSCoding, NSCopying>
@property (nonatomic, strong) CommotityListOperator *operator;
@property (nonatomic, assign) double time;
+ (instancetype)modelObjectWithDictionary:(NSDictionary *)dict;
- (instancetype)initWithDictionary:(NSDictionary *)dict;
- (NSDictionary *)dictionaryRepresentation;
@end
//
// CommotityListCreateInfo.m
//
// Created by Z on 16/4/11
// Copyright (c) 2016 __MyCompanyName__. All rights reserved.
//
#import "CommotityListCreateInfo.h"
#import "CommotityListOperator.h"
NSString *const kCommotityListCreateInfoOperator = @"operator";
NSString *const kCommotityListCreateInfoTime = @"time";
@interface CommotityListCreateInfo ()
- (id)objectOrNilForKey:(id)aKey fromDictionary:(NSDictionary *)dict;
@end
@implementation CommotityListCreateInfo
@synthesize operator = _operator;
@synthesize time = _time;
+ (instancetype)modelObjectWithDictionary:(NSDictionary *)dict
{
return [[self alloc] initWithDictionary:dict];
}
- (instancetype)initWithDictionary:(NSDictionary *)dict
{
self = [super init];
// This check serves to make sure that a non-NSDictionary object
// passed into the model class doesn't break the parsing.
if(self && [dict isKindOfClass:[NSDictionary class]]) {
self.operator = [CommotityListOperator modelObjectWithDictionary:[dict objectForKey:kCommotityListCreateInfoOperator]];
self.time = [[self objectOrNilForKey:kCommotityListCreateInfoTime fromDictionary:dict] doubleValue];
}
return self;
}
- (NSDictionary *)dictionaryRepresentation
{
NSMutableDictionary *mutableDict = [NSMutableDictionary dictionary];
[mutableDict setValue:[self.operator dictionaryRepresentation] forKey:kCommotityListCreateInfoOperator];
[mutableDict setValue:[NSNumber numberWithDouble:self.time] forKey:kCommotityListCreateInfoTime];
return [NSDictionary dictionaryWithDictionary:mutableDict];
}
- (NSString *)description
{
return [NSString stringWithFormat:@"%@", [self dictionaryRepresentation]];
}
#pragma mark - Helper Method
- (id)objectOrNilForKey:(id)aKey fromDictionary:(NSDictionary *)dict
{
id object = [dict objectForKey:aKey];
return [object isEqual:[NSNull null]] ? nil : object;
}
#pragma mark - NSCoding Methods
- (id)initWithCoder:(NSCoder *)aDecoder
{
self = [super init];
self.operator = [aDecoder decodeObjectForKey:kCommotityListCreateInfoOperator];
self.time = [aDecoder decodeDoubleForKey:kCommotityListCreateInfoTime];
return self;
}
- (void)encodeWithCoder:(NSCoder *)aCoder
{
[aCoder encodeObject:_operator forKey:kCommotityListCreateInfoOperator];
[aCoder encodeDouble:_time forKey:kCommotityListCreateInfoTime];
}
- (id)copyWithZone:(NSZone *)zone
{
CommotityListCreateInfo *copy = [[CommotityListCreateInfo alloc] init];
if (copy) {
copy.operator = [self.operator copyWithZone:zone];
copy.time = self.time;
}
return copy;
}
@end
//
// CommotityListLastModifyInfo.h
//
// Created by Z on 16/4/11
// Copyright (c) 2016 __MyCompanyName__. All rights reserved.
//
#import <Foundation/Foundation.h>
@class CommotityListOperator;
@interface CommotityListLastModifyInfo : NSObject <NSCoding, NSCopying>
@property (nonatomic, strong) CommotityListOperator *operator;
@property (nonatomic, assign) double time;
+ (instancetype)modelObjectWithDictionary:(NSDictionary *)dict;
- (instancetype)initWithDictionary:(NSDictionary *)dict;
- (NSDictionary *)dictionaryRepresentation;
@end
//
// CommotityListLastModifyInfo.m
//
// Created by Z on 16/4/11
// Copyright (c) 2016 __MyCompanyName__. All rights reserved.
//
#import "CommotityListLastModifyInfo.h"
#import "CommotityListOperator.h"
NSString *const kCommotityListLastModifyInfoOperator = @"operator";
NSString *const kCommotityListLastModifyInfoTime = @"time";
@interface CommotityListLastModifyInfo ()
- (id)objectOrNilForKey:(id)aKey fromDictionary:(NSDictionary *)dict;
@end
@implementation CommotityListLastModifyInfo
@synthesize operator = _operator;
@synthesize time = _time;
+ (instancetype)modelObjectWithDictionary:(NSDictionary *)dict
{
return [[self alloc] initWithDictionary:dict];
}
- (instancetype)initWithDictionary:(NSDictionary *)dict
{
self = [super init];
// This check serves to make sure that a non-NSDictionary object
// passed into the model class doesn't break the parsing.
if(self && [dict isKindOfClass:[NSDictionary class]]) {
self.operator = [CommotityListOperator modelObjectWithDictionary:[dict objectForKey:kCommotityListLastModifyInfoOperator]];
self.time = [[self objectOrNilForKey:kCommotityListLastModifyInfoTime fromDictionary:dict] doubleValue];
}
return self;
}
- (NSDictionary *)dictionaryRepresentation
{
NSMutableDictionary *mutableDict = [NSMutableDictionary dictionary];
[mutableDict setValue:[self.operator dictionaryRepresentation] forKey:kCommotityListLastModifyInfoOperator];
[mutableDict setValue:[NSNumber numberWithDouble:self.time] forKey:kCommotityListLastModifyInfoTime];
return [NSDictionary dictionaryWithDictionary:mutableDict];
}
- (NSString *)description
{
return [NSString stringWithFormat:@"%@", [self dictionaryRepresentation]];
}
#pragma mark - Helper Method
- (id)objectOrNilForKey:(id)aKey fromDictionary:(NSDictionary *)dict
{
id object = [dict objectForKey:aKey];
return [object isEqual:[NSNull null]] ? nil : object;
}
#pragma mark - NSCoding Methods
- (id)initWithCoder:(NSCoder *)aDecoder
{
self = [super init];
self.operator = [aDecoder decodeObjectForKey:kCommotityListLastModifyInfoOperator];
self.time = [aDecoder decodeDoubleForKey:kCommotityListLastModifyInfoTime];
return self;
}
- (void)encodeWithCoder:(NSCoder *)aCoder
{
[aCoder encodeObject:_operator forKey:kCommotityListLastModifyInfoOperator];
[aCoder encodeDouble:_time forKey:kCommotityListLastModifyInfoTime];
}
- (id)copyWithZone:(NSZone *)zone
{
CommotityListLastModifyInfo *copy = [[CommotityListLastModifyInfo alloc] init];
if (copy) {
copy.operator = [self.operator copyWithZone:zone];
copy.time = self.time;
}
return copy;
}
@end
//
// CommotityListModel.h
//
// Created by Z on 16/4/11
// Created by Z on 16/4/27
// Copyright (c) 2016 __MyCompanyName__. All rights reserved.
//
......@@ -11,17 +11,23 @@
@interface CommotityListModel : NSObject <NSCoding, NSCopying>
@property (nonatomic, strong) CommotityListCategory *category;
@property (nonatomic, assign) double brokerageRate;
@property (nonatomic, assign) double originalPrice;
@property (nonatomic, assign) double inv;
@property (nonatomic, assign) double price;
@property (nonatomic, strong) NSString *uuid;
@property (nonatomic, strong) NSString *engName;
@property (nonatomic, strong) CommotityListCategory *category;
@property (nonatomic, assign) double salesVolume;
@property (nonatomic, assign) double visited;
@property (nonatomic, strong) CommotityListBrand *brand;
@property (nonatomic, assign) id engName;
@property (nonatomic, strong) NSString *pictures;
@property (nonatomic, strong) NSString *name;
@property (nonatomic, assign) double price;
@property (nonatomic, assign) double originalPrice;
@property (nonatomic, strong) NSString *specName;
@property (nonatomic, assign) double favorited;
@property (nonatomic, strong) NSString *cover;
@property (nonatomic, assign) double commission;
@property (nonatomic, strong) NSString *tranferType;
@property (nonatomic, assign) double inv;
@property (nonatomic, strong) NSString *name;
@property (nonatomic, assign) double score;
+ (instancetype)modelObjectWithDictionary:(NSDictionary *)dict;
- (instancetype)initWithDictionary:(NSDictionary *)dict;
......
//
// CommotityListOperator.h
//
// Created by Z on 16/4/11
// Copyright (c) 2016 __MyCompanyName__. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface CommotityListOperator : NSObject <NSCoding, NSCopying>
@property (nonatomic, strong) NSString *operatorIdentifier;
@property (nonatomic, strong) NSString *fullName;
+ (instancetype)modelObjectWithDictionary:(NSDictionary *)dict;
- (instancetype)initWithDictionary:(NSDictionary *)dict;
- (NSDictionary *)dictionaryRepresentation;
@end
//
// CommotityListOperator.m
//
// Created by Z on 16/4/11
// Copyright (c) 2016 __MyCompanyName__. All rights reserved.
//
#import "CommotityListOperator.h"
NSString *const kCommotityListOperatorId = @"id";
NSString *const kCommotityListOperatorFullName = @"fullName";
@interface CommotityListOperator ()
- (id)objectOrNilForKey:(id)aKey fromDictionary:(NSDictionary *)dict;
@end
@implementation CommotityListOperator
@synthesize operatorIdentifier = _operatorIdentifier;
@synthesize fullName = _fullName;
+ (instancetype)modelObjectWithDictionary:(NSDictionary *)dict
{
return [[self alloc] initWithDictionary:dict];
}
- (instancetype)initWithDictionary:(NSDictionary *)dict
{
self = [super init];
// This check serves to make sure that a non-NSDictionary object
// passed into the model class doesn't break the parsing.
if(self && [dict isKindOfClass:[NSDictionary class]]) {
self.operatorIdentifier = [self objectOrNilForKey:kCommotityListOperatorId fromDictionary:dict];
self.fullName = [self objectOrNilForKey:kCommotityListOperatorFullName fromDictionary:dict];
}
return self;
}
- (NSDictionary *)dictionaryRepresentation
{
NSMutableDictionary *mutableDict = [NSMutableDictionary dictionary];
[mutableDict setValue:self.operatorIdentifier forKey:kCommotityListOperatorId];
[mutableDict setValue:self.fullName forKey:kCommotityListOperatorFullName];
return [NSDictionary dictionaryWithDictionary:mutableDict];
}
- (NSString *)description
{
return [NSString stringWithFormat:@"%@", [self dictionaryRepresentation]];
}
#pragma mark - Helper Method
- (id)objectOrNilForKey:(id)aKey fromDictionary:(NSDictionary *)dict
{
id object = [dict objectForKey:aKey];
return [object isEqual:[NSNull null]] ? nil : object;
}
#pragma mark - NSCoding Methods
- (id)initWithCoder:(NSCoder *)aDecoder
{
self = [super init];
self.operatorIdentifier = [aDecoder decodeObjectForKey:kCommotityListOperatorId];
self.fullName = [aDecoder decodeObjectForKey:kCommotityListOperatorFullName];
return self;
}
- (void)encodeWithCoder:(NSCoder *)aCoder
{
[aCoder encodeObject:_operatorIdentifier forKey:kCommotityListOperatorId];
[aCoder encodeObject:_fullName forKey:kCommotityListOperatorFullName];
}
- (id)copyWithZone:(NSZone *)zone
{
CommotityListOperator *copy = [[CommotityListOperator alloc] init];
if (copy) {
copy.operatorIdentifier = [self.operatorIdentifier copyWithZone:zone];
copy.fullName = [self.fullName copyWithZone:zone];
}
return copy;
}
@end
//
// CommotityListUpper.h
//
// Created by Z on 16/4/11
// Copyright (c) 2016 __MyCompanyName__. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface CommotityListUpper : NSObject <NSCoding, NSCopying>
@property (nonatomic, strong) NSString *name;
@property (nonatomic, strong) NSString *code;
@property (nonatomic, strong) NSString *uuid;
+ (instancetype)modelObjectWithDictionary:(NSDictionary *)dict;
- (instancetype)initWithDictionary:(NSDictionary *)dict;
- (NSDictionary *)dictionaryRepresentation;
@end
//
// CommotityListUpper.m
//
// Created by Z on 16/4/11
// Copyright (c) 2016 __MyCompanyName__. All rights reserved.
//
#import "CommotityListUpper.h"
NSString *const kCommotityListUpperName = @"name";
NSString *const kCommotityListUpperCode = @"code";
NSString *const kCommotityListUpperUuid = @"uuid";
@interface CommotityListUpper ()
- (id)objectOrNilForKey:(id)aKey fromDictionary:(NSDictionary *)dict;
@end
@implementation CommotityListUpper
@synthesize name = _name;
@synthesize code = _code;
@synthesize uuid = _uuid;
+ (instancetype)modelObjectWithDictionary:(NSDictionary *)dict
{
return [[self alloc] initWithDictionary:dict];
}
- (instancetype)initWithDictionary:(NSDictionary *)dict
{
self = [super init];
// This check serves to make sure that a non-NSDictionary object
// passed into the model class doesn't break the parsing.
if(self && [dict isKindOfClass:[NSDictionary class]]) {
self.name = [self objectOrNilForKey:kCommotityListUpperName fromDictionary:dict];
self.code = [self objectOrNilForKey:kCommotityListUpperCode fromDictionary:dict];
self.uuid = [self objectOrNilForKey:kCommotityListUpperUuid fromDictionary:dict];
}
return self;
}
- (NSDictionary *)dictionaryRepresentation
{
NSMutableDictionary *mutableDict = [NSMutableDictionary dictionary];
[mutableDict setValue:self.name forKey:kCommotityListUpperName];
[mutableDict setValue:self.code forKey:kCommotityListUpperCode];
[mutableDict setValue:self.uuid forKey:kCommotityListUpperUuid];
return [NSDictionary dictionaryWithDictionary:mutableDict];
}
- (NSString *)description
{
return [NSString stringWithFormat:@"%@", [self dictionaryRepresentation]];
}
#pragma mark - Helper Method
- (id)objectOrNilForKey:(id)aKey fromDictionary:(NSDictionary *)dict
{
id object = [dict objectForKey:aKey];
return [object isEqual:[NSNull null]] ? nil : object;
}
#pragma mark - NSCoding Methods
- (id)initWithCoder:(NSCoder *)aDecoder
{
self = [super init];
self.name = [aDecoder decodeObjectForKey:kCommotityListUpperName];
self.code = [aDecoder decodeObjectForKey:kCommotityListUpperCode];
self.uuid = [aDecoder decodeObjectForKey:kCommotityListUpperUuid];
return self;
}
- (void)encodeWithCoder:(NSCoder *)aCoder
{
[aCoder encodeObject:_name forKey:kCommotityListUpperName];
[aCoder encodeObject:_code forKey:kCommotityListUpperCode];
[aCoder encodeObject:_uuid forKey:kCommotityListUpperUuid];
}
- (id)copyWithZone:(NSZone *)zone
{
CommotityListUpper *copy = [[CommotityListUpper alloc] init];
if (copy) {
copy.name = [self.name copyWithZone:zone];
copy.code = [self.code copyWithZone:zone];
copy.uuid = [self.uuid copyWithZone:zone];
}
return copy;
}
@end
......@@ -14,12 +14,4 @@
- (void)cellWithModel:(CatgoryModel *)model indexPath:(NSIndexPath *)indexPath;
- (void)cellWithHotTagsModel:(JavenHotTagsModel *)model indexPath:(NSIndexPath *)indexPath;
- (void)hideTopLine;
- (void)showTopLine;
- (void)hideRightLine;
- (void)showRightLine;
- (void)hideLeftLine;
- (void)showLeftLine;
@end
......@@ -9,79 +9,27 @@
#import "AddCommodityCollectionViewCell.h"
@interface AddCommodityCollectionViewCell ()
@property (weak, nonatomic) IBOutlet UIView *viewTopLine;
@property (weak, nonatomic) IBOutlet UIView *viewLeftLine;
@property (weak, nonatomic) IBOutlet UIView *viewRightLine;
@property (weak, nonatomic) IBOutlet UIImageView *imgView;
@property (weak, nonatomic) IBOutlet UILabel *labelTItle;
@property (weak, nonatomic) IBOutlet UILabel *labelDsc;
@property (weak, nonatomic) IBOutlet UITextField *textFieldTitle;
@end
@implementation AddCommodityCollectionViewCell
- (void)cellWithModel:(CatgoryModel *)model indexPath:(NSIndexPath *)indexPath {
[self.imgView sd_setImageWithURL:[NSURL URLWithString:model.pictures] placeholderImage:kPlaceHolderImage];
self.labelDsc.text = model.adescription;
self.labelTItle.text = model.name;
if ((int)indexPath.row / 4 == 0) {
[self showTopLine];
}else{
[self hideTopLine];
}
- (void)awakeFromNib {
self.textFieldTitle.enabled = NO;
if ((int)indexPath.row % 4 == 0) {
[self showLeftLine];
}else{
[self hideLeftLine];
}
}
- (void)cellWithHotTagsModel:(JavenHotTagsModel *)model indexPath:(NSIndexPath *)indexPath
- (void)cellWithModel:(CatgoryModel *)model indexPath:(NSIndexPath *)indexPath
{
//[self.imgView sd_setImageWithURL:[NSURL URLWithString:model.pictures] placeholderImage:nil];
//self.labelDsc.text = model.adescription;
self.labelTItle.text = model.name;
if ((int)indexPath.row / 4 == 0) {
[self showTopLine];
}else{
[self hideTopLine];
}
if ((int)indexPath.row % 4 == 0) {
[self showLeftLine];
}else{
[self hideLeftLine];
}
}
self.textFieldTitle.text = model.name;
- (void)hideTopLine {
self.viewTopLine.hidden = YES;
}
- (void)hideRightLine {
self.viewRightLine.hidden = YES;
}
- (void)showTopLine {
self.viewTopLine.hidden = NO;
}
- (void)showRightLine {
self.viewRightLine.hidden = NO;
- (void)cellWithHotTagsModel:(JavenHotTagsModel *)model indexPath:(NSIndexPath *)indexPath
{
self.textFieldTitle.text = model.name;
}
- (void)hideLeftLine {
self.viewLeftLine.hidden = YES;
}
- (void)showLeftLine {
self.viewLeftLine.hidden = NO;
}
- (void)awakeFromNib {
// Initialization code
}
@end
......@@ -9,8 +9,13 @@
#import <UIKit/UIKit.h>
@interface AddCommodityHeaderCollectionReusableView : UICollectionReusableView
@property (weak, nonatomic) IBOutlet UIButton *buttonMore;
- (void)sectionHot;
- (void)sectionHotTag;
- (void)sectionCategory;
- (void)sectionNormalWithTitle:(NSString *)title;
@end
......@@ -20,6 +20,19 @@
[self.icon setImage:[UIImage imageNamed:@"hotBrand"]];
self.labelTitle.text = @"热门品牌";
}
- (void)sectionHotTag {
[self.icon setImage:[UIImage imageNamed:@"hotTagIcon"]];
self.labelTitle.text = @"热门标签";
}
- (void)sectionCategory {
[self.icon setImage:[UIImage imageNamed:@"allCategory"]];
self.labelTitle.text = @"所有分类";
}
- (void)sectionNormalWithTitle:(NSString *)title {
[self.icon setImage:[UIImage imageNamed:@"classify"]];
self.labelTitle.text = title;
......
......@@ -24,10 +24,19 @@
<color key="textColor" red="0.066666666669999999" green="0.066666666669999999" blue="0.066666666669999999" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="fgT-hs-GFX">
<rect key="frame" x="262" y="6" width="48" height="33"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<state key="normal" title="更多…">
<color key="titleColor" red="0.75686274509999996" green="0.75686274509999996" blue="0.75686274509999996" alpha="1" colorSpace="calibratedRGB"/>
</state>
</button>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstAttribute="trailing" secondItem="fgT-hs-GFX" secondAttribute="trailing" constant="10" id="BmH-F5-fVq"/>
<constraint firstItem="WtT-uw-0m7" firstAttribute="leading" secondItem="U6b-Vx-4bR" secondAttribute="leading" constant="10" id="FfV-VQ-99C"/>
<constraint firstItem="fgT-hs-GFX" firstAttribute="centerY" secondItem="bpK-m4-bmM" secondAttribute="centerY" id="Kos-e7-eeP"/>
<constraint firstItem="WtT-uw-0m7" firstAttribute="centerY" secondItem="U6b-Vx-4bR" secondAttribute="centerY" id="Nju-Hc-tFE"/>
<constraint firstItem="bpK-m4-bmM" firstAttribute="centerY" secondItem="U6b-Vx-4bR" secondAttribute="centerY" id="SvN-l1-9vC"/>
<constraint firstItem="bpK-m4-bmM" firstAttribute="leading" secondItem="WtT-uw-0m7" secondAttribute="trailing" constant="8" id="fqp-RR-E9w"/>
......@@ -41,10 +50,11 @@
</mask>
</variation>
<connections>
<outlet property="buttonMore" destination="fgT-hs-GFX" id="edT-0c-gdp"/>
<outlet property="icon" destination="WtT-uw-0m7" id="3DK-Ih-GMv"/>
<outlet property="labelTitle" destination="bpK-m4-bmM" id="aoa-SR-gL3"/>
</connections>
<point key="canvasLocation" x="328" y="401"/>
<point key="canvasLocation" x="215" y="387"/>
</collectionReusableView>
</objects>
<resources>
......
......@@ -9,5 +9,8 @@
#import <UIKit/UIKit.h>
@interface CommodityDetailBottomView : UIView
@property (weak, nonatomic) IBOutlet UIButton *buttonPhone;
@property (weak, nonatomic) IBOutlet UIButton *buttonShop;
@property (weak, nonatomic) IBOutlet UIButton *buttonShare;
@end
......@@ -9,9 +9,6 @@
#import "CommodityDetailBottomView.h"
@interface CommodityDetailBottomView ()
@property (weak, nonatomic) IBOutlet UIButton *buttonPhone;
@property (weak, nonatomic) IBOutlet UIButton *buttonShop;
@property (weak, nonatomic) IBOutlet UIButton *buttonShare;
@end
......
......@@ -9,14 +9,15 @@
#import "CommodityListCollectionViewCell.h"
#import "NSDate+FormatterAdditions.h"
#import "addCommodityRequestModel.h"
#import "MBLabelWithFontAdapter.h"
@interface CommodityListCollectionViewCell ()
@property (weak, nonatomic) IBOutlet UIImageView *imageViewTop;
@property (weak, nonatomic) IBOutlet UILabel *labelTitle;
@property (weak, nonatomic) IBOutlet UILabel *labelCommission;
@property (weak, nonatomic) IBOutlet MBLabelWithFontAdapter *labelTitle;
@property (weak, nonatomic) IBOutlet UILabel *labelPrice;
@property (weak, nonatomic) IBOutlet UILabel *labelOriginalPrice;
@property (weak, nonatomic) IBOutlet UILabel *labelBrokerageRate;
@property (nonatomic, strong) CommotityListModel *model;
@property (weak, nonatomic) IBOutlet MBLabelWithFontAdapter *labelBrokerageRate; //佣金
@property (weak, nonatomic) IBOutlet UILabel *labelSalesVolume; //销量
@end
......@@ -24,9 +25,11 @@
- (void)cellWithModel:(CommotityListModel *)model {
self.labelPrice.text = [NSString stringWithFormat:@"%.0f",model.price];
[self.imageViewTop sd_setImageWithURL:[NSURL URLWithString:model.pictures] placeholderImage:kPlaceHolderImage];
self.labelOriginalPrice.text = [NSString stringWithFormat:@"%.0f", model.originalPrice];
self.labelBrokerageRate.text = [NSString stringWithFormat:@"%.2f", model.brokerageRate];
[self.imageViewTop sd_setImageWithURL:[NSURL URLWithString:model.cover] placeholderImage:kPlaceHolderImage];
self.labelOriginalPrice.text = [NSString stringWithFormat:@"¥%.0f", model.originalPrice];
self.labelBrokerageRate.text = [NSString stringWithFormat:@"¥%.2f", model.commission];
self.labelSalesVolume.text = [NSString stringWithFormat:@"销量:%.0f", model.salesVolume];
self.labelTitle.text = model.name;
self.model = model;
}
......@@ -52,7 +55,6 @@
if ([responseObject[@"code"] isEqualToNumber: @0]) {
[weakSelf addSUccess];
weakSelf.successBlock();
}
} failure:^(NSURLSessionDataTask *task, NSError *error) {
......
......@@ -13,25 +13,25 @@
<view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center">
<rect key="frame" x="0.0" y="0.0" width="315" height="220"/>
<subviews>
<imageView opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleAspectFit" misplaced="YES" image="hotIcon" translatesAutoresizingMaskIntoConstraints="NO" id="JCd-BI-c3c">
<rect key="frame" x="74" y="56" width="142" height="110"/>
<imageView opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleAspectFit" image="hotIcon" translatesAutoresizingMaskIntoConstraints="NO" id="JCd-BI-c3c">
<rect key="frame" x="10" y="0.0" width="295" height="220"/>
</imageView>
<view contentMode="scaleToFill" misplaced="YES" translatesAutoresizingMaskIntoConstraints="NO" id="S8b-kg-0m9" customClass="HotCommodityCell">
<rect key="frame" x="95" y="189" width="98" height="23"/>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="S8b-kg-0m9" customClass="HotCommodityCell">
<rect key="frame" x="0.0" y="219" width="315" height="1"/>
<color key="backgroundColor" red="0.86666666670000003" green="0.86666666670000003" blue="0.86666666670000003" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstAttribute="height" constant="1" id="u30-NM-gWn"/>
</constraints>
</view>
<view contentMode="scaleToFill" misplaced="YES" translatesAutoresizingMaskIntoConstraints="NO" id="bSo-Z3-jeB">
<rect key="frame" x="93" y="7" width="98" height="23"/>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="bSo-Z3-jeB">
<rect key="frame" x="0.0" y="0.0" width="315" height="1"/>
<color key="backgroundColor" red="0.86666666670000003" green="0.86666666670000003" blue="0.86666666670000003" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstAttribute="height" constant="1" id="Qhj-QZ-2YV"/>
</constraints>
</view>
<view contentMode="scaleToFill" misplaced="YES" translatesAutoresizingMaskIntoConstraints="NO" id="f0P-VR-27O">
<rect key="frame" x="256" y="46" width="37" height="118"/>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="f0P-VR-27O">
<rect key="frame" x="314" y="0.0" width="1" height="220"/>
<color key="backgroundColor" red="0.86666666670000003" green="0.86666666670000003" blue="0.86666666670000003" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="1" id="cAO-73-Oaw"/>
......
......@@ -24,10 +24,10 @@
- (void)cellWithModel:(CommotityListModel *)model
{
[self.imgViewCommodity sd_setImageWithURL:[NSURL URLWithString:model.pictures] placeholderImage:kPlaceHolderImage];
[self.imgViewCommodity sd_setImageWithURL:[NSURL URLWithString:model.cover] placeholderImage:kPlaceHolderImage];
self.labelTitle.text = model.name;
self.labelPrice.text = [NSString stringWithFormat:@"¥%.0f",model.price];
self.labelBrokerageRate.text = [NSString stringWithFormat:@"%.2f",model.brokerageRate];
self.labelBrokerageRate.text = [NSString stringWithFormat:@"%.2f",model.commission];
}
......
......@@ -17,6 +17,8 @@
#import "CatgoryModel.h"
#import "JavenHotTagsModel.h"
#import "CommoditySearchViewController.h"
#import "MoreHotTagViewController.h"
#import "MoreHotBrandViewController.h"
#define kHotCellId @"addCommodityCellHot"
#define kCellId @"addCommodityCell"
......@@ -50,18 +52,47 @@
return _arrData;
}
#pragma mark =========== actions ===========
- (void)searchAct {
CLog(@"搜索");
CommoditySearchViewController *searchVC = [[CommoditySearchViewController alloc] init];
searchVC.isShowNavigationBar = YES;
IBTUINavigationController *nc = [[IBTUINavigationController alloc] initWithRootViewController:searchVC];
// [self.navigationController presentModalViewController:nc animated:NO];
[self.navigationController presentViewController:nc animated:YES completion:nil];
[self.navigationController presentViewController:nc animated:YES completion:nil];
}
- (void)moreAction:(UIButton *)btn {
switch (btn.tag) {
case 0:
{
MoreHotBrandViewController *moreHotBrandVC = [[MoreHotBrandViewController alloc] init];
moreHotBrandVC.isShowNavigationBar = YES;
moreHotBrandVC.arrItems = self.arrData[0];
[self.navigationController pushViewController:moreHotBrandVC animated:YES];
}
break;
case 1:
{
MoreHotTagViewController *moreHotTagVC = [[MoreHotTagViewController alloc] init];
moreHotTagVC.arrItems = self.arrData[1];
moreHotTagVC.isShowNavigationBar = YES;
[self.navigationController pushViewController:moreHotTagVC animated:YES];
}
break;
case 2:
{
}
break;
default:
break;
}
}
- (void)setUpdata {
WS(weakSelf)
......@@ -113,12 +144,6 @@
return UIStatusBarStyleDefault;
}
//隐藏navigationbar
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
[self.navigationController setNavigationBarHidden:NO];
}
- (void)setUpCollectionView {
UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
_collectionView = [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:layout];
......@@ -154,12 +179,17 @@
if (kind == UICollectionElementKindSectionHeader) {
AddCommodityHeaderCollectionReusableView *reuseHeaderView = [collectionView dequeueReusableSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:kHeaderId forIndexPath:indexPath];
reuseHeaderView.buttonMore.tag = indexPath.section;
[reuseHeaderView.buttonMore addTarget:self action:@selector(moreAction:) forControlEvents:UIControlEventTouchUpInside];
if (indexPath.section == 0) {
[reuseHeaderView sectionHot];
[reuseHeaderView sectionHot];//设置图标
}else if(indexPath.section == 1){
[reuseHeaderView sectionNormalWithTitle:@"标签"];
[reuseHeaderView sectionHotTag];
}else{
[reuseHeaderView sectionNormalWithTitle:@"分类"];
reuseHeaderView.buttonMore.hidden = YES;
[reuseHeaderView sectionCategory];
}
return reuseHeaderView;
......@@ -182,8 +212,10 @@
- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath {
if (indexPath.section == 0) {
return CGSizeMake((ScreenSize.width - kMargin * 2)/3, kAutoValue(100));
}else if(indexPath.section == 1){
return CGSizeMake((ScreenSize.width - kMargin * 2)/3, kAutoValue(70));
}else{
return CGSizeMake((ScreenSize.width - kMargin * 2)/4, kAutoValue(160));
return CGSizeMake((ScreenSize.width - kMargin * 2)/2, kAutoValue(70));
}
}
......@@ -207,7 +239,9 @@
}
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
if (section == 1 && [self.arrData[section] count] > 3 ) {
return 3;
}
return [self.arrData[section] count];
}
......@@ -242,6 +276,7 @@
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
CommodityListViewController *commodityVC = [[CommodityListViewController alloc] init];
commodityVC.hidesBottomBarWhenPushed = YES;
commodityVC.isShowNavigationBar = YES;
commodityVC.model = self.arrData[indexPath.section][indexPath.row];
[self.navigationController pushViewController:commodityVC animated:YES];
}
......
......@@ -7,7 +7,8 @@
//
#import "IBTUIViewController.h"
#import "CommodityListModel/CommotityListModel.h"
@interface CommodityDetailViewController : IBTUIViewController
@property (nonatomic, strong) CommotityListModel *model;
@end
......@@ -25,35 +25,83 @@
}
self.view.backgroundColor = kBacroundColor;
UIWebView *webView = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, kWidth, kHeight - 67)];
NSURL *url = [NSURL URLWithString:@"https://m.jd.com"];
[webView loadRequest:[NSURLRequest requestWithURL:url]];
[self.view addSubview:webView];
webView.userInteractionEnabled = YES;
[self setUpWebView];
[self.view addSubview:self.topView];
WS(weakSelf)
self.topView.bacBlock = ^{
[weakSelf.navigationController popViewControllerAnimated:YES];
};
_topView.homeBlock = ^{
self.topView.homeBlock = ^{
CLog(@"home");
};
[self.view addSubview:self.bottomView];
[self.bottomView.buttonShop addTarget:self action:@selector(addCommodity) forControlEvents:UIControlEventTouchUpInside];
// Do any additional setup after loading the view.
}
- (void)addCommodity {
CLog(@"添加商品");
UserInfo *info = [UserInfo shareInstance];
NSDictionary *param = @{
@"operCtx": @{
@"time": [[NSDate date] timeStampNumber],
@"domain": info.domain,
@"operator": @{
@"id": info.uuid,
@"fullName": info.name
}
},
@"shopUuid": info.shop.uuid,
@"goodsUuid":self.model.uuid
};
// Do any additional setup after loading the view.
WS(weakSelf)
[[HTTPCilent shareCilent] POST:@"shop/addGoods" parameters:param success:^(NSURLSessionDataTask *task, id responseObject) {
if ([responseObject[@"code"] isEqualToNumber: @0]) {
[weakSelf addSUccess];
}
} failure:^(NSURLSessionDataTask *task, NSError *error) {
}];
}
- (void)addSUccess {
//添加成功提示框
MBProgressHUD *hud = [[MBProgressHUD alloc] initWithView:self.view.window];
[self.view.window addSubview:hud];
hud.animationType = MBProgressHUDAnimationFade;
hud.removeFromSuperViewOnHide = YES;
hud.labelText = @"添加成功!";
hud.mode = MBProgressHUDModeText;
[hud show:YES];
[hud hide:YES afterDelay:1];
}
- (void)setUpWebView {
UserInfo *userInfo = [UserInfo shareInstance];
NSString *urlStr = [NSString stringWithFormat:@"%@Wap/detail/shop_id/%@/id/%@/hastbar/1/.html", userInfo.webShopBaseUrl, userInfo.shop.uuid, self.model.uuid];
UIWebView *webView = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, kWidth, kHeight - 67)];
NSURL *url = [NSURL URLWithString:urlStr];
[webView loadRequest:[NSURLRequest requestWithURL:url]];
[self.view addSubview:webView];
webView.userInteractionEnabled = YES;
}
//隐藏navigationbar
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
......
......@@ -55,7 +55,6 @@
- (void)setUpData {
//前期发送请求生成参数的方式,后来不这么做了
NSString *parameters;
NSString *operation;
......@@ -73,7 +72,7 @@
}else if ([self.model isKindOfClass:[JavenHotTagsModel class]]){//热门标签
CatgoryModel *model = self.model;
operation = @"goodsData category uuid equals";
operation = @"tag uuid equals";
parameters = model.uuid;
}
......@@ -89,7 +88,6 @@
@"page" : @0,
@"probePages" : @0},
@"fetchParts" : @[@"string"]};
NSString *string = [myDictionary mj_JSONString];
WS(weakSelf)
[[HTTPCilent shareCilent] POST:@"goods/query2" parameters:myDictionary success:^(NSURLSessionDataTask *task, id responseObject) {
......@@ -107,13 +105,6 @@
}
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
[self.navigationController setNavigationBarHidden:NO];
}
- (void)setUpSortView {
_sortView = [[[SortView alloc] init] customNew];
[self.view addSubview:_sortView];
......@@ -224,6 +215,7 @@
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
CommodityDetailViewController *detailVC = [[CommodityDetailViewController alloc] init];
detailVC.model = self.arrItemDatas[indexPath.row];
[self.navigationController pushViewController:detailVC animated:YES];
}
......
//
// MoreHotBrandViewController.h
// ALand
//
// Created by Z on 16/4/27.
// Copyright © 2016年 Z. All rights reserved.
//
#import "IBTUIViewController.h"
#import "HotBrandModel.h"
@interface MoreHotBrandViewController : IBTUIViewController
@property (nonatomic, strong) NSArray *arrItems;
@end
//
// MoreHotBrandViewController.m
// ALand
//
// Created by Z on 16/4/27.
// Copyright © 2016年 Z. All rights reserved.
//
#import "MoreHotBrandViewController.h"
#import "HotCommodityCell.h"
#define kHotCellId @"addCommodityCellHot"
#define kMargin 0
@interface MoreHotBrandViewController ()<UICollectionViewDelegate, UICollectionViewDataSource>
@property (nonatomic, strong) UICollectionView *collectionView;
@end
@implementation MoreHotBrandViewController
- (void)viewDidLoad {
[super viewDidLoad];
self.navigationItem.title = @"更多热门品牌";
[self setUpCollectionView];
// Do any additional setup after loading the view.
}
- (void)setUpCollectionView {
UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
layout.itemSize = CGSizeMake((ScreenSize.width - kMargin * 2)/3, kAutoValue(100));
layout.minimumLineSpacing = 0;
layout.minimumInteritemSpacing = 0;
_collectionView = [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:layout];
[self.view addSubview:_collectionView];
_collectionView.sd_layout.topEqualToView(self.view).leftEqualToView(self.view).bottomEqualToView(self.view).rightEqualToView(self.view);
_collectionView.delegate = self;
_collectionView.dataSource = self;
_collectionView.backgroundColor = kSysWhite;
_collectionView.contentInset = UIEdgeInsetsMake(0, kMargin, 0, kMargin);
//cell
[_collectionView registerNib:[UINib nibWithNibName:@"HotCommodityCell" bundle:[NSBundle mainBundle]] forCellWithReuseIdentifier:kHotCellId];
}
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
return self.arrItems.count;
}
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
HotCommodityCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:kHotCellId forIndexPath:indexPath];
[cell cellWithModel:self.arrItems[indexPath.row] indexPath:indexPath];
return cell;
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
/*
#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
*/
@end
//
// MoreHotTagViewController.h
// ALand
//
// Created by Z on 16/4/27.
// Copyright © 2016年 Z. All rights reserved.
//
#import "IBTUIViewController.h"
#import "JavenHotTagsModel.h"
@interface MoreHotTagViewController : IBTUIViewController
@property (nonatomic, strong) NSArray *arrItems;
@end
//
// MoreHotTagViewController.m
// ALand
//
// Created by Z on 16/4/27.
// Copyright © 2016年 Z. All rights reserved.
//
#import "MoreHotTagViewController.h"
#import "AddCommodityCollectionViewCell.h"
#define kCellId @"AddCommodityCollectionViewCell.h"
#define kMargin 0
@interface MoreHotTagViewController ()<UICollectionViewDelegate, UICollectionViewDataSource>
@property (nonatomic, strong) UICollectionView *collectionView;
@end
@implementation MoreHotTagViewController
- (void)viewDidLoad {
[super viewDidLoad];
[self setUpCollectionView];
// Do any additional setup after loading the view.
}
- (void)setUpCollectionView {
UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
layout.itemSize = CGSizeMake((ScreenSize.width - kMargin * 2)/3, kAutoValue(70));
layout.minimumLineSpacing = 0;
layout.minimumInteritemSpacing = 0;
_collectionView = [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:layout];
[self.view addSubview:_collectionView];
_collectionView.sd_layout.topEqualToView(self.view).leftEqualToView(self.view).bottomEqualToView(self.view).rightEqualToView(self.view);
_collectionView.delegate = self;
_collectionView.dataSource = self;
_collectionView.backgroundColor = kSysWhite;
_collectionView.contentInset = UIEdgeInsetsMake(0, kMargin, 0, kMargin);
//cell
[_collectionView registerNib:[UINib nibWithNibName:@"AddCommodityCollectionViewCell" bundle:[NSBundle mainBundle]] forCellWithReuseIdentifier:kCellId];
}
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
return self.arrItems.count;
}
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
AddCommodityCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:kCellId forIndexPath:indexPath];
[cell cellWithHotTagsModel:self.arrItems[indexPath.row] indexPath:indexPath];
return cell;
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
/*
#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
*/
@end
......@@ -102,6 +102,7 @@
CLog(@"添加商品");
AddCommodityViewController *addVC = [[AddCommodityViewController alloc] init];
addVC.hidesBottomBarWhenPushed = YES;
addVC.isShowNavigationBar = YES;
[self.navigationController pushViewController:addVC animated:YES];
}
......
......@@ -14,6 +14,7 @@
#import "introductionViewController.h"
#import "CommodityManagementViewController.h"
#import "UMSocial.h"
#import "UMSocialWechatHandler.h"
@interface StoreManagermentViewController ()<UINavigationControllerDelegate, UIImagePickerControllerDelegate, UMSocialUIDelegate>
@property (nonatomic, strong) SelectPhotoView *photoView;
@property (nonatomic, strong) CoverShadowView *shadowView;
......@@ -136,12 +137,13 @@
[self.navigationController pushViewController:commodityVC animated:YES];
}
- (IBAction)actionShare:(id)sender {
[UMSocialSnsService presentSnsIconSheetView:self
appKey:@"507fcab25270157b37000010"
shareText:@"你要分享的文字"
shareImage:[UIImage imageNamed:@"icon.png"]
shareToSnsNames:[NSArray arrayWithObjects:UMShareToSina,UMShareToWechatSession,UMShareToQQ,nil]
delegate:self];
[UMSocialWechatHandler setWXAppId:@"wx2e218a9fb84928fa" appSecret:@"400c1925383f36f7768de707c69035e2" url:@"http://www.baidu.com"];
[[UMSocialDataService defaultDataService] postSNSWithTypes:@[UMShareToWechatSession] content:@"share" image:[UIImage imageNamed:@"add_commodityIcon0"] location:nil urlResource:nil presentedController:self completion:^(UMSocialResponseEntity *response){
if (response.responseCode == UMSResponseCodeSuccess) {
NSLog(@"分享成功!");
}
}];
}
......
......@@ -65,6 +65,8 @@
UserInfo *info = [UserInfo shareInstance];
[info UserInfoWithDictionary:responseObject[@"reseller"]];
info.webShopBaseUrl = responseObject[@"appConfig"][@"webShopBaseUrl"];
BaseViewController *baseVC = [[BaseViewController alloc] init];
baseVC.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
[weakSelf presentViewController:baseVC animated:YES completion:nil];
......
......@@ -42,7 +42,8 @@
UserInfo *info = [UserInfo shareInstance];
[info UserInfoWithDictionary:responseObject[@"reseller"]];
info.webShopBaseUrl = responseObject[@"appConfig"][@"webShopBaseUrl"];
[[NSUserDefaults standardUserDefaults] setObject:weakSelf.phoneNumberTextFiled.text forKey:@"userName"];
[[NSUserDefaults standardUserDefaults] setObject:[weakSelf.passwordTextFiled.text MD5String] forKey:@"passWord"];
......
......@@ -9,5 +9,6 @@
#import "UserInfoBaseClass.h"
#import "JavenShopModel.h"
@interface UserInfo : UserInfoBaseClass
@property (nonatomic, copy) NSString *webShopBaseUrl;
+ (UserInfo *)shareInstance;
@end
......@@ -13,11 +13,11 @@
@property (nonatomic, strong) NSArray *bankCards;
@property (nonatomic, assign) BOOL idValidated;
@property (nonatomic, assign) id code;
@property (nonatomic, assign) id uuid;
@property (nonatomic, assign) id trueName;
@property (nonatomic, assign) id good;
@property (nonatomic, assign) id name;
@property (nonatomic, strong) id code;
@property (nonatomic, strong) id uuid;
@property (nonatomic, strong) id trueName;
@property (nonatomic, strong) id good;
@property (nonatomic, strong) id name;
+ (instancetype)modelObjectWithDictionary:(NSDictionary *)dict;
- (instancetype)initWithDictionary:(NSDictionary *)dict;
......
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