Commit 810ea6c9 authored by admin's avatar admin

首页接口完成

parent 1cc64c97
...@@ -56,7 +56,6 @@ ...@@ -56,7 +56,6 @@
84AD4F3A1BF4844600BFB37C /* RankDetailHeaderView.m in Sources */ = {isa = PBXBuildFile; fileRef = 84AD4F391BF4844600BFB37C /* RankDetailHeaderView.m */; }; 84AD4F3A1BF4844600BFB37C /* RankDetailHeaderView.m in Sources */ = {isa = PBXBuildFile; fileRef = 84AD4F391BF4844600BFB37C /* RankDetailHeaderView.m */; };
84AD4F3D1BF4894D00BFB37C /* RankDetailView.m in Sources */ = {isa = PBXBuildFile; fileRef = 84AD4F3C1BF4894D00BFB37C /* RankDetailView.m */; }; 84AD4F3D1BF4894D00BFB37C /* RankDetailView.m in Sources */ = {isa = PBXBuildFile; fileRef = 84AD4F3C1BF4894D00BFB37C /* RankDetailView.m */; };
84AD4F3F1BF498A900BFB37C /* ranking.plist in Resources */ = {isa = PBXBuildFile; fileRef = 84AD4F3E1BF498A900BFB37C /* ranking.plist */; }; 84AD4F3F1BF498A900BFB37C /* ranking.plist in Resources */ = {isa = PBXBuildFile; fileRef = 84AD4F3E1BF498A900BFB37C /* ranking.plist */; };
84AD4F431BF4A66F00BFB37C /* WorkModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 84AD4F421BF4A66F00BFB37C /* WorkModel.m */; };
84AD4F461BF4A9E800BFB37C /* RankHeadView.m in Sources */ = {isa = PBXBuildFile; fileRef = 84AD4F451BF4A9E800BFB37C /* RankHeadView.m */; }; 84AD4F461BF4A9E800BFB37C /* RankHeadView.m in Sources */ = {isa = PBXBuildFile; fileRef = 84AD4F451BF4A9E800BFB37C /* RankHeadView.m */; };
84AD4F491BF4BC0600BFB37C /* RankDetailTableCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 84AD4F481BF4BC0600BFB37C /* RankDetailTableCell.m */; }; 84AD4F491BF4BC0600BFB37C /* RankDetailTableCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 84AD4F481BF4BC0600BFB37C /* RankDetailTableCell.m */; };
84C9574D1BDB344900083584 /* UIBarButtonItem+Create.m in Sources */ = {isa = PBXBuildFile; fileRef = 84C9574A1BDB344900083584 /* UIBarButtonItem+Create.m */; }; 84C9574D1BDB344900083584 /* UIBarButtonItem+Create.m in Sources */ = {isa = PBXBuildFile; fileRef = 84C9574A1BDB344900083584 /* UIBarButtonItem+Create.m */; };
...@@ -211,8 +210,6 @@ ...@@ -211,8 +210,6 @@
84AD4F3B1BF4894D00BFB37C /* RankDetailView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RankDetailView.h; sourceTree = "<group>"; }; 84AD4F3B1BF4894D00BFB37C /* RankDetailView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RankDetailView.h; sourceTree = "<group>"; };
84AD4F3C1BF4894D00BFB37C /* RankDetailView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RankDetailView.m; sourceTree = "<group>"; }; 84AD4F3C1BF4894D00BFB37C /* RankDetailView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RankDetailView.m; sourceTree = "<group>"; };
84AD4F3E1BF498A900BFB37C /* ranking.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = ranking.plist; sourceTree = "<group>"; }; 84AD4F3E1BF498A900BFB37C /* ranking.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = ranking.plist; sourceTree = "<group>"; };
84AD4F411BF4A66F00BFB37C /* WorkModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WorkModel.h; sourceTree = "<group>"; };
84AD4F421BF4A66F00BFB37C /* WorkModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WorkModel.m; sourceTree = "<group>"; };
84AD4F441BF4A9E800BFB37C /* RankHeadView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RankHeadView.h; sourceTree = "<group>"; }; 84AD4F441BF4A9E800BFB37C /* RankHeadView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RankHeadView.h; sourceTree = "<group>"; };
84AD4F451BF4A9E800BFB37C /* RankHeadView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RankHeadView.m; sourceTree = "<group>"; }; 84AD4F451BF4A9E800BFB37C /* RankHeadView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RankHeadView.m; sourceTree = "<group>"; };
84AD4F471BF4BC0600BFB37C /* RankDetailTableCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RankDetailTableCell.h; sourceTree = "<group>"; }; 84AD4F471BF4BC0600BFB37C /* RankDetailTableCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RankDetailTableCell.h; sourceTree = "<group>"; };
...@@ -1034,8 +1031,6 @@ ...@@ -1034,8 +1031,6 @@
84AD4F401BF49FC100BFB37C /* Model */ = { 84AD4F401BF49FC100BFB37C /* Model */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
84AD4F411BF4A66F00BFB37C /* WorkModel.h */,
84AD4F421BF4A66F00BFB37C /* WorkModel.m */,
); );
path = Model; path = Model;
sourceTree = "<group>"; sourceTree = "<group>";
...@@ -1570,7 +1565,6 @@ ...@@ -1570,7 +1565,6 @@
84D80EB51BF714BE00A10EA4 /* GroupItems.m in Sources */, 84D80EB51BF714BE00A10EA4 /* GroupItems.m in Sources */,
84C9574D1BDB344900083584 /* UIBarButtonItem+Create.m in Sources */, 84C9574D1BDB344900083584 /* UIBarButtonItem+Create.m in Sources */,
84AD4F3D1BF4894D00BFB37C /* RankDetailView.m in Sources */, 84AD4F3D1BF4894D00BFB37C /* RankDetailView.m in Sources */,
84AD4F431BF4A66F00BFB37C /* WorkModel.m in Sources */,
84ECCF1B1C0210F000EA4960 /* CommentModel.m in Sources */, 84ECCF1B1C0210F000EA4960 /* CommentModel.m in Sources */,
84E0ABCD1BFB082E001C8F45 /* TaskDetailModel.m in Sources */, 84E0ABCD1BFB082E001C8F45 /* TaskDetailModel.m in Sources */,
8490C4D31BF9DEF0006B6569 /* PictureTableCell.m in Sources */, 8490C4D31BF9DEF0006B6569 /* PictureTableCell.m in Sources */,
......
...@@ -20,16 +20,10 @@ ...@@ -20,16 +20,10 @@
- (void)viewDidLoad { - (void)viewDidLoad {
[super viewDidLoad]; [super viewDidLoad];
self.view.backgroundColor = [UIColor redColor];
self.takeImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, kScreenHeight)]; self.takeImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, kScreenHeight)];
_takeImageView.image = _checkImage; _takeImageView.image = _checkImage;
[self.view addSubview:_takeImageView]; [self.view addSubview:_takeImageView];
// [self addGestureRecognizerToView:_takeImageView];
// [_takeImageView setUserInteractionEnabled:YES];
// [_takeImageView setMultipleTouchEnabled:YES];
// Do any additional setup after loading the view.
} }
......
...@@ -125,7 +125,7 @@ ...@@ -125,7 +125,7 @@
@"endDateTo":@"", @"endDateTo":@"",
@"nameLike":@"", @"nameLike":@"",
@"queryOrders":@[@{@"field":@"lastModifyInfo"}], @"queryOrders":@[@{@"field":@"lastModifyInfo"}],
@"pageNumber":@(1), @"pageNumber":@(0),
@"pageSize":@(10) @"pageSize":@(10)
}; };
[MBProgressHUD showHUDAddedTo:self.view animated:YES]; [MBProgressHUD showHUDAddedTo:self.view animated:YES];
...@@ -324,7 +324,7 @@ ...@@ -324,7 +324,7 @@
{ {
NSString *url = [NSString stringWithFormat:@"%@%@", kRedStarURL, kInspectListURL]; NSString *url = [NSString stringWithFormat:@"%@%@", kRedStarURL, kInspectListURL];
HttpClient *httpCilent = [[HttpClient alloc] initWithUrl:url]; HttpClient *httpCilent = [[HttpClient alloc] initWithUrl:url];
NSMutableDictionary *parameters = [NSMutableDictionary dictionaryWithObjectsAndKeys:@"",@"userUuid",@"",@"beginDateFrom",@"",@"endDateTo",@"",@"nameLike",@[],@"queryOrders",@(1),@"pageNumber",@(10),@"pageSize", nil]; NSMutableDictionary *parameters = [NSMutableDictionary dictionaryWithObjectsAndKeys:@"",@"userUuid",@"",@"beginDateFrom",@"",@"endDateTo",@"",@"nameLike",@[],@"queryOrders",@(0),@"pageNumber",@(10),@"pageSize", nil];
if (_selectRow == 0) { if (_selectRow == 0) {
...@@ -441,7 +441,7 @@ ...@@ -441,7 +441,7 @@
@"endDateTo":@"", @"endDateTo":@"",
@"nameLike":@"", @"nameLike":@"",
@"queryOrders":queryOrders, @"queryOrders":queryOrders,
@"pageNumber":@(1), @"pageNumber":@(0),
@"pageSize":@(10) @"pageSize":@(10)
}; };
[MBProgressHUD showHUDAddedTo:self.view animated:YES]; [MBProgressHUD showHUDAddedTo:self.view animated:YES];
...@@ -514,7 +514,7 @@ ...@@ -514,7 +514,7 @@
InspectTaskViewController *inspectTaskVC = [[InspectTaskViewController alloc] init]; InspectTaskViewController *inspectTaskVC = [[InspectTaskViewController alloc] init];
inspectTaskVC.uuid = taskList.uuid; inspectTaskVC.uuid = taskList.uuid;
inspectTaskVC.store_uuid = taskList.store_uuid; inspectTaskVC.store_uuid = taskList.store_uuid;
inspectTaskVC.multiplier = taskList.reportCount / taskList.questionCount; inspectTaskVC.multiplier = (CGFloat)taskList.reportCount / taskList.questionCount;
[self.navigationController pushViewController:inspectTaskVC animated:YES]; [self.navigationController pushViewController:inspectTaskVC animated:YES];
} }
......
...@@ -28,6 +28,6 @@ ...@@ -28,6 +28,6 @@
@property (nonatomic, strong) UILabel *dayLabel; // 剩余天数 @property (nonatomic, strong) UILabel *dayLabel; // 剩余天数
@property (nonatomic, strong) UIView *alreadyView; @property (nonatomic, strong) UIImageView *alreadyView;
@property (nonatomic, strong) UIView *allView; @property (nonatomic, strong) UIView *allView;
@end @end
...@@ -75,8 +75,9 @@ ...@@ -75,8 +75,9 @@
self.alreadyLabel.textColor = kProgressUnSettledColor; self.alreadyLabel.textColor = kProgressUnSettledColor;
self.allLabel.textColor = kProgressUnSettledColor; self.allLabel.textColor = kProgressUnSettledColor;
self.allView.backgroundColor = kProgressViewAllBackColor; self.allView.backgroundColor = kProgressViewAllBackColor;
self.alreadyView.backgroundColor = kProgressViewAlreadyBackColor; UIImage *image = [UIImage imageNamed:@"progress-bar"];
image = [image resizableImageWithCapInsets:UIEdgeInsetsZero resizingMode:UIImageResizingModeTile];
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];
...@@ -84,8 +85,9 @@ ...@@ -84,8 +85,9 @@
self.alreadyLabel.textColor = kProgressDealWithColor; self.alreadyLabel.textColor = kProgressDealWithColor;
self.allLabel.textColor = kProgressDealWithColor; self.allLabel.textColor = kProgressDealWithColor;
self.allView.backgroundColor = kProgressViewAllBackColor; self.allView.backgroundColor = kProgressViewAllBackColor;
self.alreadyView.backgroundColor = kProgressViewAlreadyBackColor; UIImage *image = [UIImage imageNamed:@"progress-bar"];
image = [image resizableImageWithCapInsets:UIEdgeInsetsZero resizingMode:UIImageResizingModeTile];
self.alreadyView.image = image;
} else { } else {
self.progressLabel.text = [NSString stringWithFormat:@"已过期 %f", _multiplier]; self.progressLabel.text = [NSString stringWithFormat:@"已过期 %f", _multiplier];
...@@ -93,7 +95,9 @@ ...@@ -93,7 +95,9 @@
self.alreadyLabel.textColor = kProgressOverDueColor; self.alreadyLabel.textColor = kProgressOverDueColor;
self.allLabel.textColor = kProgressOverDueColor; self.allLabel.textColor = kProgressOverDueColor;
self.allView.backgroundColor = kProgressViewAllBackColor; self.allView.backgroundColor = kProgressViewAllBackColor;
self.alreadyView.backgroundColor = kProgressViewAlreadyBackColor; UIImage *image = [UIImage imageNamed:@"progress-bar"];
image = [image resizableImageWithCapInsets:UIEdgeInsetsZero resizingMode:UIImageResizingModeTile];
self.alreadyView.image = image;
} }
} }
...@@ -266,10 +270,10 @@ ...@@ -266,10 +270,10 @@
return _allView; return _allView;
} }
- (UIView *)alreadyView - (UIImageView *)alreadyView
{ {
if (!_alreadyView) { if (!_alreadyView) {
_alreadyView = [[UIView alloc] init]; _alreadyView = [[UIImageView alloc] init];
_alreadyView.layer.cornerRadius = 3; _alreadyView.layer.cornerRadius = 3;
_alreadyView.layer.masksToBounds = YES; _alreadyView.layer.masksToBounds = YES;
_alreadyView.translatesAutoresizingMaskIntoConstraints = NO; _alreadyView.translatesAutoresizingMaskIntoConstraints = NO;
......
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
- (void)viewWillAppear:(BOOL)animated - (void)viewWillAppear:(BOOL)animated
{ {
[super viewWillAppear:animated]; [super viewWillAppear:animated];
self.tabBarController.tabBar.hidden = YES;
self.navigationController.navigationBar.hidden = NO; self.navigationController.navigationBar.hidden = NO;
} }
...@@ -79,6 +79,7 @@ ...@@ -79,6 +79,7 @@
} }
#pragma mark - Private Methods #pragma mark - Private Methods
// 返回上一页面 // 返回上一页面
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
// //
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>
#import "TaskModel.h"
@interface RankDetailTableCell : UITableViewCell @interface RankDetailTableCell : UITableViewCell
...@@ -19,4 +20,6 @@ ...@@ -19,4 +20,6 @@
@property (nonatomic, strong) UIScrollView *scrollView; @property (nonatomic, strong) UIScrollView *scrollView;
@property (nonatomic, strong) TaskModel *task;
@end @end
//
// WorkModel.h
// redstar
//
// Created by admin on 15/11/12.
// Copyright © 2015年 ZWF. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface WorkModel : NSObject
@property (nonatomic, strong) NSArray *Info;
@property (nonatomic, strong) NSString *name;
@property (nonatomic, strong) NSString *score;
@property (nonatomic, strong) NSString *grade;
@property (nonatomic, assign, getter = isOpened) BOOL opened;
+ (instancetype)workModelWithDict:(NSDictionary *)dict;
- (instancetype)initWithDict:(NSDictionary *)dict;
@end
//
// WorkModel.m
// redstar
//
// Created by admin on 15/11/12.
// Copyright © 2015年 ZWF. All rights reserved.
//
#import "WorkModel.h"
@implementation WorkModel
+ (instancetype)workModelWithDict:(NSDictionary *)dict
{
return [[self alloc] initWithDict:dict];
}
- (instancetype)initWithDict:(NSDictionary *)dict
{
if (self = [super init]) {
[self setValuesForKeysWithDictionary:dict];
}
return self;
}
@end
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>
#import "RankDetailView.h" #import "RankDetailView.h"
#import "TaskDetailModel.h"
@interface RankDetailHeaderView : UIView @interface RankDetailHeaderView : UIView
@property (nonatomic, strong) RankDetailView *rankDetailView; @property (nonatomic, strong) RankDetailView *rankDetailView;
...@@ -18,4 +19,6 @@ ...@@ -18,4 +19,6 @@
@property (nonatomic, strong) UILabel *titleLabel; @property (nonatomic, strong) UILabel *titleLabel;
@property (nonatomic, strong) UIButton *showAllBtn; // 展开全部 @property (nonatomic, strong) UIButton *showAllBtn; // 展开全部
@property (nonatomic, strong) TaskDetailModel *taskDetail;
@end @end
...@@ -37,15 +37,31 @@ ...@@ -37,15 +37,31 @@
- (void)setup { - (void)setup {
self.shopNameLabel.text = @"上海真北店";
[self.historyBtn setTitle:@"历史成绩" forState:UIControlStateNormal]; [self.historyBtn setTitle:@"历史成绩" forState:UIControlStateNormal];
self.arrowImageView1.image = [UIImage imageNamed:@"arrow_right"]; self.arrowImageView1.image = [UIImage imageNamed:@"arrow_right"];
self.rankDetailView.backgroundColor = [UIColor whiteColor]; self.rankDetailView.backgroundColor = [UIColor whiteColor];
self.titleLabel.text = @"口碑七大重点工作详情"; self.titleLabel.text = @"口碑七大重点工作详情";
[self.showAllBtn setTitle:@"历史成绩" forState:UIControlStateNormal]; [self.showAllBtn setTitle:@"展开" forState:UIControlStateNormal];
self.arrowImageView2.image = [UIImage imageNamed:@"arrow_right"];} self.arrowImageView2.image = [UIImage imageNamed:@"arrow_right"];
}
- (void)setTaskDetail:(TaskDetailModel *)taskDetail
{
_taskDetail = taskDetail;
self.shopNameLabel.text = [NSString stringWithFormat:@"%@", taskDetail.store_name];
self.rankDetailView.addressLabel.text = @"上海市真北路1108号";
self.rankDetailView.titleLabel.text = [NSString stringWithFormat:@"%@", taskDetail.name];
self.rankDetailView.reportTimeLabel.text = @"上报时间";
self.rankDetailView.totalScoreLabel.text = @"总评分";
self.rankDetailView.totalGradeLabel.text = @"总排名";
self.rankDetailView.timeLabel.text = [NSString stringWithFormat:@"%@", taskDetail.beginDate];
self.rankDetailView.scoreLabel.text = [NSString stringWithFormat:@"%@", taskDetail.score];
}
- (UILabel *)shopNameLabel - (UILabel *)shopNameLabel
{ {
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>
@class WorkModel; @class TaskGroup;
@protocol RankHeadViewDelegate <NSObject> @protocol RankHeadViewDelegate <NSObject>
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
@end @end
@interface RankHeadView : UITableViewHeaderFooterView @interface RankHeadView : UITableViewHeaderFooterView
@property (nonatomic, strong) WorkModel *work; @property (nonatomic, strong) TaskGroup *taskGroup;
@property (nonatomic, weak) id<RankHeadViewDelegate> delegate; @property (nonatomic, weak) id<RankHeadViewDelegate> delegate;
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
// //
#import "RankHeadView.h" #import "RankHeadView.h"
#import "WorkModel.h" #import "TaskGroup.h"
@interface RankHeadView () @interface RankHeadView ()
{ {
...@@ -71,24 +71,25 @@ ...@@ -71,24 +71,25 @@
- (void)headBtnClick - (void)headBtnClick
{ {
_work.opened = !_work.isOpened; _taskGroup.opened = !_taskGroup.isOpened;
if ([_delegate respondsToSelector:@selector(clickRankHeadView)]) { if ([_delegate respondsToSelector:@selector(clickRankHeadView)]) {
[_delegate clickRankHeadView]; [_delegate clickRankHeadView];
} }
} }
- (void)setWork:(WorkModel *)work - (void)setTaskGroup:(TaskGroup *)taskGroup
{ {
_work = work; _taskGroup = taskGroup;
[_bgButton setTitle:work.name forState:UIControlStateNormal];
NSString *scoreStr = [NSString stringWithFormat:@"%@ 分", work.score]; [_bgButton setTitle:taskGroup.category forState:UIControlStateNormal];
NSString *scoreStr = [NSString stringWithFormat:@"%@ 分", taskGroup.score];
NSMutableAttributedString *scoreAttr = [[NSMutableAttributedString alloc] initWithString:scoreStr]; NSMutableAttributedString *scoreAttr = [[NSMutableAttributedString alloc] initWithString:scoreStr];
[scoreAttr addAttributes:@{NSForegroundColorAttributeName:kNavigationBarColor,NSFontAttributeName:[UIFont systemFontOfSize:19.0f]} range:NSMakeRange(0,scoreAttr.length - 1)]; [scoreAttr addAttributes:@{NSForegroundColorAttributeName:kNavigationBarColor,NSFontAttributeName:[UIFont systemFontOfSize:19.0f]} range:NSMakeRange(0,scoreAttr.length - 1)];
[scoreAttr addAttributes:@{NSForegroundColorAttributeName:kDetailSmallTitleColor, NSFontAttributeName:[UIFont systemFontOfSize:14.0f]} range:NSMakeRange(scoreAttr.length - 1,1)]; [scoreAttr addAttributes:@{NSForegroundColorAttributeName:kDetailSmallTitleColor, NSFontAttributeName:[UIFont systemFontOfSize:14.0f]} range:NSMakeRange(scoreAttr.length - 1,1)];
[_scoreLabel setAttributedText:scoreAttr]; [_scoreLabel setAttributedText:scoreAttr];
NSString *rankStr = [NSString stringWithFormat:@"第 %@ 名", work.grade]; NSString *rankStr = [NSString stringWithFormat:@"第 %@ 名", taskGroup.ranking];
NSMutableAttributedString *rankAttr = [[NSMutableAttributedString alloc] initWithString:rankStr]; NSMutableAttributedString *rankAttr = [[NSMutableAttributedString alloc] initWithString:rankStr];
[rankAttr addAttributes:@{NSForegroundColorAttributeName:kRankHeadTitleTextColor,NSFontAttributeName:[UIFont systemFontOfSize:14.0f]} range:NSMakeRange(0,1)]; [rankAttr addAttributes:@{NSForegroundColorAttributeName:kRankHeadTitleTextColor,NSFontAttributeName:[UIFont systemFontOfSize:14.0f]} range:NSMakeRange(0,1)];
[rankAttr addAttributes:@{NSForegroundColorAttributeName:kGradeNumberTextColor} range:NSMakeRange(1,rankStr.length - 2)]; [rankAttr addAttributes:@{NSForegroundColorAttributeName:kGradeNumberTextColor} range:NSMakeRange(1,rankStr.length - 2)];
...@@ -101,8 +102,8 @@ ...@@ -101,8 +102,8 @@
- (void)didMoveToSuperview - (void)didMoveToSuperview
{ {
_arrowImageView.transform = _work.isOpened ? CGAffineTransformMakeRotation(M_PI) : CGAffineTransformMakeRotation(0); _arrowImageView.transform = _taskGroup.isOpened ? CGAffineTransformMakeRotation(M_PI) : CGAffineTransformMakeRotation(0);
_lineView.hidden = _work.isOpened ? YES : NO; _lineView.hidden = _taskGroup.isOpened ? YES : NO;
} }
- (void)layoutSubviews - (void)layoutSubviews
......
...@@ -10,5 +10,7 @@ ...@@ -10,5 +10,7 @@
@interface RankDetailViewController : UIViewController @interface RankDetailViewController : UIViewController
@property (nonatomic, assign) NSInteger indexRow; @property (nonatomic, assign) NSInteger indexRow;
@property (nonatomic, copy) NSString *uuid;
@property (nonatomic, copy) NSString *store_uuid;
@end @end
...@@ -11,7 +11,15 @@ ...@@ -11,7 +11,15 @@
#import "RankDetailHeaderView.h" #import "RankDetailHeaderView.h"
#import "RankHeadView.h" #import "RankHeadView.h"
#import "WorkModel.h" #import <MBProgressHUD.h>
#import "HttpClient.h"
#import "TaskGroup.h"
#import "TaskModel.h"
#import "TaskDetailModel.h"
#import "CheckPicViewController.h"
#import <UIButton+WebCache.h>
#define kRankDetailCell @"RankDetailTableCell" #define kRankDetailCell @"RankDetailTableCell"
...@@ -20,11 +28,10 @@ ...@@ -20,11 +28,10 @@
@property (nonatomic, strong) RankDetailHeaderView *rankDetailHeaderView; @property (nonatomic, strong) RankDetailHeaderView *rankDetailHeaderView;
@property (nonatomic, strong) NSArray *workData; @property (nonatomic, strong) NSMutableArray *taskData;
@property (nonatomic, strong) NSMutableDictionary *selectedIndexes; // 存放二次展开的cell @property (nonatomic, strong) NSMutableDictionary *selectedIndexes; // 存放二次展开的cell
@end @end
@implementation RankDetailViewController @implementation RankDetailViewController
...@@ -42,6 +49,13 @@ ...@@ -42,6 +49,13 @@
self.view.backgroundColor = [UIColor lightGrayColor]; self.view.backgroundColor = [UIColor lightGrayColor];
if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0) {
self.edgesForExtendedLayout = UIRectEdgeNone;
self.extendedLayoutIncludesOpaqueBars = NO;
self.modalPresentationCapturesStatusBarAppearance = NO;
self.navigationController.navigationBar.translucent = NO;
}
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:@"口碑详情"];
...@@ -56,11 +70,10 @@ ...@@ -56,11 +70,10 @@
self.navigationItem.leftBarButtonItem = backItem; self.navigationItem.leftBarButtonItem = backItem;
// 添加tableView
[self addTableView];
// 初始化容器 // 初始化容器
self.selectedIndexes = [[NSMutableDictionary alloc] init]; self.selectedIndexes = [[NSMutableDictionary alloc] init];
// 请求口碑排名详情
[self requestRankingDetail];
} }
...@@ -70,25 +83,38 @@ ...@@ -70,25 +83,38 @@
} }
#pragma mark - Private Methods #pragma mark - Private Methods
- (void)addTableView {
- (void)requestRankingDetail
NSURL *url = [[NSBundle mainBundle] URLForResource:@"ranking.plist" withExtension:nil]; {
NSArray *tempArray = [NSArray arrayWithContentsOfURL:url]; NSString *url = [NSString stringWithFormat:@"%@%@%@/%@",kRedStarURL, kInspectDetailURL, self.uuid, self.store_uuid];
NSLog(@"url = %@" , url);
NSMutableArray *workArray = [NSMutableArray array]; HttpClient *httpClient = [[HttpClient alloc] initWithUrl:url];
for (NSDictionary *dict in tempArray) {
WorkModel *work = [WorkModel workModelWithDict:dict];
[workArray addObject:work];
}
_workData = workArray;
self.tableView.tableHeaderView = self.rankDetailHeaderView; [httpClient getPraiseDetailWithParameters:nil completion:^(id response, NSError *error) {
[self setupScrollView]; NSLog(@"口碑巡检明细PraiseDetail = %@", response);
// 注册cell NSDictionary *dataDict = response[@"data"];
[self.tableView registerClass:[RankDetailTableCell class] forCellReuseIdentifier:kRankDetailCell]; TaskDetailModel *taskDetail = [TaskDetailModel taskDetailModelWithDict:dataDict];
self.rankDetailHeaderView.taskDetail = taskDetail;
NSArray *dataArray = dataDict[@"categories"];
NSMutableArray *tgArray = [NSMutableArray array];
for (NSDictionary *dict in dataArray) {
TaskGroup *taskGroup = [TaskGroup taskGroupWithDict:dict];
[tgArray addObject:taskGroup];
}
_taskData = tgArray;
self.tableView.tableHeaderView = self.rankDetailHeaderView;
[self.tableView registerClass:[RankDetailTableCell class] forCellReuseIdentifier:kRankDetailCell];
[self setupScrollView];
}];
} }
// 返回上一页面 // 返回上一页面
- (void)doBack:(UIBarButtonItem *)sender - (void)doBack:(UIBarButtonItem *)sender
{ {
...@@ -106,14 +132,16 @@ ...@@ -106,14 +132,16 @@
UIButton *button = [[UIButton alloc] init]; UIButton *button = [[UIButton alloc] init];
[button setImage:[UIImage imageNamed:[NSString stringWithFormat:@"0%d", i]] forState:UIControlStateNormal]; [button setImage:[UIImage imageNamed:[NSString stringWithFormat:@"0%d", i]] forState:UIControlStateNormal];
button.frame = CGRectMake(i * imageViewW + 2, 2, imageViewW - 2 * marginW, imageViewH); button.frame = CGRectMake(i * imageViewW + 2, 2, imageViewW - 2 * marginW, imageViewH);
[button addTarget:self action:@selector(ccilck) forControlEvents:UIControlEventTouchUpInside]; [button addTarget:self action:@selector(showBigPic:) forControlEvents:UIControlEventTouchUpInside];
[self.rankDetailHeaderView.rankDetailView.showScrollView addSubview:button]; [self.rankDetailHeaderView.rankDetailView.showScrollView addSubview:button];
} }
} }
- (void)ccilck - (void)showBigPic:(UIButton *)btn
{ {
NSLog(@"test"); CheckPicViewController *checkVC = [[CheckPicViewController alloc] init];
checkVC.checkImage = btn.imageView.image;
[self.navigationController pushViewController:checkVC animated:YES];
} }
...@@ -135,12 +163,45 @@ ...@@ -135,12 +163,45 @@
cell.arrowImageView.transform = CGAffineTransformIdentity; cell.arrowImageView.transform = CGAffineTransformIdentity;
cell.arrowImageView.transform = CGAffineTransformMakeRotation(M_PI / 2); cell.arrowImageView.transform = CGAffineTransformMakeRotation(M_PI / 2);
}]; }];
NSArray *imgaeUrlArray = cell.task.answerAttachments;
NSMutableArray *urlArray = [NSMutableArray array];
for (NSDictionary *imageUrlDict in imgaeUrlArray) {
NSString *urlStr = [NSString stringWithFormat:@"%@%@", kRedStarURL, imageUrlDict[@"fileUrl"]];
[urlArray addObject:urlStr];
}
CGFloat marginW = 5.0;
CGFloat imageViewW = 90 + 2 * marginW;
cell.scrollView = [[UIScrollView alloc] init]; cell.scrollView = [[UIScrollView alloc] init];
cell.scrollView.backgroundColor = [UIColor lightGrayColor];
cell.scrollView.translatesAutoresizingMaskIntoConstraints = NO; cell.scrollView.translatesAutoresizingMaskIntoConstraints = NO;
cell.scrollView.contentSize = CGSizeMake((urlArray.count - 1) * imageViewW, 65);
[cell.contentView addSubview:cell.scrollView]; [cell.contentView addSubview:cell.scrollView];
for (int i = 0; i < urlArray.count; i++) {
UIButton *button = [[UIButton alloc] init];
button.translatesAutoresizingMaskIntoConstraints = NO;
NSString *urlStr = [NSString stringWithFormat:@"%@", urlArray[i]];
NSURL *url = [NSURL URLWithString:urlStr];
[button sd_setImageWithURL:url forState:UIControlStateNormal placeholderImage:[UIImage imageNamed:@"default_pic"]];
[button addTarget:self action:@selector(showBigPic:) forControlEvents:UIControlEventTouchUpInside];
[cell.scrollView addSubview:button];
NSLayoutConstraint *urlTop = [NSLayoutConstraint constraintWithItem:button attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:cell.scrollView attribute:NSLayoutAttributeTop multiplier:1.0 constant:0];
[cell.scrollView addConstraint:urlTop];
NSLayoutConstraint *urlLeft = [NSLayoutConstraint constraintWithItem:button attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:cell.scrollView attribute:NSLayoutAttributeLeft multiplier:1.0 constant:i * imageViewW];
[cell.scrollView addConstraint:urlLeft];
NSLayoutConstraint *urlWidth = [NSLayoutConstraint constraintWithItem:button attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:imageViewW];
[cell.scrollView addConstraint:urlWidth];
NSLayoutConstraint *urlHeight = [NSLayoutConstraint constraintWithItem:button attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:65];
[cell.scrollView addConstraint:urlHeight];
}
NSLayoutConstraint *someoneTop = [NSLayoutConstraint constraintWithItem:cell.scrollView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:cell.contentView attribute:NSLayoutAttributeTop multiplier:1.0 constant:45]; NSLayoutConstraint *someoneTop = [NSLayoutConstraint constraintWithItem:cell.scrollView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:cell.contentView attribute:NSLayoutAttributeTop multiplier:1.0 constant:45];
[cell.contentView addConstraint:someoneTop]; [cell.contentView addConstraint:someoneTop];
...@@ -179,13 +240,13 @@ ...@@ -179,13 +240,13 @@
#pragma mark - UITableView DataSource/Delegate #pragma mark - UITableView DataSource/Delegate
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{ {
return _workData.count; return _taskData.count;
} }
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{ {
WorkModel *work = _workData[section]; TaskGroup *taskGroup = _taskData[section];
NSInteger count = work.isOpened ? work.Info.count : 0; NSInteger count = taskGroup.isOpened ? taskGroup.answers.count : 0;
return count; return count;
} }
...@@ -197,13 +258,15 @@ ...@@ -197,13 +258,15 @@
cell = [[RankDetailTableCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:kRankDetailCell]; cell = [[RankDetailTableCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:kRankDetailCell];
} }
WorkModel *workModel = _workData[indexPath.section]; TaskGroup *taskGroup = _taskData[indexPath.section];
NSDictionary *dict = workModel.Info[indexPath.row]; TaskModel *task = taskGroup.answers[indexPath.row];
cell.task = task;
cell.selectionStyle = UITableViewCellSelectionStyleNone; cell.selectionStyle = UITableViewCellSelectionStyleNone;
[cell.mainTitleBtn setTitle:[NSString stringWithFormat:@"%d、%@", (int)(indexPath.row + 1),dict[@"titles"]] forState:UIControlStateNormal]; [cell.mainTitleBtn setTitle:[NSString stringWithFormat:@"%d、%@", (int)(indexPath.row + 1) ,task.title] forState:UIControlStateNormal];
cell.scoreLabel.text = [NSString stringWithFormat:@"%@分", dict[@"scroes"]]; cell.scoreLabel.text = [NSString stringWithFormat:@"%@分", task.score];
// 按钮点击事件 // 按钮点击事件
[cell.mainTitleBtn addTarget:self action:@selector(showScrollView:) forControlEvents:UIControlEventTouchUpInside]; [cell.mainTitleBtn addTarget:self action:@selector(showScrollView:) forControlEvents:UIControlEventTouchUpInside];
...@@ -244,8 +307,7 @@ ...@@ -244,8 +307,7 @@
{ {
RankHeadView *headView = [RankHeadView headViewWithTableView:tableView]; RankHeadView *headView = [RankHeadView headViewWithTableView:tableView];
headView.delegate = self; headView.delegate = self;
headView.work = _workData[section]; headView.taskGroup = _taskData[section];
return headView; return headView;
} }
...@@ -287,13 +349,6 @@ ...@@ -287,13 +349,6 @@
{ {
if (!_rankDetailHeaderView) { if (!_rankDetailHeaderView) {
_rankDetailHeaderView = [[RankDetailHeaderView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, 298)]; _rankDetailHeaderView = [[RankDetailHeaderView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, 298)];
_rankDetailHeaderView.rankDetailView.addressLabel.text = @"上海市真北路1108号";
_rankDetailHeaderView.rankDetailView.titleLabel.text = @"2015年8月口碑巡检";
_rankDetailHeaderView.rankDetailView.reportTimeLabel.text = @"上报时间";
_rankDetailHeaderView.rankDetailView.totalScoreLabel.text = @"总评分";
_rankDetailHeaderView.rankDetailView.totalGradeLabel.text = @"总排名";
_rankDetailHeaderView.rankDetailView.timeLabel.text = @"2015-08-15";
_rankDetailHeaderView.rankDetailView.scoreLabel.text = @"100";
if (self.indexRow < 3) { if (self.indexRow < 3) {
NSString *imageName = [NSString stringWithFormat:@"medal_0%ld", (long)(_indexRow + 1)]; NSString *imageName = [NSString stringWithFormat:@"medal_0%ld", (long)(_indexRow + 1)];
_rankDetailHeaderView.rankDetailView.gradeImageView.image = [UIImage imageNamed:imageName]; _rankDetailHeaderView.rankDetailView.gradeImageView.image = [UIImage imageNamed:imageName];
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
// //
#import "RankingListCell.h" #import "RankingListCell.h"
#import "RankListModel.h"
@implementation RankingListCell @implementation RankingListCell
...@@ -33,6 +34,9 @@ ...@@ -33,6 +34,9 @@
- (void)setRankList:(RankListModel *)rankList - (void)setRankList:(RankListModel *)rankList
{ {
_rankList = rankList; _rankList = rankList;
[self.shopNameButton setTitle:[NSString stringWithFormat:@"%@", rankList.store_name] forState:UIControlStateNormal];
self.scoreLabel.text = [NSString stringWithFormat:@"%@", rankList.score];
} }
- (void)setSelected:(BOOL)selected animated:(BOOL)animated { - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
......
...@@ -88,7 +88,7 @@ ...@@ -88,7 +88,7 @@
NSDictionary *parameters = @{@"beginDateFrom":@"", NSDictionary *parameters = @{@"beginDateFrom":@"",
@"endDateTo":@"", @"endDateTo":@"",
@"queryOrders":@[], @"queryOrders":@[],
@"pageNumber":@(1), @"pageNumber":@(0),
@"pageSize":@(10) @"pageSize":@(10)
}; };
[MBProgressHUD showHUDAddedTo:self.view animated:YES]; [MBProgressHUD showHUDAddedTo:self.view animated:YES];
...@@ -312,8 +312,12 @@ ...@@ -312,8 +312,12 @@
// cell的点击事件 // cell的点击事件
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{ {
RankListModel *rankList = _allRankListArray[indexPath.row];
RankDetailViewController *rankDetailVC = [[RankDetailViewController alloc] init]; RankDetailViewController *rankDetailVC = [[RankDetailViewController alloc] init];
rankDetailVC.indexRow = indexPath.row; rankDetailVC.indexRow = indexPath.row;
rankDetailVC.uuid = rankList.uuid;
rankDetailVC.store_uuid = rankList.store_uuid;
[self.navigationController pushViewController:rankDetailVC animated:YES]; [self.navigationController pushViewController:rankDetailVC animated:YES];
} }
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#import "RankingListCell.h" #import "RankingListCell.h"
#define kHomeRankingListCell @"homeRankingListsCell" #define kHomeRankingListCell @"homeRankingListsCell"
#import "RankDetailViewController.h" #import "RankDetailViewController.h"
#import "RankListModel.h"
#import "QuestionListTableCell.h" #import "QuestionListTableCell.h"
#define kHomeQuestionListTableCell @"homeQuestionListTableCell" #define kHomeQuestionListTableCell @"homeQuestionListTableCell"
...@@ -72,7 +73,8 @@ ...@@ -72,7 +73,8 @@
@property (nonatomic, strong) NSMutableDictionary *selectedIndexes; @property (nonatomic, strong) NSMutableDictionary *selectedIndexes;
@property (nonatomic, strong) NSMutableArray *allQuestionArray; // 问题与知识 @property (nonatomic, strong) NSMutableArray *allQuestionArray; // 问题与知识
@property (nonatomic, strong) NSMutableArray *taskListDataArray; // 问题与知识
@property (nonatomic, strong) NSMutableArray *allRankListArray;
@end @end
@implementation HomeViewController @implementation HomeViewController
...@@ -111,6 +113,20 @@ ...@@ -111,6 +113,20 @@
// 初始化容器 // 初始化容器
self.selectedIndexes = [[NSMutableDictionary alloc] init]; self.selectedIndexes = [[NSMutableDictionary alloc] init];
[MBProgressHUD showHUDAddedTo:self.view animated:YES];
self.allRankListArray = [NSMutableArray array];
self.taskListDataArray = [NSMutableArray array];
self.allQuestionArray = [NSMutableArray array];
self.tableView.tableHeaderView = self.headView;
//
[self requestRankingList];
// 巡检列表
[self requestInspectList];
// 问题与知识 // 问题与知识
[self requestQuestionList]; [self requestQuestionList];
...@@ -129,10 +145,70 @@ ...@@ -129,10 +145,70 @@
} }
#pragma mark - 请求 #pragma mark - 请求
- (void)requestRankingList
{
NSString *url = [NSString stringWithFormat:@"%@%@", kRedStarURL, kRankingListURL];
HttpClient *httpCilent = [[HttpClient alloc] initWithUrl:url];
NSDictionary *parameters = @{@"beginDateFrom":@"",
@"endDateTo":@"",
@"queryOrders":@[],
@"pageNumber":@(0),
@"pageSize":@(3)
};
__block HomeViewController *weakSelf = self;
[httpCilent getRankingListWithParameters:parameters completion:^(id response, NSError *error) {
NSLog(@"口碑排名response = %@", response);
NSDictionary *dataDict = response[@"data"];
NSArray *dataArray = dataDict[@"records"];
for (NSDictionary *ListDict in dataArray) {
RankListModel *rankList = [RankListModel rankListModelWithDict:ListDict];
[weakSelf.allRankListArray addObject:rankList];
}
[self.tableView reloadData];
[MBProgressHUD hideHUDForView:self.view animated:YES];
}];
}
- (void)requestInspectList
{
NSString *url = [NSString stringWithFormat:@"%@%@", kRedStarURL, kInspectListURL];
HttpClient *httpCilent = [[HttpClient alloc] initWithUrl:url];
NSDictionary *parameters = @{@"userUuid":@"",
@"beginDateFrom":@"",
@"endDateTo":@"",
@"nameLike":@"",
@"queryOrders":@[@{@"field":@"lastModifyInfo"}],
@"pageNumber":@(0),
@"pageSize":@(2)
};
[httpCilent getInspectListWithParameters:parameters completion:^(id response, NSError *error) {
NSLog(@"巡检列表%@", response);
NSDictionary *dataDict = response[@"data"];
NSArray *dataArray = dataDict[@"records"];
for (NSDictionary *dict in dataArray) {
TaskListModel *taskList = [[TaskListModel alloc] init];
[taskList setValuesForKeysWithDictionary:dict];
[_taskListDataArray addObject:taskList];
}
[self.tableView reloadData];
[MBProgressHUD hideHUDForView:self.view animated:YES];
}];
}
- (void)requestQuestionList - (void)requestQuestionList
{ {
// 初始化数组 // 初始化数组
self.allQuestionArray = [NSMutableArray array];
// 请求地址 // 请求地址
NSString *urlStr = [NSString stringWithFormat:@"%@%@", kRedStarURL, kQuestionListURL]; NSString *urlStr = [NSString stringWithFormat:@"%@%@", kRedStarURL, kQuestionListURL];
NSString *user_uuid = [[NSUserDefaults standardUserDefaults] objectForKey:@"user_uuid"]; NSString *user_uuid = [[NSUserDefaults standardUserDefaults] objectForKey:@"user_uuid"];
...@@ -148,18 +224,18 @@ ...@@ -148,18 +224,18 @@
// //
__block HomeViewController *weakSelf = self; __block HomeViewController *weakSelf = self;
[MBProgressHUD showHUDAddedTo:self.view animated:YES];
// 请求问题列表 // 请求问题列表
[httpClient getQuestionListWithParameters:parameters completion:^(id response, NSError *error) { [httpClient getQuestionListWithParameters:parameters completion:^(id response, NSError *error) {
NSDictionary *dataDict = (NSDictionary *)response[@"data"]; NSDictionary *dataDict = (NSDictionary *)response[@"data"];
NSDictionary *recordsDict = (NSDictionary *)dataDict[@"records"]; NSDictionary *recordsDict = (NSDictionary *)dataDict[@"records"];
NSLog(@"问题与知识列表recods = %@", response); NSLog(@"问题与知识列表recods = %@", response);
NSLog(@"error = %@", error);
for (NSDictionary *questionDict in recordsDict) { for (NSDictionary *questionDict in recordsDict) {
QuestionModel *question = [[QuestionModel alloc] init]; QuestionModel *question = [[QuestionModel alloc] init];
[question setValuesForKeysWithDictionary:questionDict]; [question setValuesForKeysWithDictionary:questionDict];
[weakSelf.allQuestionArray addObject:question]; [weakSelf.allQuestionArray addObject:question];
} }
[self.tableView reloadData];
self.tableView.tableHeaderView = self.headView; self.tableView.tableHeaderView = self.headView;
[MBProgressHUD hideHUDForView:self.view animated:YES]; [MBProgressHUD hideHUDForView:self.view animated:YES];
}]; }];
...@@ -329,6 +405,7 @@ ...@@ -329,6 +405,7 @@
NSNumber *selectedIndex = [NSNumber numberWithBool:isSelected]; NSNumber *selectedIndex = [NSNumber numberWithBool:isSelected];
[_selectedIndexes setObject:selectedIndex forKey:path]; [_selectedIndexes setObject:selectedIndex forKey:path];
if (cell.isDrop) { if (cell.isDrop) {
[UIView animateWithDuration:0.2 animations:^{ [UIView animateWithDuration:0.2 animations:^{
...@@ -438,10 +515,14 @@ ...@@ -438,10 +515,14 @@
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{ {
if (section == 1) { if (section == 0) {
return 4;
} else {
return 2; return 2;
} else if (section == 1) {
return _allRankListArray.count + 1;
} else if (section == 2) {
return _allQuestionArray.count;
} else{
return _taskListDataArray.count;
} }
} }
...@@ -480,14 +561,13 @@ ...@@ -480,14 +561,13 @@
if (!cell) { if (!cell) {
cell = [[RankingListCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:kHomeRankingListCell]; cell = [[RankingListCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:kHomeRankingListCell];
} }
RankListModel *rankList = _allRankListArray[indexPath.row - 1];
cell.rankList = rankList;
cell.selectionStyle = UITableViewCellSelectionStyleNone; cell.selectionStyle = UITableViewCellSelectionStyleNone;
cell.scoreState = ScoreStateHigh; cell.scoreState = ScoreStateHigh;
NSString *imageName = [NSString stringWithFormat:@"medal_0%ld", (long)(indexPath.row)]; NSString *imageName = [NSString stringWithFormat:@"medal_0%ld", (long)(indexPath.row)];
cell.gradeImageView.image = [UIImage imageNamed:imageName]; cell.gradeImageView.image = [UIImage imageNamed:imageName]; // 添加点击事件
[cell.shopNameButton setTitle:@"上海真北店" forState:UIControlStateNormal];
cell.scoreLabel.text = @"98";
cell.selectionStyle = UITableViewCellSelectionStyleNone;
// 添加点击事件
[cell.shopNameButton addTarget:self action:@selector(loadMoreInfo:) forControlEvents:UIControlEventTouchUpInside]; [cell.shopNameButton addTarget:self action:@selector(loadMoreInfo:) forControlEvents:UIControlEventTouchUpInside];
return cell; return cell;
} }
...@@ -509,22 +589,13 @@ ...@@ -509,22 +589,13 @@
if (!cell) { if (!cell) {
cell = [[InspectListCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:kHomeInspectListCell]; cell = [[InspectListCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:kHomeInspectListCell];
} }
TaskListModel *taskList = [[TaskListModel alloc] init]; TaskListModel *taskList = _taskListDataArray[indexPath.row];
taskList.reportCount = 10;
taskList.questionCount = 13;
cell.taskList = taskList; cell.taskList = taskList;
cell.selectionStyle = UITableViewCellSelectionStyleNone; cell.selectionStyle = UITableViewCellSelectionStyleNone;
cell.titleLabel.text = [NSString stringWithFormat:@"%@", _test7Array[indexPath.row]];
cell.startDate.text = [NSString stringWithFormat:@"起始时间:%@", _test8Array[indexPath.row]];
cell.overDate.text = [NSString stringWithFormat:@"截止时间:%@", _test9Array[indexPath.row]];
cell.alreadyLabel.text = [NSString stringWithFormat:@"%@", _test5Array[indexPath.row]];
cell.allLabel.text = [NSString stringWithFormat:@"/%@", _test6Array[indexPath.row]];
// CGFloat already = [_test5Array[indexPath.row] floatValue];
// CGFloat all = [_test6Array[indexPath.row] floatValue];
// cell.multiplier = already / all;
cell.allView.backgroundColor = kProgressViewAllBackColor; cell.allView.backgroundColor = kProgressViewAllBackColor;
cell.alreadyView.backgroundColor = kProgressViewAlreadyBackColor; UIImage *image = [UIImage imageNamed:@"progress-bar"];
image = [image resizableImageWithCapInsets:UIEdgeInsetsZero resizingMode:UIImageResizingModeTile];
cell.alreadyView.image = image;
return cell; return cell;
} }
} }
...@@ -548,11 +619,12 @@ ...@@ -548,11 +619,12 @@
[self.navigationController pushViewController:questionDetailVC animated:YES]; [self.navigationController pushViewController:questionDetailVC animated:YES];
} else { } else {
InspectListCell *cell = (InspectListCell *)[self tableView:_tableView cellForRowAtIndexPath:indexPath];
InspectTaskViewController *inspectTaskVC = [[InspectTaskViewController alloc] init]; InspectTaskViewController *inspectTaskVC = [[InspectTaskViewController alloc] init];
inspectTaskVC.multiplier = cell.multiplier; TaskListModel *taskList = _taskListDataArray[indexPath.row];
inspectTaskVC.alreadyNumber = cell.alreadyLabel.text; inspectTaskVC.uuid = taskList.uuid;
inspectTaskVC.allNumber = cell.allLabel.text; inspectTaskVC.store_uuid = taskList.store_uuid;
inspectTaskVC.multiplier = (CGFloat)taskList.reportCount / taskList.questionCount ;
[self.navigationController pushViewController:inspectTaskVC animated:YES]; [self.navigationController pushViewController:inspectTaskVC animated:YES];
} }
...@@ -568,7 +640,7 @@ ...@@ -568,7 +640,7 @@
return 40; return 40;
} else { } else {
if([self cellIsSelected:indexPath]) { if([self cellIsSelected:indexPath]) {
return 108; return 108;
} }
return 50; return 50;
} }
......
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