Commit 1e87f045 authored by admin's avatar admin

完善在线抽查

parent 22ef2cab
......@@ -10,10 +10,10 @@
#define Url_h
// url 测试环境
// #define kRedStarURL @"http://218.244.151.129:7580/"
#define kRedStarURL @"http://218.244.151.129:7580/"
// 正式环境
#define kRedStarURL @"http://219.235.234.225:7580/"
// #define kRedStarURL @"http://219.235.234.225:7580/"
// 检查更新
......
......@@ -22,6 +22,11 @@
@property (nonatomic, strong) NSMutableArray *uuidArray;
@property (nonatomic, strong) OnLineFooterView *footView;
@property (nonatomic, strong) NSString *storeName;
@property (nonatomic, strong) NSString *dateStr;
@property (nonatomic, strong) UIView *backGroundView;
@property (nonatomic, strong) UIView *pickBackView;
@property (nonatomic, strong) UIDatePicker *datePicker;
@end
@implementation OnLineViewController
......@@ -50,6 +55,7 @@
self.navigationItem.leftBarButtonItem = backItem;
_storeName = @"全部";
_dateStr = @"";
}
- (void)doBack:(id)sender
......@@ -75,6 +81,20 @@
- (void)saveClick:(UIButton *)sender
{
if (_dateStr.length == 0) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"提示" message:@"请选择截止时间!" delegate:self cancelButtonTitle:nil otherButtonTitles:@"确定", nil];
[alert show];
return;
}
if (self.footView.titleTextView.text.length == 0 || self.footView.contentTextView.text.length == 0) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"提示" message:@"任务标题和任务内容不能为空!" delegate:self cancelButtonTitle:nil otherButtonTitles:@"确定", nil];
[alert show];
return;
}
// 提示框
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"提示" message:@"您确定要下达新的抽查任务吗?" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"确定", nil];
alert.tag = 334281;
......@@ -82,6 +102,31 @@
[alert show];
}
- (void)closeBackGroundView
{
[UIView animateWithDuration:0.3 animations:^{
_backGroundView.alpha = .0f;
_pickBackView.alpha = 0.0f;
} completion:^(BOOL finished) {
[_backGroundView removeFromSuperview];
[_datePicker removeFromSuperview];
[_pickBackView removeFromSuperview];
_backGroundView = nil;
_datePicker = nil;
_pickBackView = nil;
}];
}
- (void)okClick:(UIButton *)sender
{
NSDate *select = [_datePicker date];
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"yyyy-MM-dd"];
_dateStr = [dateFormatter stringFromDate:select];
[self closeBackGroundView];
[self.tableView reloadData];
}
#pragma mark - SelectStoreDelegate
- (void)deliverWithArray:(NSMutableArray *)array
{
......@@ -103,6 +148,7 @@
if (alertView.tag == 334281) {
if (buttonIndex == 1) {
NSDate *date = [NSDate date];
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"YYYY-MM-dd hh:mm:ss"];
......@@ -117,24 +163,35 @@
NSLog(@"发起抽查url = %@", url);
HttpClient *httpClient= [[HttpClient alloc] initWithUrl:url];
NSDictionary *parameters = @{
@"title":self.footView.titleTextView.text,
NSDictionary *parameters = @{@"title":self.footView.titleTextView.text,
@"content":self.footView.contentTextView.text,
@"endDate":dateString,
@"endDate":_dateStr,
@"state":@"initial",
@"stores":_uuidArray
};
@"stores":_uuidArray};
NSLog(@"发起抽查par = %@", parameters);
[httpClient saveSportCheckWithParameters:parameters completion:^(id response, NSError *error) {
NSLog(@"发起抽查 response = %@", response);
NSLog(@"发起抽查 error = %@", error);
if ([response[@"message"] isEqualToString:@"ok"]) {
[self.navigationController popViewControllerAnimated:YES];
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"提示" message:@"下达任务成功!" delegate:self cancelButtonTitle:nil otherButtonTitles:@"确定", nil];
alert.tag = 334285;
[alert show];
}
}];
}
}
if (alertView.tag == 334285) {
if (buttonIndex == 0) {
[self.navigationController popViewControllerAnimated:YES];
}
}
}
#pragma mark - TableView Delegate/DateSource
......@@ -153,7 +210,13 @@
}
cell.titleLabel.text = [NSString stringWithFormat:@"%@", _titleArray[indexPath.row]];
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
cell.selectLabel.text = [NSString stringWithFormat:@"%@", _storeName];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
if (indexPath.row == 0) {
cell.selectLabel.text = [NSString stringWithFormat:@"%@", _storeName];
} else {
cell.selectLabel.text = [NSString stringWithFormat:@"%@", _dateStr];
}
return cell;
......@@ -167,12 +230,64 @@
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
SelectStoreViewController *select = [[SelectStoreViewController alloc] init];
select.delegate = self;
[self.navigationController pushViewController:select animated:YES];
if (indexPath.row == 0) {
SelectStoreViewController *select = [[SelectStoreViewController alloc] init];
select.delegate = self;
[self.navigationController pushViewController:select animated:YES];
} else {
if (!_backGroundView) {
_backGroundView = [[UIView alloc] initWithFrame:self.view.bounds];
UITapGestureRecognizer *tapGR = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(closeBackGroundView)];
[_backGroundView addGestureRecognizer:tapGR];
}
if (!_pickBackView) {
_pickBackView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 280, 190)];
_pickBackView.backgroundColor = [UIColor whiteColor];
_pickBackView.center = CGPointMake(self.view.center.x, self.view.center.y - 120);
_pickBackView.alpha = 0.0;
UIButton *okButton = [[UIButton alloc] initWithFrame:CGRectMake(140, 150, 140, 40)];
[okButton setTitle:@"确定" forState:UIControlStateNormal];
okButton.titleLabel.font = [UIFont systemFontOfSize:15.0];
[okButton setTitleColor:kLightBlack forState:UIControlStateNormal];
[okButton addTarget:self action:@selector(okClick:) forControlEvents:UIControlEventTouchUpInside];
[_pickBackView addSubview:okButton];
UIButton *quitButton = [[UIButton alloc] initWithFrame:CGRectMake(0, 150, 140, 40)];
[quitButton setTitle:@"取消" forState:UIControlStateNormal];
quitButton.titleLabel.font = [UIFont systemFontOfSize:15.0];
[quitButton setTitleColor:kLightBlack forState:UIControlStateNormal];
[quitButton addTarget:self action:@selector(closeBackGroundView) forControlEvents:UIControlEventTouchUpInside];
[_pickBackView addSubview:quitButton];
}
if (!_datePicker) {
_datePicker = [[UIDatePicker alloc] initWithFrame:CGRectMake(0, 0, 280, 150)];
_datePicker.datePickerMode = UIDatePickerModeDate;
[_pickBackView addSubview:_datePicker];
}
_backGroundView.alpha = 0;
_backGroundView.backgroundColor = [UIColor blackColor];
[self.view insertSubview:_backGroundView aboveSubview:_tableView];
[self.view insertSubview:_pickBackView aboveSubview:_backGroundView];
[UIView animateWithDuration:0.3 animations:^{
_backGroundView.alpha = 0.6;
_pickBackView.alpha = 1.0;
}];
}
}
#pragma mark - lazy loading
- (UITableView *)tableView
{
if (!_tableView) {
......
......@@ -15,4 +15,5 @@
@property (nonatomic, strong) UILabel *addressLabel;
@property (nonatomic, strong) UIScrollView *showScrollView; // 轮播图
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier storePictures:(NSArray *)storePictures;
@end
......@@ -11,16 +11,16 @@
#import <UIButton+WebCache.h>
@implementation OnLineResultDetailCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier storePictures:(NSArray *)storePictures
{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
[self setupScrollView];
[self setupScrollViewWithStorePictures:storePictures];
}
return self;
}
- (void)setupScrollView
- (void)setupScrollViewWithStorePictures:(NSArray *)storePictures
{
int imageCount = 4;
......
......@@ -180,7 +180,7 @@
{
OnLineResultDetailCell *cell = [tableView dequeueReusableCellWithIdentifier:kOnLineResultDetailCell];
if (!cell) {
cell = [[OnLineResultDetailCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:kOnLineResultDetailCell];
cell = [[OnLineResultDetailCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:kOnLineResultDetailCell storePictures:_storeDetail.storePictures];
}
cell.contentView.backgroundColor = kResultTitleBackColor;
cell.shopNameLabel.text = [NSString stringWithFormat:@"%@", _storeDetail.store_name];
......
......@@ -176,14 +176,10 @@
if (indexPath.section == 0) {
return;
} else {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"提示" message:@"当前功能正在开发!" delegate:self cancelButtonTitle:nil otherButtonTitles:@"确定", nil];
[alert show];
// OnLineResultViewController *onLineResult = [[OnLineResultViewController alloc] init];
// onLineResult.storeDetail = _allStoreArray[indexPath.row];
// onLineResult.checkUuid = self.uuid;
// [self.navigationController pushViewController:onLineResult animated:YES];
OnLineResultViewController *onLineResult = [[OnLineResultViewController alloc] init];
onLineResult.storeDetail = _allStoreArray[indexPath.row];
onLineResult.checkUuid = self.uuid;
[self.navigationController pushViewController:onLineResult animated:YES];
}
}
......
......@@ -193,10 +193,10 @@
- (void)addSpotCheckTaskClick:(UIButton *)sender
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"提示" message:@"当前功能正在开发!" delegate:self cancelButtonTitle:nil otherButtonTitles:@"确定", nil];
[alert show];
// OnLineViewController *onlineVC = [[OnLineViewController alloc] init];
// [self.navigationController pushViewController:onlineVC animated:YES];
// UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"提示" message:@"当前功能正在开发!" delegate:self cancelButtonTitle:nil otherButtonTitles:@"确定", nil];
// [alert show];
OnLineViewController *onlineVC = [[OnLineViewController alloc] init];
[self.navigationController pushViewController:onlineVC animated:YES];
}
- (void)dropCilck:(MenuButton *)sender
......
......@@ -493,12 +493,12 @@ typedef NSComparisonResult (^NSComparator)(id obj1, id obj2);
nav = [[UINavigationController alloc] initWithRootViewController:inspectListVC];
} else if ([item.titleLabel.text isEqualToString:@"口碑标准"]) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"提示" message:@"当前功能正在开发!" delegate:self cancelButtonTitle:nil otherButtonTitles:@"确定", nil];
[alert show];
return;
// UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"提示" message:@"当前功能正在开发!" delegate:self cancelButtonTitle:nil otherButtonTitles:@"确定", nil];
// [alert show];
// return;
// LookOnLineViewController *lookOnLine = [[LookOnLineViewController alloc] init];
// nav = [[UINavigationController alloc] initWithRootViewController:lookOnLine];
LookOnLineViewController *lookOnLine = [[LookOnLineViewController alloc] init];
nav = [[UINavigationController alloc] initWithRootViewController:lookOnLine];
// StandardViewController *standardVC = [[StandardViewController alloc] init];
......
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