Commit 7fbcb01a authored by admin's avatar admin

修复部分bug

parent fff7b6b9
This diff is collapsed.
......@@ -13,21 +13,5 @@
stopOnStyle = "0">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "redstar/Classes/Module/Function/OnLine/OnLineTaskComplete/Cell/OnLineCompleteDetailCell.m"
timestampString = "471346560.745287"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "178"
endingLineNumber = "178"
landmarkName = "-taskDetailLabel"
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
</Breakpoints>
</Bucket>
......@@ -15,6 +15,7 @@
@property (nonatomic, strong) UILabel *titleLabel;
@property (nonatomic, strong) UILabel *peopleLabel;
@property (nonatomic, strong) UILabel *dateLabel;
@property (nonatomic, strong) AnnounceModel *announce;
@property (nonatomic, copy) NSString *currentState;
......
......@@ -20,9 +20,8 @@
self.titleLabel.attributedText = attrStr;
//self.titleLabel.text = [NSString stringWithFormat:@"%@", announce.content];
self.peopleLabel.text = [NSString stringWithFormat:@"发布人:%@ 发布日期:%@", announce.lastModify_operName ,announce.lastModify_time];
self.peopleLabel.text = [NSString stringWithFormat:@"发布人:%@", announce.lastModify_operName];
self.dateLabel.text = [NSString stringWithFormat:@"发布日期:%@" ,announce.lastModify_time];
if ([self.currentState isEqualToString:@"false"]) {
if (announce.priority == 0) {
self.stateLabel.text = @"低";
......@@ -94,7 +93,7 @@
_titleLabel.font = [UIFont systemFontOfSize:15.0];
[self.contentView addSubview:_titleLabel];
NSLayoutConstraint *overDateTop = [NSLayoutConstraint constraintWithItem:_titleLabel attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeTop multiplier:1.0 constant:17];
NSLayoutConstraint *overDateTop = [NSLayoutConstraint constraintWithItem:_titleLabel attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeTop multiplier:1.0 constant:7];
[self.contentView addConstraint:overDateTop];
NSLayoutConstraint *overDateLeft = [NSLayoutConstraint constraintWithItem:_titleLabel attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeLeft multiplier:1.0 constant:55];
......@@ -130,13 +129,40 @@
[self.contentView addConstraint:overDateRight];
NSLayoutConstraint *overDateHeight = [NSLayoutConstraint constraintWithItem:_peopleLabel attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:20];
NSLayoutConstraint *overDateHeight = [NSLayoutConstraint constraintWithItem:_peopleLabel attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:18];
[self.contentView addConstraint:overDateHeight];
}
return _peopleLabel;
}
- (UILabel *)dateLabel
{
if (!_dateLabel) {
_dateLabel = [[UILabel alloc] init];
_dateLabel.translatesAutoresizingMaskIntoConstraints = NO;
_dateLabel.textColor = kLightGray;
_dateLabel.font = [UIFont systemFontOfSize:13.0];
[self.contentView addSubview:_dateLabel];
NSLayoutConstraint *overDateTop = [NSLayoutConstraint constraintWithItem:_dateLabel attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.peopleLabel attribute:NSLayoutAttributeBottom multiplier:1.0 constant:1];
[self.contentView addConstraint:overDateTop];
NSLayoutConstraint *overDateLeft = [NSLayoutConstraint constraintWithItem:_dateLabel attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeLeft multiplier:1.0 constant:55];
[self.contentView addConstraint:overDateLeft];
NSLayoutConstraint *overDateRight = [NSLayoutConstraint constraintWithItem:_dateLabel attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeRight multiplier:1.0 constant:0];
[self.contentView addConstraint:overDateRight];
NSLayoutConstraint *overDateHeight = [NSLayoutConstraint constraintWithItem:_dateLabel attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:18];
[self.contentView addConstraint:overDateHeight];
}
return _dateLabel;
}
- (UILabel *)stateLabel
{
if (!_stateLabel) {
......
......@@ -48,7 +48,7 @@
self.contentTextView.backgroundColor = [UIColor clearColor];
self.placeholderLabel2.text = @"请输入评论内容...";
self.placeholderLabel2.text = @"请输入评论内容,不超过200字";
[self.sureBtn setTitle:@"确定" forState:UIControlStateNormal];
......
......@@ -43,7 +43,7 @@
self.contentTextView.backgroundColor = [UIColor clearColor];
self.placeholderLabel2.text = @"请输入评论内容...";
self.placeholderLabel2.text = @"请输入评论内容,不超过200字";
[self.sureBtn setTitle:@"确定" forState:UIControlStateNormal];
......
......@@ -87,8 +87,8 @@
self.titleTextView.backgroundColor = [UIColor clearColor];
self.contentTextView.backgroundColor = [UIColor clearColor];
self.placeholderLabel1.text = @"请输入文字...";
self.placeholderLabel2.text = @"请输入文字...";
self.placeholderLabel1.text = @"请输入文字,不超过500字";
self.placeholderLabel2.text = @"请输入文字,不超过500字";
[self.saveButton setTitle:@"保存并下达" forState:UIControlStateNormal];
......
......@@ -31,7 +31,7 @@
self.backImageView1.image = resizingName;
self.contentTextView.backgroundColor = [UIColor clearColor];
self.placeholderLabel2.text = @"请输入文字...";
self.placeholderLabel2.text = @"请输入文字,不超过500字";
[self.resultButton setTitle:@"上报结果" forState:UIControlStateNormal];
}
......
......@@ -78,6 +78,9 @@
NSLayoutConstraint *tableBottom = [NSLayoutConstraint constraintWithItem:_titleLabel attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0];
[self.contentView addConstraint:tableBottom];
NSLayoutConstraint *tableHeight = [NSLayoutConstraint constraintWithItem:_titleLabel attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:44];
[self.contentView addConstraint:tableHeight];
}
return _titleLabel;
}
......
//
// InspectDetailView.h
// InspectTaskDetailCell.h
// redstar
//
// Created by admin on 15/11/12.
// Created by admin on 15/12/12.
// Copyright © 2015年 ZWF. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "InspectListCell.h"
#import "TaskDetailModel.h"
@interface InspectTaskDetailCell : UITableViewCell
@property (nonatomic, strong) UILabel *titleLabel;
@interface InspectDetailView : UIView
@property (nonatomic, strong) UILabel *shopnameLabel; // 商店名称
@property (nonatomic, strong) UILabel *startDateLabel; // 起始时间
@property (nonatomic, strong) UILabel *overDateLabel; // 截止时间
@property (nonatomic, strong) UILabel *progressLabel; // 完成进度
@property (nonatomic, strong) UILabel *alreadyLabel;
@property (nonatomic, strong) UILabel *allLabel;
//@property (nonatomic, assign) ProgressState progressState;
@property (nonatomic, assign) CGFloat multiplier;
@property (nonatomic, strong) UIButton *unfoldBtn;
@property (nonatomic, strong) UIImageView *arrowImageView;
@property (nonatomic, strong) UILabel *dayLabel; // 剩余天数
@property (nonatomic, strong) UIImageView *alreadyView;
@property (nonatomic, strong) UIView *allView;
@property (nonatomic, strong) UILabel *introDetailLabel;
@property (nonatomic, strong) TaskDetailModel *taskDetail;
@end
//
// InspectTitleTableViewCell.h
// redstar
//
// Created by admin on 15/12/12.
// Copyright © 2015年 ZWF. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface InspectTitleTableViewCell : UITableViewCell
@end
//
// InspectTitleTableViewCell.m
// redstar
//
// Created by admin on 15/12/12.
// Copyright © 2015年 ZWF. All rights reserved.
//
#import "InspectTitleTableViewCell.h"
@implementation InspectTitleTableViewCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
self.contentView.backgroundColor = kSectionBackGroundColor;
[self setup];
}
return self;
}
#pragma mark - Private Methods
- (void)setup
{
UILabel *titleLabel = [[UILabel alloc] init];
titleLabel.translatesAutoresizingMaskIntoConstraints = NO;
titleLabel.backgroundColor = [UIColor clearColor];
titleLabel.font = [UIFont systemFontOfSize:15.0];
titleLabel.textColor = kLightBlack;
titleLabel.text = @"分类项目";
[self.contentView addSubview:titleLabel];
NSLayoutConstraint *titleLabelTop = [NSLayoutConstraint constraintWithItem:titleLabel attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeTop multiplier:1.0 constant:0];
[self.contentView addConstraint:titleLabelTop];
NSLayoutConstraint *titleLabelLeft = [NSLayoutConstraint constraintWithItem:titleLabel attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeLeft multiplier:1.0 constant:20];
[self.contentView addConstraint:titleLabelLeft];
NSLayoutConstraint *titleLabelWidth = [NSLayoutConstraint constraintWithItem:titleLabel attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeRight multiplier:1.0 constant:-20];
[self.contentView addConstraint:titleLabelWidth];
NSLayoutConstraint *titleLabelHeight = [NSLayoutConstraint constraintWithItem:titleLabel attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:40];
[self.contentView addConstraint:titleLabelHeight];
NSLayoutConstraint *titleLabelBottom = [NSLayoutConstraint constraintWithItem:titleLabel attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0];
[self.contentView addConstraint:titleLabelBottom];
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
@end
//
// InspectDetailHeaderView.h
// redstar
//
// Created by admin on 15/11/12.
// Copyright © 2015年 ZWF. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "InspectDetailView.h"
#import "TaskDetailModel.h"
@interface InspectDetailHeaderView : UIView
@property (nonatomic, strong) UILabel *titleLabel;
@property (nonatomic,strong) InspectDetailView *detailView;
@property (nonatomic, strong) TaskDetailModel *taskDetail;
@end
//
// InspectDetailHeaderView.m
// redstar
//
// Created by admin on 15/11/12.
// Copyright © 2015年 ZWF. All rights reserved.
//
#import "InspectDetailHeaderView.h"
@implementation InspectDetailHeaderView
- (instancetype)init
{
self = [super init];
if (self) {
[self setup];
}
return self;
}
- (instancetype)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
[self setup];
}
return self;
}
#pragma mark - Private Methods
- (void)setup
{
UILabel *titleLabel = [[UILabel alloc] init];
titleLabel.translatesAutoresizingMaskIntoConstraints = NO;
titleLabel.textAlignment = NSTextAlignmentCenter;
titleLabel.textColor = kAnnounceTextColor;
titleLabel.backgroundColor = kSectionBackGroundColor;
titleLabel.font = [UIFont systemFontOfSize:17.0];
[self addSubview:titleLabel];
NSLayoutConstraint *titleLabelTop = [NSLayoutConstraint constraintWithItem:titleLabel attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeTop multiplier:1.0 constant:0];
[self addConstraint:titleLabelTop];
NSLayoutConstraint *titleLabelLeft = [NSLayoutConstraint constraintWithItem:titleLabel attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeLeft multiplier:1.0 constant:0];
[self addConstraint:titleLabelLeft];
NSLayoutConstraint *titleLabelWidth = [NSLayoutConstraint constraintWithItem:titleLabel attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeRight multiplier:1.0 constant:0];
[self addConstraint:titleLabelWidth];
NSLayoutConstraint *titleLabelHeight = [NSLayoutConstraint constraintWithItem:titleLabel attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:45];
[self addConstraint:titleLabelHeight];
_titleLabel = titleLabel;
self.detailView.backgroundColor = [UIColor whiteColor];
UILabel *classifyLabel = [[UILabel alloc] init];
classifyLabel.translatesAutoresizingMaskIntoConstraints = NO;
classifyLabel.textColor = kAnnounceTextColor;
classifyLabel.backgroundColor = [UIColor clearColor];
classifyLabel.font = [UIFont systemFontOfSize:15.0];
classifyLabel.text = @"分类项目";
[self addSubview:classifyLabel];
NSLayoutConstraint *classifyTop = [NSLayoutConstraint constraintWithItem:classifyLabel attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeTop multiplier:1.0 constant:245];
[self addConstraint:classifyTop];
NSLayoutConstraint *classifyLeft = [NSLayoutConstraint constraintWithItem:classifyLabel attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeLeft multiplier:1.0 constant:20];
[self addConstraint:classifyLeft];
NSLayoutConstraint *classifyHeight = [NSLayoutConstraint constraintWithItem:classifyLabel attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:39];
[self addConstraint:classifyHeight];
}
- (void)setTaskDetail:(TaskDetailModel *)taskDetail
{
_taskDetail = taskDetail;
self.titleLabel.text = [NSString stringWithFormat:@"%@", taskDetail.name];
self.detailView.shopnameLabel.text = [NSString stringWithFormat:@"%@", taskDetail.store_name];
self.detailView.startDateLabel.text = [NSString stringWithFormat:@"%@", taskDetail.beginDate];
self.detailView.overDateLabel.text = [NSString stringWithFormat:@"%@", taskDetail.endDate];
if (taskDetail.questionCount == 0 || taskDetail.reportCount == 0) {
self.detailView.multiplier = 0;
} else {
self.detailView.multiplier = (CGFloat)taskDetail.reportCount / taskDetail.questionCount;
}
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"yyyy-MM-dd"];
// 当前时间
NSDate *date = [NSDate date];
NSString *strDate = [dateFormatter stringFromDate:date];
NSDate *today = [dateFormatter dateFromString:strDate];
NSLog(@"today = %@", today);
// endTime
NSDate *endTime = [dateFormatter dateFromString:[NSString stringWithFormat:@"%@", taskDetail.endDate]];
NSLog(@"endTime = %@", endTime);
NSCalendar *cal = [NSCalendar currentCalendar];
unsigned int unitFlags = NSYearCalendarUnit | NSMonthCalendarUnit | NSDayCalendarUnit;
NSDateComponents *d = [cal components:unitFlags fromDate:today toDate:endTime options:0];
if (d.day > 0) {
self.detailView.dayLabel.text = [NSString stringWithFormat:@"%ld", (long)d.day];
} else {
self.detailView.dayLabel.text = @"0";
}
if ([taskDetail.state isEqualToString:@"initial"]) {
if (taskDetail.reportCount == 0 || taskDetail.questionCount == 0) {
self.detailView.progressLabel.text = @"0%";
} else {
self.detailView.progressLabel.text = [NSString stringWithFormat:@"未处理 %.0f%%", (CGFloat)taskDetail.reportCount / taskDetail.questionCount * 100];
}
self.detailView.progressLabel.textColor = kProgressUnSettledColor;
self.detailView.alreadyLabel.textColor = kProgressUnSettledColor;
self.detailView.allLabel.textColor = kProgressUnSettledColor;
} else if ([taskDetail.state isEqualToString:@"processing"]) {
self.detailView.progressLabel.text = [NSString stringWithFormat:@"进行中 %.0f%%", (CGFloat)taskDetail.reportCount / taskDetail.questionCount * 100];
self.detailView.progressLabel.textColor = kProgressDealWithColor;
self.detailView.alreadyLabel.textColor = kProgressDealWithColor;
self.detailView.allLabel.textColor = kProgressDealWithColor;
} else if ([taskDetail.state isEqualToString:@"reported"]) {
self.detailView.progressLabel.text = [NSString stringWithFormat:@"已上报 %.0f%%", (CGFloat)taskDetail.reportCount / taskDetail.questionCount * 100];
self.detailView.progressLabel.textColor = kProgressDealWithColor;
self.detailView.alreadyLabel.textColor = kProgressDealWithColor;
self.detailView.allLabel.textColor = kProgressDealWithColor;
} else if ([taskDetail.state isEqualToString:@"finished"]) {
self.detailView.progressLabel.text = [NSString stringWithFormat:@"已评分 %.0f%%", (CGFloat)taskDetail.reportCount / taskDetail.questionCount * 100];
self.detailView.progressLabel.textColor = kProgressDealWithColor;
self.detailView.alreadyLabel.textColor = kProgressDealWithColor;
self.detailView.allLabel.textColor = kProgressDealWithColor;
} else if ([taskDetail.state isEqualToString:@"published"]) {
self.detailView.progressLabel.text = [NSString stringWithFormat:@"已发布 %.0f%%", (CGFloat)taskDetail.reportCount / taskDetail.questionCount * 100];
self.detailView.progressLabel.textColor = kProgressDealWithColor;
self.detailView.alreadyLabel.textColor = kProgressDealWithColor;
self.detailView.allLabel.textColor = kProgressDealWithColor;
} else {
self.detailView.progressLabel.text = [NSString stringWithFormat:@"已过期 %.0f%%", (CGFloat)taskDetail.reportCount / taskDetail.questionCount * 100];
self.detailView.progressLabel.textColor = kProgressOverDueColor;
self.detailView.alreadyLabel.textColor = kProgressOverDueColor;
self.detailView.allLabel.textColor = kProgressOverDueColor;
}
self.detailView.allView.backgroundColor = kProgressViewAllBackColor;
self.detailView.alreadyView.backgroundColor = kProgressViewAlreadyBackColor;
self.detailView.alreadyLabel.text = [NSString stringWithFormat:@"%d", taskDetail.reportCount];
self.detailView.allLabel.text = [NSString stringWithFormat:@"/%d", taskDetail.questionCount];
}
- (InspectDetailView *)detailView
{
if (!_detailView) {
_detailView = [[InspectDetailView alloc] init];
_detailView.translatesAutoresizingMaskIntoConstraints = NO;
[self addSubview:_detailView];
NSLayoutConstraint *titleLabelTop = [NSLayoutConstraint constraintWithItem:_detailView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeTop multiplier:1.0 constant:45];
[self addConstraint:titleLabelTop];
NSLayoutConstraint *titleLabelLeft = [NSLayoutConstraint constraintWithItem:_detailView attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeLeft multiplier:1.0 constant:0];
[self addConstraint:titleLabelLeft];
NSLayoutConstraint *titleLabelWidth = [NSLayoutConstraint constraintWithItem:_detailView attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeRight multiplier:1.0 constant:0];
[self addConstraint:titleLabelWidth];
NSLayoutConstraint *titleLabelHeight = [NSLayoutConstraint constraintWithItem:_detailView attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:200];
[self addConstraint:titleLabelHeight];
}
return _detailView;
}
@end
......@@ -7,11 +7,8 @@
//
#import "InspectTaskViewController.h"
#import "InspectDetailView.h"
#import "InspectSortTableCell.h"
#import "InspectDetailHeaderView.h"
#import "TaskGroup.h"
#import "TaskModel.h"
#import "InspectHeaderView.h"
......@@ -26,12 +23,17 @@
#define kTaskSortCell @"InspectTaskSortCell"
#import "InspectTaskDetailCell.h"
#define kTaskDetailCell @"inspectTaskDetailCell"
#import "InspectTitleTableViewCell.h"
#define kTAskTitleCell @"inspectTitleTaViewCell"
@interface InspectTaskViewController () <UITableViewDelegate, UITableViewDataSource, InspectHeaderDelegate>
@property (nonatomic, strong) UITableView *tableView;
@property (nonatomic, strong) NSArray *taskData;
@property (nonatomic, strong) InspectDetailHeaderView *detailHeaderView;
@property (nonatomic, assign) BOOL isOpen;
@property (nonatomic, strong) TaskDetailModel *taskDetail;
@end
......@@ -64,7 +66,6 @@
self.navigationItem.leftBarButtonItem = backItem;
UILabel *customLab = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 40, 30)];
[customLab setTextColor:[UIColor whiteColor]];
[customLab setText:@"口碑巡检任务"];
......@@ -74,6 +75,7 @@
// 口碑巡检明细
[self requestRankingDetail];
_isOpen = NO;
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(requestCurrentList)
......@@ -101,13 +103,11 @@
NSString *url = [NSString stringWithFormat:@"%@%@%@/%@",kRedStarURL, kInspectDetailURL, self.uuid, self.store_uuid];
HttpClient *httpClient = [[HttpClient alloc] initWithUrl:url];
__block InspectTaskViewController *weakSelf = self;
[MBProgressHUD showHUDAddedTo:self.view animated:YES];
[httpClient getPraiseDetailWithParameters:nil completion:^(id response, NSError *error) {
NSLog(@"口碑巡检明细PraiseDetail = %@", response);
NSDictionary *dataDict = response[@"data"];
TaskDetailModel *taskDetail = [TaskDetailModel taskDetailModelWithDict:dataDict];
weakSelf.detailHeaderView.taskDetail = taskDetail;
_taskDetail = taskDetail;
NSArray *dataArray = dataDict[@"categories"];
......@@ -138,14 +138,12 @@
NSLog(@"url = %@", url);
HttpClient *httpClient = [[HttpClient alloc] initWithUrl:url];
__block InspectTaskViewController *weakSelf = self;
[MBProgressHUD showHUDAddedTo:self.view animated:YES];
[httpClient getPraiseDetailWithParameters:nil completion:^(id response, NSError *error) {
NSLog(@"口碑巡检明细PraiseDetail = %@", response);
NSLog(@"error = %@", error);
NSDictionary *dataDict = response[@"data"];
TaskDetailModel *taskDetail = [TaskDetailModel taskDetailModelWithDict:dataDict];
weakSelf.detailHeaderView.taskDetail = taskDetail;
_taskDetail = taskDetail;
NSArray *dataArray = dataDict[@"categories"];
......@@ -167,30 +165,69 @@
}];
}
- (void)unfoldCilck:(UIButton *)sender
{
_isOpen = !_isOpen;
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:0 inSection:0];
[self.tableView reloadRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];
}
#pragma mark - TableView Delegate/DataSource
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return _taskData.count;
return _taskData.count + 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
TaskGroup *taskGroup = _taskData[section];
if (section == 0) {
return 2;
} else {
TaskGroup *taskGroup = _taskData[section - 1];
NSInteger count = taskGroup.isOpened ? taskGroup.answers.count : 0;
return count;
}
}
// cell显示的内容
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
if (indexPath.section == 0) {
if (indexPath.row == 0) {
InspectTaskDetailCell *cell=[tableView dequeueReusableCellWithIdentifier:kTaskDetailCell];
if (!cell) {
cell = [[InspectTaskDetailCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:kTaskDetailCell];
}
cell.taskDetail = _taskDetail;
cell.selectionStyle = UITableViewCellSelectionStyleNone;
[cell.unfoldBtn addTarget:self action:@selector(unfoldCilck:) forControlEvents:UIControlEventTouchUpInside];
if (_isOpen) {
cell.introDetailLabel.text = [NSString stringWithFormat:@"%@", _taskDetail.remark];
} else {
cell.introDetailLabel.text = @"";
}
return cell;
} else {
InspectTitleTableViewCell *cell=[tableView dequeueReusableCellWithIdentifier:kTAskTitleCell];
if (!cell) {
cell = [[InspectTitleTableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:kTAskTitleCell];
}
cell.selectionStyle = UITableViewCellSelectionStyleNone;
return cell;
}
} else {
InspectSortTableCell *cell=[tableView dequeueReusableCellWithIdentifier:kTaskSortCell];
if (!cell) {
cell = [[InspectSortTableCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:kTaskSortCell];
}
TaskGroup *taskGroup = _taskData[indexPath.section];
TaskGroup *taskGroup = _taskData[indexPath.section - 1];
TaskModel *task = taskGroup.answers[indexPath.row];
cell.task = task;
......@@ -199,12 +236,17 @@
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
return cell;
}
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
TaskGroup *taskGroup = _taskData[indexPath.section];
if (indexPath.section == 0) {
return;
} else {
TaskGroup *taskGroup = _taskData[indexPath.section - 1];
TaskModel *task = taskGroup.answers[indexPath.row];
if (task.state == 0) {
......@@ -230,17 +272,16 @@
inspectVC.taskModel = task;
[self.navigationController pushViewController:inspectVC animated:YES];
}
}
// cell的高度
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
return 44;
}
}
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
if (section == 0) {
return 0;
} else {
return 50;
}
}
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
......@@ -251,10 +292,14 @@
// 自定义section
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
if (section == 0) {
return nil;
} else {
InspectHeaderView *headView = [InspectHeaderView headViewWithTableView:tableView];
headView.delegate = self;
headView.taskGroup = _taskData[section];
headView.taskGroup = _taskData[section - 1];
return headView;
}
}
- (void)clickHeadView
......@@ -270,10 +315,15 @@
_tableView.showsVerticalScrollIndicator = NO;
_tableView.showsHorizontalScrollIndicator = NO;
[_tableView registerClass:[InspectSortTableCell class] forCellReuseIdentifier:kTaskSortCell];
_tableView.tableHeaderView = self.detailHeaderView;
[_tableView registerClass:[InspectTaskDetailCell class] forCellReuseIdentifier:kTaskDetailCell];
[_tableView registerClass:[InspectTitleTableViewCell class] forCellReuseIdentifier:kTAskTitleCell];
_tableView.rowHeight = UITableViewAutomaticDimension;
_tableView.estimatedRowHeight = 150.0;
[self.view addSubview:_tableView];
NSLayoutConstraint *tableTop = [NSLayoutConstraint constraintWithItem:_tableView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeTop multiplier:1.0 constant:0];
NSLayoutConstraint *tableTop = [NSLayoutConstraint constraintWithItem:_tableView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeTop multiplier:1.0 constant:-35];
[self.view addConstraint:tableTop];
NSLayoutConstraint *tableLeft = [NSLayoutConstraint constraintWithItem:_tableView attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeLeft multiplier:1.0 constant:0];
......@@ -288,22 +338,4 @@
return _tableView;
}
- (InspectDetailHeaderView *)detailHeaderView
{
if (!_detailHeaderView) {
_detailHeaderView = [[InspectDetailHeaderView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, 285)];
}
return _detailHeaderView;
}
/*
#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
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