Commit b3e1d946 authored by admin's avatar admin

修复首页显示

parent db5156eb
......@@ -95,6 +95,7 @@
84AD4F3D1BF4894D00BFB37C /* RankDetailView.m in Sources */ = {isa = PBXBuildFile; fileRef = 84AD4F3C1BF4894D00BFB37C /* RankDetailView.m */; };
84AD4F3F1BF498A900BFB37C /* ranking.plist in Resources */ = {isa = PBXBuildFile; fileRef = 84AD4F3E1BF498A900BFB37C /* ranking.plist */; };
84AD4F461BF4A9E800BFB37C /* RankHeadView.m in Sources */ = {isa = PBXBuildFile; fileRef = 84AD4F451BF4A9E800BFB37C /* RankHeadView.m */; };
84B4765A1C2E4B37006C6488 /* PicCategoryViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 84B476591C2E4B37006C6488 /* PicCategoryViewController.m */; };
84BB16A21C191A7F00383A64 /* OnLineResultFootView.m in Sources */ = {isa = PBXBuildFile; fileRef = 84BB16A11C191A7F00383A64 /* OnLineResultFootView.m */; };
84C9574D1BDB344900083584 /* UIBarButtonItem+Create.m in Sources */ = {isa = PBXBuildFile; fileRef = 84C9574A1BDB344900083584 /* UIBarButtonItem+Create.m */; };
84C9574E1BDB344900083584 /* UIView+Frame.m in Sources */ = {isa = PBXBuildFile; fileRef = 84C9574C1BDB344900083584 /* UIView+Frame.m */; };
......@@ -359,6 +360,8 @@
84AD4F3E1BF498A900BFB37C /* ranking.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = ranking.plist; 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>"; };
84B476581C2E4B37006C6488 /* PicCategoryViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PicCategoryViewController.h; sourceTree = "<group>"; };
84B476591C2E4B37006C6488 /* PicCategoryViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PicCategoryViewController.m; sourceTree = "<group>"; };
84BB16A01C191A7F00383A64 /* OnLineResultFootView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OnLineResultFootView.h; sourceTree = "<group>"; };
84BB16A11C191A7F00383A64 /* OnLineResultFootView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OnLineResultFootView.m; sourceTree = "<group>"; };
84C957491BDB344900083584 /* UIBarButtonItem+Create.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIBarButtonItem+Create.h"; sourceTree = "<group>"; };
......@@ -716,6 +719,7 @@
8426A4A71BDF0CD600E5FDF5 /* Picture */ = {
isa = PBXGroup;
children = (
84B476531C2E4B1C006C6488 /* PictureCategory */,
849A183D1C152CD400071600 /* AddPicture */,
8490C4C71BF9DEF0006B6569 /* PictureDetail */,
8490C4CB1BF9DEF0006B6569 /* PictureList */,
......@@ -1599,6 +1603,47 @@
path = Model;
sourceTree = "<group>";
};
84B476531C2E4B1C006C6488 /* PictureCategory */ = {
isa = PBXGroup;
children = (
84B476541C2E4B1C006C6488 /* Cell */,
84B476551C2E4B1C006C6488 /* Model */,
84B476561C2E4B1C006C6488 /* View */,
84B476571C2E4B1C006C6488 /* ViewController */,
);
path = PictureCategory;
sourceTree = "<group>";
};
84B476541C2E4B1C006C6488 /* Cell */ = {
isa = PBXGroup;
children = (
);
path = Cell;
sourceTree = "<group>";
};
84B476551C2E4B1C006C6488 /* Model */ = {
isa = PBXGroup;
children = (
);
path = Model;
sourceTree = "<group>";
};
84B476561C2E4B1C006C6488 /* View */ = {
isa = PBXGroup;
children = (
);
path = View;
sourceTree = "<group>";
};
84B476571C2E4B1C006C6488 /* ViewController */ = {
isa = PBXGroup;
children = (
84B476581C2E4B37006C6488 /* PicCategoryViewController.h */,
84B476591C2E4B37006C6488 /* PicCategoryViewController.m */,
);
path = ViewController;
sourceTree = "<group>";
};
84C582E91BDDFACD00AF838D /* Cell */ = {
isa = PBXGroup;
children = (
......@@ -2416,6 +2461,7 @@
8480BEB21C143A4100E2F18F /* StateTableView.m in Sources */,
849B2F711C0CA22F005D809F /* AnnoContentTableViewCell.m in Sources */,
84A2270E1C229409002766DC /* RankPickView.m in Sources */,
84B4765A1C2E4B37006C6488 /* PicCategoryViewController.m in Sources */,
84D3E6021C04DA85001FF1DD /* InspectUpLoadFootView.m in Sources */,
84A673881C0B50B4000F828E /* OnLineCompleteViewController.m in Sources */,
8474C5991BE78BBC007DCF19 /* QuestionDetailCell.m in Sources */,
......
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "store_show@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "store_show@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "case_show@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "case_show@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "report_show@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "report_show@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
......@@ -6,12 +6,12 @@
},
{
"idiom" : "universal",
"filename" : "task_online@2x.png",
"filename" : "口碑巡检_功能一览@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "task_online@3x.png",
"filename" : "口碑巡检_功能一览@3x.png",
"scale" : "3x"
}
],
......
......@@ -6,12 +6,12 @@
},
{
"idiom" : "universal",
"filename" : "口碑巡检_功能一览@2x.png",
"filename" : "praise_report@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "口碑巡检_功能一览@3x.png",
"filename" : "praise_report@3x.png",
"scale" : "3x"
}
],
......
......@@ -6,12 +6,12 @@
},
{
"idiom" : "universal",
"filename" : "praise_standard@2x.png",
"filename" : "question_problem@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "praise_standard@3x.png",
"filename" : "question_problem@3x.png",
"scale" : "3x"
}
],
......
......@@ -6,12 +6,12 @@
},
{
"idiom" : "universal",
"filename" : "praise_image@2x.png",
"filename" : "praise_standard@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "praise_image@3x.png",
"filename" : "praise_standard@3x.png",
"scale" : "3x"
}
],
......
......@@ -6,12 +6,12 @@
},
{
"idiom" : "universal",
"filename" : "question_problem@2x.png",
"filename" : "praise_image@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "question_problem@3x.png",
"filename" : "praise_image@3x.png",
"scale" : "3x"
}
],
......
......@@ -6,12 +6,12 @@
},
{
"idiom" : "universal",
"filename" : "praise_report@2x.png",
"filename" : "stor_icon_big@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "praise_report@3x.png",
"filename" : "stor_icon_big@3x.png",
"scale" : "3x"
}
],
......
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "task_online@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "task_online@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "store_icon@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "store_icon@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
......@@ -11,6 +11,7 @@
#import "RankingListViewController.h"
#import "PictureViewController.h"
#import "QuestionViewController.h"
#import "PicCategoryViewController.h"
@interface FunctionViewController ()
@property (nonatomic, strong) UIView *lineView;
......@@ -50,12 +51,12 @@
#pragma mark - Private Methods
- (void)setup
{
[self.onLineSamplingBtn setTitle:@"口碑巡检" forState:UIControlStateNormal];
[self.wordOfMouthBtn setTitle:@"口碑排名" forState:UIControlStateNormal];
[self.standardBtn setTitle:@"问题与知识" forState:UIControlStateNormal];
[self.pictureBtn setTitle:@"图说口碑" forState:UIControlStateNormal];
[self.questionBtn setTitle:@"口碑标准" forState:UIControlStateNormal];
[self.rankBtn setTitle:@"在线抽查" forState:UIControlStateNormal];
[self.onLineSamplingBtn setTitle:@"口碑报告" forState:UIControlStateNormal];
[self.wordOfMouthBtn setTitle:@"商场风采" forState:UIControlStateNormal];
[self.standardBtn setTitle:@"图说口碑" forState:UIControlStateNormal];
[self.pictureBtn setTitle:@"口碑标准" forState:UIControlStateNormal];
[self.questionBtn setTitle:@"问题知识" forState:UIControlStateNormal];
[self.rankBtn setTitle:@"口碑巡检" forState:UIControlStateNormal];
//self.lineView.backgroundColor = kSeparateLineViewColor;
......@@ -80,9 +81,12 @@
} else if ([item.titleLabel.text isEqualToString:@"问题与知识"]) {
QuestionViewController *questionVC = [[QuestionViewController alloc] init];
nav = [[UINavigationController alloc] initWithRootViewController:questionVC];
} else if ([item.titleLabel.text isEqualToString:@"口碑排名"]) {
} else if ([item.titleLabel.text isEqualToString:@"口碑报告"]) {
RankingListViewController *rankingListVC = [[RankingListViewController alloc] init];
nav = [[UINavigationController alloc] initWithRootViewController:rankingListVC];
} else if ([item.titleLabel.text isEqualToString:@"商场风采"]) {
InspectListViewController *inspectListVC = [[InspectListViewController alloc] init];
nav = [[UINavigationController alloc] initWithRootViewController:inspectListVC];
} else {
return;
}
......
......@@ -10,6 +10,7 @@
#import "AddPictureTableCell.h"
#import "AddButtonTableViewCell.h"
#import "AddPicTextTableViewCell.h"
#import "CheckPicViewController.h"
#import "HttpClient.h"
......@@ -81,7 +82,10 @@
- (void)doBack:(id)sender
{
[self.navigationController popViewControllerAnimated:YES];
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"提示" message:@"您确定要放弃编辑当前图说口碑吗?" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"确定", nil];
alert.tag = 9211232;
[alert show];
}
- (void)createImagePicker:(UIButton *)sender
......@@ -122,7 +126,8 @@
HttpClient *http1 = [[HttpClient alloc] initWithUrl:url];
NSDictionary *parameters = @{
@"title":cell.contentTextView.text,
@"content":cell.titleTextView.text
@"content":cell.titleTextView.text,
@"type":@"store"
};
[http1 savePicturePraiseWithParameters:parameters completion:^(id response, NSError *error) {
NSLog(@"6.1保存图说口碑 resp = %@, error = %@", response, error);
......@@ -143,7 +148,6 @@
UIImage *image = [UIImage imageWithContentsOfFile:fullPath];
NSData *imageData = UIImageJPEGRepresentation(image, 0.5);
NSString *imageBase64 = [imageData base64EncodedStringWithOptions:0];
NSDictionary *parameters = @{
@"description":cell.titleTextView.text,
@"fileName":imageName,
......@@ -170,6 +174,13 @@
[imageData writeToFile:fullPath atomically:NO];
}
- (void)showBigPic:(UIButton *)sender
{
CheckPicViewController *checkVC = [[CheckPicViewController alloc] init];
checkVC.checkImage = sender.imageView.image;
[self.navigationController pushViewController:checkVC animated:YES];
}
#pragma mark - UItextView
- (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text
{
......@@ -270,6 +281,29 @@
NSString *operId = [[NSUserDefaults standardUserDefaults] objectForKey:@"user_code"];
NSString *operName = [[NSUserDefaults standardUserDefaults] objectForKey:@"user_name"];
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:(_rowNumber - 2) inSection:0];
AddPicTextTableViewCell *cell = [_tableView cellForRowAtIndexPath:indexPath]; if (_imageNameArray.count == _rowNumber - 2 || cell.titleTextView.text.length != 0) {
NSString *urlStr = [NSString stringWithFormat:@"%@%@%@/submit_attachment?time=%@&operId=%@&operName=%@", kRedStarURL, kUpLoadPictureURL, _praiseUuid ,dateString, operId, operName];
urlStr = [urlStr stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding];
HttpClient *httpClinet = [[HttpClient alloc] initWithUrl:urlStr];
NSString *imageName = _imageNameArray[_rowNumber - 3];
NSString *fullPath = [[NSHomeDirectory() stringByAppendingPathComponent:@"Documents"] stringByAppendingPathComponent:imageName];
UIImage *image = [UIImage imageWithContentsOfFile:fullPath];
NSData *imageData = UIImageJPEGRepresentation(image, 0.5);
NSString *imageBase64 = [imageData base64EncodedStringWithOptions:0];
NSDictionary *parameters = @{
@"description":cell.titleTextView.text,
@"fileName":imageName,
@"fileContent":imageBase64
};
[httpClinet upLoadPraisePictureWithParameters:parameters completion:^(id response, NSError *error) {
NSLog(@"6.2上传口碑图片 resp = %@, error = %@", response, error);
NSString *url = [NSString stringWithFormat:@"%@%@%@/submit?time=%@&operId=%@&operName=%@", kRedStarURL, kSubmitPicturePraiseURL,_praiseUuid, dateString, operId, operName];
url = [url stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding];
HttpClient *http1 = [[HttpClient alloc] initWithUrl:url];
......@@ -279,6 +313,14 @@
[self.navigationController popViewControllerAnimated:YES];
}
}];
}];
}
}
}
if (alertView.tag == 9211232) {
if (buttonIndex == 1) {
[self.navigationController popViewControllerAnimated:YES];
}
}
}
......@@ -322,19 +364,29 @@
UIImage *image = [UIImage imageWithContentsOfFile:fullPath];
UIImage *image00 = [self cutImage:image];
[cell.photoButton setImage:image00 forState:UIControlStateNormal];
[cell.photoButton removeTarget:self action:@selector(createImagePicker:) forControlEvents:UIControlEventTouchUpInside];
[cell.photoButton addTarget:self action:@selector(showBigPic:) forControlEvents:UIControlEventTouchUpInside];
} else {
if (indexPath.row == _rowNumber - 2) {
[cell.photoButton setImage:[UIImage imageNamed:@"add-photo_icon"] forState:UIControlStateNormal];
[cell.photoButton removeTarget:self action:@selector(showBigPic:) forControlEvents:UIControlEventTouchUpInside];
[cell.photoButton addTarget:self action:@selector(createImagePicker:) forControlEvents:UIControlEventTouchUpInside];
} else {
NSString *imageName = _imageNameArray[indexPath.row - 1];
NSString *fullPath = [[NSHomeDirectory() stringByAppendingPathComponent:@"Documents"] stringByAppendingPathComponent:imageName];
UIImage *image = [UIImage imageWithContentsOfFile:fullPath];
UIImage *image00 = [self cutImage:image];
[cell.photoButton setImage:image00 forState:UIControlStateNormal];
[cell.photoButton removeTarget:self action:@selector(createImagePicker:) forControlEvents:UIControlEventTouchUpInside];
[cell.photoButton addTarget:self action:@selector(showBigPic:) forControlEvents:UIControlEventTouchUpInside];
cell.titleTextView.userInteractionEnabled = NO;
}
}
cell.titleTextView.delegate = self;
[cell.photoButton addTarget:self action:@selector(createImagePicker:) forControlEvents:UIControlEventTouchUpInside];
return cell;
}
}
......
//
// PicCategoryViewController.h
// redstar
//
// Created by admin on 15/12/26.
// Copyright © 2015年 ZWF. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface PicCategoryViewController : UIViewController
@end
//
// PicCategoryViewController.m
// redstar
//
// Created by admin on 15/12/26.
// Copyright © 2015年 ZWF. All rights reserved.
//
#import "PicCategoryViewController.h"
#import "StandardTableViewCell.h"
#import "PictureViewController.h"
#define kPicCategoryTableViewCell @"picCategoryViewCell"
@interface PicCategoryViewController ()<UITableViewDelegate, UITableViewDataSource>
@property (nonatomic, strong) UITableView *tableView;
@property (nonatomic, strong) NSArray *titleArray;
@property (nonatomic, strong) NSArray *detailTitleArray;
@end
@implementation PicCategoryViewController
- (void)viewDidLoad {
[super viewDidLoad];
if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0) {
self.edgesForExtendedLayout = UIRectEdgeNone;
self.extendedLayoutIncludesOpaqueBars = NO;
self.modalPresentationCapturesStatusBarAppearance = NO;
self.navigationController.navigationBar.translucent = NO;
}
[self setupNav];
self.titleArray = [NSArray arrayWithObjects:@"商场风采",@"优秀案例",@"巡店报告", nil];
self.detailTitleArray = [NSArray arrayWithObjects:@"SOP:标准作业程序",@"内部精品培训课程讲义资料...",@"专家讲师精品课程视频分享...", nil];
self.tableView.delegate = self;
self.tableView.dataSource = self;
}
- (void)setupNav
{
UILabel *customLab = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 40, 30)];
[customLab setTextColor:[UIColor whiteColor]];
[customLab setText:@"口碑标准"];
customLab.font = [UIFont boldSystemFontOfSize:19];
self.navigationItem.titleView = customLab;
UIButton *backBtn = [UIButton buttonWithType:UIButtonTypeCustom];
backBtn.frame = CGRectMake(0, 0, 30, 44);
[backBtn setImage:[UIImage imageNamed:@"back_btn"] forState:UIControlStateNormal];
[backBtn addTarget:self action:@selector(doBack:) forControlEvents:UIControlEventTouchUpInside];
UIBarButtonItem *backItem = [[UIBarButtonItem alloc] initWithCustomView:backBtn];
self.navigationItem.leftBarButtonItem = backItem;
}
-(void)doBack:(id)sender
{
[self.navigationController dismissViewControllerAnimated:YES completion:nil];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
#pragma mark - UItableView Delegate/DataSource
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return _titleArray.count;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return 1;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
StandardTableViewCell *cell=[tableView dequeueReusableCellWithIdentifier:kPicCategoryTableViewCell];
if (!cell) {
cell = [[StandardTableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:kPicCategoryTableViewCell];
}
cell.iconImageView.image = [UIImage imageNamed:[NSString stringWithFormat:@"pic_0%ld",(long)indexPath.section]];
cell.titleLabel.text = [NSString stringWithFormat:@"%@", _titleArray[indexPath.section]];
cell.detailTitleLabel.text = [NSString stringWithFormat:@"%@", _detailTitleArray[indexPath.section]];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
return cell;
}
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
return 10;
}
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
{
return CGFLOAT_MIN;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
PictureViewController *sopVC = [[PictureViewController alloc] init];
sopVC.come = @"图说";
if (indexPath.section == 0) {
sopVC.category = @"store";
[self.navigationController pushViewController:sopVC animated:YES];
} else if (indexPath.section == 1) {
sopVC.category = @"casus";
[self.navigationController pushViewController:sopVC animated:YES];
} else {
sopVC.category = @"report";
[self.navigationController pushViewController:sopVC animated:YES];
}
}
#pragma mark - lazy laoding
- (UITableView *)tableView
{
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.tableFooterView = [[UIView alloc] init];
_tableView.rowHeight = UITableViewAutomaticDimension;
_tableView.estimatedRowHeight = 300.0;
[self.view addSubview:_tableView];
[self.view insertSubview:_tableView atIndex:0];
NSLayoutConstraint *tableTop = [NSLayoutConstraint constraintWithItem:_tableView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeTop multiplier:1.0 constant:0];
[self.view addConstraint:tableTop];
NSLayoutConstraint *tableLeft = [NSLayoutConstraint constraintWithItem:_tableView attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeLeft multiplier:1.0 constant:0];
[self.view addConstraint:tableLeft];
NSLayoutConstraint *tableRight = [NSLayoutConstraint constraintWithItem:_tableView attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeRight multiplier:1.0 constant:0];
[self.view addConstraint:tableRight];
NSLayoutConstraint *tableBottom = [NSLayoutConstraint constraintWithItem:_tableView attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0];
[self.view addConstraint:tableBottom];
}
return _tableView;
}
@end
......@@ -14,15 +14,16 @@
self.descriptionText = value;
}
- (void)setValuesForKeysWithDictionary:(NSDictionary<NSString *,id> *)keyedValues{
Class cls = self.class;
for (NSString *key in keyedValues.allKeys) {
NSString *varName = [NSString stringWithFormat:@"_%@", key];
const char *c_key = [varName cStringUsingEncoding:NSUTF8StringEncoding];
Ivar var = class_getInstanceVariable(cls, c_key);
if (var) {
[self setValue:[keyedValues objectForKey:key] forKey:key];
}
}
}
//- (void)setValuesForKeysWithDictionary:(NSDictionary<NSString *,id> *)keyedValues{
// Class cls = self.class;
// for (NSString *key in keyedValues.allKeys) {
// NSString *varName = [NSString stringWithFormat:@"_%@", key];
// NSLog(@"varName ===== %@", varName);
// const char *c_key = [varName cStringUsingEncoding:NSUTF8StringEncoding];
// Ivar var = class_getInstanceVariable(cls, c_key);
// if (var) {
// [self setValue:[keyedValues objectForKey:key] forKey:key];
// }
// }
//}
@end
......@@ -15,6 +15,7 @@
@property (nonatomic, strong) UIImageView *titleImageView;
@property (nonatomic, strong) UILabel *titleLabel;
@property (nonatomic, strong) UILabel *detailsLabel;
@property (nonatomic, strong) UILabel *adressLabel;
@property (nonatomic, strong) UILabel *dateLabel;
......
......@@ -32,10 +32,11 @@
self.titleLabel.text = [NSString stringWithFormat:@"%@", pictureList.title];
self.detailsLabel.text = [NSString stringWithFormat:@"%@", pictureList.content];
if (pictureList.submitTime == nil || pictureList.submitTime == NULL || [pictureList.submitTime isEqual:[NSNull null]]) {
self.dateLabel.text = [NSString stringWithFormat:@"发布时间: "];
self.dateLabel.text = [NSString stringWithFormat:@""];
} else {
self.dateLabel.text = [NSString stringWithFormat:@"发布时间: %@",pictureList.submitTime];
self.dateLabel.text = [[NSString stringWithFormat:@"%@",pictureList.submitTime] substringToIndex:10];
}
self.adressLabel.text = [NSString stringWithFormat:@"%@", pictureList.storePath];
if (pictureList.hotspot) {
self.hotLabel.hidden = NO;
......@@ -149,12 +150,38 @@
NSLayoutConstraint *titleRight = [NSLayoutConstraint constraintWithItem:_detailsLabel attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeRight multiplier:1.0 constant:-15];
[self.contentView addConstraint:titleRight];
NSLayoutConstraint *titleImageHeight = [NSLayoutConstraint constraintWithItem:_detailsLabel attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:40];
NSLayoutConstraint *titleImageHeight = [NSLayoutConstraint constraintWithItem:_detailsLabel attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:23];
[self.contentView addConstraint:titleImageHeight];
}
return _detailsLabel;
}
- (UILabel *)adressLabel
{
if (!_adressLabel) {
_adressLabel = [[UILabel alloc] init];
_adressLabel.font = [UIFont systemFontOfSize:14.0];
_adressLabel.translatesAutoresizingMaskIntoConstraints = NO;
_adressLabel.numberOfLines = 0;
_adressLabel.textColor = kLightGray;
[self.contentView addSubview:_adressLabel];
NSLayoutConstraint *titleImageTop = [NSLayoutConstraint constraintWithItem:_adressLabel attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.detailsLabel attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0];
[self.contentView addConstraint:titleImageTop];
NSLayoutConstraint *titleImageLeft = [NSLayoutConstraint constraintWithItem:_adressLabel attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.titleImageView attribute:NSLayoutAttributeRight multiplier:1.0 constant:10];
[self.contentView addConstraint:titleImageLeft];
NSLayoutConstraint *titleRight = [NSLayoutConstraint constraintWithItem:_adressLabel attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeRight multiplier:1.0 constant:-15];
[self.contentView addConstraint:titleRight];
NSLayoutConstraint *titleImageHeight = [NSLayoutConstraint constraintWithItem:_adressLabel attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:23];
[self.contentView addConstraint:titleImageHeight];
}
return _adressLabel;
}
- (UILabel *)dateLabel
{
if (!_dateLabel) {
......@@ -165,16 +192,16 @@
[self.contentView addSubview:_dateLabel];
NSLayoutConstraint *titleImageTop = [NSLayoutConstraint constraintWithItem:_dateLabel attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.titleImageView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:5];
NSLayoutConstraint *titleImageTop = [NSLayoutConstraint constraintWithItem:_dateLabel attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.titleImageView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:7];
[self.contentView addConstraint:titleImageTop];
NSLayoutConstraint *titleImageLeft = [NSLayoutConstraint constraintWithItem:_dateLabel attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeLeft multiplier:1.0 constant:15];
NSLayoutConstraint *titleImageLeft = [NSLayoutConstraint constraintWithItem:_dateLabel attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.titleImageView attribute:NSLayoutAttributeRight multiplier:1.0 constant:10];
[self.contentView addConstraint:titleImageLeft];
NSLayoutConstraint *titleRight = [NSLayoutConstraint constraintWithItem:_dateLabel attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.thumbBtn attribute:NSLayoutAttributeLeft multiplier:1.0 constant:0];
[self.contentView addConstraint:titleRight];
NSLayoutConstraint *titleImageHeight = [NSLayoutConstraint constraintWithItem:_dateLabel attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:35];
NSLayoutConstraint *titleImageHeight = [NSLayoutConstraint constraintWithItem:_dateLabel attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:25];
[self.contentView addConstraint:titleImageHeight];
NSLayoutConstraint *titleImageBottom = [NSLayoutConstraint constraintWithItem:_dateLabel attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:-5];
......@@ -194,7 +221,7 @@
_thumbBtn.titleLabel.font = [UIFont systemFontOfSize:16.0];
[self.contentView addSubview:_thumbBtn];
NSLayoutConstraint *titleImageTop = [NSLayoutConstraint constraintWithItem:_thumbBtn attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.titleImageView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:12];
NSLayoutConstraint *titleImageTop = [NSLayoutConstraint constraintWithItem:_thumbBtn attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.titleImageView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:8];
[self.contentView addConstraint:titleImageTop];
NSLayoutConstraint *titleImageWidth = [NSLayoutConstraint constraintWithItem:_thumbBtn attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:self.commentBtn attribute:NSLayoutAttributeWidth multiplier:1.0 constant:0];
......@@ -219,7 +246,7 @@
_commentBtn.titleLabel.font = [UIFont systemFontOfSize:16.0];
[self.contentView addSubview:_commentBtn];
NSLayoutConstraint *titleImageTop = [NSLayoutConstraint constraintWithItem:_commentBtn attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.titleImageView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:12];
NSLayoutConstraint *titleImageTop = [NSLayoutConstraint constraintWithItem:_commentBtn attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.titleImageView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:8];
[self.contentView addConstraint:titleImageTop];
NSLayoutConstraint *titleImageWidth = [NSLayoutConstraint constraintWithItem:_commentBtn attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:70];
......
......@@ -9,5 +9,6 @@
#import <UIKit/UIKit.h>
@interface PictureViewController : UIViewController
@property (nonatomic, strong) NSString *come;
@property (nonatomic, strong) NSString *category;
@end
......@@ -67,6 +67,8 @@
[self setupNav];
self.view.backgroundColor = [UIColor whiteColor];
self.menuView.backgroundColor = kInspectSectionBackGroundColor;
if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0) {
......@@ -76,7 +78,6 @@
self.navigationController.navigationBar.translucent = NO;
}
_page = 0;
}
......@@ -86,7 +87,7 @@
{
UILabel *customLab = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 40, 30)];
[customLab setTextColor:[UIColor whiteColor]];
[customLab setText:@"图说口碑"];
[customLab setText:@"商场风采"];
customLab.font = [UIFont boldSystemFontOfSize:19];
self.navigationItem.titleView = customLab;
......@@ -110,17 +111,21 @@
-(void)doBack:(id)sender
{
if ([self.come isEqualToString:@"首页"]) {
[self.navigationController dismissViewControllerAnimated:YES completion:nil];
} else {
[self.navigationController popViewControllerAnimated:YES];
}
}
- (void)addClick:(UIButton *)sender
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"提示" message:@"当前功能正在开发!" delegate:self cancelButtonTitle:nil otherButtonTitles:@"确定", nil];
[alert show];
// UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"提示" message:@"当前功能正在开发!" delegate:self cancelButtonTitle:nil otherButtonTitles:@"确定", nil];
// [alert show];
// AddPictureViewController *addPic = [[AddPictureViewController alloc] init];
// [self.navigationController pushViewController:addPic animated:YES];
AddPictureViewController *addPic = [[AddPictureViewController alloc] init];
[self.navigationController pushViewController:addPic animated:YES];
}
- (void)requestPicturePraise
......@@ -131,8 +136,9 @@
NSString *urlStr = [NSString stringWithFormat:@"%@%@", kRedStarURL, kQueryPicturePraiseURL];
NSString *user_uuid = [[NSUserDefaults standardUserDefaults] objectForKey:@"user_uuid"];
NSDictionary *parameters = @{
@"scope":@"all",
@"user":user_uuid,
// @"scope":@"all",
@"type":self.category,
@"pageNumber":@(0),
@"pageSize":@(10)
};
......@@ -179,7 +185,9 @@
NSString *urlStr = [NSString stringWithFormat:@"%@%@", kRedStarURL, kQueryPicturePraiseURL];
NSString *user_uuid = [[NSUserDefaults standardUserDefaults] objectForKey:@"user_uuid"];
NSDictionary *parameters = @{
@"scope":@"all",
@"user":user_uuid,
@"type":self.category,
@"pageNumber":@(_page),
@"pageSize":@(10)
};
......@@ -386,7 +394,10 @@
NSMutableDictionary *parameters = [NSMutableDictionary dictionaryWithObjectsAndKeys:
user_uuid,@"user",
@(0),@"pageNumber",
@(10),@"pageSize", nil];
@(10),@"pageSize",
self.category,@"type",
@"all",@"scope",
nil];
// 发起请求
HttpClient *httpClient = [[HttpClient alloc] initWithUrl:urlStr];
......@@ -557,7 +568,9 @@
NSDictionary *parameters = @{@"user":user_uuid,
@"pageNumber":@(_page),
@"pageSize":@(10),
@"queryOrders":queryOrders
@"queryOrders":queryOrders,
@"type":self.category,
@"scope":@"all"
};
// 发起请求
HttpClient *httpClient = [[HttpClient alloc] initWithUrl:urlStr];
......
......@@ -80,7 +80,7 @@
UILabel *customLab = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 40, 30)];
[customLab setTextColor:[UIColor whiteColor]];
[customLab setText:@"口碑排名"];
[customLab setText:@"口碑报告"];
customLab.font = [UIFont boldSystemFontOfSize:19];
self.navigationItem.titleView = customLab;
......@@ -138,7 +138,7 @@
[MBProgressHUD showHUDAddedTo:self.view animated:YES];
__block RankingListViewController *weakSelf = self;
[httpCilent getRankingListWithParameters:parameters completion:^(id response, NSError *error) {
NSLog(@"口碑排名response = %@", response);
NSLog(@"口碑报告response = %@", response);
NSDictionary *dataDict = response[@"data"];
NSArray *dataArray = dataDict[@"records"];
......@@ -212,7 +212,7 @@
NSLog(@"parrrrrters = %@", parameters);
[MBProgressHUD showHUDAddedTo:self.view animated:YES];
[httpCilent getRankingListWithParameters:parameters completion:^(id response, NSError *error) {
NSLog(@"分区域 口碑排名response = %@ error = %@", response, error);
NSLog(@"分区域 口碑报告response = %@ error = %@", response, error);
NSDictionary *dataDict = response[@"data"];
NSArray *dataArray = dataDict[@"records"];
......
......@@ -13,8 +13,9 @@
#import "InspectListViewController.h"
#import "RankingListViewController.h"
#import "OnLineViewController.h"
#import "PictureViewController.h"
#import "PicCategoryViewController.h"
#import "QuestionViewController.h"
#import "PictureViewController.h"
#import "HomeCellItem.h"
......@@ -41,6 +42,9 @@
#import "InspectTaskViewController.h"
#import "TaskListModel.h"
#import "PictureTableCell.h"
#define KHomePicTableCell @"pictureTableViewCell"
#import "SpotCheckOnLineViewController.h"
#import "LookOnLineViewController.h"
......@@ -67,20 +71,12 @@ typedef NSComparisonResult (^NSComparator)(id obj1, id obj2);
@property (nonatomic, strong) HomeHeaderView *headView;
@property (nonatomic, strong) NSMutableArray *titleArray; // section标题
@property (nonatomic, strong) NSArray *btnTitleArray; // section标题
@property (nonatomic, strong) NSArray *announeArray; // 公告内容
@property (nonatomic, strong) NSArray *test1Array; // section标题
@property (nonatomic, strong) NSArray *test2Array; // section标题
@property (nonatomic, strong) NSArray *test3Array; // section标题
// rank cell
@property (nonatomic, strong) NSMutableDictionary *selectedIndexes;
@property (nonatomic, strong) NSMutableArray *sectionArray; // section标题
@property (nonatomic, strong) NSMutableArray *allQuestionArray; // 问题与知识
@property (nonatomic, strong) NSMutableArray *taskListDataArray; // 问题与知识
@property (nonatomic, strong) NSMutableArray *allRankListArray;
@property (nonatomic, strong) NSMutableArray *allPraiseListArray;
@end
@implementation HomeViewController
......@@ -98,59 +94,53 @@ typedef NSComparisonResult (^NSComparator)(id obj1, id obj2);
self.navigationItem.titleView = customLab;
self.titleArray = [NSMutableArray array];
self.sectionArray = [NSMutableArray array];
NSArray *permissions = [[NSUserDefaults standardUserDefaults] objectForKey:@"permissions"];
if ([permissions containsObject:@"500101"] || [permissions containsObject:@"500102"]) {
[self.titleArray addObject:@"口碑巡检"];
[self requestInspectList];
}
// 口碑报告 商场风采 图说口碑 口碑标准 问题知识 口碑巡检
if ([permissions containsObject:@"500201"]) {
[self.titleArray addObject:@"口碑排名"];
[self.titleArray addObject:@"口碑报告"];
[self requestRankingList];
}
if ([permissions containsObject:@"500501"] || [permissions containsObject:@"500502"]) {
[self.titleArray addObject:@"问题知识"];
[self requestQuestionList];
}
[self.titleArray addObject:@"商场风采"];
[self requestPicturePraise];
if ([permissions containsObject:@"500301"] || [permissions containsObject:@"500302"]) {
[self.titleArray addObject:@"图说口碑"];
}
if ([permissions containsObject:@"500401"] || [permissions containsObject:@"500402"]) {
[self.titleArray addObject:@"口碑标准"];
}
if ([permissions containsObject:@"500701"] || [permissions containsObject:@"500702"]) {
[self.titleArray addObject:@"在线抽查"];
if ([permissions containsObject:@"500501"] || [permissions containsObject:@"500502"]) {
[self.titleArray addObject:@"问题知识"];
[self requestQuestionList];
}
if ([permissions containsObject:@"500101"] || [permissions containsObject:@"500102"]) {
[self.titleArray addObject:@"口碑巡检"];
[self requestInspectList];
}
[[NSUserDefaults standardUserDefaults] setObject:_titleArray forKey:@"function"];
[self setupNav];
[self setupTableView];
// 初始化容器
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.tableView.header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
// 进入刷新状态后会自动调用这个block
[self refreshAllData];
}];
self.allPraiseListArray = [NSMutableArray array];
[[NSNotificationCenter defaultCenter] addObserver:self
......@@ -164,19 +154,65 @@ typedef NSComparisonResult (^NSComparator)(id obj1, id obj2);
object:nil];
}
-(void)dealloc
- (void)viewWillAppear:(BOOL)animated
{
[[NSNotificationCenter defaultCenter] removeObserver:self];
[super viewWillAppear:animated];
self.tabBarController.tabBar.hidden = NO;
self.navigationController.navigationBar.hidden = YES;
[self.tableView.header beginRefreshing];
}
#pragma mark - 刷新数据
- (void)refreshAllData
{
[self refreshInspectList];
[self refreshRankingList];
[self refreshQuestionList];
[self refreshPraiseList];
}
- (void)refreshInspectList {
- (void)refreshPraiseList
{
// 请求地址
NSString *urlStr = [NSString stringWithFormat:@"%@%@", kRedStarURL, kQueryPicturePraiseURL];
NSString *user_uuid = [[NSUserDefaults standardUserDefaults] objectForKey:@"user_uuid"];
NSDictionary *parameters = @{
@"scope":@"all",
@"user":user_uuid,
@"type":@"store",
@"pageNumber":@(0),
@"pageSize":@(2)
};
// 发起请求
HttpClient *httpClient = [[HttpClient alloc] initWithUrl:urlStr];
[MBProgressHUD showHUDAddedTo:self.view animated:YES];
// 请求问题列表
[httpClient queryPicturePraiseWithParameters:parameters completion:^(id response, NSError *error) {
NSLog(@"刷新!!== 图说口碑 response = %@ error = %@" , response, error);
NSDictionary *dataDict = response[@"data"];
NSArray *dataArray = dataDict[@"records"];
NSMutableArray *tempArray = [NSMutableArray array];
for (NSDictionary *dict in dataArray) {
PictureListModel *picList = [[PictureListModel alloc] init];
[picList setValuesForKeysWithDictionary:dict];
[tempArray addObject:picList];
}
_allPraiseListArray = tempArray;
[self.tableView reloadData];
[MBProgressHUD hideHUDForView:self.view animated:YES];
[self.tableView.header endRefreshing];
}];
}
// 刷新口碑任务
- (void)refreshInspectList
{
// 口碑任务
NSString *url3 = [NSString stringWithFormat:@"%@%@", kRedStarURL, kInspectListURL];
HttpClient *httpCilent3 = [[HttpClient alloc] initWithUrl:url3];
......@@ -197,12 +233,14 @@ typedef NSComparisonResult (^NSComparator)(id obj1, id obj2);
[inspectTempArr addObject:taskList];
}
_taskListDataArray = inspectTempArr;
[self.tableView reloadData];
[MBProgressHUD hideHUDForView:self.view animated:YES];
[self.tableView.header endRefreshing];
}];
}
- (void)refreshRankingList {
// 口碑巡检
NSString *url1 = [NSString stringWithFormat:@"%@%@", kRedStarURL, kRankingListURL];
......@@ -214,7 +252,7 @@ typedef NSComparisonResult (^NSComparator)(id obj1, id obj2);
};
__block HomeViewController *weakSelf = self;
[httpCilent1 getRankingListWithParameters:parameters1 completion:^(id response, NSError *error) {
NSLog(@"刷新!! = 口碑排名response = %@", response);
NSLog(@"刷新!! = 口碑报告response = %@", response);
NSDictionary *dataDict = response[@"data"];
NSArray *dataArray = dataDict[@"records"];
......@@ -225,8 +263,11 @@ typedef NSComparisonResult (^NSComparator)(id obj1, id obj2);
[rankTempArr addObject:rankList];
}
weakSelf.allRankListArray = rankTempArr;
[self.tableView reloadData];
[MBProgressHUD hideHUDForView:self.view animated:YES];
[self.tableView.header endRefreshing];
}];
}
......@@ -255,26 +296,15 @@ typedef NSComparisonResult (^NSComparator)(id obj1, id obj2);
[questionTempArr addObject:question];
}
_allQuestionArray = questionTempArr;
[self.tableView reloadData];
[MBProgressHUD hideHUDForView:self.view animated:YES];
}];
}
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
self.tabBarController.tabBar.hidden = NO;
self.navigationController.navigationBar.hidden = YES;
[self.tableView.header beginRefreshing];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
}
#pragma mark - 请求
#pragma mark - 请求数据
- (void)requestRankingList
{
......@@ -287,7 +317,7 @@ typedef NSComparisonResult (^NSComparator)(id obj1, id obj2);
};
[httpCilent getRankingListWithParameters:parameters completion:^(id response, NSError *error) {
NSLog(@"口碑排名response = %@", response);
NSLog(@"口碑报告response = %@", response);
NSDictionary *dataDict = response[@"data"];
NSArray *dataArray = dataDict[@"records"];
......@@ -308,7 +338,9 @@ typedef NSComparisonResult (^NSComparator)(id obj1, id obj2);
rank.index = rank.score == prevRank.score ? prevRank.index: i + 1;
}
}
if (_allRankListArray.count != 0) {
[_sectionArray addObject:@"口碑报告"];
}
[self.tableView reloadData];
[MBProgressHUD hideHUDForView:self.view animated:YES];
......@@ -355,6 +387,9 @@ typedef NSComparisonResult (^NSComparator)(id obj1, id obj2);
[taskList setValuesForKeysWithDictionary:dict];
[_taskListDataArray addObject:taskList];
}
if (_taskListDataArray.count != 0) {
[_sectionArray addObject:@"口碑巡检"];
}
[self.tableView reloadData];
[MBProgressHUD hideHUDForView:self.view animated:YES];
......@@ -362,7 +397,6 @@ typedef NSComparisonResult (^NSComparator)(id obj1, id obj2);
}
- (void)requestQuestionList
{
// 初始化数组
......@@ -373,9 +407,8 @@ typedef NSComparisonResult (^NSComparator)(id obj1, id obj2);
NSDictionary *parameters = @{@"user":user_uuid,
@"scope":@"all",
@"pageNumber":@(0),
@"pageSize":@(10)
@"pageSize":@(2)
};
// 发起请求
HttpClient *httpClient = [[HttpClient alloc] initWithUrl:urlStr];
//
......@@ -392,6 +425,9 @@ typedef NSComparisonResult (^NSComparator)(id obj1, id obj2);
[question setValuesForKeysWithDictionary:questionDict];
[weakSelf.allQuestionArray addObject:question];
}
if (_allQuestionArray.count != 0) {
[_sectionArray addObject:@"问题知识"];
}
[self.tableView reloadData];
self.tableView.tableHeaderView = self.headView;
......@@ -399,6 +435,45 @@ typedef NSComparisonResult (^NSComparator)(id obj1, id obj2);
}];
}
- (void)requestPicturePraise
{
// 请求地址
NSString *urlStr = [NSString stringWithFormat:@"%@%@", kRedStarURL, kQueryPicturePraiseURL];
NSString *user_uuid = [[NSUserDefaults standardUserDefaults] objectForKey:@"user_uuid"];
NSDictionary *parameters = @{
@"scope":@"all",
@"user":user_uuid,
@"type":@"store",
@"pageNumber":@(0),
@"pageSize":@(2)
};
// 发起请求
HttpClient *httpClient = [[HttpClient alloc] initWithUrl:urlStr];
[MBProgressHUD showHUDAddedTo:self.view animated:YES];
// 请求问题列表
[httpClient queryPicturePraiseWithParameters:parameters completion:^(id response, NSError *error) {
NSLog(@"图说口碑 response = %@ error = %@" , response, error);
NSDictionary *dataDict = response[@"data"];
NSArray *dataArray = dataDict[@"records"];
NSMutableArray *tempArray = [NSMutableArray array];
for (NSDictionary *dict in dataArray) {
PictureListModel *picList = [[PictureListModel alloc] init];
[picList setValuesForKeysWithDictionary:dict];
[tempArray addObject:picList];
}
_allPraiseListArray = tempArray;
if (_allPraiseListArray.count != 0) {
[_sectionArray addObject:@"商场风采"];
}
[self.tableView reloadData];
[MBProgressHUD hideHUDForView:self.view animated:YES];
}];
}
#pragma mark - Private Methods
- (void)setupNav
......@@ -434,49 +509,54 @@ typedef NSComparisonResult (^NSComparator)(id obj1, id obj2);
[item addTarget:self action:@selector(itemClick:) forControlEvents:UIControlEventTouchUpInside];
[self.headView.scrollView addSubview:item];
}
self.tableView.tableHeaderView = self.headView;
// 设置下拉刷新
self.tableView.header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
// 进入刷新状态后会自动调用这个block
[self refreshAllData];
}];
}
// 更多按钮点击事件
- (void)moreButtonClick:(UIButton *)sender
{
if (_titleArray.count == 5) {
UIButton *button = (UIButton *)sender;
NSInteger section = sender.tag - 332892;
UINavigationController *nav;
if (button.tag - 332892 == 0) {
if ([_sectionArray[section] isEqualToString:@"在线抽查"]) {
SpotCheckOnLineViewController *spotOnline = [[SpotCheckOnLineViewController alloc] init];
nav = [[UINavigationController alloc] initWithRootViewController:spotOnline];
} else if ([_sectionArray[section] isEqualToString:@"口碑巡检"]) {
InspectListViewController *inspectListVC = [[InspectListViewController alloc] init];
nav = [[UINavigationController alloc] initWithRootViewController:inspectListVC];
} else {
} else if ([_sectionArray[section] isEqualToString:@"口碑标准"]) {
StandardViewController *standardVC = [[StandardViewController alloc] init];
nav = [[UINavigationController alloc] initWithRootViewController:standardVC];
} else if ([_sectionArray[section] isEqualToString:@"图说口碑"]) {
PicCategoryViewController *pictureVC = [[PicCategoryViewController alloc] init];
nav = [[UINavigationController alloc] initWithRootViewController:pictureVC];
} else if ([_sectionArray[section] isEqualToString:@"问题知识"]) {
QuestionViewController *questionVC = [[QuestionViewController alloc] init];
nav = [[UINavigationController alloc] initWithRootViewController:questionVC];
}
[nav.navigationBar setBarTintColor:kNavigationBarColor];
[nav.navigationBar setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIColor whiteColor],NSForegroundColorAttributeName,nil]];
[self presentViewController:nav animated:YES completion:nil];
} else {
UIButton *button = (UIButton *)sender;
UINavigationController *nav;
if (button.tag - 332892 == 0) {
InspectListViewController *inspectListVC = [[InspectListViewController alloc] init];
nav = [[UINavigationController alloc] initWithRootViewController:inspectListVC];
} else if (button.tag - 332892 == 1) {
} else if ([_sectionArray[section] isEqualToString:@"口碑报告"]){
RankingListViewController *rankingListVC = [[RankingListViewController alloc] init];
nav = [[UINavigationController alloc] initWithRootViewController:rankingListVC];
} else {
QuestionViewController *questionVC = [[QuestionViewController alloc] init];
nav = [[UINavigationController alloc] initWithRootViewController:questionVC];
} else if ([_sectionArray[section] isEqualToString:@"查看抽查"]){
LookOnLineViewController *lookOnLine = [[LookOnLineViewController alloc] init];
nav = [[UINavigationController alloc] initWithRootViewController:lookOnLine];
} else if ([_sectionArray[section] isEqualToString:@"商场风采"]) {
PictureViewController *pic = [[PictureViewController alloc] init];
pic.come = @"首页";
pic.category = @"store";
nav = [[UINavigationController alloc] initWithRootViewController:pic];
}
[nav.navigationBar setBarTintColor:kNavigationBarColor];
[nav.navigationBar setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIColor whiteColor],NSForegroundColorAttributeName,nil]];
[self presentViewController:nav animated:YES completion:nil];
}
}
- (void)itemClick:(HomeCellItem *)sender
......@@ -490,29 +570,25 @@ typedef NSComparisonResult (^NSComparator)(id obj1, id obj2);
InspectListViewController *inspectListVC = [[InspectListViewController alloc] init];
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;
// LookOnLineViewController *lookOnLine = [[LookOnLineViewController alloc] init];
// nav = [[UINavigationController alloc] initWithRootViewController:lookOnLine];
StandardViewController *standardVC = [[StandardViewController alloc] init];
nav = [[UINavigationController alloc] initWithRootViewController:standardVC];
} else if ([item.titleLabel.text isEqualToString:@"图说口碑"]) {
PictureViewController *pictureVC = [[PictureViewController alloc] init];
PicCategoryViewController *pictureVC = [[PicCategoryViewController alloc] init];
nav = [[UINavigationController alloc] initWithRootViewController:pictureVC];
} else if ([item.titleLabel.text isEqualToString:@"问题知识"]) {
QuestionViewController *questionVC = [[QuestionViewController alloc] init];
nav = [[UINavigationController alloc] initWithRootViewController:questionVC];
} else if ([item.titleLabel.text isEqualToString:@"口碑排名"]){
} else if ([item.titleLabel.text isEqualToString:@"口碑报告"]){
RankingListViewController *rankingListVC = [[RankingListViewController alloc] init];
nav = [[UINavigationController alloc] initWithRootViewController:rankingListVC];
} else if ([item.titleLabel.text isEqualToString:@"查看抽查"]){
LookOnLineViewController *lookOnLine = [[LookOnLineViewController alloc] init];
nav = [[UINavigationController alloc] initWithRootViewController:lookOnLine];
} else if ([item.titleLabel.text isEqualToString:@"商场风采"]) {
PictureViewController *pic = [[PictureViewController alloc] init];
pic.come = @"首页";
pic.category = @"store";
nav = [[UINavigationController alloc] initWithRootViewController:pic];
}
[nav.navigationBar setBarTintColor:kNavigationBarColor];
......@@ -526,31 +602,25 @@ typedef NSComparisonResult (^NSComparator)(id obj1, id obj2);
#pragma mark - TableView Delegate/DataSource
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
NSMutableArray *titleArray = [[NSUserDefaults standardUserDefaults] objectForKey:@"function"];
if (titleArray.count == 6) {
return 3;
} else if (titleArray.count == 5) {
return 2;
} else {
return titleArray.count;
}
return _sectionArray.count;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
NSMutableArray *titleArray = [[NSUserDefaults standardUserDefaults] objectForKey:@"function"];
NSUInteger s2 = [_sectionArray indexOfObject:@"口碑报告"];
NSUInteger s4 = [_sectionArray indexOfObject:@"商场风采"];
NSUInteger s3 = [_sectionArray indexOfObject:@"问题知识"];
NSUInteger s1 = [_sectionArray indexOfObject:@"口碑巡检"];
NSUInteger s1 = [titleArray indexOfObject:@"口碑巡检"];
NSUInteger s2 = [titleArray indexOfObject:@"口碑排名"];
NSUInteger s3 = [titleArray indexOfObject:@"问题知识"];
if ([titleArray[section] isEqualToString:@"口碑巡检"] && section == s1) {
if ([_sectionArray[section] isEqualToString:@"口碑巡检"] && section == s1) {
return _taskListDataArray.count;
} else if ([titleArray[section] isEqualToString:@"口碑排名"] && section == s2) {
} else if ([_sectionArray[section] isEqualToString:@"口碑报告"] && section == s2) {
return _allRankListArray.count + 1;
} else if ([titleArray[section] isEqualToString:@"问题知识"] && section == s3) {
} else if ([_sectionArray[section] isEqualToString:@"问题知识"] && section == s3) {
return _allQuestionArray.count;
} else if ([_sectionArray[section] isEqualToString:@"商场风采"] && section == s4) {
return _allPraiseListArray.count;
} else {
return 0;
}
......@@ -560,12 +630,12 @@ typedef NSComparisonResult (^NSComparator)(id obj1, id obj2);
// cell显示的内容
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
NSMutableArray *titleArray = [[NSUserDefaults standardUserDefaults] objectForKey:@"function"];
NSUInteger s1 = [titleArray indexOfObject:@"口碑巡检"];
NSUInteger s2 = [titleArray indexOfObject:@"口碑排名"];
NSUInteger s3 = [titleArray indexOfObject:@"问题知识"];
NSUInteger s2 = [_sectionArray indexOfObject:@"口碑报告"];
NSUInteger s4 = [_sectionArray indexOfObject:@"商场风采"];
NSUInteger s3 = [_sectionArray indexOfObject:@"问题知识"];
NSUInteger s1 = [_sectionArray indexOfObject:@"口碑巡检"];
if ([titleArray[indexPath.section] isEqualToString:@"口碑巡检"] && indexPath.section == s1) {
if ([_sectionArray[indexPath.section] isEqualToString:@"口碑巡检"] && indexPath.section == s1) {
InspectListCell *cell=[tableView dequeueReusableCellWithIdentifier:kHomeInspectListCell];
if (!cell) {
cell = [[InspectListCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:kHomeInspectListCell];
......@@ -578,7 +648,7 @@ typedef NSComparisonResult (^NSComparator)(id obj1, id obj2);
image = [image resizableImageWithCapInsets:UIEdgeInsetsZero resizingMode:UIImageResizingModeTile];
cell.alreadyView.image = image;
return cell;
} else if ([titleArray[indexPath.section] isEqualToString:@"口碑排名"] && indexPath.section == s2) {
} else if ([_sectionArray[indexPath.section] isEqualToString:@"口碑报告"] && indexPath.section == s2) {
if (indexPath.row == 0) {
HomeTitleTableCell *cell=[tableView dequeueReusableCellWithIdentifier:kHomeTitleTableCell];
if (!cell) {
......@@ -597,7 +667,7 @@ typedef NSComparisonResult (^NSComparator)(id obj1, id obj2);
cell.selectionStyle = UITableViewCellSelectionStyleNone;
return cell;
}
} else if ([titleArray[indexPath.section] isEqualToString:@"问题知识"] && indexPath.section == s3) {
} else if ([_sectionArray[indexPath.section] isEqualToString:@"问题知识"] && indexPath.section == s3) {
// 问题与知识
QuestionListTableCell *cell = [tableView dequeueReusableCellWithIdentifier:kHomeQuestionListTableCell];
if (!cell) {
......@@ -607,6 +677,13 @@ typedef NSComparisonResult (^NSComparator)(id obj1, id obj2);
QuestionModel *question = _allQuestionArray[indexPath.row];
cell.question = question;
return cell;
} else if ([_sectionArray[indexPath.section] isEqualToString:@"商场风采"] && indexPath.section == s4) {
PictureTableCell *cell=[tableView dequeueReusableCellWithIdentifier:KHomePicTableCell];
if (!cell) {
cell = [[PictureTableCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:KHomePicTableCell];
}
cell.pictureList = _allPraiseListArray[indexPath.row];
return cell;
} else {
return nil;
}
......@@ -619,11 +696,11 @@ typedef NSComparisonResult (^NSComparator)(id obj1, id obj2);
// cell点击事件
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
NSMutableArray *titleArray = [[NSUserDefaults standardUserDefaults] objectForKey:@"function"];
NSUInteger s1 = [titleArray indexOfObject:@"口碑巡检"];
NSUInteger s2 = [titleArray indexOfObject:@"口碑排名"];
NSUInteger s3 = [titleArray indexOfObject:@"问题知识"];
if ([titleArray[indexPath.section] isEqualToString:@"口碑巡检"] && indexPath.section == s1) {
NSUInteger s2 = [_sectionArray indexOfObject:@"口碑报告"];
NSUInteger s4 = [_sectionArray indexOfObject:@"商场风采"];
NSUInteger s3 = [_sectionArray indexOfObject:@"问题知识"];
NSUInteger s1 = [_sectionArray indexOfObject:@"口碑巡检"];
if ([_sectionArray[indexPath.section] isEqualToString:@"口碑巡检"] && indexPath.section == s1) {
InspectTaskViewController *inspectTaskVC = [[InspectTaskViewController alloc] init];
TaskListModel *taskList = self.taskListDataArray[indexPath.row];
inspectTaskVC.uuid = taskList.uuid;
......@@ -631,7 +708,7 @@ typedef NSComparisonResult (^NSComparator)(id obj1, id obj2);
inspectTaskVC.multiplier = (CGFloat)taskList.reportCount / taskList.questionCount ;
self.hidesBottomBarWhenPushed = YES;
[self.navigationController pushViewController:inspectTaskVC animated:YES];
} else if ([titleArray[indexPath.section] isEqualToString:@"口碑排名"] && indexPath.section == s2) {
} else if ([_sectionArray[indexPath.section] isEqualToString:@"口碑报告"] && indexPath.section == s2) {
if (indexPath.row == 0) {
return;
}
......@@ -644,12 +721,18 @@ typedef NSComparisonResult (^NSComparator)(id obj1, id obj2);
rankDetailVC.storePictures = rankList.storePictures;
self.hidesBottomBarWhenPushed = YES;
[self.navigationController pushViewController:rankDetailVC animated:YES];
} else if ([titleArray[indexPath.section] isEqualToString:@"问题知识"] && indexPath.section == s3) {
} else if ([_sectionArray[indexPath.section] isEqualToString:@"问题知识"] && indexPath.section == s3) {
QuestionDetailViewController *questionDetailVC = [[QuestionDetailViewController alloc] init];
QuestionModel *question = self.allQuestionArray[indexPath.row];
questionDetailVC.questionUuid = question.uuid;
self.hidesBottomBarWhenPushed = YES;
[self.navigationController pushViewController:questionDetailVC animated:YES];
} else if ([_sectionArray[indexPath.section] isEqualToString:@"商场风采"] && indexPath.section == s4) {
PictureListModel *picList = _allPraiseListArray[indexPath.row];
PictureStoryViewController *storyVC = [[PictureStoryViewController alloc] init];
storyVC.uuid = picList.uuid;
self.hidesBottomBarWhenPushed = YES;
[self.navigationController pushViewController:storyVC animated:YES];
} else {
return;
}
......@@ -698,9 +781,8 @@ typedef NSComparisonResult (^NSComparator)(id obj1, id obj2);
titleLabel.translatesAutoresizingMaskIntoConstraints = NO;
titleLabel.textColor = kPictureCellDetailsColor;
titleLabel.font = [UIFont systemFontOfSize:17.0];
NSMutableArray *allTitleArray = [[NSUserDefaults standardUserDefaults] objectForKey:@"function"];
titleLabel.text = allTitleArray[section];
titleLabel.text = _sectionArray[section];
[sectionView addSubview:titleLabel];
......@@ -767,19 +849,7 @@ typedef NSComparisonResult (^NSComparator)(id obj1, id obj2);
return sectionView;
}
//- (void)pushclick:(UIButton *)sender
//{
// NSInteger section = sender.tag - kPushTag;
//
// RankListModel *rankList = _rankData[section-2];
//
// RankDetailViewController *rankDetailVC = [[RankDetailViewController alloc] init];
// rankDetailVC.indexRow = section;
// rankDetailVC.uuid = rankList.uuid;
// rankDetailVC.store_uuid = rankList.store_uuid;
// self.hidesBottomBarWhenPushed = YES;
// [self.navigationController pushViewController:rankDetailVC animated:YES];
//}
#pragma mark - lazy loading
- (UIImageView *)bgImageView
......@@ -961,4 +1031,9 @@ typedef NSComparisonResult (^NSComparator)(id obj1, id obj2);
[_tableView reloadData];
}
-(void)dealloc
{
[[NSNotificationCenter defaultCenter] removeObserver:self];
}
@end
......@@ -65,7 +65,7 @@
[super viewDidLoad];
//NSMutableArray *titleArray = [[NSUserDefaults standardUserDefaults] objectForKey:@"function"];
NSArray *titleArray = [NSArray arrayWithObjects:@"口碑巡检",@"口碑排名",@"问题知识", nil];
NSArray *titleArray = [NSArray arrayWithObjects:@"口碑巡检",@"口碑报告",@"问题知识", nil];
self.titleArray = [NSMutableArray arrayWithArray:titleArray];
UILabel *customLab = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 100, 30)];
......@@ -99,10 +99,10 @@
}
if ([self.titleArray containsObject:@"口碑排名"]) {
if ([self.titleArray containsObject:@"口碑报告"]) {
self.allRankListArray = [NSMutableArray array];
if (_allRankListArray.count == 0) {
[_titleArray removeObject:@"口碑排名"];
[_titleArray removeObject:@"口碑报告"];
}
[self requestAllRankList];
}
......@@ -221,7 +221,7 @@
@"keyword":self.customStr
};
[httpCilent1 getRankingListWithParameters:parameters1 completion:^(id response, NSError *error) {
NSLog(@"口碑排名response = %@", response);
NSLog(@"口碑报告response = %@", response);
if ([(NSArray *)response[@"data"] count] == 0) {
return;
}
......@@ -245,8 +245,8 @@
}
if (_allRankListArray.count != 0) {
if (![_titleArray containsObject:@"口碑排名"]) {
[_titleArray addObject:@"口碑排名"];
if (![_titleArray containsObject:@"口碑报告"]) {
[_titleArray addObject:@"口碑报告"];
}
}
......@@ -323,11 +323,11 @@
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
NSUInteger s1 = [_titleArray indexOfObject:@"口碑巡检"];
NSUInteger s2 = [_titleArray indexOfObject:@"口碑排名"];
NSUInteger s2 = [_titleArray indexOfObject:@"口碑报告"];
NSUInteger s3 = [_titleArray indexOfObject:@"问题知识"];
if ([_titleArray[section] isEqualToString:@"口碑巡检"] && section == s1) {
return _taskListDataArray.count;
} else if ([_titleArray[section] isEqualToString:@"口碑排名"] && section == s2) {
} else if ([_titleArray[section] isEqualToString:@"口碑报告"] && section == s2) {
return _allRankListArray.count + 1;
} else if ([_titleArray[section] isEqualToString:@"问题知识"] && section == s3) {
return _allQuestionArray.count;
......@@ -343,7 +343,7 @@
{
NSUInteger s1 = [_titleArray indexOfObject:@"口碑巡检"];
NSUInteger s2 = [_titleArray indexOfObject:@"口碑排名"];
NSUInteger s2 = [_titleArray indexOfObject:@"口碑报告"];
NSUInteger s3 = [_titleArray indexOfObject:@"问题知识"];
if ([_titleArray[indexPath.section] isEqualToString:@"口碑巡检"] && indexPath.section == s1) {
InspectListCell *cell=[tableView dequeueReusableCellWithIdentifier:kHomeInspectListCell];
......@@ -358,7 +358,7 @@
image = [image resizableImageWithCapInsets:UIEdgeInsetsZero resizingMode:UIImageResizingModeTile];
cell.alreadyView.image = image;
return cell;
} else if ([_titleArray[indexPath.section] isEqualToString:@"口碑排名"] && indexPath.section == s2) {
} else if ([_titleArray[indexPath.section] isEqualToString:@"口碑报告"] && indexPath.section == s2) {
if (indexPath.row == 0) {
HomeTitleTableCell *cell=[tableView dequeueReusableCellWithIdentifier:kHomeTitleTableCell];
if (!cell) {
......
......@@ -50,7 +50,7 @@
self.view.backgroundColor = kSectionBackGroundColor;
self.titleArray = [NSMutableArray arrayWithObjects:@"配置项目",@"配置",@"帮助与反馈",@"关于",@"检查版本更新", nil];
self.titleArray = [NSMutableArray arrayWithObjects:@"配置",@"关于",@"检查版本更新", nil];
[self setupTableView];
......@@ -189,9 +189,9 @@
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
if (indexPath.row == 4) {
if (indexPath.row == 2) {
[self getVersion];
} else if (indexPath.row == 3) {
} else if (indexPath.row == 1) {
AboutMeViewController *about = [[AboutMeViewController alloc] init];
[self.navigationController pushViewController:about animated:YES];
}
......
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