Commit d5c2a1ce authored by admin's avatar admin

完成上传检查点

parent ea559b8a
...@@ -14,7 +14,6 @@ ...@@ -14,7 +14,6 @@
#import "CommonFunc.h" #import "CommonFunc.h"
#import "HttpClient.h" #import "HttpClient.h"
#import "RedStarTools.h"
#import <MBProgressHUD.h> #import <MBProgressHUD.h>
#define CATEGORYLIST @"服务", @"环境企划", @"环境物业", nil #define CATEGORYLIST @"服务", @"环境企划", @"环境物业", nil
...@@ -27,7 +26,7 @@ ...@@ -27,7 +26,7 @@
@property (nonatomic, strong) UITableView *tableView; @property (nonatomic, strong) UITableView *tableView;
@property (nonatomic, strong) AddQuestionFooterView *footerView; @property (nonatomic, strong) AddQuestionFooterView *footerView;
@property (nonatomic, strong) NSMutableArray *imageNameArray;
@property (nonatomic, strong) NSArray *titleArray; @property (nonatomic, strong) NSArray *titleArray;
@property (nonatomic, strong) NSString *imageMD5; @property (nonatomic, strong) NSString *imageMD5;
...@@ -64,7 +63,7 @@ ...@@ -64,7 +63,7 @@
UIBarButtonItem *backItem = [[UIBarButtonItem alloc] initWithCustomView:backBtn]; UIBarButtonItem *backItem = [[UIBarButtonItem alloc] initWithCustomView:backBtn];
self.navigationItem.leftBarButtonItem = backItem; self.navigationItem.leftBarButtonItem = backItem;
self.imageNameArray = [NSMutableArray array];
self.titleArray = [NSArray arrayWithObjects:@"选择对应专业组", @"选择问题分类", nil]; self.titleArray = [NSArray arrayWithObjects:@"选择对应专业组", @"选择问题分类", nil];
...@@ -95,11 +94,11 @@ ...@@ -95,11 +94,11 @@
[alert show]; [alert show];
return; return;
} }
NSLog(@"_selectLabel.text = %@, _selectLabel2.text = %@ ,self.footerView.contentTextView.text ===%@, elf.footerView.titleTextView.text = %@", _selectLabel.text,_selectLabel1.text,self.footerView.contentTextView.text, self.footerView.titleTextView.text);
[[RedStarTools sharedInstance] loadLocalData];
NSMutableArray *localData = [RedStarTools sharedInstance].localDatas;
NSDictionary *parameters; NSDictionary *parameters;
if (localData.count == 0) { if (_imageNameArray.count == 0) {
parameters = @{@"category":_selectLabel.text, parameters = @{@"category":_selectLabel.text,
@"group":_selectLabel1.text, @"group":_selectLabel1.text,
@"title":self.footerView.contentTextView.text, @"title":self.footerView.contentTextView.text,
...@@ -107,13 +106,12 @@ ...@@ -107,13 +106,12 @@
}; };
} else { } else {
NSMutableArray *imageArray = [NSMutableArray array]; NSMutableArray *imageArray = [NSMutableArray array];
for (int i = 0; i < localData.count; i++) { for (int i = 0; i < _imageNameArray.count; i++) {
NSString *imageName = [NSString stringWithFormat:@"%@", localData[i]]; NSString *imageName = _imageNameArray[i];
NSString *fullPath = [[NSHomeDirectory() stringByAppendingPathComponent:@"Documents"] stringByAppendingPathComponent:imageName]; NSString *fullPath = [[NSHomeDirectory() stringByAppendingPathComponent:@"Documents"] stringByAppendingPathComponent:imageName];
UIImage *image = [UIImage imageWithContentsOfFile:fullPath]; UIImage *image = [UIImage imageWithContentsOfFile:fullPath];
NSData *imageData = UIImageJPEGRepresentation(image, 0.5); NSData *imageData = UIImageJPEGRepresentation(image, 0.5);
NSString *imageBase64 = [imageData base64EncodedStringWithOptions:0]; NSString *imageBase64 = [imageData base64EncodedStringWithOptions:0];
NSMutableDictionary *dict = [NSMutableDictionary dictionary]; NSMutableDictionary *dict = [NSMutableDictionary dictionary];
[dict setObject:imageBase64 forKey:@"fileContent"]; [dict setObject:imageBase64 forKey:@"fileContent"];
[dict setObject:imageName forKey:@"fileName"]; [dict setObject:imageName forKey:@"fileName"];
...@@ -128,14 +126,13 @@ ...@@ -128,14 +126,13 @@
@"attachments":imageArray}; @"attachments":imageArray};
} }
NSLog(@"par = %@", parameters);
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"];
NSString *operName = [[NSUserDefaults standardUserDefaults] objectForKey:@"user_name"]; NSString *operName = [[NSUserDefaults standardUserDefaults] objectForKey:@"user_name"];
...@@ -149,8 +146,7 @@ ...@@ -149,8 +146,7 @@
[client uploadNewQuestionWithParameters:parameters completion:^(id response, NSError *error) { [client uploadNewQuestionWithParameters:parameters completion:^(id response, NSError *error) {
NSLog(@"上传 response= %@, error = %@", response, error); NSLog(@"上传 response= %@, error = %@", response, error);
if (response[@"success"]) { if (response[@"success"]) {
[RedStarTools sharedInstance].localDatas = [NSMutableArray array];
[[RedStarTools sharedInstance] saveLocalData];
[MBProgressHUD hideHUDForView:self.view animated:YES]; [MBProgressHUD hideHUDForView:self.view animated:YES];
} }
}]; }];
...@@ -161,8 +157,6 @@ ...@@ -161,8 +157,6 @@
// 返回上一页面 // 返回上一页面
- (void)doBack:(UIBarButtonItem *)sender - (void)doBack:(UIBarButtonItem *)sender
{ {
[RedStarTools sharedInstance].localDatas = [NSMutableArray array];
[[RedStarTools sharedInstance] saveLocalData];
[self.navigationController popViewControllerAnimated:YES]; [self.navigationController popViewControllerAnimated:YES];
} }
...@@ -195,6 +189,21 @@ ...@@ -195,6 +189,21 @@
self.footerView.takePhotoView.frame = CGRectMake(0, 170, kScreenWidth, k * btnH + (k + 1) * marginY); self.footerView.takePhotoView.frame = CGRectMake(0, 170, kScreenWidth, k * btnH + (k + 1) * marginY);
self.footerView.height = self.footerView.takePhotoView.frame.size.height + 220; self.footerView.height = self.footerView.takePhotoView.frame.size.height + 220;
NSString *imageName = _imageNameArray[button.superview.tag - 1];
NSString *fullPath = [[NSHomeDirectory() stringByAppendingPathComponent:@"Documents"] stringByAppendingPathComponent:imageName];
NSFileManager* fileManager = [NSFileManager defaultManager];
BOOL blHave=[[NSFileManager defaultManager] fileExistsAtPath:fullPath];
if (!blHave) {
return ;
} else {
BOOL blDele= [fileManager removeItemAtPath:fullPath error:nil];
if (blDele) {
NSLog(@"dele success");
}else {
NSLog(@"dele fail");
}
}
} }
- (void)createImagePicker - (void)createImagePicker
...@@ -219,17 +228,16 @@ ...@@ -219,17 +228,16 @@
[self.navigationController pushViewController:checkVC animated:YES]; [self.navigationController pushViewController:checkVC animated:YES];
} }
// 保存图片至沙盒 #pragma mark - 保存图片至沙盒
- (void)saveImage:(UIButton *)button - (void)saveImage:(UIImage *)currentImage {
{
UIImage *currentImage = button.imageView.image;
NSData *imageData = UIImageJPEGRepresentation(currentImage, 0.5); NSData *imageData = UIImageJPEGRepresentation(currentImage, 0.5);
self.imageMD5 = [CommonFunc md5Data:imageData];
// 获取沙盒目录
NSString *fullPath = [[NSHomeDirectory() stringByAppendingPathComponent:@"Documents"] stringByAppendingPathComponent:_imageMD5];
[[RedStarTools sharedInstance].localDatas addObject:_imageMD5]; NSString *imageName = [CommonFunc md5Data:imageData];
[[RedStarTools sharedInstance] saveLocalData]; [_imageNameArray addObject:imageName];
// 获取沙盒目录
NSString *fullPath = [[NSHomeDirectory() stringByAppendingPathComponent:@"Documents"] stringByAppendingPathComponent:imageName];
// 将图片写入文件 // 将图片写入文件
[imageData writeToFile:fullPath atomically:NO]; [imageData writeToFile:fullPath atomically:NO];
} }
...@@ -237,14 +245,11 @@ ...@@ -237,14 +245,11 @@
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{ {
UIImage *image = [info objectForKey:UIImagePickerControllerOriginalImage]; UIImage *image = [info objectForKey:UIImagePickerControllerOriginalImage];
[self saveImage:image];
// 创建一个新的控件 // 创建一个新的控件
UIButton *newButton = [self.footerView.takePhotoView createButtonWithImage:image]; UIButton *newButton = [self.footerView.takePhotoView createButtonWithImage:image];
[newButton addTarget:self action:@selector(takePhotoShowPicture:) forControlEvents:UIControlEventTouchUpInside]; [newButton addTarget:self action:@selector(takePhotoShowPicture:) forControlEvents:UIControlEventTouchUpInside];
// 保存图片至沙盒
[self saveImage:newButton];
[self.footerView.takePhotoView insertSubview:newButton atIndex:self.footerView.takePhotoView.subviews.count - 1]; [self.footerView.takePhotoView insertSubview:newButton atIndex:self.footerView.takePhotoView.subviews.count - 1];
[self.footerView.takePhotoView.allImages addObject:image]; [self.footerView.takePhotoView.allImages addObject:image];
......
...@@ -12,4 +12,6 @@ ...@@ -12,4 +12,6 @@
@interface InspectDetailFooterView : UIView @interface InspectDetailFooterView : UIView
@property (nonatomic, strong) TakePhotoView *takePhotoView; @property (nonatomic, strong) TakePhotoView *takePhotoView;
@property (nonatomic, strong) UIButton *reportBtn; @property (nonatomic, strong) UIButton *reportBtn;
@property (nonatomic, strong) UITextView *contentTextView;
@end @end
...@@ -38,7 +38,6 @@ ...@@ -38,7 +38,6 @@
@interface InspectDetailFooterView () <UITextViewDelegate> @interface InspectDetailFooterView () <UITextViewDelegate>
@property (nonatomic, strong) UILabel *pictureLabel; @property (nonatomic, strong) UILabel *pictureLabel;
@property (nonatomic, strong) UILabel *introLabel; @property (nonatomic, strong) UILabel *introLabel;
@property (nonatomic, strong) UITextView *contentTextView;
@property (nonatomic, strong) UIImageView *backImageView2; @property (nonatomic, strong) UIImageView *backImageView2;
@property (nonatomic, strong) UILabel *placeholderLabel2; @property (nonatomic, strong) UILabel *placeholderLabel2;
@end @end
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
self = [super init]; self = [super init];
if (self) { if (self) {
self.backgroundColor = kSectionBackGroundColor; self.backgroundColor = kSectionBackGroundColor;
NSLog(@"answerAttachments.count = %ld referenceAttachments.count = %ld", answerAttachments.count , referenceAttachments.count); NSLog(@"answerAttachments.count = %ld referenceAttachments.count = %ld", (unsigned long)answerAttachments.count , (unsigned long)referenceAttachments.count);
CGFloat imageMaginX = 20; CGFloat imageMaginX = 20;
CGFloat imageMaginY = 10; CGFloat imageMaginY = 10;
CGFloat imageW = (kScreenWidth - imageMaginX * 3) / 2; CGFloat imageW = (kScreenWidth - imageMaginX * 3) / 2;
......
...@@ -12,4 +12,8 @@ ...@@ -12,4 +12,8 @@
@interface InspectNotUploadViewController : UIViewController @interface InspectNotUploadViewController : UIViewController
@property (nonatomic, assign) int questionCount; @property (nonatomic, assign) int questionCount;
@property (nonatomic, strong) TaskModel *taskModel; @property (nonatomic, strong) TaskModel *taskModel;
@property(nonatomic, strong) NSString *store_uuid;
@property (nonatomic, strong) NSString *uuid; // 口碑巡检uuid
@property (nonatomic, strong) NSString *praiseUuid;
@property (nonatomic, strong) NSString *questionUuid;
@end @end
...@@ -10,7 +10,8 @@ ...@@ -10,7 +10,8 @@
#import "InspectNotUpLoadCell.h" #import "InspectNotUpLoadCell.h"
#import "CheckPicViewController.h" #import "CheckPicViewController.h"
#import "InspectDetailFooterView.h" #import "InspectDetailFooterView.h"
#import <MBProgressHUD.h>
#import "CommonFunc.h"
#import "HttpClient.h" #import "HttpClient.h"
#define kInspectNotUploadCell @"InspectNotUploadCell" #define kInspectNotUploadCell @"InspectNotUploadCell"
...@@ -18,6 +19,7 @@ ...@@ -18,6 +19,7 @@
@property (nonatomic, strong) UITableView *tableView; @property (nonatomic, strong) UITableView *tableView;
@property (nonatomic, strong) InspectDetailFooterView *footerView; @property (nonatomic, strong) InspectDetailFooterView *footerView;
@property (nonatomic, strong) NSMutableArray *imageNameArray;
@end @end
...@@ -46,6 +48,9 @@ ...@@ -46,6 +48,9 @@
[self.tableView registerClass:[InspectNotUpLoadCell class] forCellReuseIdentifier:kInspectNotUploadCell]; [self.tableView registerClass:[InspectNotUpLoadCell class] forCellReuseIdentifier:kInspectNotUploadCell];
self.tableView.tableFooterView = self.footerView; self.tableView.tableFooterView = self.footerView;
self.footerView.takePhotoView.delegate = self; self.footerView.takePhotoView.delegate = self;
[self.footerView.reportBtn addTarget:self action:@selector(uploadTaskInfo:) forControlEvents:UIControlEventTouchUpInside];
self.imageNameArray = [NSMutableArray array];
} }
...@@ -55,6 +60,53 @@ ...@@ -55,6 +60,53 @@
} }
#pragma mark - private Methods #pragma mark - private Methods
- (void)uploadTaskInfo:(UIButton *)sender
{
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"];
NSLog(@"self = %@, 1= %@, 2 = %@", self.praiseUuid, self.store_uuid, self.questionUuid);
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
};
NSLog(@"上传检查点parameters = %@", parameters);
[httpClient uploadInspectResultWithParameters:parameters completion:^(id response, NSError *error) {
NSLog(@"ressssss =%@ errorrrrr = %@", response, error);
[MBProgressHUD hideHUDForView:self.view animated:YES];
}];
}
// 返回上一页面 // 返回上一页面
- (void)doBack:(UIBarButtonItem *)sender - (void)doBack:(UIBarButtonItem *)sender
{ {
...@@ -64,6 +116,7 @@ ...@@ -64,6 +116,7 @@
#pragma mark - TakePhoto Delegate #pragma mark - TakePhoto Delegate
- (void)deletePhoto:(UIButton *)button - (void)deletePhoto:(UIButton *)button
{ {
NSLog(@"button -.tag === %ld", (long)button.superview.tag);
// 从存放所有Image的数组里移除当前点击的Image // 从存放所有Image的数组里移除当前点击的Image
[self.footerView.takePhotoView.allImages removeObject:[(UIButton *)button.superview imageForState:UIControlStateNormal]]; [self.footerView.takePhotoView.allImages removeObject:[(UIButton *)button.superview imageForState:UIControlStateNormal]];
// 移除显示Image的Button // 移除显示Image的Button
...@@ -81,6 +134,21 @@ ...@@ -81,6 +134,21 @@
self.footerView.takePhotoView.frame = CGRectMake(0, 40, kScreenWidth, k * btnH + (k + 1) * marginY); self.footerView.takePhotoView.frame = CGRectMake(0, 40, kScreenWidth, k * btnH + (k + 1) * marginY);
self.footerView.height = self.footerView.takePhotoView.frame.size.height + 220; self.footerView.height = self.footerView.takePhotoView.frame.size.height + 220;
NSString *imageName = _imageNameArray[button.superview.tag - 1];
NSString *fullPath = [[NSHomeDirectory() stringByAppendingPathComponent:@"Documents"] stringByAppendingPathComponent:imageName];
NSFileManager* fileManager = [NSFileManager defaultManager];
BOOL blHave=[[NSFileManager defaultManager] fileExistsAtPath:fullPath];
if (!blHave) {
return ;
} else {
BOOL blDele= [fileManager removeItemAtPath:fullPath error:nil];
if (blDele) {
NSLog(@"dele success");
}else {
NSLog(@"dele fail");
}
}
} }
- (void)createImagePicker - (void)createImagePicker
...@@ -105,11 +173,26 @@ ...@@ -105,11 +173,26 @@
[self.navigationController pushViewController:checkVC animated:YES]; [self.navigationController pushViewController:checkVC animated:YES];
} }
#pragma mark - 保存图片至沙盒
- (void)saveImage:(UIImage *)currentImage {
NSData *imageData = UIImageJPEGRepresentation(currentImage, 0.5);
NSString *imageName = [CommonFunc md5Data:imageData];
[_imageNameArray addObject:imageName];
// 获取沙盒目录
NSString *fullPath = [[NSHomeDirectory() stringByAppendingPathComponent:@"Documents"] stringByAppendingPathComponent:imageName];
// 将图片写入文件
[imageData writeToFile:fullPath atomically:NO];
}
#pragma mark - UIImagePickerController 代理方法 #pragma mark - UIImagePickerController 代理方法
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{ {
UIImage *image = [info objectForKey:UIImagePickerControllerOriginalImage]; UIImage *image = [info objectForKey:UIImagePickerControllerOriginalImage];
[self saveImage:image];
// 创建一个新的控件 // 创建一个新的控件
UIButton *newButton = [self.footerView.takePhotoView createButtonWithImage:image]; UIButton *newButton = [self.footerView.takePhotoView createButtonWithImage:image];
[newButton addTarget:self action:@selector(takePhotoShowPicture:) forControlEvents:UIControlEventTouchUpInside]; [newButton addTarget:self action:@selector(takePhotoShowPicture:) forControlEvents:UIControlEventTouchUpInside];
......
...@@ -123,7 +123,7 @@ ...@@ -123,7 +123,7 @@
NSDictionary *parameters = @{@"userUuid":@"", NSDictionary *parameters = @{@"userUuid":@"",
@"queryOrders":@[@{@"field":@"lastModifyInfo"}], @"queryOrders":@[@{@"field":@"lastModifyInfo"}],
@"pageNumber":@(0), @"pageNumber":@(0),
@"pageSize":@(10) @"pageSize":@(20)
}; };
[MBProgressHUD showHUDAddedTo:self.view animated:YES]; [MBProgressHUD showHUDAddedTo:self.view animated:YES];
......
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
_task = task; _task = task;
if (task.state == 0) { if (task.state == 0) {
self.stateLabel.textColor = kNavigationBarColor; self.stateLabel.textColor = [UIColor orangeColor];
self.stateLabel.text = [NSString stringWithFormat:@"未上报"]; self.stateLabel.text = [NSString stringWithFormat:@"未上报"];
} else if (task.state == 1) { } else if (task.state == 1) {
......
...@@ -82,7 +82,12 @@ ...@@ -82,7 +82,12 @@
self.detailView.shopnameLabel.text = [NSString stringWithFormat:@"%@", taskDetail.store_name]; self.detailView.shopnameLabel.text = [NSString stringWithFormat:@"%@", taskDetail.store_name];
self.detailView.startDateLabel.text = [NSString stringWithFormat:@"%@", taskDetail.beginDate]; self.detailView.startDateLabel.text = [NSString stringWithFormat:@"%@", taskDetail.beginDate];
self.detailView.overDateLabel.text = [NSString stringWithFormat:@"%@", taskDetail.endDate]; self.detailView.overDateLabel.text = [NSString stringWithFormat:@"%@", taskDetail.endDate];
self.detailView.multiplier = (CGFloat)taskDetail.reportCount / taskDetail.questionCount; if (taskDetail.questionCount == 0 || taskDetail.reportCount == 0) {
self.detailView.multiplier = 0;
} else {
self.detailView.multiplier = (CGFloat)taskDetail.reportCount / taskDetail.questionCount;
}
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"yyyy-MM-dd"]; [dateFormatter setDateFormat:@"yyyy-MM-dd"];
...@@ -108,7 +113,11 @@ ...@@ -108,7 +113,11 @@
if ([taskDetail.state isEqualToString:@"initial"]) { if ([taskDetail.state isEqualToString:@"initial"]) {
self.detailView.progressLabel.text = [NSString stringWithFormat:@"未处理 %.0f%%", (CGFloat)taskDetail.reportCount / taskDetail.questionCount * 100]; if (taskDetail.reportCount == 0 || taskDetail.questionCount == 0) {
self.detailView.progressLabel.text = @"0%";
} else {
self.detailView.progressLabel.text = [NSString stringWithFormat:@"未处理 %.0f%%", (CGFloat)taskDetail.reportCount / taskDetail.questionCount * 100];
}
self.detailView.progressLabel.textColor = kProgressUnSettledColor; self.detailView.progressLabel.textColor = kProgressUnSettledColor;
self.detailView.alreadyLabel.textColor = kProgressUnSettledColor; self.detailView.alreadyLabel.textColor = kProgressUnSettledColor;
self.detailView.allLabel.textColor = kProgressUnSettledColor; self.detailView.allLabel.textColor = kProgressUnSettledColor;
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
@property (nonatomic, strong) UILabel *allLabel; @property (nonatomic, strong) UILabel *allLabel;
@property (nonatomic, assign) ProgressState progressState; //@property (nonatomic, assign) ProgressState progressState;
@property (nonatomic, assign) CGFloat multiplier; @property (nonatomic, assign) CGFloat multiplier;
......
...@@ -49,6 +49,7 @@ ...@@ -49,6 +49,7 @@
#pragma mark Private Methods #pragma mark Private Methods
- (void)setup { - (void)setup {
self.upLineView.backgroundColor = kSeparateLineColor; self.upLineView.backgroundColor = kSeparateLineColor;
self.downLineView.backgroundColor = kSeparateLineColor; self.downLineView.backgroundColor = kSeparateLineColor;
...@@ -66,40 +67,40 @@ ...@@ -66,40 +67,40 @@
self.arrowImageView.image = [UIImage imageNamed:@"grey-trilateral_down"]; self.arrowImageView.image = [UIImage imageNamed:@"grey-trilateral_down"];
} }
- (void)setProgressState:(ProgressState)progressState //- (void)setProgressState:(ProgressState)progressState
{ //{
_progressState = progressState; // _progressState = progressState;
if (_progressState == ProgressStateUnSettled) { // if (_progressState == ProgressStateUnSettled) {
self.progressLabel.text = [NSString stringWithFormat:@"未处理 %f", _multiplier];; // self.progressLabel.text = [NSString stringWithFormat:@"未处理 %f", _multiplier];;
self.progressLabel.textColor = kProgressUnSettledColor; // self.progressLabel.textColor = kProgressUnSettledColor;
self.alreadyLabel.textColor = kProgressUnSettledColor; // self.alreadyLabel.textColor = kProgressUnSettledColor;
self.allLabel.textColor = kProgressUnSettledColor; // self.allLabel.textColor = kProgressUnSettledColor;
self.allView.backgroundColor = kProgressViewAllBackColor; // self.allView.backgroundColor = kProgressViewAllBackColor;
UIImage *image = [UIImage imageNamed:@"progress-bar"]; // UIImage *image = [UIImage imageNamed:@"progress-bar"];
image = [image resizableImageWithCapInsets:UIEdgeInsetsZero resizingMode:UIImageResizingModeTile]; // image = [image resizableImageWithCapInsets:UIEdgeInsetsZero resizingMode:UIImageResizingModeTile];
self.alreadyView.image = image; // self.alreadyView.image = image;
} else if (_progressState == ProgressStateDealWith) { // } else if (_progressState == ProgressStateDealWith) {
//
self.progressLabel.text = [NSString stringWithFormat:@"进行中 %f", _multiplier]; // self.progressLabel.text = [NSString stringWithFormat:@"进行中 %f", _multiplier];
self.progressLabel.textColor = kProgressDealWithColor; // self.progressLabel.textColor = kProgressDealWithColor;
self.alreadyLabel.textColor = kProgressDealWithColor; // self.alreadyLabel.textColor = kProgressDealWithColor;
self.allLabel.textColor = kProgressDealWithColor; // self.allLabel.textColor = kProgressDealWithColor;
self.allView.backgroundColor = kProgressViewAllBackColor; // self.allView.backgroundColor = kProgressViewAllBackColor;
UIImage *image = [UIImage imageNamed:@"progress-bar"]; // UIImage *image = [UIImage imageNamed:@"progress-bar"];
image = [image resizableImageWithCapInsets:UIEdgeInsetsZero resizingMode:UIImageResizingModeTile]; // image = [image resizableImageWithCapInsets:UIEdgeInsetsZero resizingMode:UIImageResizingModeTile];
self.alreadyView.image = image; // self.alreadyView.image = image;
} else { // } else {
//
self.progressLabel.text = [NSString stringWithFormat:@"已过期 %f", _multiplier]; // self.progressLabel.text = [NSString stringWithFormat:@"已过期 %f", _multiplier];
self.progressLabel.textColor = kProgressOverDueColor; // self.progressLabel.textColor = kProgressOverDueColor;
self.alreadyLabel.textColor = kProgressOverDueColor; // self.alreadyLabel.textColor = kProgressOverDueColor;
self.allLabel.textColor = kProgressOverDueColor; // self.allLabel.textColor = kProgressOverDueColor;
self.allView.backgroundColor = kProgressViewAllBackColor; // self.allView.backgroundColor = kProgressViewAllBackColor;
UIImage *image = [UIImage imageNamed:@"progress-bar"]; // UIImage *image = [UIImage imageNamed:@"progress-bar"];
image = [image resizableImageWithCapInsets:UIEdgeInsetsZero resizingMode:UIImageResizingModeTile]; // image = [image resizableImageWithCapInsets:UIEdgeInsetsZero resizingMode:UIImageResizingModeTile];
self.alreadyView.image = image; // self.alreadyView.image = image;
} // }
} //}
#pragma mark - lazy loading #pragma mark - lazy loading
- (UIView *)upLineView - (UIView *)upLineView
...@@ -288,7 +289,9 @@ ...@@ -288,7 +289,9 @@
NSLayoutConstraint *overDateBottom = [NSLayoutConstraint constraintWithItem:_alreadyView attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.allView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:-1]; NSLayoutConstraint *overDateBottom = [NSLayoutConstraint constraintWithItem:_alreadyView attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.allView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:-1];
[self.allView addConstraint:overDateBottom]; [self.allView addConstraint:overDateBottom];
NSLayoutConstraint *overDatewidth = [NSLayoutConstraint constraintWithItem:_alreadyView attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:self.allView attribute:NSLayoutAttributeWidth multiplier:self.multiplier constant:0];
NSLayoutConstraint *overDatewidth = [NSLayoutConstraint constraintWithItem:_alreadyView attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:self.allView attribute:NSLayoutAttributeWidth multiplier:self.multiplier constant:-1];
[self.allView addConstraint:overDatewidth]; [self.allView addConstraint:overDatewidth];
} }
......
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
@property (nonatomic, strong) NSArray *taskData; @property (nonatomic, strong) NSArray *taskData;
@property (nonatomic, strong) InspectDetailHeaderView *detailHeaderView; @property (nonatomic, strong) InspectDetailHeaderView *detailHeaderView;
@property (nonatomic, strong) TaskDetailModel *taskDetail;
@end @end
@implementation InspectTaskViewController @implementation InspectTaskViewController
...@@ -104,7 +105,7 @@ ...@@ -104,7 +105,7 @@
NSDictionary *dataDict = response[@"data"]; NSDictionary *dataDict = response[@"data"];
TaskDetailModel *taskDetail = [TaskDetailModel taskDetailModelWithDict:dataDict]; TaskDetailModel *taskDetail = [TaskDetailModel taskDetailModelWithDict:dataDict];
weakSelf.detailHeaderView.taskDetail = taskDetail; weakSelf.detailHeaderView.taskDetail = taskDetail;
_taskDetail = taskDetail;
NSArray *dataArray = dataDict[@"categories"]; NSArray *dataArray = dataDict[@"categories"];
...@@ -164,16 +165,19 @@ ...@@ -164,16 +165,19 @@
TaskGroup *taskGroup = _taskData[indexPath.section]; TaskGroup *taskGroup = _taskData[indexPath.section];
TaskModel *task = taskGroup.answers[indexPath.row]; TaskModel *task = taskGroup.answers[indexPath.row];
if (task.readonly) { if (task.state == 0) {
InspectUploadedViewController *inspectVC = [[InspectUploadedViewController alloc] init];
inspectVC.questionCount = taskGroup.questionCount;
inspectVC.taskModel = task;
[self.navigationController pushViewController:inspectVC animated:YES];
} else {
InspectNotUploadViewController *inspectNotVC = [[InspectNotUploadViewController alloc] init]; InspectNotUploadViewController *inspectNotVC = [[InspectNotUploadViewController alloc] init];
inspectNotVC.questionCount = taskGroup.questionCount; inspectNotVC.questionCount = taskGroup.questionCount;
inspectNotVC.taskModel = task; inspectNotVC.taskModel = task;
inspectNotVC.store_uuid = _taskDetail.store_uuid;
inspectNotVC.praiseUuid = _taskDetail.uuid;
inspectNotVC.questionUuid = task.uuid;
[self.navigationController pushViewController:inspectNotVC animated:YES]; [self.navigationController pushViewController:inspectNotVC animated:YES];
} else {
InspectUploadedViewController *inspectVC = [[InspectUploadedViewController alloc] init];
inspectVC.questionCount = taskGroup.questionCount;
inspectVC.taskModel = task;
[self.navigationController pushViewController:inspectVC animated:YES];
} }
......
...@@ -52,7 +52,7 @@ ...@@ -52,7 +52,7 @@
{ {
_taskDetail = taskDetail; _taskDetail = taskDetail;
self.shopNameLabel.text = [NSString stringWithFormat:@"%@", taskDetail.store_name]; self.shopNameLabel.text = [NSString stringWithFormat:@"%@", taskDetail.store_name];
self.rankDetailView.addressLabel.text = @"上海市真北路1108号"; self.rankDetailView.addressLabel.text = [NSString stringWithFormat:@"%@", taskDetail.storePath];
self.rankDetailView.titleLabel.text = [NSString stringWithFormat:@"%@", taskDetail.name]; self.rankDetailView.titleLabel.text = [NSString stringWithFormat:@"%@", taskDetail.name];
self.rankDetailView.reportTimeLabel.text = @"上报时间"; self.rankDetailView.reportTimeLabel.text = @"上报时间";
self.rankDetailView.totalScoreLabel.text = @"总评分"; self.rankDetailView.totalScoreLabel.text = @"总评分";
......
...@@ -72,7 +72,7 @@ ...@@ -72,7 +72,7 @@
if (section < 3) { if (section < 3) {
UIImageView *gradeImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:[NSString stringWithFormat:@"medal_0%ld", section + 1]]]; UIImageView *gradeImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:[NSString stringWithFormat:@"medal_0%d", section + 1]]];
[self addSubview:gradeImageView]; [self addSubview:gradeImageView];
_gradeImageView = gradeImageView; _gradeImageView = gradeImageView;
...@@ -83,7 +83,7 @@ ...@@ -83,7 +83,7 @@
gradeLabel.textColor = kLightBlack; gradeLabel.textColor = kLightBlack;
gradeLabel.font = [UIFont systemFontOfSize:16.0]; gradeLabel.font = [UIFont systemFontOfSize:16.0];
[self addSubview:gradeLabel]; [self addSubview:gradeLabel];
gradeLabel.text = [NSString stringWithFormat:@"第%ld名", section + 1]; gradeLabel.text = [NSString stringWithFormat:@"第%d名", section + 1];
_gradeLabel = gradeLabel; _gradeLabel = gradeLabel;
} }
_section = section; _section = section;
......
...@@ -120,9 +120,6 @@ ...@@ -120,9 +120,6 @@
*/ */
- (void)loginButtonClick:(UIButton *)sender - (void)loginButtonClick:(UIButton *)sender
{ {
self.rootTBC = [[RootTabBarController alloc] init];
[self presentViewController:_rootTBC animated:YES completion:nil];
if (self.loginView.usernameTextFiled.text.length == 0 || self.loginView.passwordTextFiled.text.length == 0) { if (self.loginView.usernameTextFiled.text.length == 0 || self.loginView.passwordTextFiled.text.length == 0) {
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"提示" message:@"账号、密码不能为空" delegate:nil cancelButtonTitle:@"确定" otherButtonTitles:nil, nil]; UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"提示" message:@"账号、密码不能为空" delegate:nil cancelButtonTitle:@"确定" otherButtonTitles:nil, nil];
[alertView show]; [alertView show];
......
...@@ -49,4 +49,7 @@ typedef void (^completionBlock) (id response, NSError *error); ...@@ -49,4 +49,7 @@ typedef void (^completionBlock) (id response, NSError *error);
// 上传新问题 // 上传新问题
- (void)uploadNewQuestionWithParameters:(id)parameters completion:(completionBlock)completion; - (void)uploadNewQuestionWithParameters:(id)parameters completion:(completionBlock)completion;
// 上传新检查点
- (void)uploadInspectResultWithParameters:(id)parameters completion:(completionBlock)completion;
@end @end
...@@ -193,4 +193,13 @@ ...@@ -193,4 +193,13 @@
}]; }];
} }
- (void)uploadInspectResultWithParameters:(id)parameters completion:(completionBlock)completion
{
[self postParameters:parameters completion:^(id response, NSError *error) {
if (completion) {
completion (response, error);
}
}];
}
@end @end
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
<key>CFBundleInfoDictionaryVersion</key> <key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string> <string>6.0</string>
<key>CFBundleName</key> <key>CFBundleName</key>
<string>redstar</string> <string>红星管理在线</string>
<key>CFBundlePackageType</key> <key>CFBundlePackageType</key>
<string>APPL</string> <string>APPL</string>
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
......
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