Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
O
Opple-iOS
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张杰
Opple-iOS
Commits
eabd8a46
Commit
eabd8a46
authored
May 19, 2016
by
zhu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
今天进度 商品接口调试 场景库点选添加背景,产品没拿到数据
parent
ba95f88f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
55 additions
and
30 deletions
+55
-30
ProductLibraryView.h
Lighting/Class/ProductLibraryView.h
+3
-2
ProductLibraryView.m
Lighting/Class/ProductLibraryView.m
+52
-28
No files found.
Lighting/Class/ProductLibraryView.h
View file @
eabd8a46
...
@@ -28,7 +28,7 @@ UICollectionViewDelegate,UICollectionViewDelegateFlowLayout>
...
@@ -28,7 +28,7 @@ UICollectionViewDelegate,UICollectionViewDelegateFlowLayout>
@property
(
nonatomic
,
strong
)
UIButton
*
fengGeBtn
;
@property
(
nonatomic
,
strong
)
UIButton
*
fengGeBtn
;
@property
(
nonatomic
,
strong
)
UIButton
*
leiXingBtn
;
@property
(
nonatomic
,
strong
)
UIButton
*
leiXingBtn
;
@property
(
nonatomic
,
strong
)
NSMutableArray
*
nameData
;
@property
(
nonatomic
,
strong
)
NSMutableArray
*
nameData
;
@property
(
nonatomic
,
strong
)
NS
MutableArray
*
arrayData
;
@property
(
nonatomic
,
strong
)
NS
Array
*
arrayData
;
@property
(
nonatomic
,
strong
)
NSMutableArray
*
array1
;
@property
(
nonatomic
,
strong
)
NSMutableArray
*
array1
;
@property
(
nonatomic
,
strong
)
NSMutableArray
*
array2
;
@property
(
nonatomic
,
strong
)
NSMutableArray
*
array2
;
@property
(
nonatomic
,
strong
)
NSMutableArray
*
array3
;
@property
(
nonatomic
,
strong
)
NSMutableArray
*
array3
;
...
@@ -37,10 +37,11 @@ UICollectionViewDelegate,UICollectionViewDelegateFlowLayout>
...
@@ -37,10 +37,11 @@ UICollectionViewDelegate,UICollectionViewDelegateFlowLayout>
* 筛选数据源
* 筛选数据源
*/
*/
@property
(
nonatomic
,
strong
)
NSMutableArray
*
screeningDatas
;
@property
(
nonatomic
,
strong
)
NSMutableArray
*
screeningDatas
;
@property
(
nonatomic
,
strong
)
GoodsFilter
*
goodsFilter
;
/**
/**
* 商品数据源对象
* 商品数据源对象
*/
*/
@property
(
nonatomic
,
strong
)
GoodsResponse
*
datasArray
;
@property
(
nonatomic
,
strong
)
NSMutableArray
*
datasArray
;
/**
/**
* 商品iD
* 商品iD
*/
*/
...
...
Lighting/Class/ProductLibraryView.m
View file @
eabd8a46
...
@@ -8,7 +8,19 @@
...
@@ -8,7 +8,19 @@
#import "ProductLibraryView.h"
#import "ProductLibraryView.h"
@implementation
ProductLibraryView
@implementation
ProductLibraryView
/**
* 初始化商品数据源数组
*/
-
(
NSMutableArray
*
)
datasArray
{
if
(
_datasArray
==
nil
)
{
_datasArray
=
[
NSMutableArray
array
];
}
return
_datasArray
;
}
-
(
void
)
viewDidLoad
{
-
(
void
)
viewDidLoad
{
[
self
initdata
];
[
self
initdata
];
[
self
getScreeningdatas
];
[
self
getScreeningdatas
];
...
@@ -38,11 +50,8 @@
...
@@ -38,11 +50,8 @@
-
(
void
)
initdata
-
(
void
)
initdata
{
{
self
.
arrayData
=
[[
NSMutableArray
alloc
]
init
];
self
.
arrayData
=
[[
NSMutableArray
alloc
]
init
];
self
.
nameData
=
[[
NSMutableArray
alloc
]
initWithObjects
:
@"风格"
,
@"类型"
,
@"空间"
,
@"材质"
,
@"价格"
,
@""
,
@"高级"
,
nil
];
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
;
}
}
//#pragma mark -热门搜索
//#pragma mark -热门搜索
//- (void)setSelectedCode:(NSString *)selectedCode
//- (void)setSelectedCode:(NSString *)selectedCode
...
@@ -91,7 +100,11 @@
...
@@ -91,7 +100,11 @@
}
else
}
else
{
{
weakSelf
.
datasArray
=
response
;
for
(
TOGoodsEntity
*
model
in
response
.
goodsEntity
)
{
[
self
.
datasArray
addObject
:
model
];
}
// [weakSelf.productCollectionView reloadData];
// [weakSelf.productCollectionView reloadData];
}
}
}];
}];
...
@@ -106,11 +119,9 @@
...
@@ -106,11 +119,9 @@
if
([
returnValue
[
@"code"
]
isEqualToNumber
:
@0
])
{
if
([
returnValue
[
@"code"
]
isEqualToNumber
:
@0
])
{
GoodsFilter
*
goodsStyle
=
[[
GoodsFilter
alloc
]
initWithDictionary
:
returnValue
[
@"data"
]
error
:
nil
];
GoodsFilter
*
goodsStyle
=
[[
GoodsFilter
alloc
]
initWithDictionary
:
returnValue
[
@"data"
]
error
:
nil
];
[
self
.
screeningDatas
addObject
:
goodsStyle
.
styles
];
self
.
goodsFilter
=
goodsStyle
;
[
self
.
screeningDatas
addObject
:
goodsStyle
.
categories
];
self
.
arrayData
=
self
.
goodsFilter
.
styles
;
[
self
.
screeningDatas
addObject
:
goodsStyle
.
space
];
[
self
.
seceneTableView
reloadData
];
[
self
.
screeningDatas
addObject
:
goodsStyle
.
material
];
[
self
.
screeningDatas
addObject
:
goodsStyle
.
price
];
}
}
else
else
{
{
...
@@ -189,15 +200,15 @@
...
@@ -189,15 +200,15 @@
for
(
int
i
=
0
;
i
<
self
.
nameData
.
count
;
i
++
)
{
for
(
int
i
=
0
;
i
<
self
.
nameData
.
count
;
i
++
)
{
if
(
i
!=
5
)
{
if
(
i
!=
5
)
{
UIButton
*
btn
=
[
UIButton
buttonWithType
:
UIButtonTypeCustom
];
UIButton
*
btn
=
[
UIButton
buttonWithType
:
UIButtonTypeCustom
];
btn
.
frame
=
CGRectMake
(
ScreenWidth
-
190
,
52
+
i
*
50
,
5
0
,
46
)
;
btn
.
frame
=
CGRectMake
(
ScreenWidth
-
250
,
52
+
i
*
50
,
10
0
,
46
)
;
btn
.
backgroundColor
=
[
UIColor
whiteColor
];
btn
.
backgroundColor
=
[
UIColor
whiteColor
];
[
btn
setTitle
:[
self
.
nameData
objectAtIndex
:
i
]
forState
:
UIControlStateNormal
];
[
btn
setTitle
:[
self
.
nameData
objectAtIndex
:
i
]
forState
:
UIControlStateNormal
];
btn
.
contentEdgeInsets
=
UIEdgeInsetsMake
(
0
,
40
,
0
,
0
);
[
btn
setTitleColor
:[
UIColor
blackColor
]
forState
:
UIControlStateNormal
];
[
btn
setTitleColor
:[
UIColor
blackColor
]
forState
:
UIControlStateNormal
];
// btn.contentEdgeInsets = UIEdgeInsetsMake(0, 60, 0, 0);
[
btn
addTarget
:
self
action
:
@selector
(
selectedType
:
)
forControlEvents
:
UIControlEventTouchUpInside
];
[
btn
addTarget
:
self
action
:
@selector
(
selectedType
:
)
forControlEvents
:
UIControlEventTouchUpInside
];
btn
.
tag
=
100
+
i
;
btn
.
tag
=
100
+
i
;
btn
.
layer
.
masksToBounds
=
YES
;
btn
.
layer
.
masksToBounds
=
YES
;
btn
.
layer
.
cornerRadius
=
2
3
;
btn
.
layer
.
cornerRadius
=
2
5
;
[
self
.
view
addSubview
:
btn
];
[
self
.
view
addSubview
:
btn
];
}
}
...
@@ -256,28 +267,25 @@
...
@@ -256,28 +267,25 @@
switch
(
sender
.
tag
)
{
switch
(
sender
.
tag
)
{
case
100
:
case
100
:
// 风格
// 风格
self
.
arrayData
=
self
.
array3
;
self
.
arrayData
=
self
.
goodsFilter
.
styles
;
break
;
break
;
case
101
:
case
101
:
// 类型
// 类型
self
.
arrayData
=
self
.
array2
;
self
.
arrayData
=
self
.
goodsFilter
.
categories
;
break
;
break
;
case
102
:
case
102
:
// 空间
// 空间
self
.
arrayData
=
self
.
array1
;
self
.
arrayData
=
self
.
goodsFilter
.
space
;
break
;
break
;
case
103
:
case
103
:
// 材质
// 材质
self
.
arrayData
=
self
.
array3
;
self
.
arrayData
=
self
.
goodsFilter
.
material
;
break
;
break
;
case
104
:
case
104
:
// 价格
// 价格
self
.
arrayData
=
self
.
array3
;
self
.
arrayData
=
self
.
goodsFilter
.
price
;
break
;
case
106
:
// 高级
self
.
arrayData
=
self
.
array3
;
break
;
break
;
default
:
default
:
break
;
break
;
}
}
...
@@ -287,7 +295,17 @@
...
@@ -287,7 +295,17 @@
//定义展示的Section的个数
//定义展示的Section的个数
-
(
NSInteger
)
numberOfSectionsInCollectionView
:
(
UICollectionView
*
)
collectionView
-
(
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的个数
//定义展示的UICollectionViewCell的个数
-
(
NSInteger
)
collectionView
:
(
UICollectionView
*
)
collectionView
numberOfItemsInSection
:
(
NSInteger
)
section
-
(
NSInteger
)
collectionView
:
(
UICollectionView
*
)
collectionView
numberOfItemsInSection
:
(
NSInteger
)
section
...
@@ -300,7 +318,8 @@
...
@@ -300,7 +318,8 @@
{
{
static
NSString
*
CellIdentifier
=
@"UICollectionViewCell"
;
static
NSString
*
CellIdentifier
=
@"UICollectionViewCell"
;
ProductCollectionPictureCell
*
cell
=
(
ProductCollectionPictureCell
*
)[
collectionView
dequeueReusableCellWithReuseIdentifier
:
CellIdentifier
forIndexPath
:
indexPath
];
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
;
return
cell
;
}
}
...
@@ -376,8 +395,13 @@
...
@@ -376,8 +395,13 @@
cell
=
[[
UITableViewCell
alloc
]
initWithStyle
:
UITableViewCellStyleDefault
reuseIdentifier
:
cellID
];
cell
=
[[
UITableViewCell
alloc
]
initWithStyle
:
UITableViewCellStyleDefault
reuseIdentifier
:
cellID
];
}
}
if
([[
self
.
arrayData
objectAtIndex_opple
:
indexPath
.
row
]
isKindOfClass
:[
GoodsCategory
class
]])
{
cell
.
textLabel
.
text
=
[
self
.
arrayData
objectAtIndex
:
indexPath
.
row
];
cell
.
textLabel
.
text
=
[[
self
.
arrayData
objectAtIndex_opple
:
indexPath
.
row
]
name
];
}
else
{
//类型是多级的这里要改动
cell
.
textLabel
.
text
=
[[
self
.
arrayData
objectAtIndex_opple
:
indexPath
.
row
]
typename
];
}
// 05产品库-详情_03
// 05产品库-详情_03
return
cell
;
return
cell
;
...
@@ -385,7 +409,7 @@
...
@@ -385,7 +409,7 @@
-
(
void
)
tableView
:
(
UITableView
*
)
tableView
didSelectRowAtIndexPath
:
(
NSIndexPath
*
)
indexPath
-
(
void
)
tableView
:
(
UITableView
*
)
tableView
didSelectRowAtIndexPath
:
(
NSIndexPath
*
)
indexPath
{
{
[
self
getGoodsListDatas
];
}
}
-
(
void
)
DismissScreenView
:
(
UITapGestureRecognizer
*
)
sender
{
-
(
void
)
DismissScreenView
:
(
UITapGestureRecognizer
*
)
sender
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment