Skip to content

Commit 2b7f0bc

Browse files
committed
任务筛选~
1 parent 49010ed commit 2b7f0bc

4 files changed

Lines changed: 39 additions & 35 deletions

File tree

Coding_iOS/Controllers/AllSearchDisplayVC.m

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ - (void)setActive:(BOOL)visible animated:(BOOL)animated {
130130
[self initSearchHistoryView];
131131
}
132132

133+
133134
[self.parentVC.view addSubview:_backgroundView];
134135
[self.parentVC.view addSubview:_contentView];
135136
[self.parentVC.view bringSubviewToFront:_contentView];
@@ -328,7 +329,13 @@ - (void)goToUserInfo:(User *)user{
328329
[self.parentVC.navigationController pushViewController:vc animated:YES];
329330
}
330331

332+
- (void)goToTask:(Task*)curTask{
333+
NSString *path=[NSString stringWithFormat:@"%@/task/%@",curTask.project.project_path,curTask.id];
334+
UIViewController *vc = [BaseViewController analyseVCFromLinkStr:path];
335+
[self.parentVC.navigationController pushViewController:vc animated:YES];
336+
331337

338+
}
332339

333340
#pragma mark -
334341
#pragma mark Search Data Request
@@ -567,7 +574,7 @@ - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPa
567574
}else if(_curSearchType==eSearchType_User){
568575
return kUserSearchCellHeight;
569576
}else if(_curSearchType==eSearchType_Task){
570-
return [TaskSearchCell cellHeightWithObj:[_dateSource objectAtIndex:indexPath.row]];
577+
return kTaskSearchCellHeight;
571578
}else{
572579
return 100;
573580
}
@@ -584,6 +591,8 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath
584591
[self goToFileVC:_dateSource[indexPath.row]];
585592
}else if (_curSearchType==eSearchType_User){
586593
[self goToUserInfo:_dateSource[indexPath.row]];
594+
}else if (_curSearchType==eSearchType_Task){
595+
[self goToTask:_dateSource[indexPath.row]];
587596
}
588597
}
589598

Coding_iOS/Models/Task.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ typedef NS_ENUM(NSInteger, TaskHandleType) {
2828
@property (readwrite, nonatomic, strong) NSDate *created_at, *updated_at;
2929
@property (readonly, nonatomic, strong) NSDate *deadline_date;
3030
@property (readwrite, nonatomic, strong) Project *project;
31-
@property (readwrite, nonatomic, strong) NSNumber *id, *status, *owner_id, *priority, *comments, *has_description, *number;
31+
@property (readwrite, nonatomic, strong) NSNumber *id, *status, *owner_id, *priority, *comments, *has_description, *number,*resource_id;
3232
@property (readwrite, nonatomic, strong) NSDictionary *propertyArrayMap;
3333
@property (readwrite, nonatomic, strong) NSMutableArray *activityList, *labels;
3434
@property (nonatomic, assign) TaskHandleType handleType;

Coding_iOS/Views/Cell/TaskSearchCell.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,12 @@
66
// Copyright © 2015年 Coding. All rights reserved.
77
//
88

9+
#define kTaskSearchCellHeight 126
10+
911
#import <UIKit/UIKit.h>
1012
#import "Task.h"
1113

1214
@interface TaskSearchCell : UITableViewCell
1315
@property (strong, nonatomic) Task *task;
14-
@property (copy, nonatomic) void(^checkViewClickedBlock)(Task *task);
1516
+ (CGFloat)cellHeightWithObj:(id)obj;
1617
@end

Coding_iOS/Views/Cell/TaskSearchCell.m

Lines changed: 26 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
#define kProjectTaskListViewCell_LeftPading 93.0
1010
#define kProjectTaskListViewCell_RightPading 10.0
11-
#define kProjectTaskListViewCell_UserIconWidth 33.0
11+
#define kProjectTaskListViewCell_UserIconWidth 40.0
1212
#define kProjectTaskListViewCell_UpDownPading 10.0
1313
#define kProjectTaskListViewCell_MaxContentHeight 20.0
1414
#define kProjectTaskListViewCell_ContentWidth (kScreen_Width - kProjectTaskListViewCell_LeftPading - kProjectTaskListViewCell_RightPading)
@@ -22,8 +22,8 @@
2222
#import "NSString+Attribute.h"
2323

2424
@interface TaskSearchCell ()
25-
@property (strong, nonatomic) UIImageView *userIconView, *commentIconView, *timeClockIconView, *mdIconView, *taskPriorityView;
26-
@property (strong, nonatomic) UILabel *contentLabel, *userNameLabel, *timeLabel, *commentCountLabel, *mdLabel, *numLabel;
25+
@property (strong, nonatomic) UIImageView *userIconView, *commentIconView, *timeClockIconView, *mdIconView;
26+
@property (strong, nonatomic) UILabel *contentLabel, *userNameLabel, *timeLabel, *commentCountLabel, *mdLabel, *numLabel,*describeLabe;;
2727
@end
2828

2929

@@ -41,17 +41,22 @@ - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reus
4141
[_userIconView doCircleFrame];
4242
[self.contentView addSubview:_userIconView];
4343
}
44-
if (!_taskPriorityView) {
45-
_taskPriorityView = [UIImageView new];
46-
_taskPriorityView.contentMode = UIViewContentModeScaleAspectFit;
47-
[self.contentView addSubview:_taskPriorityView];
48-
}
44+
4945
if (!_contentLabel) {
5046
_contentLabel = [UILabel new];
5147
_contentLabel.textColor = [UIColor colorWithHexString:@"0x222222"];
5248
_contentLabel.font = kProjectTaskListViewCell_ContentFont;
5349
[self.contentView addSubview:_contentLabel];
5450
}
51+
52+
if (!_describeLabe) {
53+
_describeLabe = [UILabel new];
54+
_describeLabe.textColor = [UIColor colorWithHexString:@"0x666666"];
55+
_describeLabe.font = kProjectTaskListViewCell_ContentFont;
56+
_describeLabe.numberOfLines=2;
57+
[self.contentView addSubview:_describeLabe];
58+
}
59+
5560
if (!_numLabel) {
5661
_numLabel = [UILabel new];
5762
_numLabel.font = [UIFont systemFontOfSize:10];
@@ -101,21 +106,24 @@ - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reus
101106

102107
[_userIconView mas_makeConstraints:^(MASConstraintMaker *make) {
103108
make.left.equalTo(self.contentView).offset(kPaddingLeftWidth);
104-
make.centerY.equalTo(self.contentView);
109+
make.top.equalTo(self.contentView).offset(19);
105110
make.size.mas_equalTo(CGSizeMake(kProjectTaskListViewCell_UserIconWidth,
106111
kProjectTaskListViewCell_UserIconWidth));
107112
}];
108-
[_taskPriorityView mas_makeConstraints:^(MASConstraintMaker *make) {
109-
make.top.equalTo(self.contentView).offset(10);
110-
make.left.equalTo(self.userIconView.mas_right).offset(10);
111-
make.size.mas_equalTo(CGSizeMake(17, 17));
112-
}];
113+
113114
[_contentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
114-
make.centerY.equalTo(self.taskPriorityView);
115-
make.left.equalTo(self.taskPriorityView.mas_right).offset(10);
115+
make.top.equalTo(self.contentView).offset(19-3);
116+
make.left.equalTo(self.userIconView.mas_right).offset(10);
116117
make.right.equalTo(self.contentView).offset(-kPaddingLeftWidth);
117118
make.height.mas_equalTo(20);
118119
}];
120+
121+
[_describeLabe mas_makeConstraints:^(MASConstraintMaker *make) {
122+
make.top.equalTo(self.contentLabel.mas_bottom).offset(10);
123+
make.left.equalTo(self.userIconView.mas_right).offset(10);
124+
make.right.equalTo(self.contentView).offset(-kPaddingLeftWidth);
125+
make.height.mas_equalTo(40);
126+
}];
119127

