Skip to content

Commit faa879f

Browse files
committed
上传数据接口
1 parent 38e49fd commit faa879f

File tree

5 files changed

+120
-3
lines changed

5 files changed

+120
-3
lines changed

Coding_iOS/Controllers/RootControllers/MyTask_RootViewController.m

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@ @interface MyTask_RootViewController ()
2828
@property (nonatomic, strong) TaskSelectionView *myFliterMenu;
2929
@property (nonatomic, strong) ScreenView *screenView;
3030

31+
@property (nonatomic, strong) NSString *keyword;
32+
@property (nonatomic, strong) NSString *status; //任务状态,进行中的为1,已完成的为2
33+
@property (nonatomic, strong) NSString *label; //任务标签
34+
35+
3136
@end
3237

3338
@implementation MyTask_RootViewController
@@ -93,7 +98,15 @@ - (void)viewDidLoad
9398
[weakSelf.myFliterMenu dismissMenu];
9499
};
95100

101+
96102
_screenView = [ScreenView creat];
103+
_screenView.selectBlock = ^(NSString *keyword, NSString *status, NSString *label) {
104+
screenBar.image = [UIImage imageNamed:@"a1-已筛"];
105+
weakSelf.keyword = keyword;
106+
weakSelf.status = status;
107+
weakSelf.label = label;
108+
[weakSelf resetSearView];
109+
};
97110

98111

99112
}
@@ -136,6 +149,16 @@ - (void)resetCurView{
136149
}
137150
}
138151

