Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
红
红星美凯龙管理在线APP 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
张杰
红星美凯龙管理在线APP IOS
Commits
94c9f6e5
Commit
94c9f6e5
authored
Dec 18, 2015
by
admin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复首页 搜索 排名列表崩溃的bug
parent
04e044ce
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
131 additions
and
76 deletions
+131
-76
UserInterfaceState.xcuserstate
...userdata/admin.xcuserdatad/UserInterfaceState.xcuserstate
+0
-0
Url.h
redstar/Classes/Macro/Url.h
+3
-0
SelectAreaTableCell.m
...le/Function/OnLine/SelectStore/Cell/SelectAreaTableCell.m
+1
-1
SelectProvinceTableCell.h
...unction/OnLine/SelectStore/Cell/SelectProvinceTableCell.h
+0
-1
SelectProvinceTableCell.m
...unction/OnLine/SelectStore/Cell/SelectProvinceTableCell.m
+0
-5
SelectStoreTableCell.m
...e/Function/OnLine/SelectStore/Cell/SelectStoreTableCell.m
+0
-5
SelectStoreViewController.m
...ne/SelectStore/ViewController/SelectStoreViewController.m
+52
-15
RankDetailViewController.m
...king/RankDetail/ViewController/RankDetailViewController.m
+2
-2
RankingListViewController.m
...ng/RankingList/ViewController/RankingListViewController.m
+9
-4
HomeViewController.m
...r/Classes/Module/Home/ViewController/HomeViewController.m
+20
-31
SearchViewController.m
...Classes/Module/Home/ViewController/SearchViewController.m
+31
-12
HttpClient.h
redstar/Classes/Tools/HttpClient/HttpClient.h
+3
-0
HttpClient.m
redstar/Classes/Tools/HttpClient/HttpClient.m
+10
-0
No files found.
redstar.xcworkspace/xcuserdata/admin.xcuserdatad/UserInterfaceState.xcuserstate
View file @
94c9f6e5
No preview for this file type
redstar/Classes/Macro/Url.h
View file @
94c9f6e5
...
...
@@ -112,4 +112,7 @@
// 获取口碑列表
#define kQueryShortPraiseURL @"redstar-server/rest/praise/query_short?userUuid="
// 获取下级组织
#define kQueryLowerOrgsURL @"redstar-server/rest/organization/queryLowerOrgs"
#endif
/* Url_h */
redstar/Classes/Module/Function/OnLine/SelectStore/Cell/SelectAreaTableCell.m
View file @
94c9f6e5
...
...
@@ -15,7 +15,7 @@
if
(
!
_checkBoxButton
)
{
_checkBoxButton
=
[[
CheckBoxButton
alloc
]
init
];
[
_checkBoxButton
setTitleColor
:
kLightBlack
forState
:
UIControlStateNormal
];
//
[_checkBoxButton setTitleColor:kSelectStoreColor forState:UIControlStateSelected];
[
_checkBoxButton
setTitleColor
:
kSelectStoreColor
forState
:
UIControlStateSelected
];
_checkBoxButton
.
titleLabel
.
font
=
[
UIFont
systemFontOfSize
:
17
.
0
];
_checkBoxButton
.
translatesAutoresizingMaskIntoConstraints
=
NO
;
[
_checkBoxButton
setImage
:[
UIImage
imageNamed
:
@"uncheck_box"
]
forState
:
UIControlStateNormal
];
...
...
redstar/Classes/Module/Function/OnLine/SelectStore/Cell/SelectProvinceTableCell.h
View file @
94c9f6e5
...
...
@@ -14,5 +14,4 @@
@property
(
nonatomic
,
strong
)
CheckBoxButton
*
checkBoxButton
;
@property
(
nonatomic
,
strong
)
UIImageView
*
iconImageView
;
@property
(
nonatomic
,
strong
)
ProvinceModel
*
provinceModel
;
@end
redstar/Classes/Module/Function/OnLine/SelectStore/Cell/SelectProvinceTableCell.m
View file @
94c9f6e5
...
...
@@ -24,7 +24,6 @@
_checkBoxButton
.
titleEdgeInsets
=
UIEdgeInsetsMake
(
0
,
5
,
0
,
0
);
_checkBoxButton
.
imageView
.
contentMode
=
UIViewContentModeRight
;
_checkBoxButton
.
titleLabel
.
contentMode
=
UIViewContentModeLeft
;
[
_checkBoxButton
addTarget
:
self
action
:
@selector
(
click
:
)
forControlEvents
:
UIControlEventTouchUpInside
];
[
self
.
contentView
addSubview
:
_checkBoxButton
];
// 顶端
...
...
@@ -45,10 +44,6 @@
}
return
_checkBoxButton
;
}
-
(
void
)
click
:
(
CheckBoxButton
*
)
sender
{
sender
.
selected
=
!
sender
.
selected
;
}
-
(
UIImageView
*
)
iconImageView
{
...
...
redstar/Classes/Module/Function/OnLine/SelectStore/Cell/SelectStoreTableCell.m
View file @
94c9f6e5
...
...
@@ -81,7 +81,6 @@
_checkBoxButton
.
titleEdgeInsets
=
UIEdgeInsetsMake
(
0
,
5
,
0
,
0
);
_checkBoxButton
.
imageView
.
contentMode
=
UIViewContentModeRight
;
_checkBoxButton
.
titleLabel
.
contentMode
=
UIViewContentModeLeft
;
[
_checkBoxButton
addTarget
:
self
action
:
@selector
(
click
:
)
forControlEvents
:
UIControlEventTouchUpInside
];
[
self
.
contentView
addSubview
:
_checkBoxButton
];
// 顶端
...
...
@@ -102,10 +101,6 @@
}
return
_checkBoxButton
;
}
-
(
void
)
click
:
(
CheckBoxButton
*
)
sender
{
sender
.
selected
=
!
sender
.
selected
;
}
-
(
void
)
setSelected
:
(
BOOL
)
selected
animated
:
(
BOOL
)
animated
{
...
...
redstar/Classes/Module/Function/OnLine/SelectStore/ViewController/SelectStoreViewController.m
View file @
94c9f6e5
...
...
@@ -24,6 +24,8 @@
#import "SelectStoreHeadView.h"
#import "CheckBoxButton.h"
#import "HttpClient.h"
@interface
SelectStoreViewController
()
<
RATreeViewDelegate
,
RATreeViewDataSource
>
@property
(
nonatomic
,
strong
)
RATreeView
*
treeView
;
@property
(
nonatomic
,
strong
)
NSMutableArray
*
allAreaData
;
...
...
@@ -64,6 +66,8 @@
[
self
.
treeView
registerClass
:[
UITableViewCell
class
]
forCellReuseIdentifier
:
NSStringFromClass
([
UITableViewCell
class
])];
self
.
treeView
.
autoresizingMask
=
UIViewAutoresizingFlexibleWidth
|
UIViewAutoresizingFlexibleHeight
;
[
self
.
treeView
reloadData
];
[
self
requestQueryLowerOrgs
];
}
-
(
void
)
doBack
:
(
id
)
sender
...
...
@@ -71,9 +75,18 @@
[
self
.
navigationController
popViewControllerAnimated
:
YES
];
}
-
(
void
)
didReceiveMemoryWarning
{
[
super
didReceiveMemoryWarning
];
// Dispose of any resources that can be recreated.
-
(
void
)
requestQueryLowerOrgs
{
NSString
*
url
=
[
NSString
stringWithFormat
:
@"%@%@"
,
kRedStarURL
,
kQueryLowerOrgsURL
];
HttpClient
*
httpClient
=
[[
HttpClient
alloc
]
initWithUrl
:
url
];
NSDictionary
*
parameters
=
@{
@"path"
:
@""
,
@"pageNumber"
:
@
(
0
),
@"pageSize"
:
@
(
10
)
};
[
httpClient
queryLowerOrgsWithParameters
:
parameters
completion
:
^
(
id
response
,
NSError
*
error
)
{
NSLog
(
@"查询下级组织 reponse = %@,error = %@"
,
response
,
error
);
}];
}
-
(
void
)
loadData
...
...
@@ -107,27 +120,51 @@
}
#pragma mark - TreeView Cell Click
-
(
void
)
areaClick
:
(
CheckBoxButton
*
)
sender
{
sender
.
selected
=
!
sender
.
selected
;
NSLog
(
@"ender.title= %@"
,
sender
.
titleLabel
.
text
);
SelectAreaTableCell
*
cell
=
(
SelectAreaTableCell
*
)
sender
.
superview
.
superview
;
NSArray
*
provinceArray
=
cell
.
areaModel
.
provinceArray
;
id
item
=
[
_treeView
itemForCell
:
cell
];
AreaModel
*
area
=
cell
.
areaModel
;
if
(
sender
.
selected
)
{
for
(
ProvinceModel
*
proVin
in
provinceArray
)
{
proVin
.
isChoose
=
YES
;
for
(
ProvinceModel
*
pro
in
area
.
provinceArray
)
{
pro
.
isChoose
=
YES
;
}
[
sender
setTitleColor
:
kLightBlack
forState
:
UIControlStateNormal
];
}
else
{
for
(
ProvinceModel
*
pro
Vin
in
provinceArray
)
{
pro
Vin
.
isChoose
=
NO
;
for
(
ProvinceModel
*
pro
in
area
.
provinceArray
)
{
pro
.
isChoose
=
NO
;
}
[
sender
setTitleColor
:
kSelectStoreColor
forState
:
UIControlStateNormal
];
}
[
_treeView
reloadRowsForItems
:@[
item
]
withRowAnimation
:
RATreeViewRowAnimationNone
];
// [_treeView expandRowForItem:item withRowAnimation:RATreeViewRowAnimationNone];
//[_treeView expandRowForItem:item expandChildren:YES withRowAnimation:RATreeViewRowAnimationFade];
}
-
(
void
)
provinceClick
:
(
CheckBoxButton
*
)
sender
{
sender
.
selected
=
!
sender
.
selected
;
SelectProvinceTableCell
*
cell
=
(
SelectProvinceTableCell
*
)
sender
.
superview
.
superview
;
ProvinceModel
*
province
=
cell
.
provinceModel
;
if
(
sender
.
selected
)
{
for
(
StoreModel
*
store
in
province
.
storeArray
)
{
store
.
isChoose
=
YES
;
}
}
else
{
for
(
StoreModel
*
store
in
province
.
storeArray
)
{
store
.
isChoose
=
NO
;
}
}
[
_treeView
reloadRows
];
//[_treeView reloadData
];
}
-
(
void
)
storeClick
:
(
CheckBoxButton
*
)
sender
{
sender
.
selected
=
!
sender
.
selected
;
}
#pragma mark - RAtreeView Delegate/DataSource
-
(
NSInteger
)
treeView
:
(
RATreeView
*
)
treeView
numberOfChildrenOfItem
:
(
id
)
item
...
...
@@ -171,8 +208,8 @@
SelectAreaTableCell
*
cell
=
[
self
.
treeView
dequeueReusableCellWithIdentifier
:
kSelectAreaTableCell
];
cell
.
areaModel
=
data
;
[
cell
.
checkBoxButton
setTitle
:
data
.
name
forState
:
UIControlStateNormal
];
[
cell
.
checkBoxButton
addTarget
:
self
action
:
@selector
(
areaClick
:
)
forControlEvents
:
UIControlEventTouchUpInside
];
cell
.
iconImageView
.
image
=
[
UIImage
imageNamed
:
@"arrow_down"
];
[
cell
.
checkBoxButton
addTarget
:
self
action
:
@selector
(
areaClick
:
)
forControlEvents
:
UIControlEventTouchUpInside
];
cell
.
selectionStyle
=
UITableViewCellSelectionStyleNone
;
return
cell
;
}
else
if
(
level
==
1
)
{
...
...
@@ -185,17 +222,17 @@
cell
.
checkBoxButton
.
selected
=
NO
;
}
[
cell
.
checkBoxButton
setTitle
:
data
.
name
forState
:
UIControlStateNormal
];
[
cell
.
checkBoxButton
addTarget
:
self
action
:
@selector
(
provinceClick
:
)
forControlEvents
:
UIControlEventTouchUpInside
];
cell
.
iconImageView
.
image
=
[
UIImage
imageNamed
:
@"grey-trilateral_down"
];
cell
.
selectionStyle
=
UITableViewCellSelectionStyleNone
;
return
cell
;
}
else
{
StoreModel
*
data
=
item
;
SelectStoreTableCell
*
cell
=
[
self
.
treeView
dequeueReusableCellWithIdentifier
:
kSelectStoreTableCell
];
cell
.
storeModel
=
data
;
[
cell
.
checkBoxButton
setTitle
:
data
.
name
forState
:
UIControlStateNormal
];
cell
.
selectionStyle
=
UITableViewCellSelectionStyleNone
;
[
cell
.
checkBoxButton
addTarget
:
self
action
:
@selector
(
storeClick
:
)
forControlEvents
:
UIControlEventTouchUpInside
];
return
cell
;
}
}
...
...
redstar/Classes/Module/Function/WordOfMouth/Ranking/RankDetail/ViewController/RankDetailViewController.m
View file @
94c9f6e5
...
...
@@ -498,10 +498,10 @@
if
(
!
_rankDetailHeaderView
)
{
_rankDetailHeaderView
=
[[
RankDetailHeaderView
alloc
]
initWithFrame
:
CGRectMake
(
0
,
0
,
kScreenWidth
,
298
)];
if
(
self
.
indexRow
<
3
)
{
NSString
*
imageName
=
[
NSString
stringWithFormat
:
@"medal_0%ld"
,
(
long
)(
_indexRow
+
1
)];
NSString
*
imageName
=
[
NSString
stringWithFormat
:
@"medal_0%ld"
,
(
long
)(
_indexRow
)];
_rankDetailHeaderView
.
rankDetailView
.
gradeImageView
.
image
=
[
UIImage
imageNamed
:
imageName
];
}
else
{
NSString
*
rankStr
=
[
NSString
stringWithFormat
:
@"第 %ld 名"
,
(
long
)(
_indexRow
+
1
)];
NSString
*
rankStr
=
[
NSString
stringWithFormat
:
@"第 %ld 名"
,
(
long
)(
_indexRow
)];
NSMutableAttributedString
*
rankAttr
=
[[
NSMutableAttributedString
alloc
]
initWithString
:
rankStr
];
[
rankAttr
addAttributes
:@{
NSForegroundColorAttributeName
:
kRankHeadTitleTextColor
,
NSFontAttributeName
:
[
UIFont
systemFontOfSize
:
14
.
0
f
]}
range
:
NSMakeRange
(
0
,
1
)];
[
rankAttr
addAttributes
:@{
NSForegroundColorAttributeName
:
kGradeNumberTextColor
}
range
:
NSMakeRange
(
1
,
rankStr
.
length
-
2
)];
...
...
redstar/Classes/Module/Function/WordOfMouth/Ranking/RankingList/ViewController/RankingListViewController.m
View file @
94c9f6e5
...
...
@@ -95,7 +95,6 @@
_pickRow
=
0
;
[
self
requestShortPraise
];
[
self
requestRankingList
];
self
.
shoppingLabel
.
text
=
@"商场名称"
;
self
.
scoreLabel
.
text
=
@"总分"
;
...
...
@@ -116,12 +115,12 @@
}
#pragma mark - Private Methods
-
(
void
)
requestRankingList
-
(
void
)
requestRankingList
WithPraiseUuid
:
(
NSString
*
)
praiseUuid
{
NSString
*
url
=
[
NSString
stringWithFormat
:
@"%@%@"
,
kRedStarURL
,
kRankingListURL
];
HttpClient
*
httpCilent
=
[[
HttpClient
alloc
]
initWithUrl
:
url
];
NSDictionary
*
parameters
=
@{
@"praiseUuid"
:
@"5a7417015147f8eb0151482b2359005b"
,
NSDictionary
*
parameters
=
@{
@"praiseUuid"
:
praiseUuid
,
@"statisMode"
:
@
(
0
),
};
[
MBProgressHUD
showHUDAddedTo
:
self
.
view
animated
:
YES
];
...
...
@@ -179,6 +178,13 @@
self
.
tableView
.
dataSource
=
self
;
[
self
.
tableView
reloadData
];
}
if
(
_titleArray
.
count
==
0
)
{
return
;
}
else
{
NSDictionary
*
paDict
=
_titleArray
[
0
];
[
self
requestRankingListWithPraiseUuid
:
paDict
[
@"uuid"
]];
}
}];
}
...
...
@@ -454,7 +460,6 @@
rankDetailVC
.
uuid
=
rankList
.
uuid
;
rankDetailVC
.
store_uuid
=
rankList
.
store_uuid
;
rankDetailVC
.
storeAddress
=
rankList
.
storeAddress
;
NSLog
(
@"storeAddress = %@"
,
rankList
.
storePictures
);
rankDetailVC
.
storePictures
=
rankList
.
storePictures
;
[
self
.
navigationController
pushViewController
:
rankDetailVC
animated
:
YES
];
}
...
...
redstar/Classes/Module/Home/ViewController/HomeViewController.m
View file @
94c9f6e5
...
...
@@ -130,6 +130,7 @@ typedef NSComparisonResult (^NSComparator)(id obj1, id obj2);
}
[[
NSUserDefaults
standardUserDefaults
]
setObject
:
_titleArray
forKey
:
@"function"
];
NSLog
(
@"-title = =%@"
,
_titleArray
);
// 初始化容器
// self.btnTitleArray = [NSArray arrayWithObjects:@"在线抽查", @"口碑巡检",@"口碑标准",@"图说口碑",@"问题知识",@"口碑排名",@"查看抽查", nil];
...
...
@@ -293,19 +294,16 @@ typedef NSComparisonResult (^NSComparator)(id obj1, id obj2);
NSString
*
url
=
[
NSString
stringWithFormat
:
@"%@%@"
,
kRedStarURL
,
kRankingListURL
];
HttpClient
*
httpCilent
=
[[
HttpClient
alloc
]
initWithUrl
:
url
];
NSDictionary
*
parameters
=
@{
@"queryOrders"
:
@[@{
@"direction"
:
@"asc"
}],
@"pageNumber"
:
@
(
0
),
@"pageSize"
:
@
(
3
)
NSDictionary
*
parameters
=
@{
@"praiseUuid"
:
@"5a7417015157efa6015158f52be8004e"
,
@"statisMode"
:
@
(
0
),
};
[
httpCilent
getRankingListWithParameters
:
parameters
completion
:
^
(
id
response
,
NSError
*
error
)
{
NSLog
(
@"口碑排名response = %@"
,
response
);
NSLog
(
@"error = %@"
,
error
);
if
([(
NSArray
*
)
response
[
@"data"
]
count
]
==
0
)
{
return
;
}
NSDictionary
*
dataDict
=
response
[
@"data"
];
NSArray
*
dataArray
=
dataDict
[
@"records"
];
NSArray
*
dataArray
=
response
[
@"data"
];
NSMutableArray
*
tgArray
=
[
NSMutableArray
array
];
...
...
@@ -314,6 +312,17 @@ typedef NSComparisonResult (^NSComparator)(id obj1, id obj2);
[
tgArray
addObject
:
rankList
];
}
_allRankListArray
=
(
NSMutableArray
*
)[
self
sortRankListWithRankListArray
:
tgArray
];
for
(
int
i
=
0
;
i
<
_allRankListArray
.
count
;
i
++
)
{
RankListModel
*
rank
=
_allRankListArray
[
i
];
if
(
i
==
0
)
{
rank
.
index
=
i
+
1
;
}
else
{
RankListModel
*
prevRank
=
_allRankListArray
[
i
-
1
];
rank
.
index
=
rank
.
score
==
prevRank
.
score
?
prevRank
.
index
:
i
+
1
;
}
}
[
self
.
tableView
reloadData
];
[
MBProgressHUD
hideHUDForView
:
self
.
view
animated
:
YES
];
...
...
@@ -550,27 +559,6 @@ typedef NSComparisonResult (^NSComparator)(id obj1, id obj2);
}
else
{
return
0
;
}
// if (_titleArray.count == 5) {
// if (section == 0) {
// return _taskListDataArray.count;
// } else {
// return _allQuestionArray.count;
// }
// } else {
//
// if (section == 0) {
// return _taskListDataArray.count;
//
// } else if (section == 1 ) {
// return _allRankListArray.count + 1;
//
// } else {
// return _allQuestionArray.count;
//
// }
// }
}
...
...
@@ -608,8 +596,9 @@ typedef NSComparisonResult (^NSComparator)(id obj1, id obj2);
if
(
!
cell
)
{
cell
=
[[
RankingListCell
alloc
]
initWithStyle
:
UITableViewCellStyleValue1
reuseIdentifier
:
kHomeRankingListCell
];
}
cell
.
rankList
=
_allRankListArray
[
indexPath
.
row
-
1
];
cell
.
gradeImageView
.
image
=
[
UIImage
imageNamed
:[
NSString
stringWithFormat
:
@"medal_0%d"
,
(
int
)
indexPath
.
row
]];
RankListModel
*
rankList
=
_allRankListArray
[
indexPath
.
row
-
1
];
cell
.
rankList
=
rankList
;
cell
.
gradeImageView
.
image
=
[
UIImage
imageNamed
:[
NSString
stringWithFormat
:
@"medal_0%d"
,
rankList
.
index
]];
cell
.
selectionStyle
=
UITableViewCellSelectionStyleNone
;
return
cell
;
}
...
...
@@ -650,7 +639,7 @@ typedef NSComparisonResult (^NSComparator)(id obj1, id obj2);
}
else
if
([
titleArray
[
indexPath
.
section
]
isEqualToString
:
@"口碑排名"
]
&&
indexPath
.
section
==
s2
)
{
RankListModel
*
rankList
=
_allRankListArray
[
indexPath
.
row
-
1
];
RankDetailViewController
*
rankDetailVC
=
[[
RankDetailViewController
alloc
]
init
];
rankDetailVC
.
indexRow
=
indexPath
.
row
-
1
;
rankDetailVC
.
indexRow
=
rankList
.
index
;
rankDetailVC
.
uuid
=
rankList
.
uuid
;
rankDetailVC
.
store_uuid
=
rankList
.
store_uuid
;
rankDetailVC
.
storeAddress
=
rankList
.
storeAddress
;
...
...
redstar/Classes/Module/Home/ViewController/SearchViewController.m
View file @
94c9f6e5
...
...
@@ -64,7 +64,8 @@
-
(
void
)
viewDidLoad
{
[
super
viewDidLoad
];
NSMutableArray
*
titleArray
=
[[
NSUserDefaults
standardUserDefaults
]
objectForKey
:
@"function"
];
//NSMutableArray *titleArray = [[NSUserDefaults standardUserDefaults] objectForKey:@"function"];
NSArray
*
titleArray
=
[
NSArray
arrayWithObjects
:
@"口碑巡检"
,
@"口碑排名"
,
@"问题知识"
,
nil
];
self
.
titleArray
=
[
NSMutableArray
arrayWithArray
:
titleArray
];
UILabel
*
customLab
=
[[
UILabel
alloc
]
initWithFrame
:
CGRectMake
(
0
,
0
,
100
,
30
)];
...
...
@@ -215,24 +216,33 @@
NSString
*
url1
=
[
NSString
stringWithFormat
:
@"%@%@"
,
kRedStarURL
,
kRankingListURL
];
HttpClient
*
httpCilent1
=
[[
HttpClient
alloc
]
initWithUrl
:
url1
];
NSDictionary
*
parameters1
=
@{
@"keyword"
:
self
.
customStr
,
@"queryOrders"
:
@[@{
@"direction"
:
@"asc"
}],
@"pageNumber"
:
@
(
0
),
@"pageSize"
:
@
(
10
)
};
__block
SearchViewController
*
weakSelf
=
self
;
@"praiseUuid"
:
@"5a7417015157efa6015158f52be8004e"
,
@"statisMode"
:
@
(
0
),
@"keyword"
:
self
.
customStr
};
[
httpCilent1
getRankingListWithParameters
:
parameters1
completion
:
^
(
id
response
,
NSError
*
error
)
{
NSLog
(
@"口碑排名response = %@"
,
response
);
NSDictionary
*
dataDict
=
response
[
@"data"
];
NSArray
*
dataArray
=
dataDict
[
@"records"
];
if
([(
NSArray
*
)
response
[
@"data"
]
count
]
==
0
)
{
return
;
}
NSArray
*
dataArray
=
response
[
@"data"
];
NSMutableArray
*
rankTempArr
=
[
NSMutableArray
array
];
for
(
NSDictionary
*
ListDict
in
dataArray
)
{
RankListModel
*
rankList
=
[
RankListModel
rankListModelWithDict
:
ListDict
];
[
rankTempArr
addObject
:
rankList
];
}
weakSelf
.
allRankListArray
=
rankTempArr
;
_allRankListArray
=
(
NSMutableArray
*
)[
self
sortRankListWithRankListArray
:
rankTempArr
]
;
for
(
int
i
=
0
;
i
<
_allRankListArray
.
count
;
i
++
)
{
RankListModel
*
rank
=
_allRankListArray
[
i
];
if
(
i
==
0
)
{
rank
.
index
=
i
+
1
;
}
else
{
RankListModel
*
prevRank
=
_allRankListArray
[
i
-
1
];
rank
.
index
=
rank
.
score
==
prevRank
.
score
?
prevRank
.
index
:
i
+
1
;
}
}
if
(
_allRankListArray
.
count
!=
0
)
{
if
(
!
[
_titleArray
containsObject
:
@"口碑排名"
])
{
...
...
@@ -246,6 +256,14 @@
}
-
(
NSArray
*
)
sortRankListWithRankListArray
:
(
NSMutableArray
*
)
allRanking
{
NSArray
*
sortedArray
=
[
allRanking
sortedArrayUsingComparator
:
^
NSComparisonResult
(
RankListModel
*
p1
,
RankListModel
*
p2
){
return
[
p2
.
score
compare
:
p1
.
score
];
}];
return
sortedArray
;
}
-
(
void
)
requestAllQuestion
{
NSString
*
url2
=
[
NSString
stringWithFormat
:
@"%@%@"
,
kRedStarURL
,
kQuestionListURL
];
...
...
@@ -351,8 +369,9 @@
if
(
!
cell
)
{
cell
=
[[
RankingListCell
alloc
]
initWithStyle
:
UITableViewCellStyleValue1
reuseIdentifier
:
kHomeRankingListCell
];
}
cell
.
rankList
=
_allRankListArray
[
indexPath
.
row
-
1
];
cell
.
gradeImageView
.
image
=
[
UIImage
imageNamed
:[
NSString
stringWithFormat
:
@"medal_0%d"
,
(
int
)
indexPath
.
row
]];
RankListModel
*
rankList
=
_allRankListArray
[
indexPath
.
row
-
1
];
cell
.
rankList
=
rankList
;
cell
.
gradeImageView
.
image
=
[
UIImage
imageNamed
:[
NSString
stringWithFormat
:
@"medal_0%d"
,
rankList
.
index
]];
cell
.
selectionStyle
=
UITableViewCellSelectionStyleNone
;
return
cell
;
}
...
...
redstar/Classes/Tools/HttpClient/HttpClient.h
View file @
94c9f6e5
...
...
@@ -119,4 +119,7 @@ typedef void (^completionBlock) (id response, NSError *error);
// 获取口碑列表
-
(
void
)
queryShortPraiseWithCompletion
:(
completionBlock
)
completion
;
// 查询下级参数
-
(
void
)
queryLowerOrgsWithParameters
:(
id
)
parameters
completion
:(
completionBlock
)
completion
;
@end
redstar/Classes/Tools/HttpClient/HttpClient.m
View file @
94c9f6e5
...
...
@@ -407,4 +407,14 @@
}];
}
//
-
(
void
)
queryLowerOrgsWithParameters
:
(
id
)
parameters
completion
:
(
completionBlock
)
completion
{
[
self
postParameters
:
parameters
completion
:
^
(
id
response
,
NSError
*
error
)
{
if
(
completion
)
{
completion
(
response
,
error
);
}
}];
}
@end
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