Skip to content

Commit 12e31ed

Browse files
张达棣张达棣
authored andcommitted
更新新接口
1 parent c74c062 commit 12e31ed

15 files changed

Lines changed: 135 additions & 45 deletions

File tree

Coding_iOS/Controllers/RootControllers/MyTask_RootViewController.m

Lines changed: 59 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ @interface MyTask_RootViewController ()
3232
@property (nonatomic, strong) NSString *label; //任务标签
3333
@property (nonatomic, strong) NSString *project_id;
3434
@property (nonatomic, strong) NSString *owner, *watcher, *creator;
35+
@property (nonatomic, assign) TaskRoleType role;
3536
@end
3637

3738
@implementation MyTask_RootViewController
@@ -89,10 +90,12 @@ - (void)viewDidLoad
8990
_owner = [Login curLoginUser].id.stringValue;
9091

9192
//初始化过滤目录
92-
_myFliterMenu = [[TaskSelectionView alloc] initWithFrame:CGRectMake(0, 64, kScreen_Width, kScreen_Height - 64) items:@[@"我的任务", @"我关注的", @"我创建的"]];
93+
_myFliterMenu = [[TaskSelectionView alloc] initWithFrame:CGRectMake(0, 64, kScreen_Width, kScreen_Height - 64) items:@[@"我的任务(0)", @"我关注的(0)", @"我创建的(0)"]];
9394
__weak typeof(self) weakSelf = self;
9495
_myFliterMenu.clickBlock = ^(NSInteger pageIndex){
95-
[weakSelf.titleBtn setTitle:weakSelf.myFliterMenu.items[pageIndex] forState:UIControlStateNormal];
96+
_role = pageIndex;
97+
NSString *title = weakSelf.myFliterMenu.items[pageIndex];
98+
[weakSelf.titleBtn setTitle:[title substringToIndex:4] forState:UIControlStateNormal];
9699
weakSelf.owner = weakSelf.watcher = weakSelf.creator = nil;
97100
if (pageIndex == 0) {
98101
weakSelf.owner = [Login curLoginUser].id.stringValue;
@@ -106,13 +109,18 @@ - (void)viewDidLoad
106109
ProjectTaskListView *listView = (ProjectTaskListView *)weakSelf.myCarousel.currentItemView;
107110
[weakSelf assignmentWithlistView:listView];
108111
[listView refresh];
112+
[weakSelf resetTaskCount];
113+
[weakSelf loadTasksLabels];
109114

110115
};
111116
_myFliterMenu.closeBlock=^(){
112117
[weakSelf.myFliterMenu dismissMenu];
113118
};
114119

115120
_screenView = [ScreenView creat];
121+
weakSelf.screenView.tastArray = @[[NSString stringWithFormat:@"进行中的(0)"],
122+
[NSString stringWithFormat:@"已完成的(0)"]
123+
];
116124
_screenView.selectBlock = ^(NSString *keyword, NSString *status, NSString *label) {
117125
[((UIButton *)screenBar.customView) setImage:[UIImage imageNamed:@"a1-hasScreen"] forState:UIControlStateNormal];
118126
weakSelf.keyword = keyword;
@@ -127,10 +135,10 @@ - (void)viewDidLoad
127135
[listView refresh];
128136

129137
};
130-
131-
132138
}
133139

140+
141+
134142
- (void)addItemClicked:(id)sender{
135143
EditTaskViewController *vc = [EditTaskViewController new];
136144

@@ -143,6 +151,7 @@ - (void)addItemClicked:(id)sender{
143151
}
144152

145153
- (void)screenItemClicked:(UIBarButtonItem *)sender {
154+
[_myFliterMenu dismissMenu];
146155
[_screenView showOrHide];
147156
}
148157

@@ -155,6 +164,9 @@ - (void)didReceiveMemoryWarning
155164
- (void)viewWillAppear:(BOOL)animated{
156165
[super viewWillAppear:animated];
157166
[self resetCurView];
167+
[self resetTaskCount];
168+
[self loadTasksLabels];
169+
158170
}
159171

160172

@@ -169,6 +181,49 @@ - (void)resetCurView{
169181
}
170182
}
171183

