@@ -128,7 +128,20 @@ -(void)submit{
128128 __weak typeof (self) weakSelf = self;
129129 [[Coding_NetAPIManager sharedManager ] request_NewProject_WithObj: project image: self .projectIconImage andBlock: ^(NSString *data, NSError *error) {
130130 if (data.length > 0 ) {
131- [weakSelf gotoProWithStr: data];
131+
132+ NSString *projectRegexStr = @" /u/([^/]+)/p/([^/]+)" ;
133+ NSArray *matchedCaptures = [data captureComponentsMatchedByRegex: projectRegexStr];
134+ if (matchedCaptures.count >= 3 ) {
135+ NSString *user_global_key = matchedCaptures[1 ];
136+ NSString *project_name = matchedCaptures[2 ];
137+ Project *curPro = [[Project alloc ] init ];
138+ curPro.owner_user_name = user_global_key;
139+ curPro.name = project_name;
140+ // 标记已读
141+ [[Coding_NetAPIManager sharedManager ] request_Project_UpdateVisit_WithObj: curPro andBlock: ^(id dataTemp, NSError *errorTemp) {
142+ }];
143+ [weakSelf gotoPro: curPro];
144+ }
132145 }
133146 self.submitButtonItem .enabled = YES ;
134147 }];
@@ -164,23 +177,13 @@ -(BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange
164177}
165178
166179#pragma mark gotoVC
167- - (void )gotoProWithStr : (NSString *)data {
168- NSString *projectRegexStr = @" /u/([^/]+)/p/([^/]+)" ;
169- NSArray *matchedCaptures = [data captureComponentsMatchedByRegex: projectRegexStr];
170- if (matchedCaptures.count >= 3 ) {
171- NSString *user_global_key = matchedCaptures[1 ];
172- NSString *project_name = matchedCaptures[2 ];
173- Project *curPro = [[Project alloc ] init ];
174- curPro.owner_user_name = user_global_key;
175- curPro.name = project_name;
176- NProjectViewController *vc = [[NProjectViewController alloc ] init ];
177- vc.myProject = curPro;
178-
179- NSMutableArray *curViewControllers = [NSMutableArray arrayWithArray: [self .navigationController viewControllers ]];
180- if (curViewControllers.count >= 2 ) {
181- [curViewControllers replaceObjectAtIndex: curViewControllers.count - 1 withObject: vc];
182- [self .navigationController setViewControllers: curViewControllers animated: YES ];
183- }
180+ - (void )gotoPro : (Project *)curPro {
181+ NProjectViewController *vc = [[NProjectViewController alloc ] init ];
182+ vc.myProject = curPro;
183+ NSMutableArray *curViewControllers = [NSMutableArray arrayWithArray: [self .navigationController viewControllers ]];
184+ if (curViewControllers.count >= 2 ) {
185+ [curViewControllers replaceObjectAtIndex: curViewControllers.count - 1 withObject: vc];
186+ [self .navigationController setViewControllers: curViewControllers animated: YES ];
184187 }
185188}
186189
0 commit comments