Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
A
ALand
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
张杰
ALand
Commits
cc1a1c40
Commit
cc1a1c40
authored
Apr 14, 2016
by
Sandy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
query都加上了域 domain
parent
6b482276
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
329 additions
and
89 deletions
+329
-89
project.pbxproj
ALand.xcodeproj/project.pbxproj
+6
-0
CommodityListCollectionViewCell.m
...ass/Home/View/Commodity/CommodityListCollectionViewCell.m
+1
-1
CommodityManagementTopView.h
ALand/CodeClass/Home/View/CommodityManagementTopView.h
+1
-1
CommodityManagementTopView.m
ALand/CodeClass/Home/View/CommodityManagementTopView.m
+1
-0
CommodityListViewController.m
...me/ViewController/Commodity/CommodityListViewController.m
+31
-21
CommoditySearchViewController.m
.../ViewController/Commodity/CommoditySearchViewController.m
+16
-17
CommodityManagementViewController.m
...s/Home/ViewController/CommodityManagementViewController.m
+176
-21
ManagementSearchViewController.h
...lass/Home/ViewController/ManagementSearchViewController.h
+13
-0
ManagementSearchViewController.m
...lass/Home/ViewController/ManagementSearchViewController.m
+54
-0
ManagementViewController.h
.../CodeClass/Home/ViewController/ManagementViewController.h
+2
-1
ManagementViewController.m
.../CodeClass/Home/ViewController/ManagementViewController.m
+2
-2
LoginViewController.m
ALand/CodeClass/Login/LoginViewController.m
+23
-23
HTTPCilent.m
ALand/Global/HTTPCilent.m
+1
-0
Defintion.h
ALand/Global/RequestModels/Defintion.h
+2
-2
No files found.
ALand.xcodeproj/project.pbxproj
View file @
cc1a1c40
...
...
@@ -92,6 +92,7 @@
1979754A1CAA4DB900407E3F
/* CommodityMutipleSelectBottomView.xib in Resources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
197975491CAA4DB900407E3F
/* CommodityMutipleSelectBottomView.xib */
;
};
1979754D1CAB6E1300407E3F
/* JavenMultipleViewWithHeader.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
1979754C1CAB6E1300407E3F
/* JavenMultipleViewWithHeader.m */
;
};
197975511CAB6F5D00407E3F
/* OrderViewController.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
197975501CAB6F5D00407E3F
/* OrderViewController.m */
;
};
1983EF451CBE2726004510B3
/* ManagementSearchViewController.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
1983EF441CBE2726004510B3
/* ManagementSearchViewController.m */
;
};
199B4D681CABBCF600451E0E
/* OrderDetailViewController.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
199B4D671CABBCF600451E0E
/* OrderDetailViewController.m */
;
};
199B4D6A1CABBEF400451E0E
/* OrderDetailTopView.xib in Resources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
199B4D691CABBEF400451E0E
/* OrderDetailTopView.xib */
;
};
199B4D6D1CABBF0800451E0E
/* OrderDetailTopView.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
199B4D6C1CABBF0800451E0E
/* OrderDetailTopView.m */
;
};
...
...
@@ -382,6 +383,8 @@
1979754C1CAB6E1300407E3F
/* JavenMultipleViewWithHeader.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
JavenMultipleViewWithHeader.m
;
sourceTree
=
"<group>"
;
};
1979754F1CAB6F5D00407E3F
/* OrderViewController.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
OrderViewController.h
;
sourceTree
=
"<group>"
;
};
197975501CAB6F5D00407E3F
/* OrderViewController.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
OrderViewController.m
;
sourceTree
=
"<group>"
;
};
1983EF431CBE2726004510B3
/* ManagementSearchViewController.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
ManagementSearchViewController.h
;
sourceTree
=
"<group>"
;
};
1983EF441CBE2726004510B3
/* ManagementSearchViewController.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
ManagementSearchViewController.m
;
sourceTree
=
"<group>"
;
};
199B4D661CABBCF600451E0E
/* OrderDetailViewController.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
OrderDetailViewController.h
;
sourceTree
=
"<group>"
;
};
199B4D671CABBCF600451E0E
/* OrderDetailViewController.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
OrderDetailViewController.m
;
sourceTree
=
"<group>"
;
};
199B4D691CABBEF400451E0E
/* OrderDetailTopView.xib */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
file.xib
;
path
=
OrderDetailTopView.xib
;
sourceTree
=
"<group>"
;
};
...
...
@@ -911,6 +914,8 @@
1979752D1CA90D6C00407E3F
/* CommodityManagementViewController.m */
,
197975431CAA2FAB00407E3F
/* ManagementViewController.h */
,
197975441CAA2FAB00407E3F
/* ManagementViewController.m */
,
1983EF431CBE2726004510B3
/* ManagementSearchViewController.h */
,
1983EF441CBE2726004510B3
/* ManagementSearchViewController.m */
,
);
name
=
CommodityManagement
;
sourceTree
=
"<group>"
;
...
...
@@ -1905,6 +1910,7 @@
1946DC9A1CB7542D00AC6557
/* CatgoryModel.m in Sources */
,
197975511CAB6F5D00407E3F
/* OrderViewController.m in Sources */
,
19DCCBDF1C9AA0450072C3BF
/* ICRPlaceholderTextView.m in Sources */
,
1983EF451CBE2726004510B3
/* ManagementSearchViewController.m in Sources */
,
1900A33C1CB602D500B2B7C4
/* StoreNameViewController.m in Sources */
,
19DCCBCD1C9AA0450072C3BF
/* UIFont+Custom.m in Sources */
,
19DCCBE41C9AA0450072C3BF
/* ICRFunctionEntity.m in Sources */
,
...
...
ALand/CodeClass/Home/View/Commodity/CommodityListCollectionViewCell.m
View file @
cc1a1c40
...
...
@@ -51,7 +51,7 @@
[[
HTTPCilent
shareCilent
]
POST
:
@"shop/addGoods"
parameters
:
param
success
:^
(
NSURLSessionDataTask
*
task
,
id
responseObject
)
{
if
([
responseObject
[
@"code"
]
isEqualToNumber
:
@0
])
{
[
weakSelf
addSUccess
];
weakSelf
.
successBlock
();
}
}
failure
:^
(
NSURLSessionDataTask
*
task
,
NSError
*
error
)
{
...
...
ALand/CodeClass/Home/View/CommodityManagementTopView.h
View file @
cc1a1c40
...
...
@@ -9,5 +9,5 @@
#import <UIKit/UIKit.h>
@interface
CommodityManagementTopView
:
UIView
@property
(
nonatomic
,
strong
)
NSMutableArray
*
arrDatas
;
@end
ALand/CodeClass/Home/View/CommodityManagementTopView.m
View file @
cc1a1c40
...
...
@@ -29,6 +29,7 @@
ManagementViewController
*
manageVC
=
[[
ManagementViewController
alloc
]
init
];
[
self
hideSortView
];
manageVC
.
isShowNavigationBar
=
YES
;
manageVC
.
arrCellData
=
[
self
.
arrDatas
mutableCopy
];
[[
self
viewController
]
PushViewController
:
manageVC
animated
:
YES
];
CLog
(
@"m"
);
...
...
ALand/CodeClass/Home/ViewController/Commodity/CommodityListViewController.m
View file @
cc1a1c40
...
...
@@ -37,6 +37,9 @@
//配置navigationbar
self
.
navigationItem
.
title
=
@"商品列表"
;
self
.
view
.
backgroundColor
=
kBacroundColor
;
self
.
field
=
@""
;
self
.
direction
=
@"desc"
;
[
self
setUpSortView
];
[
self
setUpCollectionView
];
[
self
setUpData
];
...
...
@@ -53,38 +56,43 @@
-
(
void
)
setUpData
{
//前期发送请求生成参数的方式,后来不这么做了
NSString
*
jsonString
=
@"{
\"
defintion
\"
:{
\"
conditions
\"
:[{
\"
operation
\"
:
\"
string
\"
,
\"
parameter
\"
:{},
\"
parameters
\"
:[{}]}],
\"
orders
\"
:[{
\"
field
\"
:
\"
string
\"
,
\"
direction
\"
:
\"
asc
\"
}],
\"
pageSize
\"
:0,
\"
page
\"
:0,
\"
probePages
\"
:0},
\"
fetchParts
\"
:[
\"
string
\"
]}"
;
NSDictionary
*
dic
=
[
jsonString
mj_JSONObject
];
CommotityRequestModel
*
requstBody
=
[
CommotityRequestModel
modelObjectWithDictionary
:
dic
];
requstBody
.
defintion
.
pageSize
=
kPageSize
;
requstBody
.
defintion
.
page
=
@0
;
requstBody
.
defintion
.
probePages
=
@0
;
requstBody
.
defintion
.
orders
[
0
].
field
=
self
.
field
;
requstBody
.
defintion
.
orders
[
0
].
direction
=
self
.
direction
;
NSString
*
parameters
;
NSString
*
operation
;
if
([
self
.
model
isKindOfClass
:[
HotBrandModel
class
]])
{
//热门品牌
//设置请求模型
HotBrandModel
*
model
=
self
.
model
;
requstBody
.
defintion
.
conditions
[
0
].
operation
=
@"goodsData brand uuid equals"
;
requstBody
.
defintion
.
conditions
[
0
].
parameters
=
@[
model
.
uuid
]
;
operation
=
@"goodsData brand uuid equals"
;
parameters
=
model
.
uuid
;
}
else
if
([
self
.
model
isKindOfClass
:[
CatgoryModel
class
]]){
//分类
CatgoryModel
*
model
=
self
.
model
;
requstBody
.
defintion
.
conditions
[
0
].
operation
=
@"goodsData category uuid equals"
;
requstBody
.
defintion
.
conditions
[
0
].
parameters
=
@[
model
.
uuid
]
;
operation
=
@"goodsData category uuid equals"
;
parameters
=
model
.
uuid
;
}
else
if
([
self
.
model
isKindOfClass
:[
JavenHotTagsModel
class
]]){
//热门标签
CatgoryModel
*
model
=
self
.
model
;
requstBody
.
defintion
.
conditions
[
0
].
operation
=
@"goodsData category uuid equals"
;
requstBody
.
defintion
.
conditions
[
0
].
parameters
=
@[
model
.
uuid
]
;
operation
=
@"goodsData category uuid equals"
;
parameters
=
model
.
uuid
;
}
//请求模型转化为字典
NSDictionary
*
params
=
requstBody
.
mj_keyValues
;
NSDictionary
*
myDictionary
=
@{
@"defintion"
:
@{
@"conditions"
:
@[@{
@"operation"
:
@"domain equals"
,
@"parameter"
:
@{
@"operation"
:
@"string"
},
@"parameters"
:
@[[
UserInfo
shareInstance
].
domain
]},
@{
@"operation"
:
operation
,
@"parameter"
:
@{
@"operation"
:
@"string"
},
@"parameters"
:
@[
parameters
]}],
@"orders"
:
@[@{
@"field"
:
self
.
field
,
@"direction"
:
self
.
direction
}],
@"pageSize"
:
kPageSize
,
@"page"
:
@0
,
@"probePages"
:
@0
},
@"fetchParts"
:
@[
@"string"
]};
NSString
*
string
=
[
myDictionary
mj_JSONString
];
WS
(
weakSelf
)
[[
HTTPCilent
shareCilent
]
POST
:
@"goods/query2"
parameters
:
params
success
:^
(
NSURLSessionDataTask
*
task
,
id
responseObject
)
{
[[
HTTPCilent
shareCilent
]
POST
:
@"goods/query2"
parameters
:
myDictionary
success
:^
(
NSURLSessionDataTask
*
task
,
id
responseObject
)
{
for
(
NSDictionary
*
dic
in
responseObject
[
@"queryResult"
])
{
CommotityListModel
*
model
=
[
CommotityListModel
modelObjectWithDictionary
:
dic
];
...
...
@@ -133,8 +141,8 @@
switch
(
row
)
{
case
0
:
{
self
.
field
=
nil
;
self
.
direction
=
nil
;
self
.
field
=
@""
;
self
.
direction
=
@"desc"
;
}
break
;
case
1
:
//价格 高-低
...
...
@@ -221,7 +229,9 @@
-
(
UICollectionViewCell
*
)
collectionView
:
(
UICollectionView
*
)
collectionView
cellForItemAtIndexPath
:
(
NSIndexPath
*
)
indexPath
{
CommodityListCollectionViewCell
*
cell
=
[
collectionView
dequeueReusableCellWithReuseIdentifier
:
kCellID
forIndexPath
:
indexPath
];
cell
.
successBlock
=
^
{
};
[
cell
cellWithModel
:
self
.
arrItemDatas
[
indexPath
.
row
]];
return
cell
;
}
...
...
ALand/CodeClass/Home/ViewController/Commodity/CommoditySearchViewController.m
View file @
cc1a1c40
...
...
@@ -33,7 +33,8 @@
-
(
void
)
viewDidLoad
{
[
super
viewDidLoad
];
self
.
direction
=
@"desc"
;
self
.
field
=
@""
;
[
self
setUpSearchBar
];
[
self
setUpSortView
];
[
self
setUpCollectionView
];
...
...
@@ -73,24 +74,22 @@
-
(
void
)
setUpData
{
//前期发送请求生成参数的方式,后来不这么做了
NSString
*
jsonString
=
@"{
\"
defintion
\"
:{
\"
conditions
\"
:[{
\"
operation
\"
:
\"
string
\"
,
\"
parameter
\"
:{},
\"
parameters
\"
:[{}]}],
\"
orders
\"
:[{
\"
field
\"
:
\"
string
\"
,
\"
direction
\"
:
\"
asc
\"
}],
\"
pageSize
\"
:0,
\"
page
\"
:0,
\"
probePages
\"
:0},
\"
fetchParts
\"
:[
\"
string
\"
]}"
;
NSDictionary
*
dic
=
[
jsonString
mj_JSONObject
];
CommotityRequestModel
*
requstBody
=
[
CommotityRequestModel
modelObjectWithDictionary
:
dic
];
requstBody
.
defintion
.
conditions
[
0
].
operation
=
@"goodsData name like"
;
requstBody
.
defintion
.
conditions
[
0
].
parameters
=
@[
self
.
searchText
];
requstBody
.
defintion
.
pageSize
=
kPageSize
;
requstBody
.
defintion
.
page
=
@0
;
requstBody
.
defintion
.
probePages
=
@0
;
requstBody
.
defintion
.
orders
[
0
].
field
=
self
.
field
;
requstBody
.
defintion
.
orders
[
0
].
direction
=
self
.
direction
;
NSDictionary
*
myDictionary
=
@{
@"defintion"
:
@{
@"conditions"
:
@[@{
@"operation"
:
@"goodsData name like"
,
@"parameters"
:
@[
self
.
searchText
]},
@{
@"operation"
:
@"domain equals"
,
@"parameters"
:
@[[
UserInfo
shareInstance
].
domain
]},
],
@"orders"
:
@[@{
@"direction"
:
self
.
direction
,
@"field"
:
self
.
field
}],
@"page"
:
@0
,
@"pageSize"
:
@999
,
@"probePages"
:
@0
},
@"fetchParts"
:
[
NSNull
null
]}
;
//请求模型转化为字典
NSDictionary
*
params
=
requstBody
.
mj_keyValues
;
WS
(
weakSelf
)
[[
HTTPCilent
shareCilent
]
POST
:
@"goods/query2"
parameters
:
params
success
:^
(
NSURLSessionDataTask
*
task
,
id
responseObject
)
{
[[
HTTPCilent
shareCilent
]
POST
:
@"goods/query2"
parameters
:
myDictionary
success
:^
(
NSURLSessionDataTask
*
task
,
id
responseObject
)
{
for
(
NSDictionary
*
dic
in
responseObject
[
@"queryResult"
])
{
CommotityListModel
*
model
=
[
CommotityListModel
modelObjectWithDictionary
:
dic
];
...
...
@@ -231,7 +230,7 @@
CLog
(
@"点击搜索"
);
[
self
.
navigationController
.
navigationBar
endEditing
:
YES
];
[
self
setUp
Data
];
[
self
resetReload
Data
];
}
-
(
void
)
searchBar
:
(
UISearchBar
*
)
searchBar
textDidChange
:
(
NSString
*
)
searchText
{
...
...
ALand/CodeClass/Home/ViewController/CommodityManagementViewController.m
View file @
cc1a1c40
...
...
@@ -12,10 +12,12 @@
#import "CommodityTableViewCell.h"
#import "CommotityRequestModel.h"
#import "CommodityListModel/CommotityListModel.h"
#import "ManagementViewController.h"
#import "Conditions.h"
#define kCellID @"commodityCell"
#define kPageSize @
10
#define kPageSize @
999
#define kCellId @"CommodityTableViewCell.h"
@interface
CommodityManagementViewController
()
<
UITableViewDelegate
,
UITableViewDataSource
>
@interface
CommodityManagementViewController
()
<
UITableViewDelegate
,
UITableViewDataSource
,
UISearchBarDelegate
>
@property
(
nonatomic
,
strong
)
CommodityManagementTopView
*
topView
;
@property
(
nonatomic
,
strong
)
UITableView
*
tableView
;
@property
(
nonatomic
,
strong
)
NSMutableArray
*
arrItemDatas
;
...
...
@@ -23,25 +25,78 @@
@property
(
nonatomic
,
copy
)
NSString
*
field
;
//排序的字段
@property
(
nonatomic
,
copy
)
NSString
*
direction
;
//排序的顺序 升序或降序
@property
(
nonatomic
,
copy
)
NSString
*
searchText
;
//正在搜索的字段
@property
(
nonatomic
,
copy
)
NSString
*
condition
;
@property
(
nonatomic
,
strong
)
UISearchBar
*
searchBar
;
@property
(
nonatomic
,
strong
)
UIBarButtonItem
*
rightItem
;
@property
(
nonatomic
,
strong
)
UIView
*
titleView
;
@property
(
nonatomic
,
strong
)
UIView
*
searchTitleView
;
@end
@implementation
CommodityManagementViewController
-
(
void
)
viewDidLoad
{
[
super
viewDidLoad
];
self
.
navigationItem
.
title
=
@"商品管理"
;
self
.
condition
=
@"shop online only"
;
self
.
searchText
=
@""
;
self
.
field
=
@""
;
self
.
direction
=
@"desc"
;
[
self
setUpNavigationbar
];
[
self
setUpViews
];
[
self
setUpData
];
[
self
setUpSearchBar
];
}
-
(
void
)
setUpSearchBar
{
UIView
*
titleView
=
[[
UIView
alloc
]
initWithFrame
:
CGRectMake
(
0
,
0
,
kWidth
-
100
,
35
)];
//allocate titleView
UIColor
*
color
=
self
.
navigationController
.
navigationBar
.
barTintColor
;
[
titleView
setBackgroundColor
:
color
];
self
.
searchBar
=
[[
UISearchBar
alloc
]
init
];
self
.
searchBar
.
backgroundColor
=
kRandomColor
;
self
.
searchBar
.
delegate
=
self
;
self
.
searchBar
.
frame
=
CGRectMake
(
0
,
0
,
0
,
35
);
self
.
searchBar
.
centerX
=
titleView
.
centerX
;
self
.
searchBar
.
backgroundImage
=
[
UIImage
imageWithColor
:
color
];
[
titleView
addSubview
:
self
.
searchBar
];
UIBarButtonItem
*
rightBtn
=
[[
UIBarButtonItem
alloc
]
initWithImage
:[
UIImage
imageNamed
:
@"searchIcon"
]
style
:
UIBarButtonItemStyleDone
target
:
self
action
:
@selector
(
searchAct
)];
rightBtn
.
tintColor
=
kTextColorDarkGray
;
self
.
navigationItem
.
rightBarButtonItem
=
rightBtn
;
self
.
searchTitleView
=
titleView
;
}
-
(
void
)
cancelSearchAction
{
self
.
searchText
=
@""
;
self
.
condition
=
@"shop online only"
;
self
.
searchBar
.
width
=
0
;
self
.
searchBar
.
centerX
=
(
kWidth
-
100
)
/
2
;
self
.
navigationItem
.
titleView
=
self
.
titleView
;
self
.
navigationItem
.
rightBarButtonItem
=
self
.
rightItem
;
}
-
(
void
)
setUpNavigationbar
{
self
.
navigationItem
.
title
=
@"商品管理"
;
self
.
titleView
=
self
.
navigationItem
.
titleView
;
self
.
rightItem
=
[[
UIBarButtonItem
alloc
]
initWithImage
:[
UIImage
imageNamed
:
@"searchIcon"
]
style
:
UIBarButtonItemStyleDone
target
:
self
action
:
@selector
(
searchAct
)];
self
.
rightItem
.
tintColor
=
kTextColorDarkGray
;
self
.
navigationItem
.
rightBarButtonItem
=
self
.
rightItem
;
}
-
(
void
)
setUpViews
{
[
self
.
view
addSubview
:
self
.
topView
];
[
self
.
view
addSubview
:
self
.
sorView
];
WS
(
weakSelf
)
self
.
sorView
.
leftTableSelect
=
^
(
NSInteger
row
){
[
weakSelf
leftSelectCodtition
:
row
];
CLog
(
@"l"
);
};
self
.
sorView
.
rightTableSelect
=
^
(
NSInteger
row
){
[
weakSelf
rightSelectCondition
:
row
];
CLog
(
@"r"
);
};
...
...
@@ -49,10 +104,74 @@
_tableView
=
[
UITableView
plainTableViewWithTarget
:
self
cellNibName
:
@"CommodityTableViewCell"
cellId
:
kCellId
];
[
self
.
view
addSubview
:
_tableView
];
_tableView
.
sd_layout
.
topSpaceToView
(
self
.
sorView
,
0
).
leftEqualToView
(
self
.
view
).
rightEqualToView
(
self
.
view
).
bottomEqualToView
(
self
.
view
);
}
-
(
void
)
leftSelectCodtition
:
(
NSInteger
)
row
{
switch
(
row
)
{
case
0
:
{
self
.
condition
=
@"shop online only"
;
}
break
;
case
1
:
{
self
.
condition
=
@"shop offline only"
;
}
break
;
default
:
break
;
}
[
self
resetReloadData
];
}
//改变排序条件之后重新请求数据
-
(
void
)
resetReloadData
{
[
self
.
arrItemDatas
removeAllObjects
];
[
self
setUpData
];
}
-
(
void
)
rightSelectCondition
:
(
NSInteger
)
row
{
switch
(
row
)
{
case
0
:
{
self
.
field
=
@"shop goods create time"
;
self
.
direction
=
@"desc"
;
}
break
;
case
1
:
{
self
.
field
=
@"salesvolume"
;
self
.
direction
=
@"desc"
;
}
break
;
case
2
:
{
self
.
field
=
@"brokerageRate"
;
self
.
direction
=
@"desc"
;
}
break
;
case
3
:
{
self
.
field
=
@" spec price"
;
self
.
direction
=
@"desc"
;
}
break
;
default
:
break
;
}
[
self
resetReloadData
];
}
-
(
NSMutableArray
*
)
arrItemDatas
{
if
(
!
_arrItemDatas
)
{
_arrItemDatas
=
[
NSMutableArray
array
];
...
...
@@ -62,21 +181,21 @@
-
(
void
)
setUpData
{
//前期发送请求生成参数的方式,后来不这么做了
NSString
*
jsonString
=
@"{
\"
defintion
\"
:{
\"
conditions
\"
:[{
\"
operation
\"
:
\"
string
\"
,
\"
parameter
\"
:{},
\"
parameters
\"
:[{}]}],
\"
orders
\"
:[{
\"
field
\"
:
\"
string
\"
,
\"
direction
\"
:
\"
asc
\"
}],
\"
pageSize
\"
:0,
\"
page
\"
:0,
\"
probePages
\"
:0},
\"
fetchParts
\"
:[
\"
string
\"
]}"
;
NSDictionary
*
dic
=
[
jsonString
mj_JSONObject
];
CommotityRequestModel
*
requstBody
=
[
CommotityRequestModel
modelObjectWithDictionary
:
dic
];
requstBody
.
defintion
.
conditions
[
0
].
operation
=
@"shop uuid equals"
;
requstBody
.
defintion
.
conditions
[
0
].
parameters
=
@[[
UserInfo
shareInstance
].
shop
.
uuid
];
requstBody
.
defintion
.
pageSize
=
kPageSize
;
requstBody
.
defintion
.
page
=
@0
;
requstBody
.
defintion
.
probePages
=
@0
;
requstBody
.
defintion
.
orders
[
0
].
field
=
self
.
field
;
requstBody
.
defintion
.
orders
[
0
].
direction
=
self
.
direction
;
//请求模型转化为字典
NSDictionary
*
params
=
requstBody
.
mj_keyValues
;
NSDictionary
*
params
=
@{
@"defintion"
:
@{
@"probePages"
:
@0
,
@"orders"
:
@[@{
@"field"
:
self
.
field
,
@"direction"
:
self
.
direction
}],
@"conditions"
:
@[@{
@"parameters"
:
@[[
UserInfo
shareInstance
].
domain
],
@"operation"
:
@"domain equals"
,
@"parameter"
:
@{
@"operation"
:
@"string"
}},
@{
@"parameters"
:
@[@[[
UserInfo
shareInstance
].
shop
.
uuid
]],
@"operation"
:
@"shop uuid equals"
,
@"parameter"
:
@{
@"operation"
:
@"sring"
}},
@{
@"parameters"
:
@[
self
.
searchText
],
@"operation"
:
self
.
condition
,
@"parameter"
:
@{
@"operation"
:
@"sring"
}}],
@"pageSize"
:
kPageSize
,
@"page"
:
@0
},
@"fetchParts"
:
@[
@"string"
]}
;
WS
(
weakSelf
)
[[
HTTPCilent
shareCilent
]
POST
:
@"goods/query2"
parameters
:
params
success
:^
(
NSURLSessionDataTask
*
task
,
id
responseObject
)
{
...
...
@@ -98,13 +217,28 @@
-
(
void
)
searchAct
{
[
self
.
sorView
hide
];
CLog
(
@"search"
);
WS
(
weakSelf
)
self
.
navigationItem
.
titleView
=
self
.
searchTitleView
;
[
UIView
animateWithDuration
:
0
.
3
animations
:
^
{
weakSelf
.
searchBar
.
width
=
kWidth
-
100
;
weakSelf
.
searchBar
.
centerX
=
(
kWidth
-
100
)
/
2
;
}
completion
:^
(
BOOL
finished
)
{
[
weakSelf
.
searchBar
becomeFirstResponder
];
}]
;
UIBarButtonItem
*
cancelSearch
=
[[
UIBarButtonItem
alloc
]
initWithTitle
:
@"取消"
style
:
UIBarButtonItemStyleDone
target
:
self
action
:
@selector
(
cancelSearchAction
)];
self
.
navigationItem
.
rightBarButtonItem
=
cancelSearch
;
}
-
(
void
)
viewWillDisappear
:
(
BOOL
)
animated
{
[
self
.
navigationController
.
navigationBar
endEditing
:
YES
];
[
super
viewWillDisappear
:
animated
];
[
self
.
sorView
hide
];
}
#pragma mark =========== tableview delegate ===========
-
(
NSInteger
)
tableView
:
(
UITableView
*
)
tableView
numberOfRowsInSection
:
(
NSInteger
)
section
{
...
...
@@ -122,11 +256,31 @@
return
130
;
}
-
(
void
)
tableView
:
(
UITableView
*
)
tableView
didSelectRowAtIndexPath
:
(
NSIndexPath
*
)
indexPath
{
}
#pragma mark =========== searchBar Delegate ===========
-
(
void
)
searchBarSearchButtonClicked
:
(
UISearchBar
*
)
searchBar
{
CLog
(
@"点击搜索"
);
self
.
condition
=
@"goodsData name like"
;
[
self
.
navigationController
.
navigationBar
endEditing
:
YES
];
[
self
resetReloadData
];
}
-
(
void
)
searchBar
:
(
UISearchBar
*
)
searchBar
textDidChange
:
(
NSString
*
)
searchText
{
self
.
searchText
=
searchText
;
}
#pragma mark =========== lazy loading ===========
-
(
CommodityManagementSortView
*
)
sorView
{
if
(
!
_sorView
)
{
_sorView
=
[[
CommodityManagementSortView
new
]
sortView
];
_sorView
.
frame
=
CGRectMake
(
0
,
_topView
.
bottom
-
50
,
kWidth
,
49
);
}
return
_sorView
;
}
...
...
@@ -135,6 +289,7 @@
if
(
!
_topView
)
{
_topView
=
[
CommodityManagementTopView
viewWithNibName
:
@"CommodityManagementTopView"
];
_topView
.
frame
=
CGRectMake
(
0
,
0
,
kWidth
,
64
+
64
);
_topView
.
arrDatas
=
self
.
arrItemDatas
;
}
return
_topView
;
}
...
...
ALand/CodeClass/Home/ViewController/ManagementSearchViewController.h
0 → 100644
View file @
cc1a1c40
//
// ManagementSearchViewController.h
// ALand
//
// Created by Z on 16/4/13.
// Copyright © 2016年 Z. All rights reserved.
//
#import "IBTUIViewController.h"
@interface
ManagementSearchViewController
:
IBTUIViewController
@end
ALand/CodeClass/Home/ViewController/ManagementSearchViewController.m
0 → 100644
View file @
cc1a1c40
//
// ManagementSearchViewController.m
// ALand
//
// Created by Z on 16/4/13.
// Copyright © 2016年 Z. All rights reserved.
//
#import "ManagementSearchViewController.h"
@interface
ManagementSearchViewController
()
<
UISearchBarDelegate
,
UITableViewDelegate
,
UITableViewDataSource
>
@end
@implementation
ManagementSearchViewController
-
(
void
)
viewDidLoad
{
[
super
viewDidLoad
];
[
self
setUpSearchBar
];
// Do any additional setup after loading the view.
}
-
(
void
)
setUpSearchBar
{
UIView
*
titleView
=
[[
UIView
alloc
]
initWithFrame
:
CGRectMake
(
0
,
0
,
280
,
35
)];
//allocate titleView
UIColor
*
color
=
self
.
navigationController
.
navigationBar
.
barTintColor
;
[
titleView
setBackgroundColor
:
color
];
UISearchBar
*
searchBar
=
[[
UISearchBar
alloc
]
init
];
searchBar
.
delegate
=
self
;
searchBar
.
frame
=
CGRectMake
(
0
,
0
,
260
,
35
);
searchBar
.
centerX
=
titleView
.
centerX
;
searchBar
.
backgroundImage
=
[
UIImage
imageWithColor
:
color
];
[
searchBar
setAutocapitalizationType
:
UITextAutocapitalizationTypeNone
];
[
titleView
addSubview
:
searchBar
];
self
.
navigationItem
.
titleView
=
titleView
;
[
searchBar
becomeFirstResponder
];
}
-
(
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
ALand/CodeClass/Home/ViewController/ManagementViewController.h
View file @
cc1a1c40
...
...
@@ -8,7 +8,8 @@
#import "IBTUIViewController.h"
#import "CommodityManagementSortView.h"
#import "CommodityManagementViewController.h"
@interface
ManagementViewController
:
IBTUIViewController
@property
(
nonatomic
,
strong
)
CommodityManagementSortView
*
sorView
;
@property
(
nonatomic
,
strong
)
NSMutableArray
*
arrCellData
;
@end
ALand/CodeClass/Home/ViewController/ManagementViewController.m
View file @
cc1a1c40
...
...
@@ -87,12 +87,12 @@
}
-
(
NSInteger
)
tableView
:
(
UITableView
*
)
tableView
numberOfRowsInSection
:
(
NSInteger
)
section
{
return
10
;
return
self
.
arrCellData
.
count
;
}
-
(
UITableViewCell
*
)
tableView
:
(
UITableView
*
)
tableView
cellForRowAtIndexPath
:
(
NSIndexPath
*
)
indexPath
{
CommodityTableViewCell
*
cell
=
[
tableView
dequeueReusableCellWithIdentifier
:
kCellId
forIndexPath
:
indexPath
];
[
cell
cellWithModel
:
self
.
arrCellData
[
indexPath
.
row
]];
return
cell
;
}
...
...
ALand/CodeClass/Login/LoginViewController.m
View file @
cc1a1c40
...
...
@@ -43,29 +43,29 @@
//本地已有密码时登录
-
(
void
)
defaultLoginAction
{
if
([[
NSUserDefaults
standardUserDefaults
]
objectForKey
:
@"userName"
])
{
NSDictionary
*
paramers
=
@{
@"domain"
:
kDomain
,
@"loginName"
:
[[
NSUserDefaults
standardUserDefaults
]
objectForKey
:
@"userName"
]
,
@"password"
:
[[
NSUserDefaults
standardUserDefaults
]
objectForKey
:
@"passWord"
],
@"rememberMe"
:
@"true"
};
[
MBProgressHUD
showHUDAddedTo
:
self
.
view
animated
:
YES
];
WS
(
weakSelf
)
[[
HTTPCilent
shareCilent
]
POST
:
@"app/resellerLogin"
parameters
:
paramers
success
:^
(
NSURLSessionDataTask
*
task
,
id
responseObject
)
{
UserInfo
*
info
=
[
UserInfo
shareInstance
];
[
info
UserInfoWithDictionary
:
responseObject
[
@"reseller"
]];
[
MBProgressHUD
hideHUDForView
:
self
.
view
animated
:
YES
];
BaseViewController
*
baseVC
=
[[
BaseViewController
alloc
]
init
];
baseVC
.
modalTransitionStyle
=
UIModalTransitionStyleCrossDissolve
;
[
weakSelf
presentViewController
:
baseVC
animated
:
YES
completion
:
nil
];
}
failure
:^
(
NSURLSessionDataTask
*
task
,
NSError
*
error
)
{
}];
}
//
if ([[NSUserDefaults standardUserDefaults] objectForKey:@"userName"]) {
//
//
NSDictionary *paramers = @{@"domain":kDomain,
//
@"loginName":[[NSUserDefaults standardUserDefaults] objectForKey:@"userName"] ,
//
@"password":[[NSUserDefaults standardUserDefaults] objectForKey:@"passWord"],
//
@"rememberMe":@"true"};
//
[MBProgressHUD showHUDAddedTo:self.view animated:YES];
//
WS(weakSelf)
//
[[HTTPCilent shareCilent] POST:@"app/resellerLogin" parameters:paramers success:^(NSURLSessionDataTask *task, id responseObject) {
//
UserInfo *info = [UserInfo shareInstance];
//
[info UserInfoWithDictionary:responseObject[@"reseller"]];
//
//
//
[MBProgressHUD hideHUDForView:self.view animated:YES];
//
BaseViewController *baseVC = [[BaseViewController alloc] init];
//
baseVC.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
//
[weakSelf presentViewController:baseVC animated:YES completion:nil];
//
} failure:^(NSURLSessionDataTask *task, NSError *error) {
//
//
}];
//
//
//
}
}
...
...
ALand/Global/HTTPCilent.m
View file @
cc1a1c40
...
...
@@ -49,6 +49,7 @@
}
failure
:^
(
NSURLSessionDataTask
*
_Nullable
task
,
NSError
*
_Nonnull
error
)
{
CLog
(
@"POST请求失败!----->%@"
,
[
error
localizedDescription
]);
failure
(
task
,
error
);
}];
}
...
...
ALand/Global/RequestModels/Defintion.h
View file @
cc1a1c40
...
...
@@ -12,8 +12,8 @@
@interface
Defintion
:
NSObject
<
NSCoding
,
NSCopying
>
@property
(
nonatomic
,
strong
)
NSNumber
*
pageSize
;
@property
(
nonatomic
,
strong
)
NSArray
<
Orders
*>
*
orders
;
@property
(
nonatomic
,
strong
)
NSArray
<
Conditions
*>
*
conditions
;
@property
(
nonatomic
,
strong
)
NS
Mutable
Array
<
Orders
*>
*
orders
;
@property
(
nonatomic
,
strong
)
NS
Mutable
Array
<
Conditions
*>
*
conditions
;
@property
(
nonatomic
,
assign
)
NSNumber
*
probePages
;
@property
(
nonatomic
,
strong
)
NSNumber
*
page
;
...
...
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