Commit 4d4b6cc7 authored by admin's avatar admin

除问题与知识的排序未完成 排序与筛选完成

parent fc6efa4b
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "unfold_btn@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "unfold_btn@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
......@@ -25,7 +25,7 @@
#define kQuestionListCell @"questionListTableViewCell"
#define kThumbTag 745645
@interface QuestionViewController () <UITableViewDelegate, UITableViewDataSource, ScreenTableDelegate, TaxisViewDelegate>
@interface QuestionViewController () <UITableViewDelegate, UITableViewDataSource, ScreenTableDelegate, TaxisViewDelegate, InspectTableViewDelegate>
@property (nonatomic, strong) UITableView *tableView;
@property (nonatomic, strong) NSMutableArray *allQuestionArray;
......@@ -41,6 +41,9 @@
@property (nonatomic, strong) NoDataView *noDataView;
@property (nonatomic, assign) NSInteger selectRow;
@property (nonatomic, assign) NSInteger timeSelectNum;
@end
@implementation QuestionViewController
......@@ -272,6 +275,7 @@
- (void)closeRedView
{
_selctedButton.isDrop = NO;
_selctedButton.selected = NO;
[_selctedButton setTitleColor:kInspectSectionButtonTextColor forState:UIControlStateNormal];
CGRect fromFrame = CGRectMake(0, -kTaxisViewHeight, kScreenWidth, kTaxisViewHeight);
[UIView animateWithDuration:0.3 animations:^{
......@@ -292,10 +296,13 @@
[_bgView addGestureRecognizer:tapGR];
}
if (!_screenView) {
_screenView = [[ScreenView alloc] init];
_screenView = [[ScreenView alloc] initWithTitleArray:[NSArray arrayWithObjects:@"待解决", @"已解决",@"已作废",nil]];
_screenView.delegate = self;
_screenView.inspectTableView.inspectDelegate = self;
_screenView.backgroundColor = [UIColor whiteColor];
}
[_screenView.resetBtn addTarget:self action:@selector(resetClick:) forControlEvents:UIControlEventTouchUpInside];
[_screenView.submitBtn addTarget:self action:@selector(submitClick:) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:_bgView];
[self.view insertSubview:_screenView aboveSubview:_bgView];
......@@ -317,6 +324,7 @@
- (void)closeGreenView
{
_selctedButton.isDrop = NO;
_selctedButton.selected = NO;
[_selctedButton setTitleColor:kInspectSectionButtonTextColor forState:UIControlStateNormal];
CGRect fromFrame = CGRectMake(0, -kScreenViewHeight, kScreenWidth, kScreenViewHeight);
[UIView animateWithDuration:0.3 animations:^{
......@@ -334,18 +342,171 @@
NSLog(@"%@", self.searchBar.searchTextFiled.text);
}
// 重置按钮
- (void)resetClick:(UIButton *)sender
{
NSInteger selectedIndex = 0;
NSIndexPath *selectedIndexPath = [NSIndexPath indexPathForRow:selectedIndex inSection:0];
[_screenView.tableView selectRowAtIndexPath:selectedIndexPath animated:NO scrollPosition:UITableViewScrollPositionNone];
_screenView.textView.text = @"";
NSInteger timeIndex = 0;
NSIndexPath *timeIndexPath = [NSIndexPath indexPathForRow:timeIndex inSection:0];
[_screenView.tableView selectRowAtIndexPath:timeIndexPath animated:NO scrollPosition:UITableViewScrollPositionNone];
_selectRow = 0;
}
// 提交按钮
- (void)submitClick:(UIButton *)sender
{
// 请求地址
NSString *urlStr = [NSString stringWithFormat:@"%@%@", kRedStarURL, kQuestionListURL];
NSString *user_uuid = [[NSUserDefaults standardUserDefaults] objectForKey:@"user_uuid"];
NSMutableDictionary *parameters = [NSMutableDictionary dictionaryWithObjectsAndKeys:
user_uuid,@"user",
@"all",@"scope",
@(0),@"pageNumber",
@(10),@"pageSize", nil];
// 发起请求
HttpClient *httpClient = [[HttpClient alloc] initWithUrl:urlStr];
//
__block QuestionViewController *weakSelf = self;
[MBProgressHUD showHUDAddedTo:self.view animated:YES];
if (_screenView.groupTabBar.selectNumber == 0) {
if (_selectRow == 0) {
[parameters setObject:@"created" forKey:@"state"];
} else if (_selectRow == 1) {
[parameters setObject:@"resolved" forKey:@"state"];
} else {
[parameters setObject:@"aborted" forKey:@"state"];
}
} else if (_screenView.groupTabBar.selectNumber == 1) {
if (_screenView.textView.text.length != 0){
[parameters setObject:_screenView.textView.text forKey:@"contentLike"];
} else {
[parameters setObject:_screenView.textView.text forKey:@"contentLike"];
}
} else {
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
// 当前时间
NSDate *today = [NSDate date];
NSString *todayStr = [dateFormatter stringFromDate:today];
if (_timeSelectNum == 0) {
NSDate *week = [today dateByAddingTimeInterval:-60*60*24*7];
NSString *weekStr = [dateFormatter stringFromDate:week];
[parameters setObject:weekStr forKey:@"submitTimeFrom"];
[parameters setObject:todayStr forKey:@"submitTimeTo"];
} else if (_timeSelectNum == 1) {
NSDate *oneMonth = [self getPriousorLaterDateFromDate:today withMonth:-1];
NSString *oneMonthStr = [dateFormatter stringFromDate:oneMonth];
NSLog(@"oneMonth = %@", oneMonthStr);
[parameters setObject:oneMonthStr forKey:@"submitTimeFrom"];
[parameters setObject:todayStr forKey:@"submitTimeTo"];
} else if (_timeSelectNum == 2) {
NSDate *threeMonth = [self getPriousorLaterDateFromDate:today withMonth:-3];
NSString *threeMonthStr = [dateFormatter stringFromDate:threeMonth];
[parameters setObject:threeMonthStr forKey:@"submitTimeFrom"];
[parameters setObject:todayStr forKey:@"submitTimeTo"];
} else if (_timeSelectNum == 3) {
NSDate *oneYear = [self getPriousorLaterDateFromDate:today withMonth:-12];
NSString *oneYearStr = [dateFormatter stringFromDate:oneYear];
[parameters setObject:oneYearStr forKey:@"submitTimeFrom"];
[parameters setObject:todayStr forKey:@"submitTimeTo"];
} else {
NSDate *oneYear = [self getPriousorLaterDateFromDate:today withMonth:-12];
NSString *oneYearStr = [dateFormatter stringFromDate:oneYear];
[parameters setObject:oneYearStr forKey:@"submitTimeTo"];
}
}
NSLog(@"parameters = %@",parameters);
// 请求问题列表
[httpClient getQuestionListWithParameters:parameters completion:^(id response, NSError *error) {
NSDictionary *dataDict = (NSDictionary *)response[@"data"];
NSDictionary *recordsDict = (NSDictionary *)dataDict[@"records"];
NSLog(@"问题与知识列表recods = %@", response);
NSMutableArray *tempArray = [NSMutableArray array];
for (NSDictionary *questionDict in recordsDict) {
QuestionModel *question = [[QuestionModel alloc] init];
[question setValuesForKeysWithDictionary:questionDict];
[tempArray addObject:question];
}
_allQuestionArray = tempArray;
if (_allQuestionArray.count == 0) {
if (_tableView) {
[_tableView removeFromSuperview];
_tableView = nil;
}
weakSelf.noDataView.backgroundColor = [UIColor whiteColor];
[MBProgressHUD hideHUDForView:weakSelf.view animated:YES];
[weakSelf closeGreenView];
} else {
if (_noDataView) {
[_noDataView removeFromSuperview];
_noDataView = nil;
}
weakSelf.tableView.delegate = weakSelf;
weakSelf.tableView.dataSource = weakSelf;
[weakSelf.tableView reloadData];
[MBProgressHUD hideHUDForView:weakSelf.view animated:YES];
_screenView.textView.text = @"";
[weakSelf closeGreenView];
}
}];
}
- (NSDate *)getPriousorLaterDateFromDate:(NSDate *)date withMonth:(int)month
{
NSDateComponents *comps = [[NSDateComponents alloc] init];
[comps setMonth:month];
NSCalendar *calender = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar];
NSDate *mDate = [calender dateByAddingComponents:comps toDate:date options:0];
return mDate;
}
#pragma mark - InspectTableViewDelegate
- (void)inspectTableViewDidSelectWithRow:(NSInteger)row
{
_selectRow = row;
}
#pragma mark - TaxisDelegate
- (void)timeChange:(UIButton *)sender
{
[self closeRedView];
[self closeRedView];
}
#pragma mark - ScreenTableDelegate
- (void)tableViewDidSelectRow:(NSInteger)row
{
NSLog(@"点一下");
[self closeGreenView];
_timeSelectNum = row;
}
#pragma mark - UItableView Delegate/DataSource
......
......@@ -22,7 +22,7 @@
@property (nonatomic, copy) NSString *lastModify_time;
@property (nonatomic, copy) NSString *name;
@property (nonatomic, assign) int questionCount;
@property (nonatomic, copy) NSString *ranking;
@property (nonatomic,copy) NSString *ranking;
@property (nonatomic, assign) int reportCount;
@property (nonatomic, copy) NSString *reportTime;
@property (nonatomic, copy) NSString *reported;
......
......@@ -14,4 +14,5 @@
@end
@interface InspectTableView : UITableView
@property (nonatomic, weak) id <InspectTableViewDelegate> inspectDelegate;
- (instancetype)initWithTitleArray:(NSArray *)titleArray;
@end
......@@ -16,11 +16,20 @@
@implementation InspectTableView
- (instancetype)initWithTitleArray:(NSArray *)titleArray
{
self = [super init];
if (self) {
self.testArray = titleArray;
[self setup];
}
return self;
}
- (instancetype)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
self.testArray = [NSArray arrayWithObjects:@"全部", @"未处理",@"进行中",@"已上报",@"已评分", @"已发布", @"已过期",nil];
[self setup];
}
......
......@@ -38,11 +38,10 @@
@property (nonatomic, strong) UIButton *selectBtn;
@property (nonatomic, strong) NSMutableArray *taskListDataArray;
@property (nonatomic, assign) NSInteger selectRow;
@property (nonatomic, assign) NSInteger selectRow;
@property (nonatomic, assign) NSInteger timeSelectNum;
@property (nonatomic, strong) NoDataView *noDataView;
@end
......@@ -122,9 +121,6 @@
NSString *url = [NSString stringWithFormat:@"%@%@", kRedStarURL, kInspectListURL];
HttpClient *httpCilent = [[HttpClient alloc] initWithUrl:url];
NSDictionary *parameters = @{@"userUuid":@"",
// @"beginDateFrom":@"",
// @"endDateTo":@"",
// @"nameLike":@"",
@"queryOrders":@[@{@"field":@"lastModifyInfo"}],
@"pageNumber":@(0),
@"pageSize":@(10)
......@@ -267,7 +263,7 @@
[_bgView addGestureRecognizer:tapGR];
}
if (!_screenView) {
_screenView = [[ScreenView alloc] init];
_screenView = [[ScreenView alloc] initWithTitleArray:[NSArray arrayWithObjects:@"全部", @"未处理",@"进行中",@"已上报",@"已评分", @"已发布", @"已过期",nil]];
_screenView.delegate = self;
_screenView.inspectTableView.inspectDelegate = self;
_screenView.backgroundColor = [UIColor whiteColor];
......@@ -327,57 +323,107 @@
{
NSString *url = [NSString stringWithFormat:@"%@%@", kRedStarURL, kInspectListURL];
HttpClient *httpCilent = [[HttpClient alloc] initWithUrl:url];
NSMutableDictionary *parameters = [NSMutableDictionary dictionaryWithObjectsAndKeys:@"",@"userUuid",@"",@"beginDateFrom",@"",@"endDateTo",@"",@"nameLike",@[],@"queryOrders",@(0),@"pageNumber",@(10),@"pageSize", nil];
if (_selectRow == 0) {
NSMutableDictionary *parameters = [NSMutableDictionary dictionaryWithObjectsAndKeys:
@"",@"userUuid",
@[],@"queryOrders",
@(0),@"pageNumber",
@(10),@"pageSize", nil];
if (_screenView.groupTabBar.selectNumber == 0) {
} else if (_selectRow == 1) {
_screenView.textView.text = @"";
[parameters setObject:@"initial" forKey:@"state"];
NSArray *array = @[@{@"field":@"state"}];
[parameters setObject:array forKey:@"queryOrders"];
} else if (_selectRow == 2) {
_screenView.textView.text = @"";
[parameters setObject:@"processing" forKey:@"state"];
NSArray *array = @[@{@"field":@"state"}];
[parameters setObject:array forKey:@"queryOrders"];
} else if (_selectRow == 3) {
_screenView.textView.text = @"";
[parameters setObject:@"reported" forKey:@"state"];
NSArray *array = @[@{@"field":@"state"}];
[parameters setObject:array forKey:@"queryOrders"];
} else if (_selectRow == 4) {
_screenView.textView.text = @"";
[parameters setObject:@"finished" forKey:@"state"];
NSArray *array = @[@{@"field":@"state"}];
[parameters setObject:array forKey:@"queryOrders"];
} else if (_selectRow == 5) {
_screenView.textView.text = @"";
[parameters setObject:@"published" forKey:@"state"];
if (_selectRow == 0) {
} else if (_selectRow == 1) {
_screenView.textView.text = @"";
[parameters setObject:@"initial" forKey:@"state"];
} else if (_selectRow == 2) {
_screenView.textView.text = @"";
[parameters setObject:@"processing" forKey:@"state"];
} else if (_selectRow == 3) {
_screenView.textView.text = @"";
[parameters setObject:@"reported" forKey:@"state"];
} else if (_selectRow == 4) {
_screenView.textView.text = @"";
[parameters setObject:@"finished" forKey:@"state"];
} else if (_selectRow == 5) {
_screenView.textView.text = @"";
[parameters setObject:@"published" forKey:@"state"];
} else if (_selectRow == 6){
_screenView.textView.text = @"";
[parameters setObject:@"expired" forKey:@"state"];
}
NSArray *array = @[@{@"field":@"state"}];
[parameters setObject:array forKey:@"queryOrders"];
} else if (_selectRow == 6){
_screenView.textView.text = @"";
[parameters setObject:@"expired" forKey:@"state"];
NSArray *array = @[@{@"field":@"state"}];
} else if (_screenView.groupTabBar.selectNumber == 1) {
if (_screenView.textView.text.length != 0){
[parameters setObject:_screenView.textView.text forKey:@"nameLike"];
NSArray *array = @[@{@"field":@"name"}];
[parameters setObject:array forKey:@"queryOrders"];
} else {
NSArray *array = @[];
[parameters setObject:_screenView.textView.text forKey:@"nameLike"];
[parameters setObject:array forKey:@"queryOrders"];
}
} else {
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
// 当前时间
NSDate *today = [NSDate date];
NSString *todayStr = [dateFormatter stringFromDate:today];
if (_timeSelectNum == 0) {
NSDate *week = [today dateByAddingTimeInterval:-60*60*24*7];
NSString *weekStr = [dateFormatter stringFromDate:week];
[parameters setObject:weekStr forKey:@"beginDateFrom"];
[parameters setObject:todayStr forKey:@"endDateTo"];
} else if (_timeSelectNum == 1) {
NSDate *oneMonth = [self getPriousorLaterDateFromDate:today withMonth:-1];
NSString *oneMonthStr = [dateFormatter stringFromDate:oneMonth];
NSLog(@"oneMonth = %@", oneMonthStr);
[parameters setObject:oneMonthStr forKey:@"beginDateFrom"];
[parameters setObject:todayStr forKey:@"endDateTo"];
} else if (_timeSelectNum == 2) {
NSDate *threeMonth = [self getPriousorLaterDateFromDate:today withMonth:-3];
NSString *threeMonthStr = [dateFormatter stringFromDate:threeMonth];
[parameters setObject:threeMonthStr forKey:@"beginDateFrom"];
[parameters setObject:todayStr forKey:@"endDateTo"];
} else if (_timeSelectNum == 3) {
NSDate *oneYear = [self getPriousorLaterDateFromDate:today withMonth:-12];
NSString *oneYearStr = [dateFormatter stringFromDate:oneYear];
[parameters setObject:oneYearStr forKey:@"beginDateFrom"];
[parameters setObject:todayStr forKey:@"endDateTo"];
} else {
NSDate *oneYear = [self getPriousorLaterDateFromDate:today withMonth:-12];
NSString *oneYearStr = [dateFormatter stringFromDate:oneYear];
[parameters setObject:oneYearStr forKey:@"endDateTo"];
}
NSArray *array = @[@{@"field":@"lastModifyInfo",
@"direction":@"asc"}];
[parameters setObject:array forKey:@"queryOrders"];
NSLog(@"parameters = %@",parameters);
}
if (_screenView.textView.text.length != 0){
[parameters setObject:_screenView.textView.text forKey:@"nameLike"];
NSArray *array = @[@{@"field":@"name"}];
[parameters setObject:array forKey:@"queryOrders"];
} else {
NSArray *array = @[];
[parameters setObject:array forKey:@"queryOrders"];
}
NSLog(@"parment =%@", parameters);
[MBProgressHUD showHUDAddedTo:self.view animated:YES];
[httpCilent getInspectListWithParameters:parameters completion:^(id response, NSError *error) {
NSLog(@"respones = %@", response);
......@@ -419,6 +465,15 @@
}
- (NSDate *)getPriousorLaterDateFromDate:(NSDate *)date withMonth:(int)month
{
NSDateComponents *comps = [[NSDateComponents alloc] init];
[comps setMonth:month];
NSCalendar *calender = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar];
NSDate *mDate = [calender dateByAddingComponents:comps toDate:date options:0];
return mDate;
}
#pragma mark - InspectTableViewDelegate
- (void)inspectTableViewDidSelectWithRow:(NSInteger)row
{
......@@ -428,7 +483,7 @@
#pragma mark - ScreenDelegate
- (void)tableViewDidSelectRow:(NSInteger)row
{
NSLog(@"row == %ld", (long)row);
_timeSelectNum = row;
}
#pragma mark - TaxisDelegate
- (void)timeChange:(UIButton *)sender
......
......@@ -22,7 +22,22 @@
#pragma mark - Private Methods
- (void)setup
{
UIView *lineView = [[UIView alloc] init];
lineView.backgroundColor = kSeparateLineColor;
lineView.translatesAutoresizingMaskIntoConstraints = NO;
[self.contentView addSubview:lineView];
NSLayoutConstraint *tableTop = [NSLayoutConstraint constraintWithItem:lineView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeTop multiplier:1.0 constant:0];
[self.contentView addConstraint:tableTop];
NSLayoutConstraint *tableLeft = [NSLayoutConstraint constraintWithItem:lineView attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeLeft multiplier:1.0 constant:20];
[self.contentView addConstraint:tableLeft];
NSLayoutConstraint *tableRight = [NSLayoutConstraint constraintWithItem:lineView attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeRight multiplier:1.0 constant:40];
[self.contentView addConstraint:tableRight];
NSLayoutConstraint *tableHeight = [NSLayoutConstraint constraintWithItem:lineView attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:0.8];
[self.contentView addConstraint:tableHeight];
}
- (void)setTask:(TaskModel *)task
......
......@@ -23,7 +23,7 @@
@property (nonatomic, copy) NSString *name;
@property (nonatomic, assign) int questionCount;
@property (nonatomic, strong) NSArray *questions;
@property (nonatomic, copy) NSString *ranking;
@property (nonatomic,copy) NSString *ranking;
@property (nonatomic, assign) int reportCount;
@property (nonatomic, copy) NSString *reportTime;
@property (nonatomic, copy) NSString *reported;
......
......@@ -13,6 +13,7 @@
@property (nonatomic, copy) NSString *category;
@property (nonatomic, assign) int questionCount;
@property (nonatomic, copy) NSString *ranking;
@property (nonatomic, assign) int reportCount;
@property (nonatomic, copy) NSString *reportTime;
@property (nonatomic, copy) NSString *score;
......
......@@ -56,29 +56,10 @@
self.detailView.backgroundColor = [UIColor whiteColor];
UIView *lineView = [[UIView alloc] init];
lineView.translatesAutoresizingMaskIntoConstraints = NO;
lineView.backgroundColor = kSeparateLineColor;
[self addSubview:lineView];
NSLayoutConstraint *upLineBottom = [NSLayoutConstraint constraintWithItem:lineView attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0];
[self addConstraint:upLineBottom];
NSLayoutConstraint *upLineLeft = [NSLayoutConstraint constraintWithItem:lineView attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeLeft multiplier:1.0 constant:0];
[self addConstraint:upLineLeft];
NSLayoutConstraint *upLineRight = [NSLayoutConstraint constraintWithItem:lineView attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeRight multiplier:1.0 constant:0];
[self addConstraint:upLineRight];
NSLayoutConstraint *upLineHeight = [NSLayoutConstraint constraintWithItem:lineView attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:1];
[self addConstraint:upLineHeight];
UILabel *classifyLabel = [[UILabel alloc] init];
classifyLabel.translatesAutoresizingMaskIntoConstraints = NO;
classifyLabel.textColor = kAnnounceTextColor;
classifyLabel.backgroundColor = kSectionBackGroundColor;
classifyLabel.backgroundColor = [UIColor clearColor];
classifyLabel.font = [UIFont systemFontOfSize:15.0];
classifyLabel.text = @"分类项目";
[self addSubview:classifyLabel];
......
......@@ -13,7 +13,8 @@
{
UIButton *_bgButton;
UIImageView *_arrowImageView;
UIView *_lineView;
// UIView *_lineView;
UIView *_lineView1;
}
@end
......@@ -47,10 +48,15 @@
[self addSubview:arrowIMView];
_arrowImageView = arrowIMView;
UIView *lineView = [[UIView alloc] init];
lineView.backgroundColor = kSeparateLineColor;
[self addSubview:lineView];
_lineView = lineView;
// UIView *lineView = [[UIView alloc] init];
// lineView.backgroundColor = kSeparateLineColor;
// [self addSubview:lineView];
// _lineView = lineView;
UIView *lineView1 = [[UIView alloc] init];
lineView1.backgroundColor = kSeparateLineColor;
[self addSubview:lineView1];
_lineView1 = lineView1;
}
return self;
}
......@@ -77,7 +83,7 @@
- (void)didMoveToSuperview
{
_arrowImageView.transform = _taskGroup.isOpened ? CGAffineTransformMakeRotation(M_PI) : CGAffineTransformMakeRotation(0);
_lineView.hidden = _taskGroup.isOpened ? YES : NO;
//_lineView.hidden = _taskGroup.isOpened ? YES : NO;
}
- (void)layoutSubviews
......@@ -86,7 +92,9 @@
_bgButton.frame = self.bounds;
_arrowImageView.frame = CGRectMake(self.frame.size.width - 33, (self.frame.size.height - 8) / 2, 13, 8);
_lineView.frame = CGRectMake(0, self.frame.size.height - 1, self.frame.size.width, 1);
//_lineView.frame = CGRectMake(0, self.frame.size.height - 1, self.frame.size.width, 1);
_lineView1.frame = CGRectMake(0, 0, self.frame.size.width, 1);
}
......
......@@ -118,6 +118,8 @@
self.tableView.delegate = self;
self.tableView.dataSource = self;
self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
[MBProgressHUD hideHUDForView:self.view animated:YES];
}];
......
......@@ -43,8 +43,8 @@
self.rankDetailView.backgroundColor = [UIColor whiteColor];
self.titleLabel.text = @"口碑七大重点工作详情";
[self.showAllBtn setTitle:@"展开" forState:UIControlStateNormal];
self.arrowImageView2.image = [UIImage imageNamed:@"arrow_right"];
[self.showAllBtn setTitle:@"展开全部" forState:UIControlStateNormal];
self.arrowImageView2.image = [UIImage imageNamed:@"unfold_btn"];
}
......@@ -212,16 +212,16 @@
_arrowImageView2.translatesAutoresizingMaskIntoConstraints = NO;
[self addSubview:_arrowImageView2];
// label
NSLayoutConstraint *historyTop = [NSLayoutConstraint constraintWithItem:_arrowImageView2 attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.rankDetailView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:16];
NSLayoutConstraint *historyTop = [NSLayoutConstraint constraintWithItem:_arrowImageView2 attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.rankDetailView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:17];
[self addConstraint:historyTop];
NSLayoutConstraint *historyWidth = [NSLayoutConstraint constraintWithItem:_arrowImageView2 attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:7];
NSLayoutConstraint *historyWidth = [NSLayoutConstraint constraintWithItem:_arrowImageView2 attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:12.5];
[self addConstraint:historyWidth];
NSLayoutConstraint *historyRight = [NSLayoutConstraint constraintWithItem:_arrowImageView2 attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeRight multiplier:1.0 constant:-20];
[self addConstraint:historyRight];
NSLayoutConstraint *historyHeight = [NSLayoutConstraint constraintWithItem:_arrowImageView2 attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:12];
NSLayoutConstraint *historyHeight = [NSLayoutConstraint constraintWithItem:_arrowImageView2 attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:10.5];
[self addConstraint:historyHeight];
}
return _arrowImageView2;
......
......@@ -82,14 +82,24 @@
_taskGroup = taskGroup;
[_bgButton setTitle:taskGroup.category forState:UIControlStateNormal];
NSString *scoreStr = nil;
if (taskGroup.score == NULL || taskGroup.score == nil) {
scoreStr = @"0 分";
} else {
scoreStr = [NSString stringWithFormat:@"%@ 分", taskGroup.score];
}
NSString *scoreStr = [NSString stringWithFormat:@"%@ 分", taskGroup.score];
NSMutableAttributedString *scoreAttr = [[NSMutableAttributedString alloc] initWithString:scoreStr];
[scoreAttr addAttributes:@{NSForegroundColorAttributeName:kNavigationBarColor,NSFontAttributeName:[UIFont systemFontOfSize:19.0f]} range:NSMakeRange(0,scoreAttr.length - 1)];
[scoreAttr addAttributes:@{NSForegroundColorAttributeName:kDetailSmallTitleColor, NSFontAttributeName:[UIFont systemFontOfSize:14.0f]} range:NSMakeRange(scoreAttr.length - 1,1)];
[_scoreLabel setAttributedText:scoreAttr];
NSString *rankStr = [NSString stringWithFormat:@"第 %@ 名", taskGroup.ranking];
NSString *rankStr = nil;
if (taskGroup.score == NULL || taskGroup.score == nil) {
rankStr = @"0 分";
} else {
rankStr = [NSString stringWithFormat:@"第 %@ 名", taskGroup.ranking];
}
NSMutableAttributedString *rankAttr = [[NSMutableAttributedString alloc] initWithString:rankStr];
[rankAttr addAttributes:@{NSForegroundColorAttributeName:kRankHeadTitleTextColor,NSFontAttributeName:[UIFont systemFontOfSize:14.0f]} range:NSMakeRange(0,1)];
[rankAttr addAttributes:@{NSForegroundColorAttributeName:kGradeNumberTextColor} range:NSMakeRange(1,rankStr.length - 2)];
......
......@@ -358,7 +358,11 @@
cell.selectionStyle = UITableViewCellSelectionStyleNone;
[cell.mainTitleBtn setTitle:[NSString stringWithFormat:@"%d、%@", (int)(indexPath.row + 1) ,task.title] forState:UIControlStateNormal];
cell.scoreLabel.text = [NSString stringWithFormat:@"%@分", task.score];
if (task.score == NULL || task.score == nil) {
cell.scoreLabel.text = [NSString stringWithFormat:@"0分"];
} else {
cell.scoreLabel.text = [NSString stringWithFormat:@"%@分", task.score];
}
// 按钮点击事件
[cell.mainTitleBtn addTarget:self action:@selector(showScrollView:) forControlEvents:UIControlEventTouchUpInside];
......
......@@ -35,7 +35,7 @@
{
_rankList = rankList;
[self.shopNameButton setTitle:[NSString stringWithFormat:@"%@", rankList.store_name] forState:UIControlStateNormal];
self.scoreLabel.text = [NSString stringWithFormat:@"%@", rankList.score];
self.scoreLabel.text = [NSString stringWithFormat:@"%.0f", rankList.score];
}
......
......@@ -14,7 +14,7 @@
@property (nonatomic,copy) NSString *store_uuid;
@property (nonatomic,copy) NSString *store_code;
@property (nonatomic,copy) NSString *store_name;
@property (nonatomic,copy) NSString *score;
@property (nonatomic, assign) double score;
@property (nonatomic,copy) NSString *reported;
@property (nonatomic,copy) NSString *commentId;
@property (nonatomic,copy) NSString *ranking;
......
......@@ -300,7 +300,7 @@
RankListModel *rankList = _allRankListArray[indexPath.row];
[cell.shopNameButton setTitle:rankList.store_name forState:UIControlStateNormal];
cell.scoreLabel.text = [NSString stringWithFormat:@"%@", rankList.score];
cell.scoreLabel.text = [NSString stringWithFormat:@"%.0f", rankList.score];
cell.shopNameButton.tag = (kShopNameBtnTag + indexPath.row);
cell.selectionStyle = UITableViewCellSelectionStyleNone;
// 添加点击事件
......
......@@ -17,13 +17,10 @@
@interface GroupTabBar : UIView
@property (nonatomic, strong) UIButton *stateBtn; // 状态
@property (nonatomic, strong) UIButton *titleBtn; // 标题
@property (nonatomic, strong) UIButton *sigleBtn; // 单号
@property (nonatomic,assign) id <GroupTabBarDelegate> delegate; // 设置代理
@property (nonatomic, strong) NSArray *items;
@property (nonatomic, assign) int selectNumber;
- (void)showIndex:(NSInteger)index;
......
......@@ -15,6 +15,8 @@
#define kSelfWidth self.frame.size.width
#define kSelfHeight self.frame.size.height
#define kBtnTag 38341034
@interface GroupTabBar ()
@property (strong) NSMutableArray *buttons; // 存放所有button的数组
@end
......@@ -37,6 +39,7 @@
for (int i = 0; i < _items.count; i++) {
GroupItems *item = _items[i];
UIButton *button = [[UIButton alloc] init];
button.tag = kBtnTag + i;
button.titleLabel.font = [UIFont systemFontOfSize:15.0];
[button setTitleColor:kLightBlack forState:UIControlStateNormal];
button.frame = CGRectMake(0, i * buttonHeight, kSelfWidth, buttonHeight);
......@@ -71,7 +74,7 @@
}
- (void)touchUpForButton:(UIButton *)button {
self.selectNumber = (int)button.tag - kBtnTag;
for (UIButton * b in self.buttons) {
b.selected = NO;
b.backgroundColor = kSectionBackGroundColor;
......
......@@ -29,5 +29,7 @@
@property (nonatomic, weak) id <ScreenTableDelegate> delegate;
- (instancetype)initWithTitleArray:(NSArray *)titleArray;
@end
......@@ -22,25 +22,25 @@
@implementation ScreenView
- (instancetype)init
- (instancetype)initWithTitleArray:(NSArray *)titleArray
{
self = [super init];
if (self) {
[self setup];
[self setupWithTitleArray:titleArray];
}
return self;
}
- (instancetype)initWithFrame:(CGRect)frame
- (instancetype)initWithFrame:(CGRect)frame titleArray:(NSArray *)titleArray
{
self = [super initWithFrame:frame];
if (self) {
[self setup];
[self setupWithTitleArray:titleArray];
}
return self;
}
- (void)setup
- (void)setupWithTitleArray:(NSArray *)titleArray;
{
self.testArray = [NSArray arrayWithObjects:@"一周", @"一个月",@"三个月",@"一年",@"历史更多",nil];
......@@ -49,7 +49,7 @@
_groupTabBar.delegate = self;
[self addSubview:_groupTabBar];
self.inspectTableView = [[InspectTableView alloc] init];
self.inspectTableView = [[InspectTableView alloc] initWithTitleArray:titleArray];
NSInteger inspectIndex = 0;
NSIndexPath *inspectIndexPath = [NSIndexPath indexPathForRow:inspectIndex inSection:0];
[_inspectTableView selectRowAtIndexPath:inspectIndexPath animated:NO scrollPosition:UITableViewScrollPositionNone];
......
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