Skip to content

Commit 721bb7d

Browse files
committed
讨论已去掉,全站搜索中还有讨论关键字
1 parent 76a69da commit 721bb7d

File tree

6 files changed

+119
-114
lines changed

6 files changed

+119
-114
lines changed

Coding_iOS/.DS_Store

0 Bytes
Binary file not shown.

Coding_iOS/Controllers/AllSearchDisplayVC.m

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,8 @@ - (void)dealloc {
7474

7575
- (NSArray *)titlesArray{
7676
if (!_titlesArray) {
77-
_titlesArray = @[@"项目", @"任务", @"讨论", @"冒泡", @"文档", @"用户", @"合并请求", @"Pull 请求"];
77+
// _titlesArray = @[@"项目", @"任务", @"讨论", @"冒泡", @"文档", @"用户", @"合并请求", @"Pull 请求"];
78+
_titlesArray = @[@"项目", @"任务", @"冒泡", @"文档", @"用户", @"合并请求"];
7879
}
7980
return _titlesArray;
8081
}
@@ -261,10 +262,11 @@ - (void)initSearchHistoryView {
261262
make.height.mas_equalTo(_historyHeight);
262263
}];
263264
_searchHistoryView.contentSize = CGSizeMake(kScreen_Width, _historyHeight);
265+
NSInteger itemNum = 3;
264266
CGFloat designScale = (kScreen_Width/ 375);
265267
CGFloat tipVWidth = 210 * designScale;
266268
CGFloat imageWidth = 24 * designScale;
267-
CGFloat paddingWidth = MAX(0, (tipVWidth - 4* imageWidth)/ 3);
269+
CGFloat paddingWidth = MAX(0, (tipVWidth - itemNum* imageWidth)/ (itemNum - 1));
268270
CGFloat fontSize = 13 * designScale;
269271

270272
UIView *tipV = [UIView new];
@@ -283,7 +285,8 @@ - (void)initSearchHistoryView {
283285
make.top.equalTo(titleL.mas_bottom).offset(15);
284286
make.height.mas_equalTo(1);
285287
}];
286-
NSArray *imageArray = @[@"project", @"task", @"topic", @"tweet", @"file", @"user", @"mr", @"pr"];
288+
// NSArray *imageArray = @[@"project", @"task", @"topic", @"tweet", @"file", @"user", @"mr", @"pr"];
289+
NSArray *imageArray = @[@"project", @"task", @"tweet", @"file", @"user", @"mr"];
287290
for (int index = 0; index < self.titlesArray.count && index < imageArray.count; index++) {
288291
UIImageView *imageV = [[UIImageView alloc] initWithImage:[UIImage imageNamed:[NSString stringWithFormat:@"search_icon_%@", imageArray[index]]]];
289292
UILabel *label = [UILabel labelWithSystemFontSize:fontSize textColorHexString:@"0x999999"];
@@ -292,8 +295,8 @@ - (void)initSearchHistoryView {
292295
[tipV addSubview:label];
293296
[imageV mas_makeConstraints:^(MASConstraintMaker *make) {
294297
make.size.mas_equalTo(CGSizeMake(imageWidth, imageWidth));
295-
make.top.equalTo(lineV.mas_bottom).offset(20 + (imageWidth + 45) * (index / 4));
296-
make.left.equalTo(tipV).offset((paddingWidth + imageWidth) * (index % 4));
298+
make.top.equalTo(lineV.mas_bottom).offset(20 + (imageWidth + 45) * (index / itemNum));
299+
make.left.equalTo(tipV).offset((paddingWidth + imageWidth) * (index % itemNum));
297300
}];
298301
[label mas_makeConstraints:^(MASConstraintMaker *make) {
299302
make.top.equalTo(imageV.mas_bottom).offset(10);
@@ -352,13 +355,14 @@ - (void)cellClickedObj:(id)obj type:(eSearchType)type{
352355
[self goToUserInfo:obj];
353356
}else if (type==eSearchType_Task){
354357
[self goToTask:obj];
355-
}else if (type==eSearchType_Topic){
356-
[self goToTopic:obj];
358+
// }else if (type==eSearchType_Topic){
359+
// [self goToTopic:obj];
357360
}else if (type==eSearchType_Merge){
358361
[self goToMRDetail:obj];
359-
}else if(type==eSearchType_Pull){
360-
[self goToMRDetail:obj];
361362
}
363+
// else if(type==eSearchType_Pull){
364+
// [self goToMRDetail:obj];
365+
// }
362366
}
363367

364368
- (void)goToProject:(Project *)project{

Coding_iOS/Util/Manager/CodingNetAPIClient.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,8 @@ - (void)requestJsonDataWithPath:(NSString *)aPath
9090
}
9191
//log请求数据
9292
DebugLog(@"\n===========request===========\n%@\n%@:\n%@", kNetworkMethodName[method], aPath, params);
93-
// aPath = [aPath stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
94-
aPath = [aPath stringByAddingPercentEncodingWithAllowedCharacters:NSCharacterSet.URLPathAllowedCharacterSet];
93+
aPath = [aPath stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];//卧槽了,有些把 params 放在 path 里面的 GET 方法
94+
// aPath = [aPath stringByAddingPercentEncodingWithAllowedCharacters:NSCharacterSet.URLPathAllowedCharacterSet];
9595
// 发起请求
9696
switch (method) {
9797
case Get:{

Coding_iOS/Util/Manager/Coding_NetAPIManager.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3903,7 +3903,8 @@ - (void)requestWithSearchString:(NSString *)strSearch typeStr:(NSString*)type an
39033903

39043904
NSString *path = [NSString stringWithFormat:@"/api/esearch/%@?q=%@&page=%d",type,strSearch, (int)page];
39053905
if ([type isEqualToString:@"all"]) {
3906-
path=[NSString stringWithFormat:@"%@&types=projects,project_topics,tasks,tweets,files,friends,merge_requests,pull_requests",path];
3906+
// path=[NSString stringWithFormat:@"%@&types=projects,project_topics,tasks,tweets,files,friends,merge_requests,pull_requests",path];
3907+
path=[NSString stringWithFormat:@"%@&types=projects,tasks,tweets,files,friends,merge_requests",path];
39073908
}else if ([type isEqualToString:@"public_project"]) {
39083909
path=[NSString stringWithFormat:@"/api/esearch/project?q=%@ related:false&page=%d",strSearch,(int)page];
39093910
}

Coding_iOS/Views/TableListView/CodingSearchDisplayView.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@
99
typedef NS_ENUM(NSUInteger, eSearchType) {
1010
eSearchType_Project=0,
1111
eSearchType_Task,
12-
eSearchType_Topic,
12+
// eSearchType_Topic,
1313
eSearchType_Tweet,
1414
eSearchType_Document,
1515
eSearchType_User,
1616
eSearchType_Merge,
17-
eSearchType_Pull,
17+
// eSearchType_Pull,
1818
eSearchType_All
1919
};
2020

Coding_iOS/Views/TableListView/CodingSearchDisplayView.m

Lines changed: 100 additions & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -121,15 +121,15 @@ - (void)setSearchPros:(PublicSearchModel *)searchPros{
121121
case eSearchType_Task:
122122
[self.dateSource addObjectsFromArray:_searchPros.tasks.list];
123123
break;
124-
case eSearchType_Topic:
125-
[self.dateSource addObjectsFromArray:_searchPros.project_topics.list];
126-
break;
124+
// case eSearchType_Topic:
125+
// [self.dateSource addObjectsFromArray:_searchPros.project_topics.list];
126+
// break;
127127
case eSearchType_Merge:
128128
[self.dateSource addObjectsFromArray:_searchPros.merge_requests.list];
129129
break;
130-
case eSearchType_Pull:
131-
[self.dateSource addObjectsFromArray:_searchPros.pull_requests.list];
132-
break;
130+
// case eSearchType_Pull:
131+
// [self.dateSource addObjectsFromArray:_searchPros.pull_requests.list];
132+
// break;
133133
default:
134134
break;
135135
}
@@ -185,18 +185,18 @@ - (void)loadMore {
185185
currentPage=[_searchPros.tasks.page intValue];
186186
totalPage=[_searchPros.tasks.totalPage intValue];
187187
break;
188-
case eSearchType_Topic:
189-
currentPage=[_searchPros.project_topics.page intValue];
190-
totalPage=[_searchPros.project_topics.totalPage intValue];
191-
break;
188+
// case eSearchType_Topic:
189+
// currentPage=[_searchPros.project_topics.page intValue];
190+
// totalPage=[_searchPros.project_topics.totalPage intValue];
191+
// break;
192192
case eSearchType_Merge:
193193
currentPage=[_searchPros.merge_requests.page intValue];
194194
totalPage=[_searchPros.merge_requests.totalPage intValue];
195195
break;
196-
case eSearchType_Pull:
197-
currentPage=[_searchPros.pull_requests.page intValue];
198-
totalPage=[_searchPros.pull_requests.totalPage intValue];
199-
break;
196+
// case eSearchType_Pull:
197+
// currentPage=[_searchPros.pull_requests.page intValue];
198+
// totalPage=[_searchPros.pull_requests.totalPage intValue];
199+
// break;
200200
default:
201201
break;
202202
}
@@ -279,22 +279,22 @@ - (void)requestDataWithPage:(NSInteger)page {
279279
}
280280
weakSelf.isLoading = NO;
281281
}];
282-
}else if(_curSearchType==eSearchType_Pull){
283-
[[Coding_NetAPIManager sharedManager] requestWithSearchString:_searchBarText typeStr:@"pr" andPage:page andBlock:^(id data, NSError *error) {
284-
if(data) {
285-
NSDictionary *dataDic = (NSDictionary *)data;
286-
NSArray *resultA = [NSObject arrayFromJSON:dataDic[@"list"] ofObjects:@"MRPR"];
287-
[weakSelf.searchPros.pull_requests.list addObjectsFromArray:resultA];
288-
//更新page
289-
weakSelf.searchPros.pull_requests.page = dataDic[@"page"] ;
290-
weakSelf.searchPros.pull_requests.totalPage = dataDic[@"totalPage"] ;
291-
[weakSelf.dateSource addObjectsFromArray:resultA];
292-
[weakSelf.searchTableView reloadData];
293-
[weakSelf.searchTableView.infiniteScrollingView stopAnimating];
294-
weakSelf.searchTableView.showsInfiniteScrolling = [weakSelf showTotalPage];
295-
}
296-
weakSelf.isLoading = NO;
297-
}];
282+
// }else if(_curSearchType==eSearchType_Pull){
283+
// [[Coding_NetAPIManager sharedManager] requestWithSearchString:_searchBarText typeStr:@"pr" andPage:page andBlock:^(id data, NSError *error) {
284+
// if(data) {
285+
// NSDictionary *dataDic = (NSDictionary *)data;
286+
// NSArray *resultA = [NSObject arrayFromJSON:dataDic[@"list"] ofObjects:@"MRPR"];
287+
// [weakSelf.searchPros.pull_requests.list addObjectsFromArray:resultA];
288+
// //更新page
289+
// weakSelf.searchPros.pull_requests.page = dataDic[@"page"] ;
290+
// weakSelf.searchPros.pull_requests.totalPage = dataDic[@"totalPage"] ;
291+
// [weakSelf.dateSource addObjectsFromArray:resultA];
292+
// [weakSelf.searchTableView reloadData];
293+
// [weakSelf.searchTableView.infiniteScrollingView stopAnimating];
294+
// weakSelf.searchTableView.showsInfiniteScrolling = [weakSelf showTotalPage];
295+
// }
296+
// weakSelf.isLoading = NO;
297+
// }];
298298
}else if(_curSearchType==eSearchType_Task){
299299
[[Coding_NetAPIManager sharedManager] requestWithSearchString:_searchBarText typeStr:@"task" andPage:page andBlock:^(id data, NSError *error) {
300300
if(data) {
@@ -339,32 +339,32 @@ - (void)requestDataWithPage:(NSInteger)page {
339339
}
340340
weakSelf.isLoading = NO;
341341
}];
342-
}else if(_curSearchType==eSearchType_Topic){
343-
[[Coding_NetAPIManager sharedManager] requestWithSearchString:_searchBarText typeStr:@"topic" andPage:page andBlock:^(id data, NSError *error) {
344-
if(data) {
345-
NSDictionary *dataDic = (NSDictionary *)data;
346-
NSArray *resultA = [NSObject arrayFromJSON:dataDic[@"list"] ofObjects:@"ProjectTopic"];
347-
348-
//topic 处理 content 关键字
349-
NSArray *resultTopic =dataDic[@"list"];
350-
for (int i=0;i<[resultA count];i++) {
351-
ProjectTopic *curTopic=[resultA objectAtIndex:i];
352-
if ([resultTopic count]>i) {
353-
curTopic.contentStr= [[[resultTopic objectAtIndex:i] objectForKey:@"content"] firstObject];
354-
}
355-
}
356-
357-
[weakSelf.searchPros.project_topics.list addObjectsFromArray:resultA];
358-
//更新page
359-
weakSelf.searchPros.project_topics.page = dataDic[@"page"] ;
360-
weakSelf.searchPros.project_topics.totalPage = dataDic[@"totalPage"] ;
361-
[weakSelf.dateSource addObjectsFromArray:resultA];
362-
[weakSelf.searchTableView reloadData];
363-
[weakSelf.searchTableView.infiniteScrollingView stopAnimating];
364-
weakSelf.searchTableView.showsInfiniteScrolling = [weakSelf showTotalPage];
365-
}
366-
weakSelf.isLoading = NO;
367-
}];
342+
// }else if(_curSearchType==eSearchType_Topic){
343+
// [[Coding_NetAPIManager sharedManager] requestWithSearchString:_searchBarText typeStr:@"topic" andPage:page andBlock:^(id data, NSError *error) {
344+
// if(data) {
345+
// NSDictionary *dataDic = (NSDictionary *)data;
346+
// NSArray *resultA = [NSObject arrayFromJSON:dataDic[@"list"] ofObjects:@"ProjectTopic"];
347+
//
348+
// //topic 处理 content 关键字
349+
// NSArray *resultTopic =dataDic[@"list"];
350+
// for (int i=0;i<[resultA count];i++) {
351+
// ProjectTopic *curTopic=[resultA objectAtIndex:i];
352+
// if ([resultTopic count]>i) {
353+
// curTopic.contentStr= [[[resultTopic objectAtIndex:i] objectForKey:@"content"] firstObject];
354+
// }
355+
// }
356+
//
357+
// [weakSelf.searchPros.project_topics.list addObjectsFromArray:resultA];
358+
// //更新page
359+
// weakSelf.searchPros.project_topics.page = dataDic[@"page"] ;
360+
// weakSelf.searchPros.project_topics.totalPage = dataDic[@"totalPage"] ;
361+
// [weakSelf.dateSource addObjectsFromArray:resultA];
362+
// [weakSelf.searchTableView reloadData];
363+
// [weakSelf.searchTableView.infiniteScrollingView stopAnimating];
364+
// weakSelf.searchTableView.showsInfiniteScrolling = [weakSelf showTotalPage];
365+
// }
366+
// weakSelf.isLoading = NO;
367+
// }];
368368
}else{
369369
[self.searchTableView.infiniteScrollingView stopAnimating];
370370
self.searchTableView.showsInfiniteScrolling = NO;
@@ -411,27 +411,27 @@ - (void)refreshHeaderTitle{
411411
titleStr=[NSString stringWithFormat:@"共搜索到 %ld 个与\"%@\"相关的任务", [_searchPros.tasks.totalRow longValue],_searchBarText];
412412
}
413413
break;
414-
case eSearchType_Topic:
415-
if ([_searchPros.project_topics.totalRow longValue]==0) {
416-
titleStr=nil;
417-
}else{
418-
titleStr=[NSString stringWithFormat:@"共搜索到 %ld 个与\"%@\"相关的讨论", [_searchPros.project_topics.totalRow longValue],_searchBarText];
419-
}
420-
break;
414+
// case eSearchType_Topic:
415+
// if ([_searchPros.project_topics.totalRow longValue]==0) {
416+
// titleStr=nil;
417+
// }else{
418+
// titleStr=[NSString stringWithFormat:@"共搜索到 %ld 个与\"%@\"相关的讨论", [_searchPros.project_topics.totalRow longValue],_searchBarText];
419+
// }
420+
// break;
421421
case eSearchType_Merge:
422422
if ([_searchPros.merge_requests.totalRow longValue]==0) {
423423
titleStr=nil;
424424
}else{
425425
titleStr=[NSString stringWithFormat:@"共搜索到 %ld 个与\"%@\"相关的合并请求", [_searchPros.merge_requests.totalRow longValue],_searchBarText];
426426
}
427427
break;
428-
case eSearchType_Pull:
429-
if ([_searchPros.pull_requests.totalRow longValue]==0) {
430-
titleStr=nil;
431-
}else{
432-
titleStr=[NSString stringWithFormat:@"共搜索到 %ld 个与\"%@\"相关的 Pull 请求", [_searchPros.pull_requests.totalRow longValue],_searchBarText];
433-
}
434-
break;
428+
// case eSearchType_Pull:
429+
// if ([_searchPros.pull_requests.totalRow longValue]==0) {
430+
// titleStr=nil;
431+
// }else{
432+
// titleStr=[NSString stringWithFormat:@"共搜索到 %ld 个与\"%@\"相关的 Pull 请求", [_searchPros.pull_requests.totalRow longValue],_searchBarText];
433+
// }
434+
// break;
435435
default:
436436
break;
437437
}
@@ -456,15 +456,15 @@ -(BOOL)showTotalPage{
456456
case eSearchType_Task:
457457
return _searchPros.tasks.page<_searchPros.tasks.totalPage;
458458
break;
459-
case eSearchType_Topic:
460-
return _searchPros.project_topics.page<_searchPros.project_topics.totalPage;
461-
break;
459+
// case eSearchType_Topic:
460+
// return _searchPros.project_topics.page<_searchPros.project_topics.totalPage;
461+
// break;
462462
case eSearchType_Merge:
463463
return _searchPros.merge_requests.page<_searchPros.merge_requests.totalPage;
464464
break;
465-
case eSearchType_Pull:
466-
return _searchPros.pull_requests.page<_searchPros.pull_requests.totalPage;
467-
break;
465+
// case eSearchType_Pull:
466+
// return _searchPros.pull_requests.page<_searchPros.pull_requests.totalPage;
467+
// break;
468468
default:
469469
return NO;
470470
break;
@@ -489,15 +489,15 @@ -(BOOL)noEmptyList{
489489
case eSearchType_Task:
490490
return [_searchPros.tasks.list count];
491491
break;
492-
case eSearchType_Topic:
493-
return [_searchPros.project_topics.list count];
494-
break;
492+
// case eSearchType_Topic:
493+
// return [_searchPros.project_topics.list count];
494+
// break;
495495
case eSearchType_Merge:
496496
return [_searchPros.merge_requests.list count];
497497
break;
498-
case eSearchType_Pull:
499-
return [_searchPros.pull_requests.list count];
500-
break;
498+
// case eSearchType_Pull:
499+
// return [_searchPros.pull_requests.list count];
500+
// break;
501501
default:
502502
return TRUE;
503503
break;
@@ -550,24 +550,24 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
550550
cell.task=task;
551551
[tableView addLineforPlainCell:cell forRowAtIndexPath:indexPath withLeftSpace:kPaddingLeftWidth];
552552
return cell;
553-
}else if(_curSearchType==eSearchType_Topic){
554-
TopicSearchCell *cell = [tableView dequeueReusableCellWithIdentifier:@"TopicSearchCell" forIndexPath:indexPath];
555-
ProjectTopic *topic =_dateSource[indexPath.row];
556-
cell.curTopic = topic;
557-
[tableView addLineforPlainCell:cell forRowAtIndexPath:indexPath withLeftSpace:kPaddingLeftWidth];
558-
return cell;
553+
// }else if(_curSearchType==eSearchType_Topic){
554+
// TopicSearchCell *cell = [tableView dequeueReusableCellWithIdentifier:@"TopicSearchCell" forIndexPath:indexPath];
555+
// ProjectTopic *topic =_dateSource[indexPath.row];
556+
// cell.curTopic = topic;
557+
// [tableView addLineforPlainCell:cell forRowAtIndexPath:indexPath withLeftSpace:kPaddingLeftWidth];
558+
// return cell;
559559
}else if(_curSearchType==eSearchType_Merge){
560560
PRMRSearchCell *cell = [tableView dequeueReusableCellWithIdentifier:@"PRMRSearchCell" forIndexPath:indexPath];
561561
MRPR *curMRPR =_dateSource[indexPath.row];
562562
cell.curMRPR = curMRPR;
563563
[tableView addLineforPlainCell:cell forRowAtIndexPath:indexPath withLeftSpace:kPaddingLeftWidth];
564564
return cell;
565-
}else if(_curSearchType==eSearchType_Pull){
566-
PRMRSearchCell *cell = [tableView dequeueReusableCellWithIdentifier:@"PRMRSearchCell" forIndexPath:indexPath];
567-
MRPR *curMRPR =_dateSource[indexPath.row];
568-
cell.curMRPR = curMRPR;
569-
[tableView addLineforPlainCell:cell forRowAtIndexPath:indexPath withLeftSpace:kPaddingLeftWidth];
570-
return cell;
565+
// }else if(_curSearchType==eSearchType_Pull){
566+
// PRMRSearchCell *cell = [tableView dequeueReusableCellWithIdentifier:@"PRMRSearchCell" forIndexPath:indexPath];
567+
// MRPR *curMRPR =_dateSource[indexPath.row];
568+
// cell.curMRPR = curMRPR;
569+
// [tableView addLineforPlainCell:cell forRowAtIndexPath:indexPath withLeftSpace:kPaddingLeftWidth];
570+
// return cell;
571571
}else{
572572
return [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"cell"];
573573
}
@@ -586,12 +586,12 @@ - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPa
586586
}else if(_curSearchType==eSearchType_Task){
587587
Task *task = _dateSource[indexPath.row];
588588
return [TaskSearchCell cellHeightWithObj:task];
589-
}else if(_curSearchType==eSearchType_Topic){
590-
ProjectTopic *topic = _dateSource[indexPath.row];
591-
return [TopicSearchCell cellHeightWithObj:topic];
592-
}else if (_curSearchType==eSearchType_Pull){
593-
MRPR *mrpr = _dateSource[indexPath.row];
594-
return [PRMRSearchCell cellHeightWithObj:mrpr];
589+
// }else if(_curSearchType==eSearchType_Topic){
590+
// ProjectTopic *topic = _dateSource[indexPath.row];
591+
// return [TopicSearchCell cellHeightWithObj:topic];
592+
// }else if (_curSearchType==eSearchType_Pull){
593+
// MRPR *mrpr = _dateSource[indexPath.row];
594+
// return [PRMRSearchCell cellHeightWithObj:mrpr];
595595
}else if (_curSearchType==eSearchType_Merge){
596596
MRPR *mrpr = _dateSource[indexPath.row];
597597
return [PRMRSearchCell cellHeightWithObj:mrpr];

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy