Commit 4cd76b1f authored by admin's avatar admin

修复bug

parent 17f1e76c
......@@ -154,6 +154,7 @@
84ECCF1B1C0210F000EA4960 /* CommentModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 84ECCF1A1C0210F000EA4960 /* CommentModel.m */; };
84ED5DD81BF2E64300A1BB6D /* ScreenView.m in Sources */ = {isa = PBXBuildFile; fileRef = 84ED5DD71BF2E64300A1BB6D /* ScreenView.m */; };
84EE92771C2FFDEB000EF5BF /* AttachmentModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 84EE92761C2FFDEB000EF5BF /* AttachmentModel.m */; };
84EE927A1C30E124000EF5BF /* UIImage+Fit.m in Sources */ = {isa = PBXBuildFile; fileRef = 84EE92791C30E124000EF5BF /* UIImage+Fit.m */; };
84F1669B1BE715E40061D350 /* ZanButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 84F1669A1BE715E40061D350 /* ZanButton.m */; };
84F30DA41BFC19F200CBAD13 /* RankListModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 84F30DA31BFC19F200CBAD13 /* RankListModel.m */; };
84F57C461BEC388A00DDEEB1 /* CommentView.m in Sources */ = {isa = PBXBuildFile; fileRef = 84F57C451BEC388A00DDEEB1 /* CommentView.m */; };
......@@ -480,6 +481,8 @@
84ED5DD71BF2E64300A1BB6D /* ScreenView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ScreenView.m; sourceTree = "<group>"; };
84EE92751C2FFDEB000EF5BF /* AttachmentModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AttachmentModel.h; sourceTree = "<group>"; };
84EE92761C2FFDEB000EF5BF /* AttachmentModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AttachmentModel.m; sourceTree = "<group>"; };
84EE92781C30E124000EF5BF /* UIImage+Fit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIImage+Fit.h"; sourceTree = "<group>"; };
84EE92791C30E124000EF5BF /* UIImage+Fit.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIImage+Fit.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>"; };
......@@ -1676,6 +1679,8 @@
84C9574A1BDB344900083584 /* UIBarButtonItem+Create.m */,
84C9574B1BDB344900083584 /* UIView+Frame.h */,
84C9574C1BDB344900083584 /* UIView+Frame.m */,
84EE92781C30E124000EF5BF /* UIImage+Fit.h */,
84EE92791C30E124000EF5BF /* UIImage+Fit.m */,
);
path = Category;
sourceTree = "<group>";
......@@ -2470,6 +2475,7 @@
84B4765A1C2E4B37006C6488 /* PicCategoryViewController.m in Sources */,
84D3E6021C04DA85001FF1DD /* InspectUpLoadFootView.m in Sources */,
84A673881C0B50B4000F828E /* OnLineCompleteViewController.m in Sources */,
84EE927A1C30E124000EF5BF /* UIImage+Fit.m in Sources */,
8474C5991BE78BBC007DCF19 /* QuestionDetailCell.m in Sources */,
8474C5911BE78A85007DCF19 /* QuestionListTableCell.m in Sources */,
8490C4D71BF9DF1D006B6569 /* PictureStoryViewController.m in Sources */,
......
No preview for this file type
......@@ -13,7 +13,7 @@
#define kRedStarURL @"http://218.244.151.129:7580/"
// 正式环境
// #define kRedStarURL @"http://219.235.234.225:7580/"
//#define kRedStarURL @"http://219.235.234.225:7580/"
// 检查更新
......
......@@ -8,7 +8,7 @@
#import "AddPicTextTableViewCell.h"
@interface AddPicTextTableViewCell ()
@interface AddPicTextTableViewCell () <UITextViewDelegate>
@property (nonatomic, strong) UIImageView *backImageView1;
@property (nonatomic, strong) UILabel *placeholderLabel2;
@property (nonatomic, strong) UIView *lineView;
......@@ -137,6 +137,7 @@
{
if (!_titleTextView) {
_titleTextView = [[UITextView alloc] init];
_titleTextView.delegate = self;
_titleTextView.font = [UIFont systemFontOfSize:15.0];
_titleTextView.translatesAutoresizingMaskIntoConstraints = NO;
[self.backImageView1 addSubview:_titleTextView];
......@@ -183,7 +184,31 @@
}
#pragma mark - UItextView
- (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text
{
if (![text isEqualToString:@""]) {
self.placeholderLabel2.hidden = YES;
}
if ([text isEqualToString:@""] && range.location == 0 && range.length == 1) {
self.placeholderLabel2.hidden = NO;
}
if ([text isEqualToString:@"\n"]) {
[self.titleTextView resignFirstResponder];
if (textView.text.length != 0) {
self.placeholderLabel2.hidden = YES;
} else {
self.placeholderLabel2.hidden = NO;
}
return NO;
}
return YES;
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
......
......@@ -13,6 +13,8 @@
#import "CheckPicViewController.h"
#import "HttpClient.h"
#import "UIImage+Fit.h"
#import "CommonFunc.h"
#define kAddPicTableViewCell @"addPicTableCell"
#define kAddPicTextTableViewCell @"addPicTextTableCell"
......@@ -172,11 +174,9 @@
- (void)saveImage:(UIImage *)currentImage {
NSData *imageData = UIImageJPEGRepresentation(currentImage, 0.5);
NSString *imageName = [NSString stringWithFormat:@"picture%d", (int)_imageNameArray.count];
NSString *imageName = [CommonFunc md5Data:imageData];
[_imageNameArray addObject:imageName];
// 获取沙盒目录
NSString *fullPath = [[NSHomeDirectory() stringByAppendingPathComponent:@"Documents"] stringByAppendingPathComponent:imageName];
// 将图片写入文件
......@@ -371,7 +371,7 @@
NSString *imageName = _imageNameArray[indexPath.row - 1];
NSString *fullPath = [[NSHomeDirectory() stringByAppendingPathComponent:@"Documents"] stringByAppendingPathComponent:imageName];
UIImage *image = [UIImage imageWithContentsOfFile:fullPath];
UIImage *image00 = [self cutImage:image];
UIImage *image00 = [UIImage image:image fillSize:CGSizeMake((kScreenWidth - 60) / 2, 90)];
[cell.photoButton setImage:image00 forState:UIControlStateNormal];
[cell.photoButton removeTarget:self action:@selector(createImagePicker:) forControlEvents:UIControlEventTouchUpInside];
[cell.photoButton addTarget:self action:@selector(showBigPic:) forControlEvents:UIControlEventTouchUpInside];
......@@ -386,44 +386,17 @@
NSString *imageName = _imageNameArray[indexPath.row - 1];
NSString *fullPath = [[NSHomeDirectory() stringByAppendingPathComponent:@"Documents"] stringByAppendingPathComponent:imageName];
UIImage *image = [UIImage imageWithContentsOfFile:fullPath];
UIImage *image00 = [self cutImage:image];
UIImage *image00 = [UIImage image:image fillSize:CGSizeMake((kScreenWidth - 60) / 2, 90)];
[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;
return cell;
}
}
//裁剪图片
- (UIImage *)cutImage:(UIImage*)image
{
//压缩图片
CGSize newSize;
CGImageRef imageRef = nil;
if ((image.size.width / image.size.height) < (((kScreenWidth - 20 * 3) / 2) / 90)) {
newSize.width = image.size.width;
newSize.height = image.size.width * 90 / ((kScreenWidth - 20 * 3) / 2);
imageRef = CGImageCreateWithImageInRect([image CGImage], CGRectMake(0, fabs(image.size.height - newSize.height) / 2, newSize.width, newSize.height));
} else {
newSize.height = image.size.height;
newSize.width = image.size.height * ((kScreenWidth - 20 * 3) / 2) / 90;
imageRef = CGImageCreateWithImageInRect([image CGImage], CGRectMake(fabs(image.size.width - newSize.width) / 2, 0, newSize.width, newSize.height));
}
return [UIImage imageWithCGImage:imageRef];
}
#pragma mark - lazy loading
- (UITableView *)tableView
{
......
......@@ -23,7 +23,6 @@
@property (nonatomic, strong) UITextView *textView2;
@property (nonatomic, strong) StateTableView *stateTableView;
@property (nonatomic, strong) TimeTableView *timeTableView;
@end
......@@ -41,24 +41,24 @@
- (void)setup
{
self.groupTabBar = [[GroupTabBar alloc] initWithFrame:CGRectMake(0, 0, 100, 250)];
self.groupTabBar = [[GroupTabBar alloc] initWithFrame:CGRectMake(0, 0, 100, 200)];
_groupTabBar.delegate = self;
[self addSubview:_groupTabBar];
self.scopeTableView = [[ScopeTableView alloc] initWithTitle:[NSMutableArray arrayWithObjects:@"所有口碑", @"我的口碑", nil]];
GroupItems *scopeItem = [[GroupItems alloc] initWithTitle:@"问题范围" view:_scopeTableView];
GroupItems *scopeItem = [[GroupItems alloc] initWithTitle:@"口碑范围" view:_scopeTableView];
self.textView1 = [[UITextView alloc] init];
_textView1.delegate = self;
_textView1.tag = 9991;
self.placeholderLabel1 = [[UILabel alloc] initWithFrame:CGRectMake(5, 0, 100, 30)];
self.placeholderLabel1.text = @"请输入标题...";
self.placeholderLabel1.text = @"请输入内容...";
self.placeholderLabel1.font = [UIFont systemFontOfSize:15.0];
self.placeholderLabel1.textColor = kOnLineCellDetailColor;
[self.textView1 addSubview:self.placeholderLabel1];
GroupItems *textViewItem1 = [[GroupItems alloc] initWithTitle:@"标题类似于" view:_textView1];
GroupItems *textViewItem1 = [[GroupItems alloc] initWithTitle:@"内容类似于" view:_textView1];
self.textView2 = [[UITextView alloc] init];
_textView2.delegate = self;
......@@ -70,19 +70,15 @@
[self.textView2 addSubview:self.placeholderLabel2];
GroupItems *textViewItem2 = [[GroupItems alloc] initWithTitle:@"关键字类似于" view:_textView2];
self.stateTableView = [[StateTableView alloc] init];
GroupItems *stateItem = [[GroupItems alloc] initWithTitle:@"问题状态" view:_stateTableView];
self.timeTableView = [[TimeTableView alloc] init];
GroupItems *timeItem = [[GroupItems alloc] initWithTitle:@"时间段" view:_timeTableView];
[self insertSubview:_scopeTableView belowSubview:_groupTabBar];
[self insertSubview:_textView1 belowSubview:_groupTabBar];
[self insertSubview:_textView2 belowSubview:_groupTabBar];
[self insertSubview:_stateTableView belowSubview:_groupTabBar];
[self insertSubview:_timeTableView belowSubview:_groupTabBar];
_groupTabBar.items = @[scopeItem, textViewItem1, textViewItem2, stateItem, timeItem];
_groupTabBar.items = @[scopeItem, textViewItem1, textViewItem2, timeItem];
[_groupTabBar showIndex:0];
self.backView.backgroundColor = [UIColor whiteColor];
......
......@@ -27,7 +27,7 @@
#define kPictureTableViewCell @"pictureTabelViewCell"
@interface PictureViewController () <UITableViewDelegate, UITableViewDataSource, TaxisViewDelegate,ScopeTableViewDelegate, StateTableViewDelegate, TimeTableViewDelegate >
@interface PictureViewController () <UITableViewDelegate, UITableViewDataSource, TaxisViewDelegate,ScopeTableViewDelegate, TimeTableViewDelegate >
@property (nonatomic, strong) MenuView *menuView;
@property (nonatomic, strong) TaxisView *taxisView;
......@@ -337,7 +337,6 @@
if (!_screenView) {
_screenView = [[PicScreenView alloc] init];
_screenView.scopeTableView.scopeDeleagte = self;
_screenView.stateTableView.stateDeleagte = self;
_screenView.timeTableView.timeDeleagte = self;
_screenView.backgroundColor = [UIColor whiteColor];
}
......@@ -350,7 +349,7 @@
_bgView.alpha = 0;
_bgView.backgroundColor = [UIColor blackColor];
CGRect toFrame = CGRectMake(0, 45, kScreenWidth, 310);
CGRect toFrame = CGRectMake(0, 45, kScreenWidth, 260);
_screenView.alpha = 0.0;
_screenView.frame = toFrame;
[UIView animateWithDuration:0.3 animations:^{
......@@ -380,7 +379,6 @@
NSInteger selectedIndex = 0;
NSIndexPath *selectedIndexPath = [NSIndexPath indexPathForRow:selectedIndex inSection:0];
[_screenView.scopeTableView selectRowAtIndexPath:selectedIndexPath animated:NO scrollPosition:UITableViewScrollPositionNone];
[_screenView.stateTableView selectRowAtIndexPath:selectedIndexPath animated:NO scrollPosition:UITableViewScrollPositionNone];
[_screenView.timeTableView selectRowAtIndexPath:selectedIndexPath animated:NO scrollPosition:UITableViewScrollPositionNone];
_screenView.textView1.text = @"";
......@@ -433,8 +431,6 @@
[parameters setObject:array forKey:@"queryOrders"];
} else if (_screenView.groupTabBar.selectNumber == 3) {
} else if (_screenView.groupTabBar.selectNumber == 4) {
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
......@@ -537,11 +533,6 @@
}
- (void)stateTableViewClick:(NSInteger)row
{
_stateRow = row;
}
- (void)timeTableViewClick:(NSInteger)row
{
_timeRow = row;
......
......@@ -18,6 +18,7 @@
#import "HttpClient.h"
#import <MBProgressHUD.h>
#import "AddQuestionTableCell.h"
#import "UIImage+Fit.h"
#define kPhotoTag 3339922
......@@ -153,7 +154,7 @@
- (void)saveImage:(UIImage *)currentImage {
NSData *imageData = UIImageJPEGRepresentation(currentImage, 0.5);
NSString *imageName = [NSString stringWithFormat:@"imageName%d", (int)_imageNameArray.count];
NSString *imageName = [CommonFunc md5Data:imageData];
[_imageNameArray addObject:imageName];
......@@ -408,7 +409,7 @@
NSString *imageName = _imageNameArray[_imageNameArray.count - 1];
NSString *fullPath = [[NSHomeDirectory() stringByAppendingPathComponent:@"Documents"] stringByAppendingPathComponent:imageName];
UIImage *image = [UIImage imageWithContentsOfFile:fullPath];
UIImage *image00 = [self cutImage:image];
UIImage *image00 = [UIImage image:image fillSize:CGSizeMake((kScreenWidth - 60) / 2, 90)];
cell.photoButton1.tag = kPhotoTag + _imageNameArray.count - 1;
[cell.photoButton1 setImage:image00 forState:UIControlStateNormal];
......@@ -440,14 +441,14 @@
NSString *imageName0 = _imageNameArray[(indexPath.row - 3) * 2];
NSString *fullPath0 = [[NSHomeDirectory() stringByAppendingPathComponent:@"Documents"] stringByAppendingPathComponent:imageName0];
UIImage *image0 = [UIImage imageWithContentsOfFile:fullPath0];
UIImage *image00 = [self cutImage:image0];
UIImage *image00 = [UIImage image:image0 fillSize:CGSizeMake((kScreenWidth - 60) / 2, 90)];
[cell.photoButton1 setImage:image00 forState:UIControlStateNormal];
NSString *imageName1 = _imageNameArray[(indexPath.row - 3) * 2 + 1];
NSLog(@"imageName = %@", imageName1);
NSString *fullPath1 = [[NSHomeDirectory() stringByAppendingPathComponent:@"Documents"] stringByAppendingPathComponent:imageName1];
UIImage *image1 = [UIImage imageWithContentsOfFile:fullPath1];
UIImage *image11 = [self cutImage:image1];
UIImage *image11 = [UIImage image:image1 fillSize:CGSizeMake((kScreenWidth - 60) / 2, 90)];
[cell.photoButton2 setImage:image11 forState:UIControlStateNormal];
[cell.photoButton1 addTarget:self action:@selector(showPicture:) forControlEvents:UIControlEventTouchUpInside];
......@@ -463,30 +464,6 @@
}
//裁剪图片
- (UIImage *)cutImage:(UIImage*)image
{
//压缩图片
CGSize newSize;
CGImageRef imageRef = nil;
if ((image.size.width / image.size.height) < (((kScreenWidth - 20 * 3) / 2) / 90)) {
newSize.width = image.size.width;
newSize.height = image.size.width * 90 / ((kScreenWidth - 20 * 3) / 2);
imageRef = CGImageCreateWithImageInRect([image CGImage], CGRectMake(0, fabs(image.size.height - newSize.height) / 2, newSize.width, newSize.height));
} else {
newSize.height = image.size.height;
newSize.width = image.size.height * ((kScreenWidth - 20 * 3) / 2) / 90;
imageRef = CGImageCreateWithImageInRect([image CGImage], CGRectMake(fabs(image.size.width - newSize.width) / 2, 0, newSize.width, newSize.height));
}
return [UIImage imageWithCGImage:imageRef];
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
if (indexPath.row == 0) {
......
......@@ -21,7 +21,7 @@
#import "NoDataView.h"
#import <MBProgressHUD.h>
#import "UIImage+Fit.h"
#import <MJRefresh.h>
#define kQuestionListCell @"questionListTableViewCell"
......
......@@ -10,7 +10,7 @@
@protocol SOPTableViewDelegate <NSObject>
- (void)selectRowWithDetailTitle:(NSString *)detailTitle;
- (void)selectRowWithDetailRow:(NSInteger )row;
@end
......
......@@ -73,8 +73,8 @@
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
if (_sop_delegate && [_sop_delegate respondsToSelector:@selector(selectRowWithDetailTitle:)]) {
[_sop_delegate selectRowWithDetailTitle:_titleArray[indexPath.row]];
if (_sop_delegate && [_sop_delegate respondsToSelector:@selector(selectRowWithDetailRow:)]) {
[_sop_delegate selectRowWithDetailRow:indexPath.row];
}
}
......
......@@ -22,7 +22,10 @@
@property (nonatomic, strong) GroupTabBar *groupTabBar;
@property (nonatomic, strong) NSArray *titleArray;
@property (nonatomic, strong) NSArray *allTopicArray;
@property (nonatomic, strong) NSArray *allTableViewArray;
@property (nonatomic, strong) NSArray *titleArray0;
@property (nonatomic, strong) NSArray *titleArray1;
@property (nonatomic, strong) NSArray *titleArray2;
@property (nonatomic, strong) NSArray *titleArray3;
......@@ -31,8 +34,9 @@
@property (nonatomic, strong) NSArray *titleArray6;
@property (nonatomic, strong) NSArray *titleArray7;
@property (nonatomic, strong) NSArray *titleArray8;
@property (nonatomic, strong) NSArray *titleArray9;
@property (nonatomic, strong) NSString *detailTitle;
@property (nonatomic, assign) NSInteger row;
@property (nonatomic, strong) UIButton *resetBtn;
@property (nonatomic, strong) UIButton *queryBtn;
......@@ -42,6 +46,8 @@
@property (nonatomic, strong) NSMutableArray *attachmentArray;
@property (nonatomic, strong) NSMutableDictionary *sopDict;
@end
@implementation SOPViewController
......@@ -57,19 +63,10 @@
self.navigationController.navigationBar.translucent = NO;
}
self.attachmentArray = [NSMutableArray array];
self.titleArray = [NSArray arrayWithObjects:@"质量管理",@"价格管理",@"现场服务",@"售后服务",@"环境管理",@"现场管理", @"400呼叫管理",@"单品管理",nil];
[self setupData];
self.attachmentArray = [NSMutableArray array];
self.titleArray1 = [NSArray arrayWithObjects:@"商品环保、质量检测管理规定",@"商品资质管理规定",@"三年质保管理规定",@"商品绿色展陈管理规定",@" 附件:绿色展陈操作手册", nil];
self.titleArray2 = [NSArray arrayWithObjects:@"商品标价签管理规定",@"商品调价管理规定",@"商场全国大促活动执行管理规定",@"商户促销活动管理规定",@"“全场最低七折”管理规定", nil];
self.titleArray3 = [NSArray arrayWithObjects:@"商场现场服务基本规定",@"便民服务管理规定",@"营业员管理规定",@"播音管理规定",@"商场实施管理者“顾客之声VOC”管理规定", @"30天无理由退货管理规定",@"15分钟退单管理规定",@"商场全员顾客服务规范管理规定",@" 附件:停车场安全员岗位车辆指挥标准手势手册",@"设计免费咨询管理规定",nil];
self.titleArray4 = [NSArray arrayWithObjects:@"商场客诉处理管理规定",@"先行赔付管理规定",@"商品质量保证金管理规定",@"送货跟单回访管理规定", nil];
self.titleArray5 = [NSArray arrayWithObjects:@"商场基础环境管理规定",@"口碑商场环境管理规定",@" 附件:室内地面维修养护规范",@" 附件:商户装修“五区管理法”规定",@" 附件:喷水池管理规范", @"商场停车场管理规定",@"商场洗手间管理规范",@"商场综合物料管理规定",nil];
self.titleArray6 = [NSArray arrayWithObjects:@"楼层日常巡场管理规定",@"商户进/出货管理规定",@"商户进场管理规定",@"商户撤场管理规定",@"商户信用等级评定管理规定", nil];
self.titleArray7 = [NSArray arrayWithObjects:@"呼叫中心商场虚拟座席远程管理规定", nil];
self.titleArray8 = [NSArray arrayWithObjects:@"商品信息管理规定", nil];
[self setupNav];
......@@ -79,17 +76,91 @@
[self.queryBtn addTarget:self action:@selector(queryClick:) forControlEvents:UIControlEventTouchUpInside];
}
- (void)resetClick:(UIButton *)sender
- (void)setupData
{
self.titleArray = [NSArray arrayWithObjects:@"手册使用说明",@"服务口碑实施管理规定",@"质量管理",@"价格管理",@"现场服务",@"售后服务", @"环境管理",@"现场管理",@"400呼叫管理",@"单品管理",nil];
self.titleArray0 = [NSArray arrayWithObjects:@"手册使用说明",nil];
self.titleArray1 = [NSArray arrayWithObjects:@"服务口碑实施管理规定",nil];
self.titleArray2 = [NSArray arrayWithObjects:@"商品环保、质量检测管理规定",@"商品资质管理规定",@"商场三年质保管理规定",@"绿色展陈管理规定", nil];
self.titleArray3 = [NSArray arrayWithObjects:@"商品标价签管理规定",@"商品调价管理规定",@"商场全国大促活动执行管理规定",@"商户促销活动管理规定",@"“全场最低七折”管理规定", nil];
self.titleArray4 = [NSArray arrayWithObjects:@"商场现场基本服务基本规范",@"便民服务管理规定",@"营业员管理规定",@"播音管理规定",@"商场实施管理者“顾客之声VOC”管理规定", @"30天无理由退货管理规定",@"15分钟退单管理规定",@"商场全员顾客服务规范管理规定",@"设计免费咨询管理规定",nil];
self.titleArray5 = [NSArray arrayWithObjects:@"商场客诉处理管理规定",@"先行赔付管理规定",@"商品质量保证金管理规定",@"送货跟单回访管理规定", nil];
self.titleArray6 = [NSArray arrayWithObjects:@"商场基础环境管理规范",@"口碑商场环境管理规范", @"商场停车场管理规定",@"商场洗手间管理规范",@"商场综合物料管理规定",nil];
self.titleArray7 = [NSArray arrayWithObjects:@"楼层日常巡场管理规定",@"商户进/出货管理规定",@"商户进场管理规定",@"商户撤场管理规定",@"红星美凯龙商户信用等级评定办法", nil];
self.titleArray8 = [NSArray arrayWithObjects:@"呼叫中心商场虚拟座席远程管理规定", nil];
self.titleArray9 = [NSArray arrayWithObjects:@"商品信息管理规定", nil];
self.allTopicArray = [NSMutableArray arrayWithObjects:_titleArray0, _titleArray1,_titleArray2,_titleArray3,_titleArray4,_titleArray5,_titleArray6,_titleArray7,_titleArray8,_titleArray9,nil];
self.sopDict = [NSMutableDictionary dictionary];
[_sopDict setObject:@"FFKB-SYSM" forKey:@"手册使用说明手册使用说明"];
[_sopDict setObject:@"FFKB-SSGL-01" forKey:@"服务口碑实施管理规定服务口碑实施管理规定"];
[_sopDict setObject:@"FFKB-ZLGL-01" forKey:@"质量管理商品环保、质量检测管理规定"];
[_sopDict setObject:@"FFKB-ZLGL-02" forKey:@"质量管理商品资质管理规定"];
[_sopDict setObject:@"FFKB-ZLGL-03" forKey:@"质量管理商场三年质保管理规定"];
[_sopDict setObject:@"FFKB-ZLGL-04" forKey:@"质量管理绿色展陈管理规定"];
[_sopDict setObject:@"FFKB-JGGL-01" forKey:@"价格管理商品标价签管理规定"];
[_sopDict setObject:@"FFKB-JGGL-02" forKey:@"价格管理商品调价管理规定"];
[_sopDict setObject:@"FFKB-JGGL-03" forKey:@"价格管理商场全国大促活动执行管理规定"];
[_sopDict setObject:@"FFKB-JGGL-04" forKey:@"价格管理商户促销活动管理规定"];
[_sopDict setObject:@"FFKB-JGGL-05" forKey:@"价格管理“全场最低七折”管理规定"];
[_sopDict setObject:@"FFKB-XCFW-01" forKey:@"现场服务商场现场基本服务基本规范"];
[_sopDict setObject:@"FFKB-XCFW-02" forKey:@"现场服务便民服务管理规定"];
[_sopDict setObject:@"FFKB-XCFW-03" forKey:@"现场服务营业员管理规定"];
[_sopDict setObject:@"FFKB-XCFW-04" forKey:@"现场服务播音管理规定"];
[_sopDict setObject:@"FFKB-XCFW-05" forKey:@"现场服务商场实施管理者“顾客之声VOC”管理规定"];
[_sopDict setObject:@"FFKB-XCFW-06" forKey:@"现场服务30天无理由退货管理规定"];
[_sopDict setObject:@"FFKB-XCFW-07" forKey:@"现场服务15分钟退单管理规定"];
[_sopDict setObject:@"FFKB-XCFW-08" forKey:@"现场服务商场全员顾客服务规范管理规定"];
[_sopDict setObject:@"FFKB-XCFW-09" forKey:@"现场服务设计免费咨询管理规定"];
[_sopDict setObject:@"FFKB-SHFW-01" forKey:@"售后服务商场客诉处理管理规定"];
[_sopDict setObject:@"FFKB-SHFW-02" forKey:@"售后服务先行赔付管理规定"];
[_sopDict setObject:@"FFKB-SHFW-03" forKey:@"售后服务商品质量保证金管理规定"];
[_sopDict setObject:@"FFKB-SHFW-04" forKey:@"售后服务送货跟单回访管理规定"];
[_sopDict setObject:@"FFKB-HJGL-01" forKey:@"环境管理商场基础环境管理规范"];
[_sopDict setObject:@"FFKB-HJGL-02" forKey:@"环境管理口碑商场环境管理规范"];
[_sopDict setObject:@"FFKB-HJGL-03" forKey:@"环境管理商场停车场管理规定"];
[_sopDict setObject:@"FFKB-HJGL-04" forKey:@"环境管理商场洗手间管理规范"];
[_sopDict setObject:@"FFKB-HJGL-05" forKey:@"环境管理商场综合物料管理规定"];
[_sopDict setObject:@"FFKB-XCGL-01" forKey:@"现场管理楼层日常巡场管理规定"];
[_sopDict setObject:@"FFKB-XCGL-02" forKey:@"现场管理商户进/出货管理规定"];
[_sopDict setObject:@"FFKB-XCGL-03" forKey:@"现场管理商户进场管理规定"];
[_sopDict setObject:@"FFKB-XCGL-04" forKey:@"现场管理商户撤场管理规定"];
[_sopDict setObject:@"FFKB-XCGL-05" forKey:@"现场管理红星美凯龙商户信用等级评定办法"];
[_sopDict setObject:@"FFKB-HJGL-01" forKey:@"400呼叫管理呼叫中心商场虚拟座席远程管理规定"];
[_sopDict setObject:@"FFKB-DPGL-01" forKey:@"单品管理商品信息管理规定"];
}
- (void)resetClick:(UIButton *)sender
{
NSInteger selectedIndex = 0;
NSIndexPath *selectedIndexPath = [NSIndexPath indexPathForRow:selectedIndex inSection:0];
for (SOPTableView *sop in _allTableViewArray) {
[sop selectRowAtIndexPath:selectedIndexPath animated:NO scrollPosition:UITableViewScrollPositionNone];
}
_row = 0;
}
- (void)queryClick:(UIButton *)sender
{
NSString *url = [NSString stringWithFormat:@"%@%@", kRedStarURL, kGetAttachmentsURL];
HttpClient *http = [[HttpClient alloc] initWithUrl:url];
NSMutableArray *titleArray = _allTopicArray[_groupTabBar.selectNumber];
NSString *encode = [_sopDict objectForKey:[NSString stringWithFormat:@"%@%@", _titleArray[_groupTabBar.selectNumber],titleArray[_row]]];
NSDictionary *parameters = @{@"type":@"sop",
@"encode":@"123"
@"encode":encode
};
[http getAttachmentsWithParameters:parameters completion:^(id response, NSError *error) {
NSLog(@"7.1 口碑标注附件列表 = %@, error = %@", response, error);
......@@ -101,6 +172,12 @@
[_attachmentArray addObject:atta];
}
if (_attachmentArray.count == 0) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"提示" message:@"暂无附件!" delegate:self cancelButtonTitle:nil otherButtonTitles:@"确定", nil];
[alert show];
return;
}
CGFloat tableH = _attachmentArray.count * 45;
if (!_bgView) {
......@@ -131,6 +208,7 @@
}];
_row = 0;
}
- (void)closeRedView
......@@ -251,38 +329,47 @@
NSInteger selectedIndex = 0;
NSIndexPath *selectedIndexPath = [NSIndexPath indexPathForRow:selectedIndex inSection:0];
SOPTableView *tableView0 = [[SOPTableView alloc] initWithTitleArray:_titleArray0];
tableView0.sop_delegate = self;
GroupItems *tableItem0 = [[GroupItems alloc] initWithTitle:_titleArray[0] view:tableView0];
SOPTableView *tableView1 = [[SOPTableView alloc] initWithTitleArray:_titleArray1];
tableView1.sop_delegate = self;
GroupItems *tableItem1 = [[GroupItems alloc] initWithTitle:_titleArray[0] view:tableView1];
GroupItems *tableItem1 = [[GroupItems alloc] initWithTitle:_titleArray[1] view:tableView1];
SOPTableView *tableView2 = [[SOPTableView alloc] initWithTitleArray:_titleArray2];
tableView2.sop_delegate = self;
GroupItems *tableItem2 = [[GroupItems alloc] initWithTitle:_titleArray[1] view:tableView2];
GroupItems *tableItem2 = [[GroupItems alloc] initWithTitle:_titleArray[2] view:tableView2];
SOPTableView *tableView3 = [[SOPTableView alloc] initWithTitleArray:_titleArray3];
tableView3.sop_delegate = self;
GroupItems *tableItem3 = [[GroupItems alloc] initWithTitle:_titleArray[2] view:tableView3];
GroupItems *tableItem3 = [[GroupItems alloc] initWithTitle:_titleArray[3] view:tableView3];
SOPTableView *tableView4 = [[SOPTableView alloc] initWithTitleArray:_titleArray4];
tableView4.sop_delegate = self;
GroupItems *tableItem4 = [[GroupItems alloc] initWithTitle:_titleArray[3] view:tableView4];
GroupItems *tableItem4 = [[GroupItems alloc] initWithTitle:_titleArray[4] view:tableView4];
SOPTableView *tableView5 = [[SOPTableView alloc] initWithTitleArray:_titleArray5];
tableView5.sop_delegate = self;
GroupItems *tableItem5 = [[GroupItems alloc] initWithTitle:_titleArray[4] view:tableView5];
GroupItems *tableItem5 = [[GroupItems alloc] initWithTitle:_titleArray[5] view:tableView5];
SOPTableView *tableView6 = [[SOPTableView alloc] initWithTitleArray:_titleArray6];
tableView6.sop_delegate = self;
GroupItems *tableItem6 = [[GroupItems alloc] initWithTitle:_titleArray[5] view:tableView6];
GroupItems *tableItem6 = [[GroupItems alloc] initWithTitle:_titleArray[6] view:tableView6];
SOPTableView *tableView7 = [[SOPTableView alloc] initWithTitleArray:_titleArray7];
tableView7.sop_delegate = self;
GroupItems *tableItem7 = [[GroupItems alloc] initWithTitle:_titleArray[6] view:tableView7];
GroupItems *tableItem7 = [[GroupItems alloc] initWithTitle:_titleArray[7] view:tableView7];
SOPTableView *tableView8 = [[SOPTableView alloc] initWithTitleArray:_titleArray8];
tableView8.sop_delegate = self;
GroupItems *tableItem8 = [[GroupItems alloc] initWithTitle:_titleArray[7] view:tableView8];
GroupItems *tableItem8 = [[GroupItems alloc] initWithTitle:_titleArray[8] view:tableView8];
SOPTableView *tableView9 = [[SOPTableView alloc] initWithTitleArray:_titleArray9];
tableView9.sop_delegate = self;
GroupItems *tableItem9 = [[GroupItems alloc] initWithTitle:_titleArray[9] view:tableView9];
[tableView0 selectRowAtIndexPath:selectedIndexPath animated:NO scrollPosition:UITableViewScrollPositionNone];
[tableView1 selectRowAtIndexPath:selectedIndexPath animated:NO scrollPosition:UITableViewScrollPositionNone];
[tableView2 selectRowAtIndexPath:selectedIndexPath animated:NO scrollPosition:UITableViewScrollPositionNone];
[tableView3 selectRowAtIndexPath:selectedIndexPath animated:NO scrollPosition:UITableViewScrollPositionNone];
......@@ -291,7 +378,11 @@
[tableView6 selectRowAtIndexPath:selectedIndexPath animated:NO scrollPosition:UITableViewScrollPositionNone];
[tableView7 selectRowAtIndexPath:selectedIndexPath animated:NO scrollPosition:UITableViewScrollPositionNone];
[tableView8 selectRowAtIndexPath:selectedIndexPath animated:NO scrollPosition:UITableViewScrollPositionNone];
[tableView9 selectRowAtIndexPath:selectedIndexPath animated:NO scrollPosition:UITableViewScrollPositionNone];
self.allTableViewArray = [NSMutableArray arrayWithObjects:tableView0,tableView1, tableView2,tableView3,tableView4,tableView5,tableView6,tableView7,tableView8,tableView9,nil];
[self.view insertSubview:tableView0 belowSubview:_groupTabBar];
[self.view insertSubview:tableView1 belowSubview:_groupTabBar];
[self.view insertSubview:tableView2 belowSubview:_groupTabBar];
[self.view insertSubview:tableView3 belowSubview:_groupTabBar];
......@@ -300,8 +391,10 @@
[self.view insertSubview:tableView6 belowSubview:_groupTabBar];
[self.view insertSubview:tableView7 belowSubview:_groupTabBar];
[self.view insertSubview:tableView8 belowSubview:_groupTabBar];
[self.view insertSubview:tableView9 belowSubview:_groupTabBar];
_groupTabBar.items = @[tableItem1, tableItem2, tableItem3, tableItem4, tableItem5, tableItem6, tableItem7, tableItem8];
_groupTabBar.items = @[ tableItem0,tableItem1, tableItem2, tableItem3, tableItem4, tableItem5, tableItem6, tableItem7, tableItem8, tableItem9];
[_groupTabBar showIndex:0];
......@@ -375,9 +468,9 @@
}
#pragma mark - SOPTableViewDelegate
- (void)selectRowWithDetailTitle:(NSString *)detailTitle
- (void)selectRowWithDetailRow:(NSInteger)row
{
_detailTitle = detailTitle;
_row = row;
}
#pragma mark - GroupTabBarDelegate
......
......@@ -8,6 +8,7 @@
#import "InspectUpLoadFootView.h"
#import <UIImageView+WebCache.h>
#import "UIImage+Fit.h"
@implementation InspectUpLoadFootView
......@@ -48,6 +49,7 @@
imageView.userInteractionEnabled = YES;
NSDictionary *dict = (NSDictionary *)answerAttachments[i];
NSURL *imageUrl = [NSURL URLWithString:[NSString stringWithFormat:@"%@%@", kRedStarURL ,dict[@"fileUrl"]]];
//imageView.contentMode = UIViewContentModeScaleAspectFit;
[imageView sd_setImageWithURL:imageUrl placeholderImage:[UIImage imageNamed:@"default_pic"]];
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(imageCilck:)];
[imageView addGestureRecognizer:tap];
......
......@@ -21,6 +21,7 @@
#import "InspectAddCell.h"
#import "InspectPicAddCell.h"
#import "InpectPictureCell.h"
#import "UIImage+Fit.h"
#define kPhotoTag 2221113
......@@ -144,14 +145,15 @@
- (void)saveImage:(UIImage *)currentImage {
NSData *imageData = UIImageJPEGRepresentation(currentImage, 0.5);
NSString *imageName = [NSString stringWithFormat:@"imageName%d", (int)_imageNameArray.count];
[_imageNameArray addObject:imageName];
NSString *imageName = [CommonFunc md5Data:imageData];
[_imageNameArray addObject:imageName];
// 获取沙盒目录
NSString *fullPath = [[NSHomeDirectory() stringByAppendingPathComponent:@"Documents"] stringByAppendingPathComponent:imageName];
// 将图片写入文件
[imageData writeToFile:fullPath atomically:NO];
imageData = nil;
}
#pragma mark - TableView Delegate/DataSource
......@@ -194,7 +196,7 @@
NSString *imageName = _imageNameArray[_imageNameArray.count - 1];
NSString *fullPath = [[NSHomeDirectory() stringByAppendingPathComponent:@"Documents"] stringByAppendingPathComponent:imageName];
UIImage *image = [UIImage imageWithContentsOfFile:fullPath];
UIImage *image00 = [self cutImage:image];
UIImage *image00 = [UIImage image:image fillSize:CGSizeMake((kScreenWidth - 60) / 2, 90)];
[cell.photoButton1 setImage:image00 forState:UIControlStateNormal];
[cell.photoButton1 addTarget:self action:@selector(showPicture:) forControlEvents:UIControlEventTouchUpInside];
......@@ -229,13 +231,13 @@
NSString *imageName0 = _imageNameArray[(indexPath.row - 1) * 2];
NSString *fullPath0 = [[NSHomeDirectory() stringByAppendingPathComponent:@"Documents"] stringByAppendingPathComponent:imageName0];
UIImage *image0 = [UIImage imageWithContentsOfFile:fullPath0];
UIImage *image00 = [self cutImage:image0];
UIImage *image00 = [UIImage image:image0 fillSize:CGSizeMake((kScreenWidth - 60) / 2, 90)];
[cell.photoButton1 setImage:image00 forState:UIControlStateNormal];
NSString *imageName1 = _imageNameArray[(indexPath.row - 1) * 2 + 1];
NSString *fullPath1 = [[NSHomeDirectory() stringByAppendingPathComponent:@"Documents"] stringByAppendingPathComponent:imageName1];
UIImage *image1 = [UIImage imageWithContentsOfFile:fullPath1];
UIImage *image11 = [self cutImage:image1];
UIImage *image11 = [UIImage image:image1 fillSize:CGSizeMake((kScreenWidth - 60) / 2, 90)];
[cell.photoButton2 setImage:image11 forState:UIControlStateNormal];
......@@ -250,29 +252,6 @@
}
}
//裁剪图片
- (UIImage *)cutImage:(UIImage*)image
{
//压缩图片
CGSize newSize;
CGImageRef imageRef = nil;
if ((image.size.width / image.size.height) < (((kScreenWidth - 20 * 3) / 2) / 90)) {
newSize.width = image.size.width;
newSize.height = image.size.width * 90 / ((kScreenWidth - 20 * 3) / 2);
imageRef = CGImageCreateWithImageInRect([image CGImage], CGRectMake(0, fabs(image.size.height - newSize.height) / 2, newSize.width, newSize.height));
} else {
newSize.height = image.size.height;
newSize.width = image.size.height * ((kScreenWidth - 20 * 3) / 2) / 90;
imageRef = CGImageCreateWithImageInRect([image CGImage], CGRectMake(fabs(image.size.width - newSize.width) / 2, 0, newSize.width, newSize.height));
}
return [UIImage imageWithCGImage:imageRef];
}
// section高度
......
......@@ -52,7 +52,7 @@
{
_taskDetail = taskDetail;
self.shopNameLabel.text = [NSString stringWithFormat:@"%@", taskDetail.store_name];
self.rankDetailView.addressLabel.text = [NSString stringWithFormat:@"%@", taskDetail.storePath];
// self.rankDetailView.addressLabel.text = [NSString stringWithFormat:@"%@", taskDetail.];
self.rankDetailView.titleLabel.text = [NSString stringWithFormat:@"%@", taskDetail.name];
self.rankDetailView.reportTimeLabel.text = @"上报时间";
self.rankDetailView.totalScoreLabel.text = @"总评分";
......
......@@ -575,7 +575,12 @@
[_rankDetailHeaderView.rankDetailView.gradeLabel setAttributedText:rankAttr];
}
self.rankDetailHeaderView.backgroundColor = kSectionBackGroundColor;
if (self.storeAddress == nil || self.storeAddress == NULL || [self.storeAddress isEqual:[NSNull null]] || self.storeAddress == Nil || [self.storeAddress isEqualToString:@"(null)"]) {
self.rankDetailHeaderView.rankDetailView.addressLabel.text = @"";
} else {
self.rankDetailHeaderView.rankDetailView.addressLabel.text = [NSString stringWithFormat:@"%@", self.storeAddress];
}
self.rankDetailHeaderView.rankDetailView.storePictures = self.storePictures;
}
return _rankDetailHeaderView;
......
......@@ -296,6 +296,7 @@ typedef NSComparisonResult (^NSComparator)(id obj1, id obj2);
[questionTempArr addObject:question];
}
_allQuestionArray = questionTempArr;
NSLog(@"111quesssssssss.count === %ld", _allQuestionArray.count);
[self.tableView reloadData];
[MBProgressHUD hideHUDForView:self.view animated:YES];
......@@ -368,7 +369,6 @@ typedef NSComparisonResult (^NSComparator)(id obj1, id obj2);
{
NSString *url = [NSString stringWithFormat:@"%@%@", kRedStarURL, kInspectListURL];
NSLog(@"uuuurl = %@", url);
HttpClient *httpCilent = [[HttpClient alloc] initWithUrl:url];
......@@ -378,18 +378,20 @@ typedef NSComparisonResult (^NSComparator)(id obj1, id obj2);
@"pageNumber":@(0),
@"pageSize":@(2)
};
NSLog(@"parrrrr = %@", parameters);
[httpCilent getInspectListWithParameters:parameters completion:^(id response, NSError *error) {
NSLog(@"巡检列表%@", response);
NSLog(@"error = %@", error);
NSDictionary *dataDict = response[@"data"];
NSArray *dataArray = dataDict[@"records"];
NSMutableArray *tempArray = [NSMutableArray array];
for (NSDictionary *dict in dataArray) {
TaskListModel *taskList = [[TaskListModel alloc] init];
[taskList setValuesForKeysWithDictionary:dict];
[_taskListDataArray addObject:taskList];
[tempArray addObject:taskList];
}
_taskListDataArray = [NSMutableArray arrayWithArray:tempArray];
if (_taskListDataArray.count != 0) {
[_sectionArray addObject:@"口碑巡检"];
}
......@@ -414,8 +416,6 @@ typedef NSComparisonResult (^NSComparator)(id obj1, id obj2);
};
// 发起请求
HttpClient *httpClient = [[HttpClient alloc] initWithUrl:urlStr];
//
__block HomeViewController *weakSelf = self;
// 请求问题列表
[httpClient getQuestionListWithParameters:parameters completion:^(id response, NSError *error) {
......@@ -426,11 +426,13 @@ typedef NSComparisonResult (^NSComparator)(id obj1, id obj2);
NSDictionary *recordsDict = (NSDictionary *)dataDict[@"records"];
NSLog(@"问题与知识列表recods = %@", response);
NSLog(@"error = %@", error);
NSMutableArray *tempArray = [NSMutableArray array];
for (NSDictionary *questionDict in recordsDict) {
QuestionModel *question = [[QuestionModel alloc] init];
[question setValuesForKeysWithDictionary:questionDict];
[weakSelf.allQuestionArray addObject:question];
[tempArray addObject:question];
}
_allQuestionArray = [NSMutableArray arrayWithArray:tempArray];
if (_allQuestionArray.count != 0) {
[_sectionArray addObject:@"问题知识"];
}
......@@ -461,10 +463,7 @@ typedef NSComparisonResult (^NSComparator)(id obj1, id obj2);
// 请求问题列表
[httpClient queryPicturePraiseWithParameters:parameters completion:^(id response, NSError *error) {
[self requestQuestionList];
NSLog(@"图说口碑 response = %@ error = %@" , response, error);
NSDictionary *dataDict = response[@"data"];
NSArray *dataArray = dataDict[@"records"];
NSMutableArray *tempArray = [NSMutableArray array];
......@@ -473,7 +472,7 @@ typedef NSComparisonResult (^NSComparator)(id obj1, id obj2);
[picList setValuesForKeysWithDictionary:dict];
[tempArray addObject:picList];
}
_allPraiseListArray = tempArray;
_allPraiseListArray = [NSMutableArray arrayWithArray:tempArray];
if (_allPraiseListArray.count != 0) {
[_sectionArray addObject:@"商场风采"];
}
......@@ -670,9 +669,18 @@ typedef NSComparisonResult (^NSComparator)(id obj1, id obj2);
if (!cell) {
cell = [[RankingListCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:kHomeRankingListCell];
}
for (int i = 0 ; i < _allRankListArray.count; i++) {
RankListModel *rank = _allRankListArray[i];
if (i == 0) {
rank.index = i + 1;
} else {
RankListModel *prevRank = _allRankListArray[i-1];
rank.index = rank.score == prevRank.score ? prevRank.index: i + 1;
}
}
RankListModel *rankList = _allRankListArray[indexPath.row - 1];
cell.rankList = rankList;
cell.gradeImageView.image = [UIImage imageNamed:[NSString stringWithFormat:@"medal_0%d", rankList.index+ 1]];
cell.gradeImageView.image = [UIImage imageNamed:[NSString stringWithFormat:@"medal_0%d", rankList.index]];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
return cell;
}
......
......@@ -78,13 +78,13 @@
NSDictionary *dict = response[@"data"];
NSString *newVersion = [NSString stringWithFormat:@"%@", dict[@"version"]];
self.jumpURL = [NSString stringWithFormat:@"%@", dict[@"url"]];
NSLog(@"newVersion = %@, _jumpURL = %@", newVersion, _jumpURL);
[self checkAppUpdate:newVersion forceUpdate:[NSString stringWithFormat:@"%@", dict[@"forceUpdate"]]];
BOOL isForce = [dict[@"forceUpdate"] boolValue];
[self checkAppUpdate:newVersion forceUpdate:isForce];
}
}];
}
- (void)checkAppUpdate:(NSString *)newVersion forceUpdate:(NSString *)forceUpdate
- (void)checkAppUpdate:(NSString *)newVersion forceUpdate:(BOOL)forceUpdate
{
// 获取当前版本
NSDictionary *infoDic = [[NSBundle mainBundle] infoDictionary];
......@@ -93,7 +93,7 @@
if (![currentVersion isEqualToString:newVersion]) {
if ([forceUpdate isEqualToString:@"1"]) {
if (forceUpdate) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"提示!" message:[NSString stringWithFormat:@"发现新版本:%@,如果不更新,可能造成本应用无法使用!", newVersion] delegate:self cancelButtonTitle:nil otherButtonTitles:@"前往更新", nil];
alert.delegate = self;
alert.tag = 322234;
......@@ -107,7 +107,7 @@
}
}
- (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
if (alertView.tag == 3058284) {
if (buttonIndex == 1) {
......
......@@ -120,6 +120,11 @@
[self.tabBarController dismissViewControllerAnimated:YES completion:nil];
}
}
if (buttonIndex == 1 && alertView.tag == 3058284) {
NSString *url = self.jumpURL;
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:url]];
}
}
#pragma mark - Private Methods
......@@ -159,14 +164,6 @@
}
}
- (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex
{
if (buttonIndex == 1 && alertView.tag == 3058284) {
NSString *url = self.jumpURL;
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:url]];
}
}
#pragma mark - TableView Delegate/DataSource
......@@ -198,7 +195,7 @@
AboutMeViewController *about = [[AboutMeViewController alloc] init];
[self.navigationController pushViewController:about animated:YES];
} else {
self.numberActionSheet = [[UIActionSheet alloc] initWithTitle:@"请求数量" delegate:self cancelButtonTitle:@"取消" destructiveButtonTitle:nil otherButtonTitles:@"10",@"20",@"30",@"40", @"50", nil];
self.numberActionSheet = [[UIActionSheet alloc] initWithTitle:@"列表请求数量设置" delegate:self cancelButtonTitle:@"取消" destructiveButtonTitle:nil otherButtonTitles:@"10",@"20",@"30",@"40", @"50", nil];
[_numberActionSheet showInView:self.view];
}
......
//
// UIImage+Fit.h
// redstar
//
// Created by admin on 15/12/28.
// Copyright © 2015年 ZWF. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface UIImage (Fit)
//计算适合的大小。并保留其原始图片大小
+ (CGSize)fitSize:(CGSize)thisSize inSize:(CGSize)aSize;
// 返回调整的缩略图
+ (UIImage *)image:(UIImage *)image fitInSize:(CGSize)viewsize;
//返回居中的缩略图
+ (UIImage *)image:(UIImage *)image centerInSize:(CGSize)viewsize;
// 返回填充的缩略图
+ (UIImage *)image:(UIImage *)image fillSize:(CGSize)viewsize;
@end
//
// UIImage+Fit.m
// redstar
//
// Created by admin on 15/12/28.
// Copyright © 2015年 ZWF. All rights reserved.
//
#import "UIImage+Fit.h"
@implementation UIImage (Fit)
//计算适合的大小。并保留其原始图片大小
+ (CGSize) fitSize: (CGSize)thisSize inSize: (CGSize) aSize
{
CGFloat scale;
CGSize newsize = thisSize;
if (newsize.height && (newsize.height > aSize.height))
{
scale = aSize.height / newsize.height;
newsize.width *= scale;
newsize.height *= scale;
}
if (newsize.width && (newsize.width >= aSize.width))
{
scale = aSize.width / newsize.width;
newsize.width *= scale;
newsize.height *= scale;
}
return newsize;
}
// 返回调整的缩略图
+ (UIImage *) image: (UIImage *) image fitInSize: (CGSize) viewsize
{
// calculate the fitted size
CGSize size = [self fitSize:image.size inSize:viewsize];
UIGraphicsBeginImageContext(viewsize);
float dwidth = (viewsize.width - size.width) / 2.0f;
float dheight = (viewsize.height - size.height) / 2.0f;
CGRect rect = CGRectMake(dwidth, dheight, size.width, size.height);
[image drawInRect:rect];
UIImage *newimg = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return newimg;
}
//返回居中的缩略图
+ (UIImage *) image: (UIImage *) image centerInSize: (CGSize) viewsize {
CGSize size = image.size;
UIGraphicsBeginImageContext(viewsize);
float dwidth = (viewsize.width - size.width) / 2.0f;
float dheight = (viewsize.height - size.height) / 2.0f;
CGRect rect = CGRectMake(dwidth, dheight, size.width, size.height);
[image drawInRect:rect];
UIImage *newimg = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return newimg;
}
// 返回填充的缩略图
+ (UIImage *) image: (UIImage *) image fillSize: (CGSize) viewsize {
CGSize size = image.size;
CGFloat scalex = viewsize.width / size.width;
CGFloat scaley = viewsize.height / size.height;
CGFloat scale = MAX(scalex, scaley);
UIGraphicsBeginImageContext(viewsize);
CGFloat width = size.width * scale;
CGFloat height = size.height * scale;
float dwidth = ((viewsize.width - width) / 2.0f);
float dheight = ((viewsize.height - height) / 2.0f);
CGRect rect = CGRectMake(dwidth, dheight, size.width * scale, size.height * scale);
[image drawInRect:rect];
UIImage *newimg = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return newimg;
}
@end
......@@ -41,9 +41,11 @@
UIButton *button = [[UIButton alloc] init];
button.tag = kBtnTag + i;
button.titleLabel.font = [UIFont systemFontOfSize:15.0];
button.titleLabel.numberOfLines = 0;
[button setTitleColor:kLightBlack forState:UIControlStateNormal];
button.frame = CGRectMake(0, i * buttonHeight, kSelfWidth, buttonHeight);
[button setTitle:item.title forState:UIControlStateNormal];
button.titleEdgeInsets = UIEdgeInsetsMake(0, 5, 0, 5);
[button addTarget:self action:@selector(touchDownForButton:) forControlEvents:UIControlEventTouchDown];
[button addTarget:self action:@selector(touchUpForButton:) forControlEvents:UIControlEventTouchUpInside];
[self addSubview:button];
......
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