184+
- (void)resetTaskCount {
185+
__weak typeof(self) weakSelf = self;
186+
[[Coding_NetAPIManager sharedManager] request_tasks_countAndBlock:^(id data, NSError *error) {
187+
NSInteger processing = [data[@"data"][@"processing"] integerValue];
188+
NSInteger done = [data[@"data"][@"done"] integerValue];
189+
190+
NSInteger watchAll = [data[@"data"][@"watchAll"] integerValue];
191+
NSInteger watchAllProcessing = [data[@"data"][@"watchAllProcessing"] integerValue];
192+
193+
NSInteger create = [data[@"data"][@"create"] integerValue];
194+
NSInteger createProcessing = [data[@"data"][@"createProcessing"] integerValue];
195+
196+
197+
weakSelf.myFliterMenu.items = @[[NSString stringWithFormat:@"我的任务(%ld", processing + done],
198+
[NSString stringWithFormat:@"我关注的(%ld", watchAll],
199+
[NSString stringWithFormat:@"我创建的(%ld", create]
200+
];
201+
if (weakSelf.role == TaskRoleTypeWatcher) {
202+
processing = watchAllProcessing;
203+
done = watchAll - processing;
204+
}
205+
206+
if (weakSelf.role == TaskRoleTypeCreator) {
207+
processing = createProcessing;
208+
done = create - processing;
209+
}
210+
211+
weakSelf.screenView.tastArray = @[[NSString stringWithFormat:@"进行中的(%ld", processing],
212+
[NSString stringWithFormat:@"已完成的(%ld", done]
213+
];
214+
}];
215+
216+
}
217+
218+
- (void)loadTasksLabels {
219+
__weak typeof(self) weakSelf = self;
220+
[[Coding_NetAPIManager sharedManager] request_projects_tasks_labelsWithRole:_role andBlock:^(id data, NSError *error) {
221+
if (data != nil) {
222+
weakSelf.screenView.labels = data[@"data"];
223+
}
224+
}];
225+
}
226+
172227
- (void)configSegmentControlWithData:(Projects *)freshProjects {
173228

174229
BOOL dataHasChanged = NO;
@@ -236,10 +291,6 @@ - (UIView *)carousel:(iCarousel *)carousel viewForItemAtIndex:(NSUInteger)index
236291
};
237292
[weakSelf.navigationController pushViewController:vc animated:YES];
238293
} tabBarHeight:CGRectGetHeight(self.rdv_tabBarController.tabBar.frame)];
239-
listView.taskcountBlock = ^(NSInteger processingCount, NSInteger doneListCount) {
240-
weakSelf.screenView.processingCount = processingCount;
241-
weakSelf.screenView.doneListCount = doneListCount;
242-
};
243294
}
244295
[listView setSubScrollsToTop:(index == carousel.currentItemIndex)];
245296
return listView;
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"images" : [
3+
{
4+
"idiom" : "universal",
5+
"scale" : "1x"
6+
},
7+
{
8+
"idiom" : "universal",
9+
"filename" : "select@2x.png",
10+
"scale" : "2x"
11+
},
12+
{
13+
"idiom" : "universal",
14+
"filename" : "select@3x.png",
15+
"scale" : "3x"
16+
}
17+
],
18+
"info" : {
19+
"version" : 1,
20+
"author" : "xcode"
21+
}
22+
}
788 Bytes
Loading
1.03 KB
Loading

Coding_iOS/Models/Tasks.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,14 @@ typedef NS_ENUM(NSInteger, TaskEntranceType){
2020
TaskEntranceTypeMine,
2121
};
2222

23+
typedef NS_ENUM(NSInteger, TaskRoleType)
24+
{
25+
TaskRoleTypeOwner = 0, //执行者
26+
TaskRoleTypeWatcher, //关注者
27+
TaskRoleTypeCreator, //创建者
28+
TaskRoleTypeAll, //全部
29+
};
30+
2331
@interface Tasks : NSObject
2432

2533
@property (readwrite, nonatomic, strong) NSNumber *page, *pageSize, *totalPage, *totalRow;

Coding_iOS/Util/Manager/Coding_NetAPIManager.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,8 +164,10 @@ typedef NS_ENUM(NSInteger, PurposeType) {
164164
- (void)request_DoCommentToTask:(Task *)task andBlock:(void (^)(id data, NSError *error))block;
165165
- (void)request_DeleteComment:(TaskComment *)comment ofTask:(Task *)task andBlock:(void (^)(id data, NSError *error))block;
166166
- (void)request_ChangeWatcher:(User *)watcher ofTask:(Task *)task andBlock:(void (^)(id data, NSError *error))block;
167-
- (void)request_Search_filtersAndBlock:(void (^)(id data, NSError *error))block; //任务标签
167+
- (void)request_projects_tasks_labelsWithRole:(TaskRoleType)role andBlock:(void (^)(id data, NSError *error))block; //任务标签
168168
- (void)request_tasks_searchWithOwner:(NSString *)owner watcher:(NSString *)watcher creator:(NSString *)creator project_id:(NSString *)project_id keyword:(NSString *)keyword status:(NSString *)status label:(NSString *)label page:(NSInteger)page andBlock:(void (^)(id data, NSError *error))block;
169+
- (void)request_tasks_countAndBlock:(void (^)(id data, NSError *error))block;
170+
169171

170172

171173
#pragma mark - User

Coding_iOS/Util/Manager/Coding_NetAPIManager.m

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1472,8 +1472,13 @@ - (void)request_ChangeWatcher:(User *)watcher ofTask:(Task *)task andBlock:(void
14721472
}];
14731473
}
14741474

