Commit eabd8a46 authored by zhu's avatar zhu

今天进度 商品接口调试 场景库点选添加背景,产品没拿到数据

parent ba95f88f
......@@ -28,7 +28,7 @@ UICollectionViewDelegate,UICollectionViewDelegateFlowLayout>
@property (nonatomic,strong) UIButton *fengGeBtn;
@property (nonatomic,strong) UIButton *leiXingBtn;
@property (nonatomic,strong) NSMutableArray *nameData;
@property (nonatomic,strong) NSMutableArray *arrayData;
@property (nonatomic,strong) NSArray *arrayData;
@property (nonatomic,strong) NSMutableArray *array1;
@property (nonatomic,strong) NSMutableArray *array2;
@property (nonatomic,strong) NSMutableArray *array3;
......@@ -37,10 +37,11 @@ UICollectionViewDelegate,UICollectionViewDelegateFlowLayout>
* 筛选数据源
*/
@property (nonatomic,strong) NSMutableArray *screeningDatas;
@property (nonatomic,strong) GoodsFilter *goodsFilter;
/**
* 商品数据源对象
*/
@property (nonatomic,strong) GoodsResponse *datasArray;
@property (nonatomic,strong) NSMutableArray *datasArray;
/**
* 商品iD
*/
......
......@@ -8,7 +8,19 @@
#import "ProductLibraryView.h"
@implementation ProductLibraryView
/**
* 初始化商品数据源数组
*/
- (NSMutableArray *)datasArray
{
if (_datasArray == nil) {
_datasArray = [NSMutableArray array];
}
return _datasArray;
}
- (void)viewDidLoad {
[self initdata];
[self getScreeningdatas];
......@@ -38,11 +50,8 @@
-(void)initdata
{
self.arrayData=[[NSMutableArray alloc]init];
self.nameData=[[NSMutableArray alloc]initWithObjects:@"风格",@"类型",@"空间",@"材质",@"价格", @"",@"高级",nil];
self.array1=[[NSMutableArray alloc]initWithObjects:@"吊灯",@"壁灯",@"台灯",@"落地灯",@"吸顶灯", @"镜前灯",@"烛台灯",@"过厅灯",@"过道灯",@"商业照明",@"家具饰品",@"其他",nil];
self.array2=[[NSMutableArray alloc]initWithObjects:@"水晶系列",@"金属系列",@"商照电工",@"陶瓷",@"木艺", @"其它",nil];
self.array3=[[NSMutableArray alloc]initWithObjects:@"田园",@"宫廷",@"乡村",@"日式风格",@"欧式风格", @"混搭风格",@"现代简约",nil];
self.arrayData=self.array3;
self.nameData=[[NSMutableArray alloc]initWithObjects:@"风格",@"类型",@"空间",@"材质",@"价格",nil];
}
//#pragma mark -热门搜索
//- (void)setSelectedCode:(NSString *)selectedCode
......@@ -91,7 +100,11 @@
}else
{
weakSelf.datasArray = response;
for (TOGoodsEntity *model in response.goodsEntity) {
[self.datasArray addObject:model];
}
// [weakSelf.productCollectionView reloadData];
}
}];
......@@ -106,11 +119,9 @@
if ([returnValue[@"code"] isEqualToNumber:@0]) {
GoodsFilter *goodsStyle = [[GoodsFilter alloc]initWithDictionary:returnValue[@"data"] error:nil];
[self.screeningDatas addObject:goodsStyle.styles];
[self.screeningDatas addObject:goodsStyle.categories];
[self.screeningDatas addObject:goodsStyle.space];
[self.screeningDatas addObject:goodsStyle.material];
[self.screeningDatas addObject:goodsStyle.price];
self.goodsFilter=goodsStyle;
self.arrayData=self.goodsFilter.styles;
[self.seceneTableView reloadData];
}
else
{
......@@ -189,15 +200,15 @@
for (int i=0; i<self.nameData.count; i++) {
if (i !=5) {
UIButton *btn=[UIButton buttonWithType:UIButtonTypeCustom];
btn.frame=CGRectMake(ScreenWidth-190, 52+i*50, 50, 46) ;
btn.frame=CGRectMake(ScreenWidth-250, 52+i*50, 100, 46) ;
btn.backgroundColor=[UIColor whiteColor];
[btn setTitle:[self.nameData objectAtIndex:i] forState:UIControlStateNormal];
btn.contentEdgeInsets = UIEdgeInsetsMake(0, 40, 0, 0);
[btn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
// btn.contentEdgeInsets = UIEdgeInsetsMake(0, 60, 0, 0);
[btn addTarget:self action:@selector(selectedType:) forControlEvents:UIControlEventTouchUpInside];
btn.tag=100 +i;
btn.layer.masksToBounds = YES;
btn.layer.cornerRadius = 23;
btn.layer.cornerRadius = 25;
[self.view addSubview:btn];
}
......@@ -256,28 +267,25 @@
switch (sender.tag) {
case 100:
// 风格
self.arrayData=self.array3;
self.arrayData=self.goodsFilter.styles;
break;
case 101:
// 类型
self.arrayData=self.array2;
self.arrayData=self.goodsFilter.categories;
break;
case 102:
// 空间
self.arrayData=self.array1;
self.arrayData=self.goodsFilter.space;
break;
case 103:
// 材质
self.arrayData=self.array3;
self.arrayData=self.goodsFilter.material;
break;
case 104:
// 价格
self.arrayData=self.array3;
break;
case 106:
// 高级
self.arrayData=self.array3;
self.arrayData=self.goodsFilter.price;
break;
default:
break;
}
......@@ -287,7 +295,17 @@
//定义展示的Section的个数
-(NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView
{
return 10;
if (self.datasArray.count/3==0 && self.datasArray.count%3!=0 ) {
return 1;
}else
{
if (self.datasArray.count%3==0) {
return self.datasArray.count/3;
}else{
return self.datasArray.count/3 +1;
}
}
}
//定义展示的UICollectionViewCell的个数
-(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
......@@ -300,7 +318,8 @@
{
static NSString * CellIdentifier = @"UICollectionViewCell";
ProductCollectionPictureCell * cell = (ProductCollectionPictureCell*)[collectionView dequeueReusableCellWithReuseIdentifier:CellIdentifier forIndexPath:indexPath];
[cell.productImageView sd_setImageWithURL:[NSURL URLWithString:[[self.datasArray objectAtIndex_opple:indexPath.row] pictures]] placeholderImage:REPLACEIMAGE];
return cell;
}
......@@ -376,8 +395,13 @@
cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID];
}
cell.textLabel.text=[self.arrayData objectAtIndex:indexPath.row];
if ([[self.arrayData objectAtIndex_opple:indexPath.row]isKindOfClass:[GoodsCategory class]]) {
cell.textLabel.text=[[self.arrayData objectAtIndex_opple:indexPath.row] name];
}else
{//类型是多级的这里要改动
cell.textLabel.text=[[self.arrayData objectAtIndex_opple:indexPath.row] typename];
}
// 05产品库-详情_03
return cell;
......@@ -385,7 +409,7 @@
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
[self getGoodsListDatas];
}
-(void)DismissScreenView:(UITapGestureRecognizer*)sender{
......
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