Commit 04cebd92 authored by admin's avatar admin

5:问题加条件现在,如果非已解决,不能点赞和添加评论

parent 30be1a46
...@@ -13,37 +13,5 @@ ...@@ -13,37 +13,5 @@
stopOnStyle = "0"> stopOnStyle = "0">
</BreakpointContent> </BreakpointContent>
</BreakpointProxy> </BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "redstar/Classes/Module/Function/Question/AddQuestion/Cell/AddQuestionTableCell.m"
timestampString = "470919794.364077"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "114"
endingLineNumber = "114"
landmarkName = "-contentTextView"
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "redstar/Classes/Module/Function/Question/AddQuestion/Cell/AddQuestionTableCell.m"
timestampString = "470919794.364077"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "190"
endingLineNumber = "190"
landmarkName = "-titleTextView"
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
</Breakpoints> </Breakpoints>
</Bucket> </Bucket>
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
self.allAnnoArray = [NSMutableArray array]; self.allAnnoArray = [NSMutableArray array];
self.isRead = NO; self.isRead = NO;
self.stateStr = @"false"; self.stateStr = @"0";
[self setNav]; [self setNav];
...@@ -70,6 +70,9 @@ ...@@ -70,6 +70,9 @@
int page_number = 0; int page_number = 0;
int page_size = 10; int page_size = 10;
NSString *url = [NSString stringWithFormat:@"%@%@%@?read=%@&page_number=%d&page_size=%d", kRedStarURL, kAnnounceListURL ,user_uuid ,_stateStr, page_number, page_size]; NSString *url = [NSString stringWithFormat:@"%@%@%@?read=%@&page_number=%d&page_size=%d", kRedStarURL, kAnnounceListURL ,user_uuid ,_stateStr, page_number, page_size];
//NSString *url = [NSString stringWithFormat:@"%@%@%@?page_number=%d&page_size=%d", kRedStarURL, kAnnounceListURL ,user_uuid, page_number, page_size];
NSLog(@"urlll = %@", url);
HttpClient *httpClient = [[HttpClient alloc] initWithUrl:url]; HttpClient *httpClient = [[HttpClient alloc] initWithUrl:url];
[httpClient getAnnounceListWithCompletion:^(id response, NSError *error) { [httpClient getAnnounceListWithCompletion:^(id response, NSError *error) {
NSLog(@"公告response = %@", response); NSLog(@"公告response = %@", response);
...@@ -125,10 +128,10 @@ ...@@ -125,10 +128,10 @@
int page_number = 0; int page_number = 0;
int page_size = 10; int page_size = 10;
if (sender.selectedSegmentIndex == 0) { if (sender.selectedSegmentIndex == 0) {
self.stateStr = @"false"; self.stateStr = @"0";
url = [NSString stringWithFormat:@"%@%@%@?read=%@&page_number=%d&page_size=%d", kRedStarURL, kAnnounceListURL ,user_uuid ,_stateStr, page_number, page_size]; url = [NSString stringWithFormat:@"%@%@%@?read=%@&page_number=%d&page_size=%d", kRedStarURL, kAnnounceListURL ,user_uuid ,_stateStr, page_number, page_size];
} else if (sender.selectedSegmentIndex == 1) { } else if (sender.selectedSegmentIndex == 1) {
self.stateStr = @"true"; self.stateStr = @"1";
url = [NSString stringWithFormat:@"%@%@%@?read=%@&page_number=%d&page_size=%d", kRedStarURL, kAnnounceListURL ,user_uuid ,_stateStr, page_number, page_size]; url = [NSString stringWithFormat:@"%@%@%@?read=%@&page_number=%d&page_size=%d", kRedStarURL, kAnnounceListURL ,user_uuid ,_stateStr, page_number, page_size];
} else { } else {
self.stateStr = @""; self.stateStr = @"";
...@@ -150,8 +153,9 @@ ...@@ -150,8 +153,9 @@
[annoArray addObject:anno]; [annoArray addObject:anno];
} }
_allAnnoArray = annoArray; _allAnnoArray = annoArray;
[self.tableView reloadData];
} }
[self.tableView reloadData];
}]; }];
...@@ -160,6 +164,7 @@ ...@@ -160,6 +164,7 @@
#pragma mark - UITableView Delegate/DataSource #pragma mark - UITableView Delegate/DataSource
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{ {
NSLog(@"cooount = %d", (int)_allAnnoArray.count);
return _allAnnoArray.count; return _allAnnoArray.count;
} }
......
...@@ -50,12 +50,12 @@ ...@@ -50,12 +50,12 @@
#pragma mark - Private Methods #pragma mark - Private Methods
- (void)setup - (void)setup
{ {
[self.onLineSamplingBtn setTitle:@"在线抽查" forState:UIControlStateNormal]; [self.onLineSamplingBtn setTitle:@"口碑巡检" forState:UIControlStateNormal];
[self.wordOfMouthBtn setTitle:@"口碑巡检" forState:UIControlStateNormal]; [self.wordOfMouthBtn setTitle:@"口碑排名" forState:UIControlStateNormal];
[self.standardBtn setTitle:@"口碑标准" forState:UIControlStateNormal]; [self.standardBtn setTitle:@"问题与知识" forState:UIControlStateNormal];
[self.pictureBtn setTitle:@"图说口碑" forState:UIControlStateNormal]; [self.pictureBtn setTitle:@"图说口碑" forState:UIControlStateNormal];
[self.questionBtn setTitle:@"问题与知识" forState:UIControlStateNormal]; [self.questionBtn setTitle:@"口碑标准" forState:UIControlStateNormal];
[self.rankBtn setTitle:@"口碑排名" forState:UIControlStateNormal]; [self.rankBtn setTitle:@"在线抽查" forState:UIControlStateNormal];
//self.lineView.backgroundColor = kSeparateLineViewColor; //self.lineView.backgroundColor = kSeparateLineViewColor;
...@@ -98,7 +98,7 @@ ...@@ -98,7 +98,7 @@
_onLineSamplingBtn = [[FuncItem alloc] init]; _onLineSamplingBtn = [[FuncItem alloc] init];
_onLineSamplingBtn.translatesAutoresizingMaskIntoConstraints = NO; _onLineSamplingBtn.translatesAutoresizingMaskIntoConstraints = NO;
[_onLineSamplingBtn addTarget:self action:@selector(itemClick:) forControlEvents:UIControlEventTouchUpInside]; [_onLineSamplingBtn addTarget:self action:@selector(itemClick:) forControlEvents:UIControlEventTouchUpInside];
[_onLineSamplingBtn setImage:[UIImage imageNamed:@"task_000"] forState:UIControlStateNormal]; [_onLineSamplingBtn setImage:[UIImage imageNamed:@"task_001"] forState:UIControlStateNormal];
[self.view addSubview:_onLineSamplingBtn]; [self.view addSubview:_onLineSamplingBtn];
NSLayoutConstraint *onLineSamplingTop = [NSLayoutConstraint constraintWithItem:_onLineSamplingBtn attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeTop multiplier:1.0 constant:0]; NSLayoutConstraint *onLineSamplingTop = [NSLayoutConstraint constraintWithItem:_onLineSamplingBtn attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeTop multiplier:1.0 constant:0];
...@@ -128,7 +128,7 @@ ...@@ -128,7 +128,7 @@
_wordOfMouthBtn = [[FuncItem alloc] init]; _wordOfMouthBtn = [[FuncItem alloc] init];
[_wordOfMouthBtn addTarget:self action:@selector(itemClick:) forControlEvents:UIControlEventTouchUpInside]; [_wordOfMouthBtn addTarget:self action:@selector(itemClick:) forControlEvents:UIControlEventTouchUpInside];
[_wordOfMouthBtn setImage:[UIImage imageNamed:@"task_001"] forState:UIControlStateNormal]; [_wordOfMouthBtn setImage:[UIImage imageNamed:@"task_005"] forState:UIControlStateNormal];
_wordOfMouthBtn.translatesAutoresizingMaskIntoConstraints = NO; _wordOfMouthBtn.translatesAutoresizingMaskIntoConstraints = NO;
[self.view addSubview:_wordOfMouthBtn]; [self.view addSubview:_wordOfMouthBtn];
...@@ -153,7 +153,7 @@ ...@@ -153,7 +153,7 @@
{ {
if (!_standardBtn) { if (!_standardBtn) {
_standardBtn = [[FuncItem alloc] init]; _standardBtn = [[FuncItem alloc] init];
[_standardBtn setImage:[UIImage imageNamed:@"task_002"] forState:UIControlStateNormal]; [_standardBtn setImage:[UIImage imageNamed:@"task_004"] forState:UIControlStateNormal];
_standardBtn.translatesAutoresizingMaskIntoConstraints = NO; _standardBtn.translatesAutoresizingMaskIntoConstraints = NO;
[_standardBtn addTarget:self action:@selector(itemClick:) forControlEvents:UIControlEventTouchUpInside]; [_standardBtn addTarget:self action:@selector(itemClick:) forControlEvents:UIControlEventTouchUpInside];
...@@ -208,7 +208,7 @@ ...@@ -208,7 +208,7 @@
{ {
if (!_questionBtn) { if (!_questionBtn) {
_questionBtn = [[FuncItem alloc] init]; _questionBtn = [[FuncItem alloc] init];
[_questionBtn setImage:[UIImage imageNamed:@"task_004"] forState:UIControlStateNormal]; [_questionBtn setImage:[UIImage imageNamed:@"task_002"] forState:UIControlStateNormal];
_questionBtn.translatesAutoresizingMaskIntoConstraints = NO; _questionBtn.translatesAutoresizingMaskIntoConstraints = NO;
[_questionBtn addTarget:self action:@selector(itemClick:) forControlEvents:UIControlEventTouchUpInside]; [_questionBtn addTarget:self action:@selector(itemClick:) forControlEvents:UIControlEventTouchUpInside];
...@@ -233,7 +233,7 @@ ...@@ -233,7 +233,7 @@
{ {
if (!_rankBtn) { if (!_rankBtn) {
_rankBtn = [[FuncItem alloc] init]; _rankBtn = [[FuncItem alloc] init];
[_rankBtn setImage:[UIImage imageNamed:@"task_005"] forState:UIControlStateNormal]; [_rankBtn setImage:[UIImage imageNamed:@"task_000"] forState:UIControlStateNormal];
_rankBtn.translatesAutoresizingMaskIntoConstraints = NO; _rankBtn.translatesAutoresizingMaskIntoConstraints = NO;
[_rankBtn addTarget:self action:@selector(itemClick:) forControlEvents:UIControlEventTouchUpInside]; [_rankBtn addTarget:self action:@selector(itemClick:) forControlEvents:UIControlEventTouchUpInside];
......
...@@ -344,8 +344,10 @@ ...@@ -344,8 +344,10 @@
// cell的点击事件 // cell的点击事件
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{ {
OnLineCompleteViewController *completeVC = [[OnLineCompleteViewController alloc] init]; UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"提示" message:@"该功能正在努力开发中!" delegate:self cancelButtonTitle:nil otherButtonTitles:@"确定", nil];
[self.navigationController pushViewController:completeVC animated:YES]; [alert show];
// OnLineCompleteViewController *completeVC = [[OnLineCompleteViewController alloc] init];
// [self.navigationController pushViewController:completeVC animated:YES];
} }
......
...@@ -122,8 +122,11 @@ ...@@ -122,8 +122,11 @@
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{ {
PictureStoryViewController *storyVC = [[PictureStoryViewController alloc] init]; UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"提示" message:@"该功能正在努力开发中!" delegate:self cancelButtonTitle:nil otherButtonTitles:@"确定", nil];
[self.navigationController pushViewController:storyVC animated:YES]; [alert show];
// PictureStoryViewController *storyVC = [[PictureStoryViewController alloc] init];
// [self.navigationController pushViewController:storyVC animated:YES];
} }
// 自定义section // 自定义section
......
...@@ -8,10 +8,8 @@ ...@@ -8,10 +8,8 @@
#import "AddQuestionTableCell.h" #import "AddQuestionTableCell.h"
@interface AddQuestionTableCell () <UITextViewDelegate>{ @interface AddQuestionTableCell ()
UITextView *_titleTextView;
UITextView *_contentTextView;
}
@property (nonatomic, strong) UIImageView *backImageView1; @property (nonatomic, strong) UIImageView *backImageView1;
@property (nonatomic, strong) UIImageView *backImageView2; @property (nonatomic, strong) UIImageView *backImageView2;
@end @end
...@@ -114,7 +112,6 @@ ...@@ -114,7 +112,6 @@
if (!_contentTextView) { if (!_contentTextView) {
_contentTextView = [[UITextView alloc] init]; _contentTextView = [[UITextView alloc] init];
_contentTextView.tag = 1002; _contentTextView.tag = 1002;
_contentTextView.delegate = self;
_contentTextView.font = [UIFont systemFontOfSize:15.0]; _contentTextView.font = [UIFont systemFontOfSize:15.0];
_contentTextView.translatesAutoresizingMaskIntoConstraints = NO; _contentTextView.translatesAutoresizingMaskIntoConstraints = NO;
[self.backImageView2 addSubview:_contentTextView]; [self.backImageView2 addSubview:_contentTextView];
...@@ -190,7 +187,6 @@ ...@@ -190,7 +187,6 @@
if (!_titleTextView) { if (!_titleTextView) {
_titleTextView = [[UITextView alloc] init]; _titleTextView = [[UITextView alloc] init];
_titleTextView.tag = 1001; _titleTextView.tag = 1001;
_titleTextView.delegate = self;
_titleTextView.font = [UIFont systemFontOfSize:15.0]; _titleTextView.font = [UIFont systemFontOfSize:15.0];
_titleTextView.translatesAutoresizingMaskIntoConstraints = NO; _titleTextView.translatesAutoresizingMaskIntoConstraints = NO;
[self.backImageView1 addSubview:_titleTextView]; [self.backImageView1 addSubview:_titleTextView];
...@@ -236,42 +232,6 @@ ...@@ -236,42 +232,6 @@
return _placeholderLabel1; return _placeholderLabel1;
} }
#pragma mark - UITextView Delegate
- (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text {
if (![text isEqualToString:@""]) {
if (textView.tag == 1001) {
self.placeholderLabel1.hidden = YES;
} else {
self.placeholderLabel2.hidden = YES;
}
}
if ([text isEqualToString:@""] && range.location == 0 && range.length == 1) {
if (textView.tag == 1001) {
self.placeholderLabel1.hidden = NO;
} else {
self.placeholderLabel2.hidden = NO;
}
}
if ([text isEqualToString:@"\n"]) {
[self.titleTextView resignFirstResponder];
[self.contentTextView resignFirstResponder];
if (textView.text.length != 0) {
self.placeholderLabel1.hidden = YES;
self.placeholderLabel2.hidden = YES;
} else {
self.placeholderLabel1.hidden = NO;
self.placeholderLabel2.hidden = NO;
}
return NO;
}
return YES;
}
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event { - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
[self.contentView endEditing:YES]; [self.contentView endEditing:YES];
} }
......
...@@ -19,9 +19,6 @@ ...@@ -19,9 +19,6 @@
#import <MBProgressHUD.h> #import <MBProgressHUD.h>
#import "AddQuestionTableCell.h" #import "AddQuestionTableCell.h"
#define kTitleTextViewTag 9283222
#define kContentTextViewTag 9283333
#define CATEGORYLIST @"服务", @"环境企划", @"环境物业", nil #define CATEGORYLIST @"服务", @"环境企划", @"环境物业", nil
#define QUESTIONLIST @"15分钟退单", @"便民服务", @"基础管理",@"轻松购系统",@"全员服务",@"人员信息",@"营运物流及服务硬件", nil #define QUESTIONLIST @"15分钟退单", @"便民服务", @"基础管理",@"轻松购系统",@"全员服务",@"人员信息",@"营运物流及服务硬件", nil
...@@ -106,71 +103,76 @@ ...@@ -106,71 +103,76 @@
return; return;
} }
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:2 inSection:0];
AddQuestionTableCell *cell = (AddQuestionTableCell *)[_tableView cellForRowAtIndexPath:indexPath];
NSString *title = [cell titleTextView].text;
NSString *content = [cell contentTextView].text;
NSDictionary *parameters;
if (_imageNameArray.count == 0) {
parameters = @{@"category":_selectLabel.text,
@"group":_selectLabel1.text,
@"title":content,
@"content":title
};
} else {
NSMutableArray *imageArray = [NSMutableArray array];
for (int i = 0; i < _imageNameArray.count; i++) {
NSString *imageName = _imageNameArray[i];
NSString *fullPath = [[NSHomeDirectory() stringByAppendingPathComponent:@"Documents"] stringByAppendingPathComponent:imageName];
UIImage *image = [UIImage imageWithContentsOfFile:fullPath];
NSData *imageData = UIImageJPEGRepresentation(image, 0.5);
NSString *imageBase64 = [imageData base64EncodedStringWithOptions:0];
NSMutableDictionary *dict = [NSMutableDictionary dictionary];
[dict setObject:imageBase64 forKey:@"fileContent"];
[dict setObject:imageName forKey:@"fileName"];
[dict setObject:@(i) forKey:@"index"];
[imageArray addObject:dict];
}
parameters = @{@"category":_selectLabel.text,
@"group":_selectLabel1.text,
@"title":content,
@"content":title,
@"attachments":imageArray};
}
NSLog(@"par = %@", parameters);
NSDate *date = [NSDate date]; UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"提示" message:@"您确定要提交新问题吗?" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"确定", nil];
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; alert.tag = 9211232;
[dateFormatter setDateFormat:@"YYYY-MM-dd+hh:mm:ss"]; [alert show];
NSString *dateString = [dateFormatter stringFromDate:date];
NSString *operId = [[NSUserDefaults standardUserDefaults] objectForKey:@"user_code"];
NSString *operName = [[NSUserDefaults standardUserDefaults] objectForKey:@"user_name"];
NSString *url = [NSString stringWithFormat:@"%@%@?time=%@&operId=%@&operName=%@", kRedStarURL, kUpLoadQuestionURL, dateString, operId, operName]; // NSIndexPath *indexPath = [NSIndexPath indexPathForRow:2 inSection:0];
url = [url stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding]; //
// AddQuestionTableCell *cell = (AddQuestionTableCell *)[_tableView cellForRowAtIndexPath:indexPath];
HttpClient *client = [[HttpClient alloc] initWithUrl:url]; //
[MBProgressHUD showHUDAddedTo:self.view animated:YES]; // NSString *title = [cell titleTextView].text;
[client uploadNewQuestionWithParameters:parameters completion:^(id response, NSError *error) { // NSString *content = [cell contentTextView].text;
NSLog(@"上传新问题 response= %@, error = %@", response, error); //
if (response[@"success"]) { // NSDictionary *parameters;
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"提示" message:@"新问题提报成功!" delegate:self cancelButtonTitle:@"确定" otherButtonTitles:nil, nil]; // if (_imageNameArray.count == 0) {
alert.tag = 90393; // parameters = @{@"category":_selectLabel.text,
[alert show]; // @"group":_selectLabel1.text,
[MBProgressHUD hideHUDForView:self.view animated:YES]; // @"title":content,
} else { // @"content":title
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"警告" message:@"新问题提报失败!" delegate:self cancelButtonTitle:@"确定" otherButtonTitles:nil, nil]; // };
[alert show]; // } else {
} // NSMutableArray *imageArray = [NSMutableArray array];
}]; // for (int i = 0; i < _imageNameArray.count; i++) {
// NSString *imageName = _imageNameArray[i];
// NSString *fullPath = [[NSHomeDirectory() stringByAppendingPathComponent:@"Documents"] stringByAppendingPathComponent:imageName];
// UIImage *image = [UIImage imageWithContentsOfFile:fullPath];
// NSData *imageData = UIImageJPEGRepresentation(image, 0.5);
// NSString *imageBase64 = [imageData base64EncodedStringWithOptions:0];
// NSMutableDictionary *dict = [NSMutableDictionary dictionary];
// [dict setObject:imageBase64 forKey:@"fileContent"];
// [dict setObject:imageName forKey:@"fileName"];
// [dict setObject:@(i) forKey:@"index"];
// [imageArray addObject:dict];
// }
//
// parameters = @{@"category":_selectLabel.text,
// @"group":_selectLabel1.text,
// @"title":content,
// @"content":title,
// @"attachments":imageArray};
// }
//
// NSLog(@"par = %@", parameters);
//
//
// NSDate *date = [NSDate date];
// NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
// [dateFormatter setDateFormat:@"YYYY-MM-dd+hh:mm:ss"];
// NSString *dateString = [dateFormatter stringFromDate:date];
//
// NSString *operId = [[NSUserDefaults standardUserDefaults] objectForKey:@"user_code"];
// NSString *operName = [[NSUserDefaults standardUserDefaults] objectForKey:@"user_name"];
//
//
// NSString *url = [NSString stringWithFormat:@"%@%@?time=%@&operId=%@&operName=%@", kRedStarURL, kUpLoadQuestionURL, dateString, operId, operName];
// url = [url stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding];
//
// HttpClient *client = [[HttpClient alloc] initWithUrl:url];
// [MBProgressHUD showHUDAddedTo:self.view animated:YES];
// [client uploadNewQuestionWithParameters:parameters completion:^(id response, NSError *error) {
// NSLog(@"上传新问题 response= %@, error = %@", response, error);
// if (response[@"success"]) {
// UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"提示" message:@"新问题提报成功!" delegate:self cancelButtonTitle:@"确定" otherButtonTitles:nil, nil];
// alert.tag = 90393;
// [alert show];
// [MBProgressHUD hideHUDForView:self.view animated:YES];
// } else {
// UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"警告" message:@"新问题提报失败!" delegate:self cancelButtonTitle:@"确定" otherButtonTitles:nil, nil];
// [alert show];
// }
// }];
} }
...@@ -234,13 +236,138 @@ ...@@ -234,13 +236,138 @@
} }
#pragma mark - UITextView Delegate
- (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text {
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:2 inSection:0];
AddQuestionTableCell *cell = (AddQuestionTableCell *)[_tableView cellForRowAtIndexPath:indexPath];
if (![text isEqualToString:@""]) {
if (textView.tag == 1001) {
cell.placeholderLabel1.hidden = YES;
} else {
cell.placeholderLabel2.hidden = YES;
}
}
if ([text isEqualToString:@""] && range.location == 0 && range.length == 1) {
if (textView.tag == 1001) {
cell.placeholderLabel1.hidden = NO;
} else {
cell.placeholderLabel2.hidden = NO;
}
}
if ([text isEqualToString:@"\n"]) {
[cell.titleTextView resignFirstResponder];
[cell.contentTextView resignFirstResponder];
if (textView.tag == 1001) {
if (textView.text.length != 0) {
cell.placeholderLabel1.hidden = YES;
} else {
cell.placeholderLabel1.hidden = NO;
}
} else {
if (textView.text.length != 0) {
cell.placeholderLabel2.hidden = YES;
} else {
cell.placeholderLabel2.hidden = NO;
}
}
return NO;
}
if (range.location>=500) {
return NO;
}
else {
return YES;
}
return YES;
}
#pragma mark - UIAlertViewDelegate #pragma mark - UIAlertViewDelegate
-(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex -(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{ {
if (buttonIndex == 0 && alertView.tag == 90393) { if (alertView.tag == 90393) {
[self.navigationController popViewControllerAnimated:YES]; if (buttonIndex == 0) {
NSNotificationCenter *notification = [NSNotificationCenter defaultCenter]; [self.navigationController popViewControllerAnimated:YES];
[notification postNotificationName:kRefreshQuestionNotification object:self]; NSNotificationCenter *notification = [NSNotificationCenter defaultCenter];
[notification postNotificationName:kRefreshQuestionNotification object:self];
}
} else if (alertView.tag == 9211232) {
if (buttonIndex == 0) {
return;
} else {
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:2 inSection:0];
AddQuestionTableCell *cell = (AddQuestionTableCell *)[_tableView cellForRowAtIndexPath:indexPath];
NSString *title = [cell titleTextView].text;
NSString *content = [cell contentTextView].text;
NSDictionary *parameters;
if (_imageNameArray.count == 0) {
parameters = @{@"category":_selectLabel.text,
@"group":_selectLabel1.text,
@"title":content,
@"content":title
};
} else {
NSMutableArray *imageArray = [NSMutableArray array];
for (int i = 0; i < _imageNameArray.count; i++) {
NSString *imageName = _imageNameArray[i];
NSString *fullPath = [[NSHomeDirectory() stringByAppendingPathComponent:@"Documents"] stringByAppendingPathComponent:imageName];
UIImage *image = [UIImage imageWithContentsOfFile:fullPath];
NSData *imageData = UIImageJPEGRepresentation(image, 0.5);
NSString *imageBase64 = [imageData base64EncodedStringWithOptions:0];
NSMutableDictionary *dict = [NSMutableDictionary dictionary];
[dict setObject:imageBase64 forKey:@"fileContent"];
[dict setObject:imageName forKey:@"fileName"];
[dict setObject:@(i) forKey:@"index"];
[imageArray addObject:dict];
}
parameters = @{@"category":_selectLabel.text,
@"group":_selectLabel1.text,
@"title":content,
@"content":title,
@"attachments":imageArray};
}
NSLog(@"par = %@", parameters);
NSDate *date = [NSDate date];
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"YYYY-MM-dd+hh:mm:ss"];
NSString *dateString = [dateFormatter stringFromDate:date];
NSString *operId = [[NSUserDefaults standardUserDefaults] objectForKey:@"user_code"];
NSString *operName = [[NSUserDefaults standardUserDefaults] objectForKey:@"user_name"];
NSString *url = [NSString stringWithFormat:@"%@%@?time=%@&operId=%@&operName=%@", kRedStarURL, kUpLoadQuestionURL, dateString, operId, operName];
url = [url stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding];
HttpClient *client = [[HttpClient alloc] initWithUrl:url];
[MBProgressHUD showHUDAddedTo:self.view animated:YES];
[client uploadNewQuestionWithParameters:parameters completion:^(id response, NSError *error) {
NSLog(@"上传新问题 response= %@, error = %@", response, error);
if (response[@"success"]) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"提示" message:@"新问题提报成功!" delegate:self cancelButtonTitle:@"确定" otherButtonTitles:nil, nil];
alert.tag = 90393;
[alert show];
[MBProgressHUD hideHUDForView:self.view animated:YES];
} else {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"警告" message:@"新问题提报失败!" delegate:self cancelButtonTitle:@"确定" otherButtonTitles:nil, nil];
[alert show];
}
}];
}
} }
} }
...@@ -328,8 +455,8 @@ ...@@ -328,8 +455,8 @@
if (!cell) { if (!cell) {
cell = [[AddQuestionTableCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:@"kAddQuestionCell"]; cell = [[AddQuestionTableCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:@"kAddQuestionCell"];
} }
cell.titleTextView.tag = kTitleTextViewTag; cell.titleTextView.delegate = self;
cell.contentTextView.tag = kContentTextViewTag; cell.contentTextView.delegate = self;
return cell; return cell;
} else if (indexPath.row == _rowNumber - 1) { } else if (indexPath.row == _rowNumber - 1) {
if ((_imageNameArray.count + 1) % 2 == 0) { if ((_imageNameArray.count + 1) % 2 == 0) {
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
@property (nonatomic, strong) CommentView *commentView; @property (nonatomic, strong) CommentView *commentView;
@property (nonatomic, strong) QuestionDetailModel *questionDetailModel; @property (nonatomic, strong) QuestionDetailModel *questionDetailModel;
@property (nonatomic, strong) NSMutableArray *allCommentArray; @property (nonatomic, strong) NSMutableArray *allCommentArray;
@property (nonatomic, assign) int clickNumber;
@end @end
...@@ -53,6 +53,7 @@ ...@@ -53,6 +53,7 @@
self.view.backgroundColor = kSectionBackGroundColor; self.view.backgroundColor = kSectionBackGroundColor;
_clickNumber = 0;
} }
...@@ -124,6 +125,12 @@ ...@@ -124,6 +125,12 @@
- (void)addComment:(UIButton *)sender - (void)addComment:(UIButton *)sender
{ {
if ([_questionDetailModel.state isEqualToString:@"created"]) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"提示" message:@"当前问题尚未解决,暂不能评论!" delegate:self cancelButtonTitle:nil otherButtonTitles:@"确定", nil];
[alert show];
return;
}
NSArray *permissions = [[NSUserDefaults standardUserDefaults] objectForKey:@"permissions"]; NSArray *permissions = [[NSUserDefaults standardUserDefaults] objectForKey:@"permissions"];
if ([permissions containsObject:@"500504"]) { if ([permissions containsObject:@"500504"]) {
if (!_backGroundView) { if (!_backGroundView) {
...@@ -167,44 +174,11 @@ ...@@ -167,44 +174,11 @@
// 提交评论 // 提交评论
- (void)submitComment:(UIButton *)sender - (void)submitComment:(UIButton *)sender
{ {
// 提示框
NSDate *date = [NSDate date]; UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"提示" message:@"您确定要提交评论吗?" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"确定", nil];
NSTimeZone *zone = [NSTimeZone systemTimeZone]; alert.tag = 3652234;
NSInteger interval = [zone secondsFromGMTForDate:date]; alert.delegate = self;
NSDate *localeDate = [date dateByAddingTimeInterval:interval]; [alert show];
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"YYYY-MM-dd+hh:mm:ss"];
NSString *dateString = [dateFormatter stringFromDate:localeDate];
NSString *operId = [[NSUserDefaults standardUserDefaults] objectForKey:@"user_code"];
NSString *operName = [[NSUserDefaults standardUserDefaults] objectForKey:@"user_name"];
NSString *url = [NSString stringWithFormat:@"%@%@?time=%@&operId=%@&operName=%@", kRedStarURL, kAddCommentURL , dateString , operId, operName];
url = [url stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding];
NSLog(@"url = %@", url);
HttpClient *httpClient = [[HttpClient alloc] initWithUrl:url];
NSDictionary *parameters = @{@"entityType":@"question",
@"entityUuid":_questionUuid,
@"comment":_commentView.contentTextView.text};
NSLog(@"parameters = %@", parameters);
[MBProgressHUD showHUDAddedTo:self.view animated:YES];
[httpClient submitCommentWithParameters:parameters completion:^(id response, NSError *error) {
NSLog(@"respo = %@, error = %@", response , error);
if ([response[@"message"] isEqualToString:@"ok"]) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"提示" message:@"添加评论成功" delegate:self cancelButtonTitle:nil otherButtonTitles:@"确定", nil];
alert.delegate = self;
[alert show];
[MBProgressHUD hideHUDForView:self.view animated:YES];
} else {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"警告" message:@"添加评论失败" delegate:self cancelButtonTitle:nil otherButtonTitles:@"确定", nil];
[alert show];
[MBProgressHUD hideHUDForView:self.view animated:YES];
}
}];
[self closeBackGroundView];
} }
- (void)closeBackGroundView - (void)closeBackGroundView
...@@ -221,18 +195,27 @@ ...@@ -221,18 +195,27 @@
- (void)addZan:(ZanButton *)sender - (void)addZan:(ZanButton *)sender
{ {
if ([_questionDetailModel.state isEqualToString:@"created"]) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"提示" message:@"当前问题尚未解决,暂不能点赞!" delegate:self cancelButtonTitle:nil otherButtonTitles:@"确定", nil];
[alert show];
return;
}
_clickNumber++;
if (_clickNumber > 4) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"提示" message:@"您点赞过于频繁,请稍后再试!" delegate:self cancelButtonTitle:nil otherButtonTitles:@"确定", nil];
[alert show];
return;
}
NSArray *permissions = [[NSUserDefaults standardUserDefaults] objectForKey:@"permissions"]; NSArray *permissions = [[NSUserDefaults standardUserDefaults] objectForKey:@"permissions"];
if ([permissions containsObject:@"500505"]) { if ([permissions containsObject:@"500505"]) {
sender.selected = !sender.selected; sender.selected = !sender.selected;
NSDate *date = [NSDate date]; NSDate *date = [NSDate date];
NSTimeZone *zone = [NSTimeZone systemTimeZone];
NSInteger interval = [zone secondsFromGMTForDate:date];
NSDate *localeDate = [date dateByAddingTimeInterval:interval];
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"YYYY-MM-dd+hh:mm:ss"]; [dateFormatter setDateFormat:@"YYYY-MM-dd+hh:mm:ss"];
NSString *dateString = [dateFormatter stringFromDate:localeDate]; NSString *dateString = [dateFormatter stringFromDate:date];
NSString *operId = [[NSUserDefaults standardUserDefaults] objectForKey:@"user_code"]; NSString *operId = [[NSUserDefaults standardUserDefaults] objectForKey:@"user_code"];
...@@ -295,6 +278,7 @@ ...@@ -295,6 +278,7 @@
- (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text - (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text
{ {
if (![text isEqualToString:@""]) { if (![text isEqualToString:@""]) {
_commentView.placeholderLabel2.hidden = YES; _commentView.placeholderLabel2.hidden = YES;
} }
...@@ -313,6 +297,13 @@ ...@@ -313,6 +297,13 @@
return NO; return NO;
} }
if (range.location>=200) {
return NO;
}
else {
return YES;
}
return YES; return YES;
} }
...@@ -448,32 +439,75 @@ ...@@ -448,32 +439,75 @@
#pragma mark - UIAlertViewDelegate #pragma mark - UIAlertViewDelegate
-(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex -(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{ {
if (buttonIndex == 0) { if (alertView.tag == 3652234) {
if (buttonIndex == 0) {
NSString *user_uuid = [[NSUserDefaults standardUserDefaults] objectForKey:@"user_uuid"]; return;
NSString *url = [NSString stringWithFormat:@"%@%@%@?userUuid=%@", kRedStarURL, kQuestionDetailURL, _questionUuid ,user_uuid]; } else {
// 提交数据
HttpClient *httpClient = [[HttpClient alloc] initWithUrl:url]; NSDate *date = [NSDate date];
[MBProgressHUD showHUDAddedTo:self.view animated:YES]; NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[httpClient getQuestionDetailWithParameters:nil completion:^(id response, NSError *error) { [dateFormatter setDateFormat:@"YYYY-MM-dd+hh:mm:ss"];
NSDictionary *dict = response[@"data"]; NSString *dateString = [dateFormatter stringFromDate:date];
NSLog(@"问题详情 = %@", dict);
QuestionDetailModel *quesDetail = [[QuestionDetailModel alloc] init];
[quesDetail setValuesForKeysWithDictionary:dict];
_questionDetailModel = quesDetail;
NSArray *commentArray = _questionDetailModel.comments;
NSMutableArray *tempArray = [NSMutableArray array]; NSString *operId = [[NSUserDefaults standardUserDefaults] objectForKey:@"user_code"];
for (NSDictionary *dict in commentArray) { NSString *operName = [[NSUserDefaults standardUserDefaults] objectForKey:@"user_name"];
CommentModel *comment = [[CommentModel alloc] init];
[comment setValuesForKeysWithDictionary:dict]; NSString *url = [NSString stringWithFormat:@"%@%@?time=%@&operId=%@&operName=%@", kRedStarURL, kAddCommentURL , dateString , operId, operName];
[tempArray addObject:comment]; url = [url stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding];
} NSLog(@"url = %@", url);
_allCommentArray = tempArray;
[self.tableView reloadData]; HttpClient *httpClient = [[HttpClient alloc] initWithUrl:url];
[MBProgressHUD hideHUDForView:self.view animated:YES]; NSDictionary *parameters = @{@"entityType":@"question",
@"entityUuid":_questionUuid,
}]; @"comment":_commentView.contentTextView.text};
NSLog(@"parameters = %@", parameters);
[MBProgressHUD showHUDAddedTo:self.view animated:YES];
[httpClient submitCommentWithParameters:parameters completion:^(id response, NSError *error) {
NSLog(@"respo = %@, error = %@", response , error);
if ([response[@"message"] isEqualToString:@"ok"]) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"提示" message:@"添加评论成功" delegate:self cancelButtonTitle:nil otherButtonTitles:@"确定", nil];
alert.delegate = self;
alert.tag = 455232;
[alert show];
[MBProgressHUD hideHUDForView:self.view animated:YES];
} else {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"警告" message:@"添加评论失败" delegate:self cancelButtonTitle:nil otherButtonTitles:@"确定", nil];
[alert show];
[MBProgressHUD hideHUDForView:self.view animated:YES];
}
}];
[self closeBackGroundView];
}
} else if (alertView.tag == 455232) {
// 刷新当前问题详情的评论列表
if (buttonIndex == 0) {
NSString *user_uuid = [[NSUserDefaults standardUserDefaults] objectForKey:@"user_uuid"];
NSString *url = [NSString stringWithFormat:@"%@%@%@?userUuid=%@", kRedStarURL, kQuestionDetailURL, _questionUuid ,user_uuid];
HttpClient *httpClient = [[HttpClient alloc] initWithUrl:url];
[MBProgressHUD showHUDAddedTo:self.view animated:YES];
[httpClient getQuestionDetailWithParameters:nil completion:^(id response, NSError *error) {
NSDictionary *dict = response[@"data"];
NSLog(@"问题详情 = %@", dict);
QuestionDetailModel *quesDetail = [[QuestionDetailModel alloc] init];
[quesDetail setValuesForKeysWithDictionary:dict];
_questionDetailModel = quesDetail;
NSArray *commentArray = _questionDetailModel.comments;
NSMutableArray *tempArray = [NSMutableArray array];
for (NSDictionary *dict in commentArray) {
CommentModel *comment = [[CommentModel alloc] init];
[comment setValuesForKeysWithDictionary:dict];
[tempArray addObject:comment];
}
_allCommentArray = tempArray;
[self.tableView reloadData];
[MBProgressHUD hideHUDForView:self.view animated:YES];
}];
}
} }
} }
......
...@@ -102,10 +102,14 @@ ...@@ -102,10 +102,14 @@
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{ {
if (indexPath.section == 1) {
HandOutViewController *hoandOutVC = [[HandOutViewController alloc] init]; UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"提示" message:@"该功能正在努力开发中!" delegate:self cancelButtonTitle:nil otherButtonTitles:@"确定", nil];
[self.navigationController pushViewController:hoandOutVC animated:YES]; [alert show];
}
// if (indexPath.section == 1) {
// HandOutViewController *hoandOutVC = [[HandOutViewController alloc] init];
// [self.navigationController pushViewController:hoandOutVC animated:YES];
// }
} }
#pragma mark - lazy laoding #pragma mark - lazy laoding
......
...@@ -78,51 +78,9 @@ ...@@ -78,51 +78,9 @@
return; return;
} }
NSMutableArray *imageArray = [NSMutableArray array]; UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"提示" message:[NSString stringWithFormat:@"你确定要上传检查点的相关信息吗?"] delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"确定", nil];
for (int i = 0; i < _imageNameArray.count; i++) { alert.tag = 533292;
NSString *imageName = _imageNameArray[i]; [alert show];
NSString *fullPath = [[NSHomeDirectory() stringByAppendingPathComponent:@"Documents"] stringByAppendingPathComponent:imageName];
UIImage *image = [UIImage imageWithContentsOfFile:fullPath];
NSData *imageData = UIImageJPEGRepresentation(image, 0.5);
NSString *imageBase64 = [imageData base64EncodedStringWithOptions:0];
NSMutableDictionary *dict = [NSMutableDictionary dictionary];
[dict setObject:imageBase64 forKey:@"fileContent"];
[dict setObject:imageName forKey:@"fileName"];
[dict setObject:@(i) forKey:@"index"];
[imageArray addObject:dict];
}
NSDate *date = [NSDate date];
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"YYYY-MM-dd+hh:mm:ss"];
NSString *dateString = [dateFormatter stringFromDate:date];
NSString *operId = [[NSUserDefaults standardUserDefaults] objectForKey:@"user_code"];
NSString *operName = [[NSUserDefaults standardUserDefaults] objectForKey:@"user_name"];
NSString *url = [NSString stringWithFormat:@"%@%@%@?time=%@&operId=%@&operName=%@",kRedStarURL, kUpLoadInspectResult, self.praiseUuid, dateString, operId, operName];
url = [url stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding];
NSLog(@"上传检查点url = %@", url);
HttpClient *httpClient = [[HttpClient alloc] initWithUrl:url];
[MBProgressHUD showHUDAddedTo:self.view animated:YES];
NSDictionary *parameters = @{@"questionUuid":self.questionUuid,
@"storeUuid":self.store_uuid,
@"remark":self.footerView.contentTextView.text,
@"attachments":imageArray
};
[httpClient uploadInspectResultWithParameters:parameters completion:^(id response, NSError *error) {
NSLog(@"上传检查点 respose =%@ error = %@", response, error);
if (response[@"success"]) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"提示" message:@"检查点上报成功!" delegate:self cancelButtonTitle:nil otherButtonTitles:@"确定", nil];
alert.delegate = self;
alert.tag = 39429234;
[alert show];
}
[MBProgressHUD hideHUDForView:self.view animated:YES];
}];
} }
// 返回上一页面 // 返回上一页面
...@@ -283,10 +241,62 @@ ...@@ -283,10 +241,62 @@
#pragma mark - UIAlertViewDelegate #pragma mark - UIAlertViewDelegate
-(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex -(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{ {
if (buttonIndex == 0 && alertView.tag == 39429234) { if (alertView.tag == 39429234) {
[self.navigationController popViewControllerAnimated:YES]; if (buttonIndex == 0) {
NSNotificationCenter *notification = [NSNotificationCenter defaultCenter]; [self.navigationController popViewControllerAnimated:YES];
[notification postNotificationName:kRefreshInspectPointNotification object:self]; NSNotificationCenter *notification = [NSNotificationCenter defaultCenter];
[notification postNotificationName:kRefreshInspectPointNotification object:self];
}
} else if (alertView.tag == 533292) {
if (buttonIndex == 0) {
return;
} else {
NSMutableArray *imageArray = [NSMutableArray array];
for (int i = 0; i < _imageNameArray.count; i++) {
NSString *imageName = _imageNameArray[i];
NSString *fullPath = [[NSHomeDirectory() stringByAppendingPathComponent:@"Documents"] stringByAppendingPathComponent:imageName];
UIImage *image = [UIImage imageWithContentsOfFile:fullPath];
NSData *imageData = UIImageJPEGRepresentation(image, 0.5);
NSString *imageBase64 = [imageData base64EncodedStringWithOptions:0];
NSMutableDictionary *dict = [NSMutableDictionary dictionary];
[dict setObject:imageBase64 forKey:@"fileContent"];
[dict setObject:imageName forKey:@"fileName"];
[dict setObject:@(i) forKey:@"index"];
[imageArray addObject:dict];
}
NSDate *date = [NSDate date];
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"YYYY-MM-dd+hh:mm:ss"];
NSString *dateString = [dateFormatter stringFromDate:date];
NSString *operId = [[NSUserDefaults standardUserDefaults] objectForKey:@"user_code"];
NSString *operName = [[NSUserDefaults standardUserDefaults] objectForKey:@"user_name"];
NSString *url = [NSString stringWithFormat:@"%@%@%@?time=%@&operId=%@&operName=%@",kRedStarURL, kUpLoadInspectResult, self.praiseUuid, dateString, operId, operName];
url = [url stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding];
NSLog(@"上传检查点url = %@", url);
HttpClient *httpClient = [[HttpClient alloc] initWithUrl:url];
[MBProgressHUD showHUDAddedTo:self.view animated:YES];
NSDictionary *parameters = @{@"questionUuid":self.questionUuid,
@"storeUuid":self.store_uuid,
@"remark":self.footerView.contentTextView.text,
@"attachments":imageArray
};
[httpClient uploadInspectResultWithParameters:parameters completion:^(id response, NSError *error) {
NSLog(@"上传检查点 respose =%@ error = %@", response, error);
if (response[@"success"]) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"提示" message:@"检查点上报成功!" delegate:self cancelButtonTitle:nil otherButtonTitles:@"确定", nil];
alert.delegate = self;
alert.tag = 39429234;
[alert show];
}
[MBProgressHUD hideHUDForView:self.view animated:YES];
}];
}
} }
} }
...@@ -369,6 +379,12 @@ ...@@ -369,6 +379,12 @@
return NO; return NO;
} }
if (range.location>=200) {
return NO;
}
else {
return YES;
}
return YES; return YES;
} }
......
...@@ -93,10 +93,7 @@ ...@@ -93,10 +93,7 @@
[dateFormatter setDateFormat:@"yyyy-MM-dd"]; [dateFormatter setDateFormat:@"yyyy-MM-dd"];
// 当前时间 // 当前时间
NSDate *date = [NSDate date]; NSDate *date = [NSDate date];
NSTimeZone *zone = [NSTimeZone systemTimeZone]; NSString *strDate = [dateFormatter stringFromDate:date];
NSInteger interval = [zone secondsFromGMTForDate: date];
NSDate *localeDate = [date dateByAddingTimeInterval: interval];
NSString *strDate = [dateFormatter stringFromDate:localeDate];
NSDate *today = [dateFormatter dateFromString:strDate]; NSDate *today = [dateFormatter dateFromString:strDate];
NSLog(@"today = %@", today); NSLog(@"today = %@", today);
// endTime // endTime
......
...@@ -177,6 +177,16 @@ ...@@ -177,6 +177,16 @@
}]; }];
} }
- (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text
{
if (range.location>=200) {
return NO;
}
else {
return YES;
}
}
// 提交评论 // 提交评论
- (void)submitComment:(UIButton *)sender - (void)submitComment:(UIButton *)sender
......
...@@ -45,6 +45,8 @@ ...@@ -45,6 +45,8 @@
- (void)viewDidLoad { - (void)viewDidLoad {
[super viewDidLoad]; [super viewDidLoad];
self.view.backgroundColor = [UIColor whiteColor];
UILabel *customLab = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 40, 30)]; UILabel *customLab = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 40, 30)];
[customLab setTextColor:[UIColor whiteColor]]; [customLab setTextColor:[UIColor whiteColor]];
[customLab setText:@"口碑排名"]; [customLab setText:@"口碑排名"];
......
...@@ -91,12 +91,30 @@ ...@@ -91,12 +91,30 @@
- (void)quitLoginClick:(UIButton *)sender - (void)quitLoginClick:(UIButton *)sender
{ {
NSUserDefaults *userDefault = [NSUserDefaults standardUserDefaults];
[userDefault removeObjectForKey:@"loginMessage"]; UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"提示" message:@"您确定要退出登录吗?" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"确定", nil];
[userDefault removeObjectForKey:@"username"]; alert.tag = 7838347;
[userDefault removeObjectForKey:@"password"]; [alert show];
}
[self.tabBarController dismissViewControllerAnimated:YES completion:nil]; #pragma mark - UIAlertViewDelegate
-(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
if (alertView.tag == 7838347) {
if (buttonIndex == 0) {
return;
} else {
NSUserDefaults *userDefault = [NSUserDefaults standardUserDefaults];
[userDefault removeObjectForKey:@"loginMessage"];
[userDefault removeObjectForKey:@"username"];
[userDefault removeObjectForKey:@"password"];
[self.tabBarController dismissViewControllerAnimated:YES completion:nil];
}
}
} }
#pragma mark - Private Methods #pragma mark - Private Methods
......
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