Commit e639546a authored by admin's avatar admin

修改问题与知识界面相关

parent 3e71de06
......@@ -136,7 +136,7 @@
#define kCommentWithStarViewHeight 325
#define kTaxisViewHeight 150
#define kScreenViewHeight 240
#define kMoreScreenViewHeight 410
#define kMoreScreenViewHeight 310
#define kRefreshInspectPointNotification @"refreshInspectPoint"
......
......@@ -30,7 +30,16 @@
_question = question;
// 标题
self.titleLabel.text = [NSString stringWithFormat:@"%@",question.title];
// self.titleLabel.text = [NSString stringWithFormat:@"%@",question.title];
// NSString *intro = [NSString stringWithFormat:@"%@", question.content];
// NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:intro];
// NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
// [paragraphStyle setLineSpacing:3];
// [attributedString addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, intro.length)];
// [self.detailsLabel setAttributedText:attributedString];
// 反馈(副标题)
self.detailsLabel.text = [NSString stringWithFormat:@"%@", question.content];
// 服务类型
......@@ -118,24 +127,33 @@
if (!_detailsLabel) {
_detailsLabel = [[UILabel alloc] init];
_detailsLabel.font = [UIFont systemFontOfSize:15.0];
_detailsLabel.numberOfLines = 2;
_detailsLabel.translatesAutoresizingMaskIntoConstraints = NO;
_detailsLabel.textColor = kQuestionCellTitleColor;
[self.contentView addSubview:_detailsLabel];
// 顶端
NSLayoutConstraint *detailsTop = [NSLayoutConstraint constraintWithItem:_detailsLabel attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.titleLabel attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0];
NSLayoutConstraint *detailsTop = [NSLayoutConstraint constraintWithItem:_detailsLabel attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeTop multiplier:1.0 constant:8];
[self.contentView addConstraint:detailsTop];
// 左边
NSLayoutConstraint *detailsLeft = [NSLayoutConstraint constraintWithItem:_detailsLabel attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeLeft multiplier:1.0 constant:20];
[self.contentView addConstraint:detailsLeft];
// NSLayoutConstraint *titleRight = [NSLayoutConstraint constraintWithItem:_titleLabel attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.hotLabel attribute:NSLayoutAttributeLeft multiplier:1.0 constant:-15];
// [self.contentView addConstraint:titleRight];
// 右边
NSLayoutConstraint *detailsRight = [NSLayoutConstraint constraintWithItem:_detailsLabel attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeRight multiplier:1.0 constant:-20];
NSLayoutConstraint *detailsRight = [NSLayoutConstraint constraintWithItem:_detailsLabel attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.hotLabel attribute:NSLayoutAttributeLeft multiplier:1.0 constant:-10];
[self.contentView addConstraint:detailsRight];
// // 右边
// NSLayoutConstraint *detailsRight = [NSLayoutConstraint constraintWithItem:_detailsLabel attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeRight multiplier:1.0 constant:-20];
// [self.contentView addConstraint:detailsRight];
// 高度
NSLayoutConstraint *detailsHeight = [NSLayoutConstraint constraintWithItem:_detailsLabel attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:25];
NSLayoutConstraint *detailsHeight = [NSLayoutConstraint constraintWithItem:_detailsLabel attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:45];
[self.contentView addConstraint:detailsHeight];
}
return _detailsLabel;
......@@ -152,7 +170,7 @@
[self.contentView addSubview:_stateLabel];
// 顶端
NSLayoutConstraint *stateTop = [NSLayoutConstraint constraintWithItem:_stateLabel attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.detailsLabel attribute:NSLayoutAttributeBottom multiplier:1.0 constant:3];
NSLayoutConstraint *stateTop = [NSLayoutConstraint constraintWithItem:_stateLabel attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.detailsLabel attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0];
[self.contentView addConstraint:stateTop];
// 左边
......
......@@ -24,8 +24,8 @@
@property (nonatomic, strong) ScopeTableView *scopeTableView;
@property (nonatomic, strong) GroupTableView *groupTableView;
@property (nonatomic, strong) CategoryTableView *categoryTableView;
@property (nonatomic, strong) UITextView *textView1;
@property (nonatomic, strong) UITextView *textView2;
//@property (nonatomic, strong) UITextView *textView1;
//@property (nonatomic, strong) UITextView *textView2;
@property (nonatomic, strong) StateTableView *stateTableView;
......
......@@ -41,7 +41,7 @@
- (void)setup
{
self.groupTabBar = [[GroupTabBar alloc] initWithFrame:CGRectMake(0, 0, 100, 350)];
self.groupTabBar = [[GroupTabBar alloc] initWithFrame:CGRectMake(0, 0, 100, 250)];
_groupTabBar.delegate = self;
[self addSubview:_groupTabBar];
......@@ -56,25 +56,25 @@
self.categoryTableView = [[CategoryTableView alloc] init];
GroupItems *categoryItem = [[GroupItems alloc] initWithTitle:@"问题分类" view:_categoryTableView];
self.textView1 = [[UITextView alloc] init];
_textView1.delegate = self;
_textView1.tag = 9991;
self.placeholderLabel1 = [[UILabel alloc] initWithFrame:CGRectMake(5, 0, 100, 30)];
self.placeholderLabel1.text = @"请输入标题...";
self.placeholderLabel1.font = [UIFont systemFontOfSize:15.0];
self.placeholderLabel1.textColor = kOnLineCellDetailColor;
[self.textView1 addSubview:self.placeholderLabel1];
GroupItems *textViewItem1 = [[GroupItems alloc] initWithTitle:@"标题类似于" view:_textView1];
self.textView2 = [[UITextView alloc] init];
_textView2.delegate = self;
_textView2.tag = 9992;
self.placeholderLabel2 = [[UILabel alloc] initWithFrame:CGRectMake(5, 0, 100, 30)];
self.placeholderLabel2.text = @"请输入关键字...";
self.placeholderLabel2.font = [UIFont systemFontOfSize:15.0];
self.placeholderLabel2.textColor = kOnLineCellDetailColor;
[self.textView2 addSubview:self.placeholderLabel2];
GroupItems *textViewItem2 = [[GroupItems alloc] initWithTitle:@"关键字类似于" view:_textView2];
// self.textView1 = [[UITextView alloc] init];
// _textView1.delegate = self;
// _textView1.tag = 9991;
// self.placeholderLabel1 = [[UILabel alloc] initWithFrame:CGRectMake(5, 0, 100, 30)];
// self.placeholderLabel1.text = @"请输入标题...";
// self.placeholderLabel1.font = [UIFont systemFontOfSize:15.0];
// self.placeholderLabel1.textColor = kOnLineCellDetailColor;
// [self.textView1 addSubview:self.placeholderLabel1];
// GroupItems *textViewItem1 = [[GroupItems alloc] initWithTitle:@"标题类似于" view:_textView1];
//
// self.textView2 = [[UITextView alloc] init];
// _textView2.delegate = self;
// _textView2.tag = 9992;
// self.placeholderLabel2 = [[UILabel alloc] initWithFrame:CGRectMake(5, 0, 100, 30)];
// self.placeholderLabel2.text = @"请输入关键字...";
// self.placeholderLabel2.font = [UIFont systemFontOfSize:15.0];
// self.placeholderLabel2.textColor = kOnLineCellDetailColor;
// [self.textView2 addSubview:self.placeholderLabel2];
// GroupItems *textViewItem2 = [[GroupItems alloc] initWithTitle:@"关键字类似于" view:_textView2];
self.stateTableView = [[StateTableView alloc] init];
GroupItems *stateItem = [[GroupItems alloc] initWithTitle:@"问题状态" view:_stateTableView];
......@@ -85,12 +85,14 @@
[self insertSubview:_scopeTableView belowSubview:_groupTabBar];
[self insertSubview:_groupTableView belowSubview:_groupTabBar];
[self insertSubview:_categoryTableView belowSubview:_groupTabBar];
[self insertSubview:_textView1 belowSubview:_groupTabBar];
[self insertSubview:_textView2 belowSubview:_groupTabBar];
// [self insertSubview:_textView1 belowSubview:_groupTabBar];
// [self insertSubview:_textView2 belowSubview:_groupTabBar];
[self insertSubview:_stateTableView belowSubview:_groupTabBar];
[self insertSubview:_timeTableView belowSubview:_groupTabBar];
_groupTabBar.items = @[scopeItem, groupItem, categoryItem, textViewItem1, textViewItem2, stateItem, timeItem];
_groupTabBar.items = @[scopeItem, groupItem, categoryItem, stateItem, timeItem];
// _groupTabBar.items = @[scopeItem, groupItem, categoryItem, textViewItem1, textViewItem2, stateItem, timeItem];
[_groupTabBar showIndex:0];
self.backView.backgroundColor = [UIColor whiteColor];
......@@ -184,45 +186,45 @@
return _submitBtn;
}
#pragma mark - UITextView Delegate
- (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text {
if (![text isEqualToString:@""]) {
if (textView.tag == 9991) {
self.placeholderLabel1.hidden = YES;
} else {
self.placeholderLabel2.hidden = YES;
}
}
if ([text isEqualToString:@""] && range.location == 0 && range.length == 1) {
if (textView.tag == 9991) {
self.placeholderLabel1.hidden = NO;
} else {
self.placeholderLabel2.hidden = NO;
}
}
if ([text isEqualToString:@"\n"]) {
[self.textView1 resignFirstResponder];
[self.textView2 resignFirstResponder];
if (textView.tag == 9991) {
if (textView.text.length != 0) {
self.placeholderLabel1.hidden = YES;
} else {
self.placeholderLabel1.hidden = NO;
}
} else {
if (textView.text.length != 0) {
self.placeholderLabel2.hidden = YES;
} else {
self.placeholderLabel2.hidden = NO;
}
}
return NO;
}
return YES;
}
//#pragma mark - UITextView Delegate
//- (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text {
// if (![text isEqualToString:@""]) {
// if (textView.tag == 9991) {
// self.placeholderLabel1.hidden = YES;
// } else {
// self.placeholderLabel2.hidden = YES;
// }
// }
//
// if ([text isEqualToString:@""] && range.location == 0 && range.length == 1) {
// if (textView.tag == 9991) {
// self.placeholderLabel1.hidden = NO;
// } else {
// self.placeholderLabel2.hidden = NO;
// }
// }
//
// if ([text isEqualToString:@"\n"]) {
// [self.textView1 resignFirstResponder];
// [self.textView2 resignFirstResponder];
//
// if (textView.tag == 9991) {
// if (textView.text.length != 0) {
// self.placeholderLabel1.hidden = YES;
// } else {
// self.placeholderLabel1.hidden = NO;
// }
// } else {
// if (textView.text.length != 0) {
// self.placeholderLabel2.hidden = YES;
// } else {
// self.placeholderLabel2.hidden = NO;
// }
// }
// return NO;
// }
//
// return YES;
//}
@end
......@@ -49,7 +49,7 @@
// 分组
@property (nonatomic, assign) NSInteger groupRow;
@property (nonatomic, strong) NSMutableArray *allGroupNameArray;
@property (nonatomic, strong) NSArray *queryOrders;
// 分类
@property (nonatomic, copy) NSString *categoryName;
@property (nonatomic, assign) NSInteger stateRow;
......@@ -132,13 +132,18 @@
NSString *urlStr = [NSString stringWithFormat:@"%@%@", kRedStarURL, kQuestionListURL];
NSString *user_uuid = [[NSUserDefaults standardUserDefaults] objectForKey:@"user_uuid"];
NSArray *queryOrders = @[@{@"field":@"resolveTime",
@"direction":@"desc"}];
_queryOrders = queryOrders;
// 请求参数
NSDictionary *parameters = @{@"user":user_uuid,
@"scope":@"all",
@"pageNumber":@(0),
@"pageSize":@(20)
@"pageSize":@(20),
@"queryOrders":queryOrders
};
// 发起请求
HttpClient *httpClient = [[HttpClient alloc] initWithUrl:urlStr];
//
......@@ -184,7 +189,8 @@
NSDictionary *parameters = @{@"user":user_uuid,
@"scope":@"all",
@"pageNumber":@(_page),
@"pageSize":pageSize
@"pageSize":pageSize,
@"queryOrders":_queryOrders
};
// 发起请求
......@@ -335,6 +341,7 @@
}
if (!_taxisView) {
_taxisView = [[TaxisView alloc] init];
_taxisView.tag = 3928342;
_taxisView.backgroundColor = [UIColor whiteColor];
}
......@@ -423,24 +430,80 @@
- (void)searchBarClick:(UIButton *)sender
{
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"content CONTAINS %@ || title CONTAINS %@", self.searchBar.searchTextFiled.text, self.searchBar.searchTextFiled.text];
NSArray *arrayPre=[_allQuestionArray filteredArrayUsingPredicate:predicate];
_allQuestionArray = [NSMutableArray arrayWithArray:arrayPre];
if (_allQuestionArray.count == 0) {
if (_tableView) {
[_tableView removeFromSuperview];
_tableView = nil;
}
self.noDataView.backgroundColor = [UIColor whiteColor];
if (_searchBar.searchTextFiled.text.length == 0) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"提示" message:@"请输入问题的关键字!" delegate:self cancelButtonTitle:@"确定" otherButtonTitles:nil, nil];
[alert show];
} else {
if (_noDataView) {
[_noDataView removeFromSuperview];
_noDataView = nil;
}
self.searchBar.backgroundColor = kSectionBackGroundColor;
[self.tableView reloadData];
NSString *urlStr = [NSString stringWithFormat:@"%@%@", kRedStarURL, kQuestionListURL];
NSString *user_uuid = [[NSUserDefaults standardUserDefaults] objectForKey:@"user_uuid"];
NSNumber *pageSize = [[NSUserDefaults standardUserDefaults] objectForKey:@"requestNumber"];
NSDictionary *parameters = @{@"user":user_uuid,
@"pageNumber":@(0),
@"pageSize":pageSize,
@"keyword":_searchBar.searchTextFiled.text,
@"queryOrders":@[@{@"field":@"keyword",
@"direction":@"asc"}]
};
// 发起请求
HttpClient *httpClient = [[HttpClient alloc] initWithUrl:urlStr];
//
__block QuestionViewController *weakSelf = self;
[MBProgressHUD showHUDAddedTo:self.view animated:YES];
// 请求问题列表
[httpClient getQuestionListWithParameters:parameters completion:^(id response, NSError *error) {
NSDictionary *dataDict = (NSDictionary *)response[@"data"];
NSDictionary *recordsDict = (NSDictionary *)dataDict[@"records"];
NSMutableArray *tempArray = [NSMutableArray array];
for (NSDictionary *questionDict in recordsDict) {
QuestionModel *question = [[QuestionModel alloc] init];
[question setValuesForKeysWithDictionary:questionDict];
[tempArray addObject:question];
}
_allQuestionArray = tempArray;
if (_allQuestionArray.count == 0) {
if (_tableView) {
[_tableView removeFromSuperview];
_tableView = nil;
}
weakSelf.noDataView.backgroundColor = [UIColor whiteColor];
[MBProgressHUD hideHUDForView:weakSelf.view animated:YES];
} else {
if (_noDataView) {
[_noDataView removeFromSuperview];
_noDataView = nil;
}
weakSelf.tableView.delegate = weakSelf;
weakSelf.tableView.dataSource = weakSelf;
[weakSelf.tableView reloadData];
[MBProgressHUD hideHUDForView:weakSelf.view animated:YES];
}
self.menuView.backgroundColor = kInspectSectionBackGroundColor;
}];
}
// NSPredicate *predicate = [NSPredicate predicateWithFormat:@"content CONTAINS %@ || title CONTAINS %@", self.searchBar.searchTextFiled.text, self.searchBar.searchTextFiled.text];
// NSArray *arrayPre=[_allQuestionArray filteredArrayUsingPredicate:predicate];
// _allQuestionArray = [NSMutableArray arrayWithArray:arrayPre];
//
// if (_allQuestionArray.count == 0) {
// if (_tableView) {
// [_tableView removeFromSuperview];
// _tableView = nil;
// }
// self.noDataView.backgroundColor = [UIColor whiteColor];
// } else {
// if (_noDataView) {
// [_noDataView removeFromSuperview];
// _noDataView = nil;
// }
// self.searchBar.backgroundColor = kSectionBackGroundColor;
// [self.tableView reloadData];
// }
}
// 重置按钮
......@@ -454,8 +517,8 @@
[_screenView.stateTableView selectRowAtIndexPath:selectedIndexPath animated:NO scrollPosition:UITableViewScrollPositionNone];
[_screenView.timeTableView selectRowAtIndexPath:selectedIndexPath animated:NO scrollPosition:UITableViewScrollPositionNone];
_screenView.textView1.text = @"";
_screenView.textView2.text = @"";
// _screenView.textView1.text = @"";
// _screenView.textView2.text = @"";
}
......@@ -501,19 +564,22 @@
NSArray *array = @[@{@"field":@"category",
@"direction":@"asc"}];
[parameters setObject:array forKey:@"queryOrders"];
} else if (_screenView.groupTabBar.selectNumber == 3) {
[parameters setObject:_screenView.textView1.text forKey:@"contentLike"];
NSArray *array = @[@{@"field":@"contentLike",
@"direction":@"asc"}];
[parameters setObject:array forKey:@"queryOrders"];
} else if (_screenView.groupTabBar.selectNumber == 4) {
[parameters setObject:_screenView.textView2.text forKey:@"keyword"];
NSArray *array = @[@{@"field":@"keyword",
@"direction":@"asc"}];
[parameters setObject:array forKey:@"queryOrders"];
} else if (_screenView.groupTabBar.selectNumber == 5) {
}
// else if (_screenView.groupTabBar.selectNumber == 3) {
// [parameters setObject:_screenView.textView1.text forKey:@"contentLike"];
// NSArray *array = @[@{@"field":@"contentLike",
// @"direction":@"asc"}];
// [parameters setObject:array forKey:@"queryOrders"];
//
// }
// else if (_screenView.groupTabBar.selectNumber == 4) {
// [parameters setObject:_screenView.textView2.text forKey:@"keyword"];
// NSArray *array = @[@{@"field":@"keyword",
// @"direction":@"asc"}];
// [parameters setObject:array forKey:@"queryOrders"];
//
// }
else if (_screenView.groupTabBar.selectNumber == 3) {
if (_stateRow == 0) {
[parameters setObject:@"created" forKey:@"state"];
} else if (_stateRow == 1) {
......@@ -524,7 +590,7 @@
NSArray *array = @[@{@"field":@"state",
@"direction":@"asc"}];
[parameters setObject:array forKey:@"queryOrders"];
} else if (_screenView.groupTabBar.selectNumber == 6) {
} else if (_screenView.groupTabBar.selectNumber == 4) {
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
......@@ -657,14 +723,16 @@
} else if (sender.tag - kTAxisBtnTag == 2) {
queryOrders = @[@{@"field":@"likeCount",
@"direction":@"desc"}];
queryOrders = @[@{@"field":@"resolveTime",
@"direction":@"asc"}];
} else {
queryOrders = @[@{@"field":@"likeCount",
@"direction":@"asc"}];
queryOrders = @[@{@"field":@"resolveTime",
@"direction":@"desc"}];
}
_queryOrders = queryOrders;
NSDictionary *parameters = @{@"user":user_uuid,
@"scope":@"all",
@"pageNumber":@(0),
......@@ -747,7 +815,7 @@
// cell的高度
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
return 120;
return 100;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment