Commit 024655c3 authored by admin's avatar admin

2.2接口出错 完成2.4接口model

parent 79e315d3
......@@ -72,12 +72,15 @@
84D825821BDD35E000CC61F7 /* HomeHeaderView.m in Sources */ = {isa = PBXBuildFile; fileRef = 84D825811BDD35E000CC61F7 /* HomeHeaderView.m */; };
84DB9BC41BDCD4B600822CC4 /* CustomDropMenuView.m in Sources */ = {isa = PBXBuildFile; fileRef = 84DB9BC31BDCD4B600822CC4 /* CustomDropMenuView.m */; };
84DB9BC71BDCD67200822CC4 /* UIView+Extension.m in Sources */ = {isa = PBXBuildFile; fileRef = 84DB9BC61BDCD67200822CC4 /* UIView+Extension.m */; };
84E0ABCD1BFB082E001C8F45 /* TaskDetailModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 84E0ABCC1BFB082E001C8F45 /* TaskDetailModel.m */; };
84E363D21BFAC5200061547E /* TaskListModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 84E363D11BFAC5200061547E /* TaskListModel.m */; };
84E420411BE849FC00689976 /* QuestionDescribeCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 84E420401BE849FC00689976 /* QuestionDescribeCell.m */; };
84E420441BE84A2300689976 /* QuestionCommentCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 84E420431BE84A2300689976 /* QuestionCommentCell.m */; };
84E420471BE88AE000689976 /* RootTabBarController.m in Sources */ = {isa = PBXBuildFile; fileRef = 84E420461BE88AE000689976 /* RootTabBarController.m */; };
84ED5DD81BF2E64300A1BB6D /* ScreenView.m in Sources */ = {isa = PBXBuildFile; fileRef = 84ED5DD71BF2E64300A1BB6D /* ScreenView.m */; };
84F1669B1BE715E40061D350 /* ZanButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 84F1669A1BE715E40061D350 /* ZanButton.m */; };
84F30DA41BFC19F200CBAD13 /* RankListModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 84F30DA31BFC19F200CBAD13 /* RankListModel.m */; };
84F30DA71BFC1A8E00CBAD13 /* RankCommentModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 84F30DA61BFC1A8E00CBAD13 /* RankCommentModel.m */; };
84F57C461BEC388A00DDEEB1 /* CommentView.m in Sources */ = {isa = PBXBuildFile; fileRef = 84F57C451BEC388A00DDEEB1 /* CommentView.m */; };
84F57C4C1BEC785E00DDEEB1 /* AddQuestionViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 84F57C4B1BEC785E00DDEEB1 /* AddQuestionViewController.m */; };
84F57C501BEC7AA300DDEEB1 /* AddQuestionFooterView.m in Sources */ = {isa = PBXBuildFile; fileRef = 84F57C4F1BEC7AA300DDEEB1 /* AddQuestionFooterView.m */; };
......@@ -238,6 +241,8 @@
84DB9BC31BDCD4B600822CC4 /* CustomDropMenuView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CustomDropMenuView.m; sourceTree = "<group>"; };
84DB9BC51BDCD67200822CC4 /* UIView+Extension.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIView+Extension.h"; sourceTree = "<group>"; };
84DB9BC61BDCD67200822CC4 /* UIView+Extension.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIView+Extension.m"; sourceTree = "<group>"; };
84E0ABCB1BFB082E001C8F45 /* TaskDetailModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TaskDetailModel.h; sourceTree = "<group>"; };
84E0ABCC1BFB082E001C8F45 /* TaskDetailModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TaskDetailModel.m; sourceTree = "<group>"; };
84E363D01BFAC5200061547E /* TaskListModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TaskListModel.h; sourceTree = "<group>"; };
84E363D11BFAC5200061547E /* TaskListModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TaskListModel.m; sourceTree = "<group>"; };
84E4203F1BE849FC00689976 /* QuestionDescribeCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = QuestionDescribeCell.h; sourceTree = "<group>"; };
......@@ -250,6 +255,10 @@
84ED5DD71BF2E64300A1BB6D /* ScreenView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ScreenView.m; sourceTree = "<group>"; };
84F166991BE715E40061D350 /* ZanButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ZanButton.h; sourceTree = "<group>"; };
84F1669A1BE715E40061D350 /* ZanButton.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ZanButton.m; sourceTree = "<group>"; };
84F30DA21BFC19F200CBAD13 /* RankListModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RankListModel.h; sourceTree = "<group>"; };
84F30DA31BFC19F200CBAD13 /* RankListModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RankListModel.m; sourceTree = "<group>"; };
84F30DA51BFC1A8E00CBAD13 /* RankCommentModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RankCommentModel.h; sourceTree = "<group>"; };
84F30DA61BFC1A8E00CBAD13 /* RankCommentModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RankCommentModel.m; sourceTree = "<group>"; };
84F57C441BEC388A00DDEEB1 /* CommentView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CommentView.h; sourceTree = "<group>"; };
84F57C451BEC388A00DDEEB1 /* CommentView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CommentView.m; sourceTree = "<group>"; };
84F57C4A1BEC785E00DDEEB1 /* AddQuestionViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AddQuestionViewController.h; sourceTree = "<group>"; };
......@@ -691,6 +700,7 @@
848699AD1BDF810900859DFE /* RankingList */ = {
isa = PBXGroup;
children = (
84F30DA11BFC19DF00CBAD13 /* Model */,
848699AE1BDF810900859DFE /* Cell */,
848699AF1BDF810900859DFE /* ViewController */,
);
......@@ -981,6 +991,8 @@
84AD4F251BF4356A00BFB37C /* TaskModel.m */,
84AD4F271BF4360E00BFB37C /* TaskGroup.h */,
84AD4F281BF4360E00BFB37C /* TaskGroup.m */,
84E0ABCB1BFB082E001C8F45 /* TaskDetailModel.h */,
84E0ABCC1BFB082E001C8F45 /* TaskDetailModel.m */,
);
path = Model;
sourceTree = "<group>";
......@@ -1139,6 +1151,17 @@
path = ZanButton;
sourceTree = "<group>";
};
84F30DA11BFC19DF00CBAD13 /* Model */ = {
isa = PBXGroup;
children = (
84F30DA21BFC19F200CBAD13 /* RankListModel.h */,
84F30DA31BFC19F200CBAD13 /* RankListModel.m */,
84F30DA51BFC1A8E00CBAD13 /* RankCommentModel.h */,
84F30DA61BFC1A8E00CBAD13 /* RankCommentModel.m */,
);
path = Model;
sourceTree = "<group>";
};
84F57C421BEC388A00DDEEB1 /* Comment */ = {
isa = PBXGroup;
children = (
......@@ -1457,6 +1480,7 @@
buildActionMask = 2147483647;
files = (
8490C4C61BF9CE85006B6569 /* HomeTitleTableCell.m in Sources */,
84F30DA71BFC1A8E00CBAD13 /* RankCommentModel.m in Sources */,
840ABECC1BE1C29F006E49C5 /* RankDetailViewController.m in Sources */,
84AD4F261BF4356A00BFB37C /* TaskModel.m in Sources */,
841D24FB1BEB75CA0005CC9F /* QuestionDetailFooterView.m in Sources */,
......@@ -1481,6 +1505,7 @@
84D8257F1BDD2F7E00CC61F7 /* MineTableFooterView.m in Sources */,
84F57C501BEC7AA300DDEEB1 /* AddQuestionFooterView.m in Sources */,
84CF0F1E1BE9B40400C855CE /* InspectDetailFooterView.m in Sources */,
84F30DA41BFC19F200CBAD13 /* RankListModel.m in Sources */,
8487D8091BF20FAD00E63E90 /* TaxisView.m in Sources */,
84AD4F361BF45BEB00BFB37C /* InspectSortTableCell.m in Sources */,
84970E281BD8DEFE00C1728A /* AppDelegate.m in Sources */,
......@@ -1507,6 +1532,7 @@
84C9574D1BDB344900083584 /* UIBarButtonItem+Create.m in Sources */,
84AD4F3D1BF4894D00BFB37C /* RankDetailView.m in Sources */,
84AD4F431BF4A66F00BFB37C /* WorkModel.m in Sources */,
84E0ABCD1BFB082E001C8F45 /* TaskDetailModel.m in Sources */,
8490C4D31BF9DEF0006B6569 /* PictureTableCell.m in Sources */,
84970E391BD8E0B300C1728A /* LoginView.m in Sources */,
84DB9BC41BDCD4B600822CC4 /* CustomDropMenuView.m in Sources */,
......
......@@ -45,12 +45,10 @@
self.titleLabel.text = [NSString stringWithFormat:@"%@", taskList.name];
self.startDate.text = [NSString stringWithFormat:@"起始时间:%@", taskList.beginDate];
self.overDate.text = [NSString stringWithFormat:@"截止时间:%@", taskList.endDate];
self.alreadyLabel.text = [NSString stringWithFormat:@"%@", taskList.reportCount];
self.allLabel.text = [NSString stringWithFormat:@"/%@", taskList.questionCount];
self.alreadyLabel.text = [NSString stringWithFormat:@"%d", taskList.reportCount];
self.allLabel.text = [NSString stringWithFormat:@"/%d", taskList.questionCount];
CGFloat already = [taskList.reportCount floatValue];
CGFloat all = [taskList.questionCount floatValue];
self.multiplier = already / all;
self.multiplier = taskList.reportCount / taskList.questionCount;
self.allView.backgroundColor = kProgressViewAllBackColor;
self.alreadyView.backgroundColor = kProgressViewAlreadyBackColor;
......
......@@ -21,10 +21,10 @@
@property (nonatomic, copy) NSString *lastModify_operName;
@property (nonatomic, copy) NSString *lastModify_time;
@property (nonatomic, copy) NSString *name;
@property (nonatomic, copy) NSString *questionCount;
@property (nonatomic, assign) int questionCount;
@property (nonatomic, copy) NSArray *questions;
@property (nonatomic, copy) NSString *ranking;
@property (nonatomic, copy) NSString *reportCount;
@property (nonatomic, assign) int reportCount;
@property (nonatomic, copy) NSString *reportTime;
@property (nonatomic, copy) NSString *reported;
@property (nonatomic, copy) NSString *score;
......
......@@ -316,17 +316,7 @@
InspectTaskViewController *inspectTaskVC = [[InspectTaskViewController alloc] init];
inspectTaskVC.uuid = taskList.uuid;
inspectTaskVC.store_uuid = taskList.store_uuid;
CGFloat already = [taskList.reportCount floatValue];
CGFloat all = [taskList.questionCount floatValue];
inspectTaskVC.multiplier = already / all;
NSLog(@"store_uuid = %@, uuid = %@",inspectTaskVC.store_uuid,inspectTaskVC.uuid);
// InspectListCell *cell = (InspectListCell *)[self tableView:_tableView cellForRowAtIndexPath:indexPath];
//
//
// inspectTaskVC.multiplier = cell.multiplier;
// inspectTaskVC.alreadyNumber = cell.alreadyLabel.text;
// inspectTaskVC.allNumber = cell.allLabel.text;
// inspectTaskVC.progressState = cell.progressState;
inspectTaskVC.multiplier = taskList.reportCount / taskList.questionCount;
[self.navigationController pushViewController:inspectTaskVC animated:YES];
}
......
......@@ -29,12 +29,17 @@
{
_task = task;
if ([task.state isEqualToString:@"已上报"]) {
if (task.state == 0) {
self.stateLabel.textColor = kNavigationBarColor;
self.stateLabel.text = [NSString stringWithFormat:@"未上报"];
} else if (task.state == 1) {
self.stateLabel.textColor = [UIColor orangeColor];
self.stateLabel.text = [NSString stringWithFormat:@"已上报"];
} else {
self.stateLabel.textColor = [UIColor orangeColor];
self.stateLabel.text = [NSString stringWithFormat:@"已评分"];
}
self.stateLabel.text = task.state;
}
#pragma mark - lazy loading
......
//
// TaskDetailModel.h
// redstar
//
// Created by admin on 15/11/17.
// Copyright © 2015年 ZWF. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface TaskDetailModel : NSObject
@property (nonatomic, copy) NSString *beginDate;
@property (nonatomic, strong) NSArray *categories;
@property (nonatomic, copy) NSString *commentId;
@property (nonatomic, copy) NSString *create_id;
@property (nonatomic, copy) NSString *create_operName;
@property (nonatomic, copy) NSString *create_time;
@property (nonatomic, copy) NSString *endDate;
@property (nonatomic, copy) NSString *enterprise;
@property (nonatomic, copy) NSString *lastModify_id;
@property (nonatomic, copy) NSString *lastModify_operName;
@property (nonatomic, copy) NSString *lastModify_time;
@property (nonatomic, copy) NSString *name;
@property (nonatomic, assign) int questionCount;
@property (nonatomic, strong) NSArray *questions;
@property (nonatomic, copy) NSString *ranking;
@property (nonatomic, assign) int reportCount;
@property (nonatomic, copy) NSString *reportTime;
@property (nonatomic, copy) NSString *reported;
@property (nonatomic, copy) NSString *score;
@property (nonatomic, copy) NSString *state;
@property (nonatomic, copy) NSString *store_code;
@property (nonatomic, copy) NSString *store_name;
@property (nonatomic, copy) NSString *store_uuid;
@property (nonatomic, strong) NSArray *stores;
@property (nonatomic, copy) NSString *uuid;
@property (nonatomic, copy) NSString *version;
+ (instancetype)taskDetailModelWithDict:(NSDictionary *)dict;
- (instancetype)initWithDict:(NSDictionary *)dict;
@end
//
// TaskDetailModel.m
// redstar
//
// Created by admin on 15/11/17.
// Copyright © 2015年 ZWF. All rights reserved.
//
#import "TaskDetailModel.h"
@implementation TaskDetailModel
+ (instancetype)taskDetailModelWithDict:(NSDictionary *)dict
{
return [[self alloc] initWithDict:dict];
}
- (instancetype)initWithDict:(NSDictionary *)dict
{
if (self = [super init]) {
[self setValuesForKeysWithDictionary:dict];
}
return self;
}
@end
......@@ -9,8 +9,15 @@
#import <Foundation/Foundation.h>
@interface TaskGroup : NSObject
@property (nonatomic, strong) NSArray *classfiy;
@property (nonatomic, copy) NSString *name;
@property (nonatomic, strong) NSArray *answers;
@property (nonatomic, copy) NSString *category;
@property (nonatomic, assign) int questionCount;
@property (nonatomic, copy) NSString *ranking;
@property (nonatomic, assign) int reportCount;
@property (nonatomic, copy) NSString *reportTime;
@property (nonatomic, copy) NSString *score;
@property (nonatomic, copy) NSString *uuid;
@property (nonatomic, copy) NSString *weight;
@property (nonatomic, assign, getter = isOpened) BOOL opened;
......
......@@ -22,11 +22,11 @@
[self setValuesForKeysWithDictionary:dict];
NSMutableArray *tempArray = [NSMutableArray array];
for (NSDictionary *dict in _classfiy) {
for (NSDictionary *dict in _answers) {
TaskModel *friend = [TaskModel taskModelWithDict:dict];
[tempArray addObject:friend];
}
_classfiy = tempArray;
_answers = tempArray;
}
return self;
}
......
......@@ -9,8 +9,23 @@
#import <Foundation/Foundation.h>
@interface TaskModel : NSObject
@property (nonatomic, copy) NSString *intro;
@property (nonatomic, copy) NSString *state;
@property (nonatomic, copy) NSString *answerAttachmentId;
@property (nonatomic, strong) NSArray *answerAttachments;
@property (nonatomic, copy) NSString *attachmentId;
@property (nonatomic, copy) NSString *attachmentNumber;
@property (nonatomic, copy) NSString *category;
@property (nonatomic, copy) NSString *lineNo;
@property (nonatomic, copy) NSString *readonly;
@property (nonatomic, copy) NSString *reference;
@property (nonatomic, strong) NSArray *referenceAttachments;
@property (nonatomic, copy) NSString *remark;
@property (nonatomic, copy) NSString *reportTime;
@property (nonatomic, strong) NSDictionary *reportor;
@property (nonatomic, assign) int state;
@property (nonatomic, copy) NSString *title;
@property (nonatomic, copy) NSString *uuid;
@property (nonatomic, copy) NSString *weight;
+ (instancetype)taskModelWithDict:(NSDictionary *)dict;
- (instancetype)initWithDict:(NSDictionary *)dict;
......
......@@ -8,7 +8,11 @@
#import <UIKit/UIKit.h>
#import "InspectDetailView.h"
#import "TaskDetailModel.h"
@interface InspectDetailHeaderView : UIView
@property (nonatomic, strong) UILabel *titleLabel;
@property (nonatomic,strong) InspectDetailView *detailView;
@property (nonatomic, strong) TaskDetailModel *taskDetail;
@end
......@@ -37,7 +37,6 @@
titleLabel.textColor = kAnnounceTextColor;
titleLabel.backgroundColor = kSectionBackGroundColor;
titleLabel.font = [UIFont systemFontOfSize:17.0];
titleLabel.text = @"2015年10月口碑巡检";
[self addSubview:titleLabel];
NSLayoutConstraint *titleLabelTop = [NSLayoutConstraint constraintWithItem:titleLabel attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeTop multiplier:1.0 constant:0];
......@@ -52,14 +51,10 @@
NSLayoutConstraint *titleLabelHeight = [NSLayoutConstraint constraintWithItem:titleLabel attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:45];
[self addConstraint:titleLabelHeight];
self.detailView.backgroundColor = [UIColor whiteColor];
_titleLabel = titleLabel;
self.detailView.backgroundColor = [UIColor whiteColor];
UIView *lineView = [[UIView alloc] init];
lineView.translatesAutoresizingMaskIntoConstraints = NO;
......@@ -99,6 +94,55 @@
[self addConstraint:classifyHeight];
}
- (void)setTaskDetail:(TaskDetailModel *)taskDetail
{
_taskDetail = taskDetail;
self.titleLabel.text = [NSString stringWithFormat:@"%@", taskDetail.name];
self.detailView.shopnameLabel.text = [NSString stringWithFormat:@"%@", taskDetail.store_name];
self.detailView.startDateLabel.text = [NSString stringWithFormat:@"%@", taskDetail.beginDate];
self.detailView.overDateLabel.text = [NSString stringWithFormat:@"%@", taskDetail.endDate];
self.detailView.multiplier = taskDetail.reportCount / taskDetail.questionCount;
if ([taskDetail.state isEqualToString:@"initial"]) {
self.detailView.progressLabel.text = [NSString stringWithFormat:@"未处理 %.0f%%", (CGFloat)taskDetail.reportCount / taskDetail.questionCount * 100];
self.detailView.progressLabel.textColor = kProgressUnSettledColor;
self.detailView.alreadyLabel.textColor = kProgressUnSettledColor;
self.detailView.allLabel.textColor = kProgressUnSettledColor;
} else if ([taskDetail.state isEqualToString:@"processing"]) {
self.detailView.progressLabel.text = [NSString stringWithFormat:@"进行中 %.0f%%", (CGFloat)taskDetail.reportCount / taskDetail.questionCount * 100];
self.detailView.progressLabel.textColor = kProgressDealWithColor;
self.detailView.alreadyLabel.textColor = kProgressDealWithColor;
self.detailView.allLabel.textColor = kProgressDealWithColor;
} else if ([taskDetail.state isEqualToString:@"reported"]) {
self.detailView.progressLabel.text = [NSString stringWithFormat:@"已上报 %.0f%%", (CGFloat)taskDetail.reportCount / taskDetail.questionCount * 100];
self.detailView.progressLabel.textColor = kProgressDealWithColor;
self.detailView.alreadyLabel.textColor = kProgressDealWithColor;
self.detailView.allLabel.textColor = kProgressDealWithColor;
} else if ([taskDetail.state isEqualToString:@"finished"]) {
self.detailView.progressLabel.text = [NSString stringWithFormat:@"已评分 %.0f%%", (CGFloat)taskDetail.reportCount / taskDetail.questionCount * 100];
self.detailView.progressLabel.textColor = kProgressDealWithColor;
self.detailView.alreadyLabel.textColor = kProgressDealWithColor;
self.detailView.allLabel.textColor = kProgressDealWithColor;
} else if ([taskDetail.state isEqualToString:@"published"]) {
self.detailView.progressLabel.text = [NSString stringWithFormat:@"已发布 %.0f%%", (CGFloat)taskDetail.reportCount / taskDetail.questionCount * 100];
self.detailView.progressLabel.textColor = kProgressDealWithColor;
self.detailView.alreadyLabel.textColor = kProgressDealWithColor;
self.detailView.allLabel.textColor = kProgressDealWithColor;
} else {
self.detailView.progressLabel.text = [NSString stringWithFormat:@"已过期 %.0f%%", (CGFloat)taskDetail.reportCount / taskDetail.questionCount * 100];
self.detailView.progressLabel.textColor = kProgressOverDueColor;
self.detailView.alreadyLabel.textColor = kProgressOverDueColor;
self.detailView.allLabel.textColor = kProgressOverDueColor;
}
self.detailView.allView.backgroundColor = kProgressViewAllBackColor;
self.detailView.alreadyView.backgroundColor = kProgressViewAlreadyBackColor;
self.detailView.alreadyLabel.text = [NSString stringWithFormat:@"%d", taskDetail.reportCount];
self.detailView.allLabel.text = [NSString stringWithFormat:@"/%d", taskDetail.questionCount];
}
- (InspectDetailView *)detailView
{
if (!_detailView) {
......
......@@ -27,4 +27,7 @@
@property (nonatomic, strong) UIImageView *arrowImageView;
@property (nonatomic, strong) UILabel *dayLabel; // 剩余天数
@property (nonatomic, strong) UIView *alreadyView;
@property (nonatomic, strong) UIView *allView;
@end
......@@ -13,8 +13,7 @@
@property (nonatomic, strong) UILabel *startDate; // 起始时间
@property (nonatomic, strong) UILabel *overDate; // 截止时间
@property (nonatomic, strong) UILabel *progress; // 完成进度
@property (nonatomic, strong) UIView *alreadyView;
@property (nonatomic, strong) UIView *allView;
@property (nonatomic, strong) UILabel *introLabel;
@property (nonatomic, strong) UILabel *surplus; // 剩余
......
......@@ -66,7 +66,7 @@
- (void)setTaskGroup:(TaskGroup *)taskGroup
{
_taskGroup = taskGroup;
NSString *nameStr = [NSString stringWithFormat:@"模块 -- %@(10/%lu)", taskGroup.name, (unsigned long)taskGroup.classfiy.count];
NSString *nameStr = [NSString stringWithFormat:@"模块 -- %@(10/%lu)", taskGroup.category, (unsigned long)taskGroup.answers.count];
NSMutableAttributedString *nameAttr = [[NSMutableAttributedString alloc] initWithString:nameStr];
[nameAttr addAttributes:@{NSForegroundColorAttributeName:kLightBlack,NSFontAttributeName:[UIFont systemFontOfSize:17.0f]} range:NSMakeRange(0,nameStr.length)];
[_bgButton setAttributedTitle:nameAttr forState:UIControlStateNormal];
......
......@@ -18,6 +18,8 @@
#import "InspectHeaderView.h"
#import "HttpClient.h"
#import "TaskDetailModel.h"
#define kTaskSortCell @"InspectTaskSortCell"
......@@ -56,7 +58,6 @@
customLab.font = [UIFont boldSystemFontOfSize:19];
self.navigationItem.titleView = customLab;
[self setupTableView];
// 口碑巡检明细
[self requestRankingDetail];
......@@ -74,27 +75,29 @@
NSString *url = [NSString stringWithFormat:@"%@%@%@/%@",kRedStarURL, kInspectDetailURL, self.uuid, self.store_uuid];
HttpClient *httpClient = [[HttpClient alloc] initWithUrl:url];
__block InspectTaskViewController *weakSelf = self;
[httpClient getPraiseDetailWithParameters:nil completion:^(id response, NSError *error) {
NSLog(@"口碑巡检明细PraiseDetail = %@", response);
NSDictionary *dataDict = response[@"data"];
TaskDetailModel *taskDetail = [TaskDetailModel taskDetailModelWithDict:dataDict];
weakSelf.detailHeaderView.taskDetail = taskDetail;
self.tableView.delegate = self;
self.tableView.dataSource = self;
}];
}
- (void)setupTableView
{
NSURL *url = [[NSBundle mainBundle] URLForResource:@"classfiy.plist" withExtension:nil];
NSArray *tempArray = [NSArray arrayWithContentsOfURL:url];
NSArray *dataArray = dataDict[@"categories"];
NSMutableArray *tgArray = [NSMutableArray array];
for (NSDictionary *dict in tempArray) {
for (NSDictionary *dict in dataArray) {
TaskGroup *taskGroup = [TaskGroup taskGroupWithDict:dict];
[tgArray addObject:taskGroup];
}
_taskData = tgArray;
self.tableView.delegate = self;
self.tableView.dataSource = self;
}];
}
#pragma mark - TableView Delegate/DataSource
......@@ -108,7 +111,7 @@
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
TaskGroup *taskGroup = _taskData[section];
NSInteger count = taskGroup.isOpened ? taskGroup.classfiy.count : 0;
NSInteger count = taskGroup.isOpened ? taskGroup.answers.count : 0;
return count;
}
......@@ -121,10 +124,10 @@
}
TaskGroup *taskGroup = _taskData[indexPath.section];
TaskModel *task = taskGroup.classfiy[indexPath.row];
TaskModel *task = taskGroup.answers[indexPath.row];
cell.task = task;
cell.titleLabel.text = [NSString stringWithFormat:@"%d、%@", (int)(indexPath.row + 1) ,task.intro];
cell.titleLabel.text = [NSString stringWithFormat:@"%d、%@", (int)(indexPath.row + 1) ,task.title];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
......@@ -198,13 +201,7 @@
if (!_detailHeaderView) {
_detailHeaderView = [[InspectDetailHeaderView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, 285)];
_detailHeaderView.detailView.multiplier = self.multiplier;
_detailHeaderView.detailView.progressState = self.progressState;
_detailHeaderView.detailView.alreadyLabel.text = self.alreadyNumber;
_detailHeaderView.detailView.allLabel.text = self.allNumber;
_detailHeaderView.detailView.shopnameLabel.text = @"上海真北店";
_detailHeaderView.detailView.startDateLabel.text = @"2015-09-30";
_detailHeaderView.detailView.overDateLabel.text = @"2015-09-30";
_detailHeaderView.detailView.dayLabel.text = @"3";
}
return _detailHeaderView;
......
......@@ -7,6 +7,10 @@
//
#import <UIKit/UIKit.h>
@class RankListModel;
@class RankCommentModel;
typedef enum ScoreState : NSUInteger {
ScoreStateHigh = 0,// 总分低
ScoreStateLow // 总数高
......@@ -26,4 +30,6 @@ typedef enum ScoreState : NSUInteger {
@property (nonatomic, strong) UILabel *dateLabel; // 发表时间
@property (nonatomic, strong) UILabel *remarkLabel; // 评语
@property (nonatomic, strong) UIImageView *arrowImageView;
@property (nonatomic, strong) RankListModel *rankList;
@end
......@@ -30,6 +30,11 @@
self.gradeView.backgroundColor = [UIColor clearColor];
}
- (void)setRankList:(RankListModel *)rankList
{
_rankList = rankList;
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
......
//
// RankCommentModel.h
// redstar
//
// Created by admin on 15/11/18.
// Copyright © 2015年 ZWF. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface RankCommentModel : NSObject
@property (nonatomic,copy) NSString *uuid;
@property (nonatomic,copy) NSString *user_uuid;
@property (nonatomic,copy) NSString *user_code;
@property (nonatomic,copy) NSString *user_name;
@property (nonatomic,copy) NSString *comment;
@property (nonatomic,copy) NSString *commentTime;
+ (instancetype)rankCommentModelWithDict:(NSDictionary *)dict;
- (instancetype)initWithDict:(NSDictionary *)dict;
@end
//
// RankCommentModel.m
// redstar
//
// Created by admin on 15/11/18.
// Copyright © 2015年 ZWF. All rights reserved.
//
#import "RankCommentModel.h"
@implementation RankCommentModel
+ (instancetype)rankCommentModelWithDict:(NSDictionary *)dict
{
return [[self alloc] initWithDict:dict];
}
- (instancetype)initWithDict:(NSDictionary *)dict
{
if (self = [super init]) {
[self setValuesForKeysWithDictionary:dict];
}
return self;
}
@end
//
// RankListModel.h
// redstar
//
// Created by admin on 15/11/18.
// Copyright © 2015年 ZWF. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface RankListModel : NSObject
@property (nonatomic,copy) NSString *uuid;
@property (nonatomic,copy) NSString *store_uuid;
@property (nonatomic,copy) NSString *store_code;
@property (nonatomic,copy) NSString *store_name;
@property (nonatomic,copy) NSString *score;
@property (nonatomic,copy) NSString *reported;
@property (nonatomic,strong) NSDictionary *comments;
+ (instancetype)rankListModelWithDict:(NSDictionary *)dict;
- (instancetype)initWithDict:(NSDictionary *)dict;
@end
//
// RankListModel.m
// redstar
//
// Created by admin on 15/11/18.
// Copyright © 2015年 ZWF. All rights reserved.
//
#import "RankListModel.h"
#import "RankCommentModel.h"
@implementation RankListModel
+ (instancetype)rankListModelWithDict:(NSDictionary *)dict
{
return [[self alloc] initWithDict:dict];
}
- (instancetype)initWithDict:(NSDictionary *)dict
{
if (self = [super init]) {
[self setValuesForKeysWithDictionary:dict];
}
return self;
}
@end
......@@ -11,6 +11,8 @@
#import "RankDetailViewController.h"
#import "HttpClient.h"
#import "RankListModel.h"
#import "RankCommentModel.h"
#define kRankingCell @"RankingTableViewCell"
......@@ -20,6 +22,9 @@
@property (nonatomic, strong) UIView *lineView1;
@property (nonatomic, strong) NSMutableDictionary *selectedIndexes;
@property (nonatomic, strong) NSMutableArray *allRankListArray;
@property (nonatomic, strong) NSMutableArray *allRankCommentArray;
@end
@implementation RankingListViewController
......@@ -43,6 +48,8 @@
UIBarButtonItem *backItem = [[UIBarButtonItem alloc] initWithCustomView:backBtn];
self.navigationItem.leftBarButtonItem = backItem;
self.allRankListArray = [NSMutableArray array];
self.allRankCommentArray = [NSMutableArray array];
if([[[UIDevice currentDevice]systemVersion]floatValue] >= 7.0) {
self.edgesForExtendedLayout = UIRectEdgeNone;
......@@ -83,9 +90,21 @@
};
[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];
NSDictionary *commentDict = rankList.comments;
RankCommentModel *rankComment = [RankCommentModel rankCommentModelWithDict:commentDict];
[self.allRankListArray addObject:rankList];
[self.allRankCommentArray addObject:rankComment];
self.tableView.delegate = self;
self.tableView.dataSource = self;
}
}];
}
......@@ -96,9 +115,6 @@
- (void)addTableViews
{
[self.tableView registerClass:[RankingListCell class] forCellReuseIdentifier:kRankingCell];
self.tableView.tableHeaderView = self.headView;
self.pointLabel1.text = @"月度排名";
self.lineView.backgroundColor = kSeparateLineColor;
self.pointLabel2.text = @"参与商家数量";
......@@ -508,10 +524,10 @@
if (!_tableView) {
_tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStyleGrouped];
_tableView.translatesAutoresizingMaskIntoConstraints = NO;
_tableView.delegate = self;
_tableView.dataSource = self;
_tableView.showsVerticalScrollIndicator = NO;
_tableView.showsHorizontalScrollIndicator = NO;
[_tableView registerClass:[RankingListCell class] forCellReuseIdentifier:kRankingCell];
_tableView.tableHeaderView = self.headView;
[self.view addSubview:_tableView];
NSLayoutConstraint *tableTop = [NSLayoutConstraint constraintWithItem:_tableView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeTop multiplier:1.0 constant:0];
......
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