Skip to content

Commit 499fb65

Browse files
committed
ProjectTaskListView 数据错乱的问题 - project_id,userId,index 不对
1 parent f9b59ce commit 499fb65

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

Coding_iOS/Controllers/RootControllers/MyTask_RootViewController.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ - (UIView *)carousel:(iCarousel *)carousel viewForItemAtIndex:(NSUInteger)index
294294
[listView setTasks:curTasks];
295295
}else{
296296
__weak typeof(self) weakSelf = self;
297-
listView = [[ProjectTaskListView alloc] initWithFrame:carousel.bounds tasks:curTasks project_id:_project_id keyword:_keyword status:_status label:_label userId:nil role:_role block:^(ProjectTaskListView *taskListView, Task *task) {
297+
listView = [[ProjectTaskListView alloc] initWithFrame:carousel.bounds tasks:curTasks project_id:curTasks.project.id.stringValue keyword:_keyword status:_status label:_label userId:nil role:_role block:^(ProjectTaskListView *taskListView, Task *task) {
298298
EditTaskViewController *vc = [[EditTaskViewController alloc] init];
299299
vc.myTask = task;
300300
vc.taskChangedBlock = ^(){
@@ -320,7 +320,7 @@ - (void)carouselCurrentItemIndexDidChange:(iCarousel *)carousel{
320320
_mySegmentControl.currentIndex = carousel.currentItemIndex;
321321
}
322322
ProjectTaskListView *curView = (ProjectTaskListView *)carousel.currentItemView;
323-
NSInteger index = carousel.scrollOffset;
323+
NSInteger index = carousel.currentItemIndex;
324324
if (index == 0) {
325325
_project_id = nil;
326326
} else {

Coding_iOS/Views/TableListView/ProjectTaskListView.m

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,8 @@ - (id)initWithFrame:(CGRect)frame tasks:(Tasks *)tasks project_id:(NSString *)pr
9191

9292
- (void)setTasks:(Tasks *)tasks{
9393
if (_myTasks != tasks) {
94+
self.userId = tasks.owner.id.stringValue;
95+
self.project_id = tasks.project.id.stringValue;
9496
self.myTasks = tasks;
9597
[_myTableView reloadData];
9698
[_myTableView.infiniteScrollingView stopAnimating];

Coding_iOS/Views/TableListView/ProjectTasksView.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ - (UIView *)carousel:(iCarousel *)carousel viewForItemAtIndex:(NSUInteger)index
106106
if (_role == TaskRoleTypeOwner) {
107107
_role = TaskRoleTypeAll;
108108
}
109-
listView = [[ProjectTaskListView alloc] initWithFrame:carousel.bounds tasks:curTasks project_id:_project_id keyword:_keyword status:_status label:_label userId:_userId role:_role block:_block tabBarHeight:0];
109+
listView = [[ProjectTaskListView alloc] initWithFrame:carousel.bounds tasks:curTasks project_id:_project_id keyword:_keyword status:_status label:_label userId:curTasks.owner.id.stringValue role:_role block:_block tabBarHeight:0];
110110
}
111111
[listView setSubScrollsToTop:(index == carousel.currentItemIndex)];
112112
return listView;
@@ -124,7 +124,7 @@ - (void)carouselCurrentItemIndexDidChange:(iCarousel *)carousel{
124124
if (_mySegmentControl) {
125125
_mySegmentControl.currentIndex = carousel.currentItemIndex;
126126
}
127-
NSInteger index = carousel.scrollOffset;
127+
NSInteger index = carousel.currentItemIndex;
128128
NSString *userId = nil;
129129
if (index != 0) {
130130
userId = ((ProjectMember *)_myMemberList[index]).user_id.stringValue;

0 commit comments

Comments
 (0)