120128
[_numLabel mas_makeConstraints:^(MASConstraintMaker *make) {
121129
make.bottom.equalTo(self.contentView).offset(-10);
@@ -168,32 +176,18 @@ - (void)layoutSubviews{
168176
return;
169177
}
170178
[_userIconView sd_setImageWithURL:[_task.owner.avatar urlImageWithCodePathResize:2*kProjectTaskListViewCell_UserIconWidth] placeholderImage:kPlaceholderMonkeyRoundWidth(kProjectTaskListViewCell_UserIconWidth)];
171-
[_taskPriorityView setImage:[UIImage imageNamed:[NSString stringWithFormat:@"taskPriority%@_small", _task.priority.stringValue]]];
172-
_contentLabel.textColor = [UIColor colorWithHexString:_task.status.integerValue == 1? @"0x222222" : @"0x999999"];
173179

174180
_contentLabel.attributedText=[NSString getAttributeFromText:[_task.content stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]] emphasizeTag:@"em" emphasizeColor:[UIColor colorWithHexString:@"0xE84D60"]];
175181

176182
// _contentLabel.text = [_task.content stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
177183
//Bottom
178-
_numLabel.text = [NSString stringWithFormat:@"#%@", _task.number.stringValue];
184+
_numLabel.text = [NSString stringWithFormat:@"#%@", _task.resource_id.stringValue];
179185
_userNameLabel.text = _task.creator.name;
180186
_timeLabel.text = [_task.created_at stringDisplay_MMdd];
181187
_commentCountLabel.text = _task.comments.stringValue;
182188
_mdIconView.hidden = _mdLabel.hidden = !_task.has_description.boolValue;
189+
_describeLabe.text=_task.description_mine;
183190
}
184191

185-
+ (CGFloat)cellHeightWithObj:(id)obj{
186-
CGFloat cellHeight = 0;
187-
if ([obj isKindOfClass:[Task class]]) {
188-
Task *task = (Task *)obj;
189-
if (task.deadline_date || task.labels.count > 0) {
190-
cellHeight = 95;
191-
}else{
192-
cellHeight = 60;
193-
}
194-
}
195-
return cellHeight;
196-
}
197192
@end
198193

199-

0 commit comments

Comments
 (0)