Commit 24060026 authored by AvatarC's avatar AvatarC

Merge branch 'develop' of https://git.oschina.net/gomoretech/RedstarIOS into develop_avatar

parents c622bb47 b8d1f808
......@@ -61,6 +61,7 @@
8490C4D31BF9DEF0006B6569 /* PictureTableCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 8490C4CE1BF9DEF0006B6569 /* PictureTableCell.m */; };
8490C4D41BF9DEF0006B6569 /* PictureViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 8490C4D21BF9DEF0006B6569 /* PictureViewController.m */; };
8490C4D71BF9DF1D006B6569 /* PictureStoryViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 8490C4D61BF9DF1D006B6569 /* PictureStoryViewController.m */; };
84945F1B1C2A6A6300C1793C /* AboutMeViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 84945F1A1C2A6A6300C1793C /* AboutMeViewController.m */; };
84970DEF1BD8DD8A00C1728A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 84970DEE1BD8DD8A00C1728A /* main.m */; };
84970DFA1BD8DD8A00C1728A /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 84970DF91BD8DD8A00C1728A /* Assets.xcassets */; };
84970DFD1BD8DD8A00C1728A /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 84970DFB1BD8DD8A00C1728A /* LaunchScreen.storyboard */; };
......@@ -284,6 +285,8 @@
8490C4D21BF9DEF0006B6569 /* PictureViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PictureViewController.m; sourceTree = "<group>"; };
8490C4D51BF9DF1D006B6569 /* PictureStoryViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PictureStoryViewController.h; sourceTree = "<group>"; };
8490C4D61BF9DF1D006B6569 /* PictureStoryViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PictureStoryViewController.m; sourceTree = "<group>"; };
84945F191C2A6A6300C1793C /* AboutMeViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AboutMeViewController.h; sourceTree = "<group>"; };
84945F1A1C2A6A6300C1793C /* AboutMeViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AboutMeViewController.m; sourceTree = "<group>"; };
84970DEA1BD8DD8A00C1728A /* redstar.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = redstar.app; sourceTree = BUILT_PRODUCTS_DIR; };
84970DEE1BD8DD8A00C1728A /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
84970DF91BD8DD8A00C1728A /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
......@@ -1171,6 +1174,15 @@
path = ViewController;
sourceTree = "<group>";
};
84945F181C2A6A4A00C1793C /* About */ = {
isa = PBXGroup;
children = (
84945F191C2A6A6300C1793C /* AboutMeViewController.h */,
84945F1A1C2A6A6300C1793C /* AboutMeViewController.m */,
);
path = About;
sourceTree = "<group>";
};
84970DE11BD8DD8A00C1728A = {
isa = PBXGroup;
children = (
......@@ -2023,6 +2035,7 @@
children = (
84FD8A081BDA01D1006E442A /* MineViewController.h */,
84FD8A091BDA01D1006E442A /* MineViewController.m */,
84945F181C2A6A4A00C1793C /* About */,
);
path = ViewController;
sourceTree = "<group>";
......@@ -2246,6 +2259,7 @@
84BB16A21C191A7F00383A64 /* OnLineResultFootView.m in Sources */,
84846E971BE069BC0010550A /* DateButton.m in Sources */,
84CC34CC1C093C2F002F10E2 /* OnLineTableViewCell.m in Sources */,
84945F1B1C2A6A6300C1793C /* AboutMeViewController.m in Sources */,
84E363D21BFAC5200061547E /* TaskListModel.m in Sources */,
84C9574E1BDB344900083584 /* UIView+Frame.m in Sources */,
848699B01BDF810900859DFE /* InspectListCell.m in Sources */,
......
......@@ -10,11 +10,11 @@
#define Url_h
// url
#define kRedStarURL @"http://218.244.151.129:7580/"
//#define kRedStarURL @"http://218.244.151.129:7580/"
// #define kRedStarURL @"http://172.16.3.12:7580/"
#define kRedStarURL @"http://219.235.234.225:7580/"
// 检查更新
......
......@@ -79,11 +79,11 @@
[self.contentView addConstraint:selectTop];
// 左边
NSLayoutConstraint *selectRight = [NSLayoutConstraint constraintWithItem:_selectLabel attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeRight multiplier:1.0 constant:0];
NSLayoutConstraint *selectRight = [NSLayoutConstraint constraintWithItem:_selectLabel attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeRight multiplier:1.0 constant:-10];
[self.contentView addConstraint:selectRight];
// 右边
NSLayoutConstraint *selectWidth = [NSLayoutConstraint constraintWithItem:_selectLabel attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.titleLabel attribute:NSLayoutAttributeRight multiplier:1.0 constant:5];
NSLayoutConstraint *selectWidth = [NSLayoutConstraint constraintWithItem:_selectLabel attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.titleLabel attribute:NSLayoutAttributeRight multiplier:1.0 constant:10];
[self.contentView addConstraint:selectWidth];
//
// 高度
......
......@@ -12,14 +12,16 @@
#import "SpotCheckOnLineViewController.h"
#import "SelectStoreViewController.h"
#import "HttpClient.h"
#import "TreeNodeModel.h"
#define kOnLineTableViewCell @"onlineTableViewCell"
@interface OnLineViewController () <UITableViewDelegate, UITableViewDataSource, UIAlertViewDelegate>
@interface OnLineViewController () <UITableViewDelegate, UITableViewDataSource, UIAlertViewDelegate, SelectStoreDelegate>
@property (nonatomic, strong) UITableView *tableView;
@property (nonatomic, strong) NSArray *titleArray;
@property (nonatomic, strong) NSMutableArray *uuidArray;
@property (nonatomic, strong) OnLineFooterView *footView;
@property (nonatomic, strong) NSString *storeName;
@end
@implementation OnLineViewController
......@@ -46,6 +48,8 @@
UIBarButtonItem *backItem = [[UIBarButtonItem alloc] initWithCustomView:backBtn];
self.navigationItem.leftBarButtonItem = backItem;
_storeName = @"全部";
}
- (void)doBack:(id)sender
......@@ -78,6 +82,20 @@
[alert show];
}
#pragma mark - SelectStoreDelegate
- (void)deliverWithArray:(NSMutableArray *)array
{
NSString *nameStr = @"";
_uuidArray = [NSMutableArray array];
for (TreeNodeModel *model in array) {
nameStr = [nameStr stringByAppendingString:[NSString stringWithFormat:@"%@,", model.name]];
[_uuidArray addObject:model.uuid];
}
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:0 inSection:0];
_storeName = nameStr;
[self.tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade];
}
#pragma mark - TableView Delegate/DateSource
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
......@@ -102,12 +120,17 @@
@"title":self.footView.titleTextView.text,
@"content":self.footView.contentTextView.text,
@"endDate":dateString,
@"state":@"initial"
@"state":@"initial",
// @"stores":_uuidArray
};
NSLog(@"发起抽查par = %@", parameters);
[httpClient saveSportCheckWithParameters:parameters completion:^(id response, NSError *error) {
NSLog(@"发起抽查 response = %@", response);
NSLog(@"发起抽查 error = %@", error);
if ([response[@"message"] isEqualToString:@"ok"]) {
[self.navigationController popViewControllerAnimated:YES];
}
}];
}
}
......@@ -129,6 +152,7 @@
}
cell.titleLabel.text = [NSString stringWithFormat:@"%@", _titleArray[indexPath.row]];
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
cell.selectLabel.text = [NSString stringWithFormat:@"%@", _storeName];
return cell;
......@@ -143,6 +167,7 @@
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
SelectStoreViewController *select = [[SelectStoreViewController alloc] init];
select.delegate = self;
[self.navigationController pushViewController:select animated:YES];
}
......
......@@ -26,5 +26,5 @@
@property (nonatomic, copy) NSString *store_name;
@property (nonatomic, copy) NSString *store_uuid;
@property (nonatomic, copy) NSString *title;
@property (nonatomic, copy) NSString *uuid;
@end
......@@ -491,7 +491,7 @@
{
LookOnLineModel *lookOnLine = _allLookOnLineList[indexPath.row];
LookOnLineDetailViewController *lookDetailVC = [[LookOnLineDetailViewController alloc] init];
lookDetailVC.uuid = lookOnLine.attachmentId;
lookDetailVC.uuid = lookOnLine.uuid;
[self.navigationController pushViewController:lookDetailVC animated:YES];
}
......
......@@ -7,6 +7,7 @@
//
#import <UIKit/UIKit.h>
@class OnLineDetailModel;
@interface LookOnLineDetailView : UIView
@property (nonatomic, strong) UILabel *titleLabel;
......@@ -20,5 +21,5 @@
@property (nonatomic, strong) UILabel *dayLabel; // 剩余天数
@property (nonatomic, strong) OnLineDetailModel *onLineDetail;
@end
......@@ -38,6 +38,13 @@
- (void)setup
{
}
- (void)setOnLineDetail:(OnLineDetailModel *)onLineDetail
{
_onLineDetail = onLineDetail;
self.bgView.backgroundColor = [UIColor whiteColor];
self.shopname.text = @"商场名称";
self.overDate.text = @"截止时间";
......@@ -60,10 +67,11 @@
self.day.text = @"天";
self.number.image = [UIImage imageNamed:@"figure_bg"];
self.surplus.text = @"剩余";
self.dayLabel.text = @"2";
self.pictureLabel.text = @"现场照片";
}
- (UILabel *)titleLabel
......
......@@ -10,6 +10,8 @@
#import "LookOnLineDetailView.h"
#import "LookOnLineFootView.h"
#import "HttpClient.h"
#import "CommonFunc.h"
#import "OnLineDetailModel.h"
#import "InspectAddCell.h"
#define kOnLineInspectAddCell @"onLineInspectAddCell"
......@@ -27,7 +29,7 @@
@property (nonatomic, strong) LookOnLineFootView *footView;
@property (nonatomic, strong) NSMutableArray *imageNameArray;
@property (nonatomic, strong) OnLineDetailModel *onLineDetail;
@property (nonatomic, assign) int rowNumber;
@end
......@@ -83,6 +85,14 @@
[httpClient getSportCheckDetailWithCompletion:^(id response, NSError *error) {
NSLog(@"5.4 抽查明细 response = %@, error = %@", response, error);
NSDictionary *dataDict = response[@"data"];
OnLineDetailModel *onlineDetail = [[OnLineDetailModel alloc] init];
[onlineDetail setValuesForKeysWithDictionary:dataDict];
_onLineDetail = onlineDetail;
self.tableView.delegate = self;
self.tableView.dataSource = self;
[self.tableView reloadData];
}];
}
......@@ -125,7 +135,8 @@
- (void)saveImage:(UIImage *)currentImage {
NSData *imageData = UIImageJPEGRepresentation(currentImage, 0.5);
NSString *imageName = [NSString stringWithFormat:@"imageName%d", (int)_imageNameArray.count];
// NSString *imageName = [NSString stringWithFormat:@"%d", (int)_imageNameArray.count];
NSString *imageName = [CommonFunc md5Data:imageData];
[_imageNameArray addObject:imageName];
......@@ -155,10 +166,25 @@
NSLog(@"上报抽检结果 url = %@", url);
HttpClient *httpClient= [[HttpClient alloc] initWithUrl:url];
NSMutableArray *imageArray = [NSMutableArray array];
for (int i = 0; i < _imageNameArray.count; i++) {
NSString *imageName = _imageNameArray[i];
NSString *fullPath = [[NSHomeDirectory() stringByAppendingPathComponent:@"Documents"] stringByAppendingPathComponent:imageName];
UIImage *image = [UIImage imageWithContentsOfFile:fullPath];
NSData *imageData = UIImageJPEGRepresentation(image, 0.5);
NSString *imageBase64 = [imageData base64EncodedStringWithOptions:0];
NSMutableDictionary *dict = [NSMutableDictionary dictionary];
[dict setObject:imageBase64 forKey:@"fileContent"];
[dict setObject:imageName forKey:@"fileName"];
[dict setObject:@(i) forKey:@"index"];
[imageArray addObject:dict];
}
NSDictionary *parameters = @{
@"storeUuid":@"",
@"processNote":self.footView.contentTextView.text,
@"attachments":@[],
@"attachments":imageArray,
};
[httpClient reportCheckResultWithParameters:parameters completion:^(id response, NSError *error) {
......@@ -281,6 +307,7 @@
if (!_headerView) {
_headerView = [[LookOnLineDetailView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, 295)];
_headerView.titleLabel.text = @"2015年十一促销临时抽查";
_headerView.onLineDetail = _onLineDetail;
}
return _headerView;
}
......
......@@ -91,6 +91,7 @@
@"pageNumber":@(0),
@"pageSize":@(999)
};
NSLog(@"url = %@", url);
[MBProgressHUD showHUDAddedTo:self.view animated:YES];
[httpClient queryLowerOrgsWithParameters:parameters completion:^(id response, NSError *error) {
NSLog(@"查询下级组织 reponse = %@,error = %@", response, error);
......@@ -115,7 +116,11 @@
[fourTree addObject:tree];
}
}
[MBProgressHUD hideHUDForView:self.view animated:YES];
if (oneTree.count == 0) {
return;
}
TreeNodeModel *tree1 = oneTree[0];
for (int k = 0; k < twoTree.count; k++) {
......@@ -147,7 +152,6 @@
}
self.treeView.nodeData = tree1;
[MBProgressHUD hideHUDForView:self.view animated:YES];
}];
}
......
......@@ -136,8 +136,6 @@
for (NSDictionary *dict in dataArray) {
TaskListModel *taskList = [[TaskListModel alloc] init];
[taskList setValuesForKeysWithDictionary:dict];
NSLog(@"taskList state = %@", taskList.state);
[taskArray addObject:taskList];
}
[_taskListDataArray addObjectsFromArray:taskArray];
......@@ -231,7 +229,6 @@
for (NSDictionary *dict in dataArray) {
TaskListModel *taskList = [[TaskListModel alloc] init];
[taskList setValuesForKeysWithDictionary:dict];
NSLog(@"taskList state = %@", taskList.state);
[tempArray addObject:taskList];
}
_taskListDataArray = [NSMutableArray arrayWithArray:tempArray];
......
......@@ -497,7 +497,6 @@
{
if (!_rankDetailHeaderView) {
_rankDetailHeaderView = [[RankDetailHeaderView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, 298)];
NSLog(@"se。row= =%ld", _indexRow);
if (self.indexRow <= 3) {
NSString *imageName = [NSString stringWithFormat:@"medal_0%ld", (long)(_indexRow)];
_rankDetailHeaderView.rankDetailView.gradeImageView.image = [UIImage imageNamed:imageName];
......
......@@ -18,6 +18,8 @@
UIButton *_otherButton;
UILabel *_scoreLabel;
NSInteger _section;
NSInteger _index;
UILabel *_gradeLabel;
UIImageView *_gradeImageView;
UIView *_lineView;
......@@ -92,6 +94,7 @@
_gradeLabel = gradeLabel;
}
_section = section;
_index = index;
UIButton *pushButton = [UIButton buttonWithType:UIButtonTypeCustom];
pushButton.tag = kPushTag + section;
......@@ -159,7 +162,7 @@
_bgButton.frame = CGRectMake(30, 0, 0.35 * kScreenWidth, self.bounds.size.height);
_arrowImageView.frame = CGRectMake(20, (self.frame.size.height - 11) / 2, 9, 10);
_scoreLabel.frame = CGRectMake(0.4 * kScreenWidth, 0, 0.25 * kScreenWidth, 50);
if (_section < 3) {
if (_index <= 3) {
_gradeImageView.frame = CGRectMake(0.8 * kScreenWidth, 9, 36, 33);
} else {
_gradeLabel.frame = CGRectMake(0.7 * kScreenWidth, 0, 0.3 * kScreenWidth, 50);
......
......@@ -57,6 +57,8 @@
@property (nonatomic, strong) NSMutableArray *uuidArray;
@property (nonatomic, assign) NSInteger statisMode;
@property (nonatomic, strong) NSString *selectName;
@property (nonatomic) BOOL isChoose;
@end
......@@ -106,6 +108,9 @@
self.gradeLabel.text = @"排名";
_isChoose = YES;
_selectName = @"全部";
_selectButton = [[UIButton alloc] init];
_selectButton.tag = 323228;
}
......@@ -211,7 +216,7 @@
NSLog(@"parrrrrters = %@", parameters);
[MBProgressHUD showHUDAddedTo:self.view animated:YES];
[httpCilent getRankingListWithParameters:parameters completion:^(id response, NSError *error) {
NSLog(@"分区域 口碑排名response = %@", response);
NSLog(@"分区域 口碑排名response = %@ error = %@", response, error);
NSArray *dataArray = response[@"data"];
......@@ -242,8 +247,6 @@
- (NSArray *)sortRankListWithRankListArray:(NSMutableArray *)allRanking
{
NSArray *sortedArray = [allRanking sortedArrayUsingComparator:^NSComparisonResult(RankListModel *p1, RankListModel *p2){
//return [@(p2.score) compare:@(p1.score)];
return [@(p2.score) compare:@(p1.score)];
}];
return sortedArray;
......@@ -296,16 +299,17 @@
}
#pragma mark - SelectStoreDelegate
- (void)deliverWithArray:(NSMutableArray *)array
{
NSString *nameStr = @"";
for (TreeNodeModel *model in array) {
nameStr = [nameStr stringByAppendingString:model.name];
nameStr = [nameStr stringByAppendingString:[NSString stringWithFormat:@"%@,", model.name]];
[_uuidArray addObject:model.uuid];
}
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:1 inSection:0];
OnLineTableViewCell *cell = (OnLineTableViewCell *)[_tableView cellForRowAtIndexPath:indexPath];
cell.selectLabel.text = nameStr;
_selectName = nameStr;
[self.tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade];
}
#pragma mark - UITableView DataSource/Delegate
......@@ -344,7 +348,7 @@
cell.selectLabel.text = [NSString stringWithFormat:@"%@", dict[@"name"]];
}
} else {
cell.selectLabel.text = @"全部";
cell.selectLabel.text = _selectName;
}
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
cell.selectionStyle = UITableViewCellSelectionStyleNone;
......
......@@ -294,8 +294,8 @@ typedef NSComparisonResult (^NSComparator)(id obj1, id obj2);
NSString *url = [NSString stringWithFormat:@"%@%@", kRedStarURL, kRankingListURL];
HttpClient *httpCilent = [[HttpClient alloc] initWithUrl:url];
NSDictionary *parameters = @{@"praiseUuid":@"5a7417015157efa6015158f52be8004e",
@"statisMode":@(0),
NSDictionary *parameters = @{@"praiseUuid":@"",
@"statisMode":@(0)
};
[httpCilent getRankingListWithParameters:parameters completion:^(id response, NSError *error) {
......
......@@ -159,16 +159,18 @@
NSString *user_name = dict[@"user_name"];
NSString *user_uuid = dict[@"user_uuid"];
NSString *enterprise_name = dict[@"enterprise_name"];
NSString *enterprise_uuid = dict[@"enterprise_uuid"];
NSString *org_name = dict[@"org_name"];
NSString *authenticode = dict[@"authenticode"];
NSArray *permissions = dict[@"permissions"];
[userDefault setObject:enterprise_uuid forKey:@"enterprise_uuid"];
[userDefault setObject:user_code forKey:@"user_code"];
[userDefault setObject:user_name forKey:@"user_name"];
[userDefault setObject:user_uuid forKey:@"user_uuid"];
[userDefault setObject:enterprise_name forKey:@"enterprise_name"];
[userDefault setObject:org_name forKey:@"org_name"];
[userDefault setObject:authenticode forKey:@"authenticode"];
[userDefault setObject:permissions forKey:@"permissions"];
self.rootTBC = [[RootTabBarController alloc] init];
......@@ -223,9 +225,11 @@
NSString *user_uuid = dict[@"user_uuid"];
NSArray *permissions = dict[@"permissions"];
NSString *enterprise_name = dict[@"enterprise_name"];
NSString *enterprise_uuid = dict[@"enterprise_uuid"];
NSString *authenticode = dict[@"authenticode"];
NSString *org_name = dict[@"org_name"];
[[NSUserDefaults standardUserDefaults] setObject:enterprise_uuid forKey:@"enterprise_uuid"];
[[NSUserDefaults standardUserDefaults] setObject:enterprise_name forKey:@"enterprise_name"];
[[NSUserDefaults standardUserDefaults] setObject:org_name forKey:@"org_name"];
[[NSUserDefaults standardUserDefaults] setObject:permissions forKey:@"permissions"];
......@@ -233,7 +237,7 @@
[[NSUserDefaults standardUserDefaults] setObject:user_name forKey:@"user_name"];
[[NSUserDefaults standardUserDefaults] setObject:user_uuid forKey:@"user_uuid"];
[[NSUserDefaults standardUserDefaults] setObject:permissions forKey:@"permissions"];
[[NSUserDefaults standardUserDefaults] setObject:authenticode forKey:@"authenticode"];
// 进入RootTabBar
self.rootTBC = [[RootTabBarController alloc] init];
[MBProgressHUD hideHUDForView:window animated:YES];
......
//
// AboutMeViewController.h
// redstar
//
// Created by admin on 15/12/23.
// Copyright © 2015年 ZWF. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface AboutMeViewController : UIViewController
@end
//
// AboutMeViewController.m
// redstar
//
// Created by admin on 15/12/23.
// Copyright © 2015年 ZWF. All rights reserved.
//
#import "AboutMeViewController.h"
#import "OnLineTableViewCell.h"
@interface AboutMeViewController ()<UITableViewDelegate, UITableViewDataSource>
@property (nonatomic, strong) UITableView *tableView;
@property (nonatomic, strong) NSMutableArray *titleArray;
@end
@implementation AboutMeViewController
- (void)viewDidLoad {
[super viewDidLoad];
self.view.backgroundColor = kSectionBackGroundColor;
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;
self.titleArray = [NSMutableArray arrayWithObjects:@"版本",@"联系电话", nil];
[self setupTableView];
}
- (void)doBack:(UIBarButtonItem *)sender
{
[self.navigationController popViewControllerAnimated:YES];
}
- (void)setupTableView
{
[self.tableView registerClass:[OnLineTableViewCell class] forCellReuseIdentifier:@"abountMeCell"];
UIView *headView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, 200)];
UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 100, 100)];
imageView.backgroundColor = [UIColor lightGrayColor];
imageView.center = CGPointMake(headView.center.x, headView.center.y - 25);
[headView addSubview:imageView];
self.tableView.tableHeaderView = headView;
}
#pragma mark - TableView Delegate/DataSource
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return _titleArray.count;
}
// cell显示的内容
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
OnLineTableViewCell *cell=[tableView dequeueReusableCellWithIdentifier:@"abountMeCell"];
if (!cell) {
cell = [[OnLineTableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:@"abountMeCell"];
}
// 设置cell右边有个小箭头
cell.titleLabel.text = _titleArray[indexPath.row];
if (indexPath.row == 0) {
NSDictionary *infoDic = [[NSBundle mainBundle] infoDictionary];
NSString *currentVersion = [NSString stringWithFormat:@"%@",infoDic[@"CFBundleShortVersionString"]];
cell.selectLabel.text = currentVersion;
} else {
cell.selectLabel.text = @"400-400-4000";
}
return cell;
}
// cell的高度
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
return 45;
}
// section高度
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
return CGFLOAT_MIN;
}
#pragma mark - lazy loading
- (UITableView *)tableView
{
if (!_tableView) {
_tableView = [[UITableView alloc] init];
}
_tableView.delegate = self;
_tableView.dataSource = self;
_tableView.translatesAutoresizingMaskIntoConstraints = NO;
_tableView.backgroundColor = kMineBackGroundColor;
_tableView.tableFooterView = [[UIView alloc] init];
[self.view addSubview:_tableView];
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;
}
/*
#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
*/
@end
......@@ -11,6 +11,8 @@
#import "MineTableFooterView.h"
#define kMineTableViewCell @"mineTableViewCell"
#import "AboutMeViewController.h"
#import "HttpClient.h"
@interface MineViewController () <UITableViewDelegate, UITableViewDataSource, UIAlertViewDelegate>
......@@ -189,6 +191,9 @@
{
if (indexPath.row == 4) {
[self getVersion];
} else if (indexPath.row == 3) {
AboutMeViewController *about = [[AboutMeViewController alloc] init];
[self.navigationController pushViewController:about animated:YES];
}
}
......
......@@ -27,10 +27,12 @@
_manager.requestSerializer = [AFJSONRequestSerializer serializer];
_manager.responseSerializer = [AFJSONResponseSerializer serializer];
// 设置请求头
[_manager.requestSerializer setValue:@"application/json;charset=utf-8" forHTTPHeaderField:@"Content-Type"];
[_manager.requestSerializer setValue:@"5a74170150b940ae0150b940f7db0082" forHTTPHeaderField:@"enterprise"];
//[_manager.requestSerializer setValue:@"5a74170150b940ae0150b940f7db0082" forHTTPHeaderField:@"enterprise"];
[_manager.requestSerializer setValue:[[NSUserDefaults standardUserDefaults] objectForKey:@"enterprise_uuid"] forHTTPHeaderField:@"enterprise"];
}
return self;
}
......
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