1475-
- (void)request_Search_filtersAndBlock:(void (^)(id data, NSError *error))block {
1476-
[[CodingNetAPIClient sharedJsonClient] requestJsonDataWithPath:@"api/v2/tasks/search_filters" withParams:nil withMethodType:Get andBlock:^(id data, NSError *error) {
1475+
- (void)request_projects_tasks_labelsWithRole:(TaskRoleType)role andBlock:(void (^)(id data, NSError *error))block {
1476+
NSArray *roleArray = @[@"owner", @"watcher", @"creator"];
1477+
if (role >= roleArray.count) {
1478+
return;
1479+
}
1480+
1481+
[[CodingNetAPIClient sharedJsonClient] requestJsonDataWithPath:@"api/projects/tasks/labels" withParams:@{@"role": roleArray[role]} withMethodType:Get andBlock:^(id data, NSError *error) {
14771482
if (data) {
14781483
block(data, nil);
14791484
}else{
@@ -1524,6 +1529,16 @@ - (void)request_tasks_searchWithOwner:(NSString *)owner watcher:(NSString *)watc
15241529
}];
15251530
}
15261531

1532+
- (void)request_tasks_countAndBlock:(void (^)(id data, NSError *error))block {
1533+
[[CodingNetAPIClient sharedJsonClient] requestJsonDataWithPath:@"/api/tasks/count" withParams:nil withMethodType:Get andBlock:^(id data, NSError *error) {
1534+
if (data) {
1535+
block(data, nil);
1536+
}else{
1537+
block(nil, error);
1538+
}
1539+
}];
1540+
}
1541+
15271542
#pragma mark User
15281543
- (void)request_AddUser:(User *)user ToProject:(Project *)project andBlock:(void (^)(id data, NSError *error))block{
15291544
// 一次添加多个成员(逗号分隔):users=102,4 (以后只支持 gk,不支持 id 了)

Coding_iOS/Views/Cell/ScreenCell.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,10 @@ - (void)creatView {
4747
_tagButton.sd_layout.leftSpaceToView(self.contentView, 20).centerYEqualToView(self.contentView).widthIs(15).heightIs(15);
4848

4949
_selImageView = [[UIImageView alloc] init];
50-
_selImageView.image = [UIImage imageNamed:@"location_checkmark"];
50+
_selImageView.image = [UIImage imageNamed:@"a1-select"];
5151
[self.contentView addSubview:_selImageView];
5252
_selImageView.hidden = YES;
53-
_selImageView.sd_layout.rightSpaceToView(self.contentView, 20).centerYEqualToView(self.contentView).widthIs(14).heightIs(11);
53+
_selImageView.sd_layout.rightSpaceToView(self.contentView, 20).centerYEqualToView(self.contentView).widthIs(20).heightIs(21);
5454

5555
_titleLab=[[UILabel alloc] init];
5656
_titleLab.font=[UIFont systemFontOfSize:15];

Coding_iOS/Views/Cell/TaskSelectionCell.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,6 @@
1313
@property (nonatomic, strong) NSString *title;
1414
@property (nonatomic, assign) BOOL isSel;
1515
@property (nonatomic, assign) BOOL isShowLine;
16+
@property (nonatomic, strong) UIImageView *selImageView;
17+
1618
@end

Coding_iOS/Views/Cell/TaskSelectionCell.m

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
@interface TaskSelectionCell ()
1212
@property (nonatomic, strong) UILabel *titleLab;
13-
@property (nonatomic, strong) UIImageView *selImageView;
1413
@property (nonatomic, strong) UILabel *line;
1514
@end
1615

@@ -45,10 +44,10 @@ - (void)creatView {
4544
_titleLab.sd_layout.leftSpaceToView(self.contentView, 20).topSpaceToView(self.contentView, 0).bottomSpaceToView(self.contentView, 0).widthIs(200);
4645

4746
_selImageView = [[UIImageView alloc] init];
48-
_selImageView.image = [UIImage imageNamed:@"location_checkmark"];
47+
_selImageView.image = [UIImage imageNamed:@"a1-select"];
4948
[self.contentView addSubview:_selImageView];
5049
_selImageView.hidden = YES;
51-
_selImageView.sd_layout.rightSpaceToView(self.contentView, 20).centerYEqualToView(self.contentView).widthIs(14).heightIs(11);
50+
_selImageView.sd_layout.rightSpaceToView(self.contentView, 20).centerYEqualToView(self.contentView).widthIs(20).heightIs(21);
5251

5352
_line = [[UILabel alloc] init];
5453
_line.backgroundColor = [UIColor colorWithRGBHex:0xdddddd];

0 commit comments

Comments
 (0)