2424#import " TaskCommentCell.h"
2525#import " TaskCommentTopCell.h"
2626#import " TaskCommentBlankCell.h"
27+ #import " TaskDescriptionCell.h"
2728#import " ActionSheetDatePicker.h"
2829#import " TaskDescriptionViewController.h"
2930
@@ -53,13 +54,11 @@ - (void)viewDidLoad
5354 // Do any additional setup after loading the view.
5455 switch (_myTask.handleType ) {
5556 case TaskHandleTypeAdd:{
56- self.title = @" 创建任务" ;
5757 _myCopyTask = [Task taskWithTask: _myTask];
5858 _myCopyTask.handleType = TaskHandleTypeAdd;
5959 }
6060 break ;
6161 case TaskHandleTypeEdit:{
62- self.title = @" 任务详情" ;
6362 _myCopyTask = [Task taskWithTask: _myTask];
6463
6564 // 评论
@@ -80,6 +79,7 @@ - (void)viewDidLoad
8079 default :
8180 break ;
8281 }
82+ [self configTitle ];
8383
8484 _myTableView = ({
8585 UITableView *tableView = [[UITableView alloc ] initWithFrame: self .view.bounds style: UITableViewStyleGrouped];
@@ -91,6 +91,7 @@ - (void)viewDidLoad
9191 [tableView registerClass: [TaskCommentCell class ] forCellReuseIdentifier: kCellIdentifier_TaskComment ];
9292 [tableView registerClass: [TaskCommentBlankCell class ] forCellReuseIdentifier: kCellIdentifier_TaskCommentBlank ];
9393 [tableView registerClass: [TaskCommentTopCell class ] forCellReuseIdentifier: kCellIdentifier_TaskCommentTop ];
94+ [tableView registerClass: [TaskDescriptionCell class ] forCellReuseIdentifier: kCellIdentifier_TaskDescriptionCell ];
9495 tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
9596 [self .view addSubview: tableView];
9697 [tableView mas_makeConstraints: ^(MASConstraintMaker *make) {
@@ -122,6 +123,14 @@ - (void)viewDidLoad
122123 }];
123124}
124125
126+ - (void )configTitle {
127+ if (_myTask.handleType == TaskEditTypeAdd) {
128+ self.title = @" 创建任务" ;
129+ }else {
130+ self.title = _myTask.project .name ;
131+ }
132+ }
133+
125134- (void )viewWillDisappear : (BOOL )animated {
126135 [super viewWillDisappear: animated];
127136 if (_myMsgInputView) {
@@ -189,6 +198,7 @@ - (void)queryToRefreshTaskDetail{
189198 weakSelf.myMsgInputView .curProject = weakSelf.myCopyTask .project ;
190199 weakSelf.myMsgInputView .commentOfId = weakSelf.myCopyTask .id ;
191200 weakSelf.myMsgInputView .toUser = nil ;
201+ [weakSelf configTitle ];
192202
193203 [weakSelf.myTableView reloadData ];
194204 [weakSelf queryToRefreshCommentList ];
@@ -297,7 +307,7 @@ - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
297307- (NSInteger )tableView : (UITableView *)tableView numberOfRowsInSection : (NSInteger )section {
298308 NSInteger row = 0 ;
299309 if (section == 0 ) {
300- row = 1 ;
310+ row = 2 ;
301311 }else if (section == 1 ){
302312 row = (self.myCopyTask .handleType == TaskHandleTypeAdd)? 3 : 4 ;
303313 }else {
@@ -312,34 +322,47 @@ - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger
312322- (UITableViewCell *)tableView : (UITableView *)tableView cellForRowAtIndexPath : (NSIndexPath *)indexPath {
313323 if (indexPath.section == 0 ) {
314324 __weak typeof (self) weakSelf = self;
315-
316- TaskContentCell *cell = [tableView dequeueReusableCellWithIdentifier: kCellIdentifier_TaskContent forIndexPath: indexPath];
317- cell.task = _myCopyTask;
318- cell.textValueChangedBlock = ^(NSString *textStr){
319- weakSelf.myCopyTask .content = textStr;
320- };
321- cell.textViewBecomeFirstResponderBlock = ^(){
322- [weakSelf.myMsgInputView isAndResignFirstResponder ];
323- };
324- cell.deleteBtnClickedBlock = ^(Task *toDelete){
325- [weakSelf.view endEditing: YES ];
326- UIActionSheet *actionSheet = [UIActionSheet bk_actionSheetCustomWithTitle: @" 删除此任务" buttonTitles: nil destructiveTitle: @" 确认删除" cancelTitle: @" 取消" andDidDismissBlock: ^(UIActionSheet *sheet, NSInteger index) {
327- if (index == 0 ) {
328- [weakSelf deleteTask: toDelete];
325+ if (indexPath.row == 0 ) {
326+ TaskContentCell *cell = [tableView dequeueReusableCellWithIdentifier: kCellIdentifier_TaskContent forIndexPath: indexPath];
327+ cell.task = _myCopyTask;
328+ cell.textValueChangedBlock = ^(NSString *textStr){
329+ weakSelf.myCopyTask .content = textStr;
330+ };
331+ cell.textViewBecomeFirstResponderBlock = ^(){
332+ [weakSelf.myMsgInputView isAndResignFirstResponder ];
333+ };
334+ cell.deleteBtnClickedBlock = ^(Task *toDelete){
335+ [weakSelf.view endEditing: YES ];
336+ UIActionSheet *actionSheet = [UIActionSheet bk_actionSheetCustomWithTitle: @" 删除此任务" buttonTitles: nil destructiveTitle: @" 确认删除" cancelTitle: @" 取消" andDidDismissBlock: ^(UIActionSheet *sheet, NSInteger index) {
337+ if (index == 0 ) {
338+ [weakSelf deleteTask: toDelete];
339+ }
340+ }];
341+ [actionSheet showInView: self .view];
342+ };
343+ cell.descriptionBtnClickedBlock = ^(Task *task){
344+ if (weakSelf.myCopyTask .has_description .boolValue && !weakSelf.myCopyTask .task_description ) {
345+ return ;
329346 }
330- }];
331- [actionSheet showInView: self .view];
332- };
333- cell.descriptionBtnClickedBlock = ^(Task *task){
334- if (weakSelf.myCopyTask .has_description .boolValue && !weakSelf.myCopyTask .task_description ) {
335- return ;
347+ [weakSelf goToDescriptionVC ];
348+ };
349+
350+ cell.backgroundColor = kColorTableBG ;
351+ [tableView addLineforPlainCell: cell forRowAtIndexPath: indexPath withLeftSpace: 20 ];
352+ return cell;
353+ }else {
354+ TaskDescriptionCell *cell = [tableView dequeueReusableCellWithIdentifier: kCellIdentifier_TaskDescriptionCell forIndexPath: indexPath];
355+ NSString *titleStr;
356+ if (_myCopyTask.handleType == TaskEditTypeAdd) {
357+ titleStr = @" 添加描述" ;
358+ }else {
359+ titleStr = _myCopyTask.has_description .boolValue ? @" 查看描述" : @" 补充描述" ;
336360 }
337- [weakSelf goToDescriptionVC ];
338- };
339-
340- cell.backgroundColor = kColorTableBG ;
341- [tableView addLineforPlainCell: cell forRowAtIndexPath: indexPath withLeftSpace: 20 ];
342- return cell;
361+ [cell setTitleStr: titleStr];
362+ cell.backgroundColor = kColorTableBG ;
363+ [tableView addLineforPlainCell: cell forRowAtIndexPath: indexPath withLeftSpace: 20 ];
364+ return cell;
365+ }
343366 }else if (indexPath.section == 1 ){
344367 LeftImage_LRTextCell *cell = [tableView dequeueReusableCellWithIdentifier: kCellIdentifier_LeftImage_LRText forIndexPath: indexPath];
345368 [cell setObj: _myCopyTask type: indexPath.row];
@@ -375,7 +398,11 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
375398- (CGFloat)tableView : (UITableView *)tableView heightForRowAtIndexPath : (NSIndexPath *)indexPath {
376399 CGFloat cellHeight = 0 ;
377400 if (indexPath.section == 0 ) {
378- cellHeight = [TaskContentCell cellHeightWithObj: _myCopyTask];
401+ if (indexPath.row == 0 ) {
402+ cellHeight = [TaskContentCell cellHeightWithObj: _myCopyTask];
403+ }else {
404+ cellHeight = [TaskDescriptionCell cellHeight ];
405+ }
379406 }else if (indexPath.section == 1 ){
380407 cellHeight = [LeftImage_LRTextCell cellHeight ];
381408 }else {
@@ -424,7 +451,13 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath
424451 [tableView deselectRowAtIndexPath: indexPath animated: YES ];
425452 ESWeakSelf;
426453 if (indexPath.section == 0 ) {
427-
454+ if (indexPath.row != 0 ) {
455+ if (self.myCopyTask .has_description .boolValue && !self.myCopyTask .task_description ) {
456+ // 描述内容 还没有加载成功
457+ return ;
458+ }
459+ [self goToDescriptionVC ];
460+ }
428461 }else if (indexPath.section == 1 ){
429462 if (indexPath.row == LeftImage_LRTextCellTypeTaskOwner) {
430463 ProjectMemberListViewController *vc = [[ProjectMemberListViewController alloc ] init ];
0 commit comments