152+
- (void)resetSearView {
153+
__weak typeof(self) weakSelf = self;
154+
155+
[[Coding_NetAPIManager sharedManager] request_tasks_searchWithOwner:nil project_id:nil keyword:_keyword status:_status label:_label andBlock:^(Projects *data, NSError *error) {
156+
// weakSelf.myProjectList = data.list;
157+
// [weakSelf.myCarousel reloadData];
158+
[weakSelf configSearchControlWithData:data];
159+
}];
160+
}
161+
139162
- (void)configSegmentControlWithData:(Projects *)freshProjects {
140163
BOOL dataHasChanged = NO;
141164
for (Project *freshPro in freshProjects.list) {
@@ -176,6 +199,47 @@ - (void)configSegmentControlWithData:(Projects *)freshProjects {
176199

177200
}
178201

202+
- (void)configSearchControlWithData:(Projects *)freshProjects {
203+
BOOL dataHasChanged = NO;
204+
for (Project *freshPro in freshProjects.list) {
205+
BOOL hasFreshPro = NO;
206+
for (Project *oldPro in self.myProjectList) {
207+
if (freshPro.id.integerValue == oldPro.id.integerValue) {
208+
hasFreshPro = YES;
209+
break;
210+
}
211+
}
212+
if (!hasFreshPro) {
213+
dataHasChanged = YES;
214+
break;
215+
}
216+
}
217+
218+
if (dataHasChanged) {
219+
// self.myProjectList = [[NSMutableArray alloc] initWithObjects:[Project project_All], nil];
220+
[self.myProjectList addObjectsFromArray:freshProjects.list];
221+
222+
//重置滑块
223+
if (_mySegmentControl) {
224+
[_mySegmentControl removeFromSuperview];
225+
}
226+
227+
__weak typeof(self) weakSelf = self;
228+
CGRect segmentFrame = CGRectMake(0, 0, kScreen_Width, kMySegmentControlIcon_Height);
229+
_mySegmentControl = [[XTSegmentControl alloc] initWithFrame:segmentFrame Items:_myProjectList selectedBlock:^(NSInteger index) {
230+
[weakSelf.myCarousel scrollToItemAtIndex:index animated:NO];
231+
}];
232+
[self.view addSubview:_mySegmentControl];
233+
234+
if (_myCarousel.currentItemIndex != 0) {
235+
_myCarousel.currentItemIndex = 0;
236+
}
237+
[_myCarousel reloadData];
238+
}
239+
240+
}
241+
242+
179243
#pragma mark iCarousel M
180244
- (NSUInteger)numberOfItemsInCarousel:(iCarousel *)carousel{
181245
return [_myProjectList count];

Coding_iOS/Util/Manager/Coding_NetAPIManager.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ typedef NS_ENUM(NSInteger, PurposeType) {
9595
- (void)request_EditTypeOfMember:(ProjectMember *)curMember inProject:(Project *)curPro andBlock:(void (^)(id data, NSError *error))block;
9696
- (void)request_ProjectServiceInfo:(Project *)curPro andBlock:(void (^)(id data, NSError *error))block;
9797

98+
9899
#pragma mark Team
99100
- (void)request_JoinedTeamsBlock:(void (^)(id data, NSError *error))block;
100101
- (void)request_DetailOfTeam:(Team *)team andBlock:(void (^)(id data, NSError *error))block;
@@ -164,6 +165,8 @@ typedef NS_ENUM(NSInteger, PurposeType) {
164165
- (void)request_DeleteComment:(TaskComment *)comment ofTask:(Task *)task andBlock:(void (^)(id data, NSError *error))block;
165166
- (void)request_ChangeWatcher:(User *)watcher ofTask:(Task *)task andBlock:(void (^)(id data, NSError *error))block;
166167
- (void)request_Search_filtersAndBlock:(void (^)(id data, NSError *error))block; //任务标签
168+
- (void)request_tasks_searchWithOwner:(NSString *)owner project_id:(NSString *)project_id keyword:(NSString *)keyword status:(NSString *)status label:(NSString *)label andBlock:(void (^)(id data, NSError *error))block;
169+
167170

168171
#pragma mark - User
169172
- (void)request_AddUser:(User *)user ToProject:(Project *)project andBlock:(void (^)(id data, NSError *error))block;

Coding_iOS/Util/Manager/Coding_NetAPIManager.m

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1483,6 +1483,36 @@ - (void)request_Search_filtersAndBlock:(void (^)(id data, NSError *error))block
14831483

14841484
}
14851485

1486+
- (void)request_tasks_searchWithOwner:(NSString *)owner project_id:(NSString *)project_id keyword:(NSString *)keyword status:(NSString *)status label:(NSString *)label andBlock:(void (^)(id data, NSError *error))block {
1487+
NSMutableDictionary *param = @{}.mutableCopy;
1488+
if (owner != nil) {
1489+
[param setValue:owner forKey:@"owner"];
1490+
}
1491+
if (project_id != nil) {
1492+
[param setValue:project_id forKey:@"project_id"];
1493+
}
1494+
if (keyword != nil) {
1495+
[param setValue:keyword forKey:@"keyword"];
1496+
}
1497+
if (status != nil) {
1498+
[param setValue:status forKey:@"status"];
1499+
}
1500+
if (label != nil) {
1501+
[param setValue:label forKey:@"label"];
1502+
}
1503+
[[CodingNetAPIClient sharedJsonClient] requestJsonDataWithPath:@"api/tasks/search" withParams:param withMethodType:Get andBlock:^(id data, NSError *error) {
1504+
1505+
Projects *pros = [NSObject objectOfClass:@"Tasks" fromJSON:data[@"data"]];
1506+
pros.list = [NSObject arrayFromJSON:data[@"data"][@"list"] ofObjects:@"Task"];
1507+
// Tasks
1508+
if (data) {
1509+
block(pros, nil);
1510+
}else{
1511+
block(nil, error);
1512+
}
1513+
}];
1514+
}
1515+
14861516
#pragma mark User
14871517
- (void)request_AddUser:(User *)user ToProject:(Project *)project andBlock:(void (^)(id data, NSError *error))block{
14881518
// 一次添加多个成员(逗号分隔):users=102,4 (以后只支持 gk,不支持 id 了)

Coding_iOS/Views/ScreenView.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@
1010

1111
@interface ScreenView : UIView
1212

13+
@property (nonatomic, copy) void(^selectBlock)(NSString *keyword, NSString *status, NSString *label);
14+
@property (nonatomic, strong) NSString *keyword;
15+
@property (nonatomic, strong) NSString *status; //任务状态,进行中的为1,已完成的为2
16+
@property (nonatomic, strong) NSString *label; //任务标签
17+
18+
1319
+ (instancetype)creat;
1420

1521
- (void)showOrHide;

Coding_iOS/Views/ScreenView.m

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ - (instancetype)initWithFrame:(CGRect)frame {
3737
#pragma mark - 外部方法
3838

3939
+ (instancetype)creat {
40-
ScreenView *screenView = [[ScreenView alloc] initWithFrame:CGRectMake(0, 0, kScreen_Width, kScreen_Height)];
40+
ScreenView *screenView = [[ScreenView alloc] initWithFrame:CGRectMake(0, 20, kScreen_Width, kScreen_Height)];
4141
screenView.hidden = YES;
4242
[kKeyWindow addSubview:screenView];
4343

@@ -87,6 +87,15 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath
8787
[tableView deselectRowAtIndexPath:indexPath animated:YES];
8888
_selectNum = indexPath.row;
8989
[tableView reloadData];
90+
if (indexPath.row < _tastArray.count) {
91+
self.label = nil;
92+
self.status = [NSString stringWithFormat:@"%ld", indexPath.row + 1];
93+
} else {
94+
self.status = nil;
95+
self.label = _labels[indexPath.row - _tastArray.count][@"name"];
96+
}
97+
[self clickDis];
98+
9099
}
91100

92101
#pragma mark - 自定义委托
@@ -117,8 +126,7 @@ - (void)creatView {
117126
searchBar.cornerRadius = 4;
118127
searchBar.masksToBounds = YES;
119128
[mainView addSubview:searchBar];
120-
searchBar.sd_layout.leftSpaceToView(mainView, 15).topSpaceToView(mainView, kMySegmentControl_Height + 20).rightSpaceToView(mainView, 15).heightIs(31);
121-
129+
searchBar.sd_layout.leftSpaceToView(mainView, 15).topSpaceToView(mainView, 0).rightSpaceToView(mainView, 15).heightIs(31);
122130

123131
UITableView *tableView = [[UITableView alloc] init];
124132
tableView.backgroundColor = [UIColor clearColor];
@@ -143,7 +151,13 @@ - (void)creatData {
143151
[self.tableView reloadData];
144152
}
145153
}];
154+
}
146155

156+
- (void)clickDis {
157+
self.hidden = YES;
158+
if (_selectBlock) {
159+
_selectBlock(_keyword, _status, _label);
160+
}
147161
}
148162

149163
#pragma mark - get/set方法

0 commit comments

Comments
 (0)