Commit edfaf8dc authored by admin's avatar admin

修改部分bug

parent 761ba49d
......@@ -6,12 +6,12 @@
},
{
"idiom" : "universal",
"filename" : "praise_report@2x.png",
"filename" : "口碑巡检_功能一览@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "praise_report@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" : "task_01@2x.png",
"filename" : "口碑巡检_首页@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "task_01@3x.png",
"filename" : "口碑巡检_首页@3x.png",
"scale" : "3x"
}
],
......
......@@ -6,12 +6,12 @@
},
{
"idiom" : "universal",
"filename" : "口碑巡检_首页@2x.png",
"filename" : "task_01@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "口碑巡检_首页@3x.png",
"filename" : "task_01@3x.png",
"scale" : "3x"
}
],
......
......@@ -194,7 +194,7 @@
NSLayoutConstraint *titleImageTop = [NSLayoutConstraint constraintWithItem:_commentBtn attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.titleImageView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:12];
[self.contentView addConstraint:titleImageTop];
NSLayoutConstraint *titleImageWidth = [NSLayoutConstraint constraintWithItem:_commentBtn attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:60];
NSLayoutConstraint *titleImageWidth = [NSLayoutConstraint constraintWithItem:_commentBtn attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:70];
[self.contentView addConstraint:titleImageWidth];
NSLayoutConstraint *titleRight = [NSLayoutConstraint constraintWithItem:_commentBtn attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeRight multiplier:1.0 constant:-15];
......
......@@ -119,9 +119,9 @@
[imageArray addObject:dict];
}
parameters = @{@"category":@"环境物业",
@"group":@"基础环境",
@"title":@"测试数据",
parameters = @{@"category":_selectLabel.text,
@"group":_selectLabel1.text,
@"title":self.footerView.contentTextView.text,
@"content":self.footerView.titleTextView.text,
@"attachments":imageArray};
}
......@@ -144,10 +144,14 @@
HttpClient *client = [[HttpClient alloc] initWithUrl:url];
[MBProgressHUD showHUDAddedTo:self.view animated:YES];
[client uploadNewQuestionWithParameters:parameters completion:^(id response, NSError *error) {
NSLog(@"上传 response= %@, error = %@", response, error);
NSLog(@"上传新问题 response= %@, error = %@", response, error);
if (response[@"success"]) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"提示" message:@"新问题提报成功!" delegate:self cancelButtonTitle:@"确定" otherButtonTitles:nil, nil];
[alert show];
[MBProgressHUD hideHUDForView:self.view animated:YES];
} else {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"警告" message:@"新问题提报失败!" delegate:self cancelButtonTitle:@"确定" otherButtonTitles:nil, nil];
[alert show];
}
}];
......
......@@ -109,17 +109,32 @@
}
// 反馈
NSString *answerStr = [NSString stringWithFormat:@"%@", questionDetail.feedback];
NSMutableAttributedString *answerAttrStr = [[NSMutableAttributedString alloc] initWithString:answerStr];
NSMutableParagraphStyle *paragraphStyle2 = [[NSMutableParagraphStyle alloc] init];
paragraphStyle2.alignment = NSTextAlignmentLeft;
paragraphStyle2.lineSpacing = 6; //行自定义行高度
[answerAttrStr addAttribute:NSParagraphStyleAttributeName value:paragraphStyle2 range:NSMakeRange(0, answerStr.length)];
self.answerLabel.attributedText = answerAttrStr;
if (questionDetail.feedback == nil || questionDetail.feedback == NULL || [questionDetail.feedback isEqual:[NSNull null]]) {
self.answerLabel.text = @"";
} else {
NSString *answerStr = [NSString stringWithFormat:@"%@", questionDetail.feedback];
NSMutableAttributedString *answerAttrStr = [[NSMutableAttributedString alloc] initWithString:answerStr];
NSMutableParagraphStyle *paragraphStyle2 = [[NSMutableParagraphStyle alloc] init];
paragraphStyle2.alignment = NSTextAlignmentLeft;
paragraphStyle2.lineSpacing = 6; //行自定义行高度
[answerAttrStr addAttribute:NSParagraphStyleAttributeName value:paragraphStyle2 range:NSMakeRange(0, answerStr.length)];
self.answerLabel.attributedText = answerAttrStr;
}
// 解决人
self.peopleLabel.text = [NSString stringWithFormat:@"问题解决负责人:%@", questionDetail.resolveUser_name];
self.dateLabel.text = [NSString stringWithFormat:@"反馈时间:%@", questionDetail.lastModify_time];
if (questionDetail.resolveUser_name == nil || questionDetail.resolveUser_name == NULL || [questionDetail.resolveUser_name isEqual:[NSNull null]]) {
self.peopleLabel.text = [NSString stringWithFormat:@"问题解决负责人:"];
} else {
self.peopleLabel.text = [NSString stringWithFormat:@"问题解决负责人:%@", questionDetail.resolveUser_name];
}
if (questionDetail.resolveTime == nil || questionDetail.resolveTime == NULL || [questionDetail.resolveTime isEqual:[NSNull null]]) {
self.dateLabel.text = [NSString stringWithFormat:@"反馈时间:"];
} else {
self.dateLabel.text = [NSString stringWithFormat:@"反馈时间:%@", questionDetail.resolveTime];
}
}
#pragma mark - lazy loading
......
......@@ -64,12 +64,16 @@
[self.sortLabel setAttributedText:sortAttr];
// 商场
NSString *shopText = [NSString stringWithFormat:@"商场:%@", questionDetail.storePath];
NSMutableAttributedString *shopAttr = [[NSMutableAttributedString alloc] initWithString:shopText];
[shopAttr addAttributes:@{NSForegroundColorAttributeName:kDetailCellDescribeTextColor,NSFontAttributeName:[UIFont systemFontOfSize:15.0f]} range:NSMakeRange(0,3)];
[shopAttr addAttributes:@{NSForegroundColorAttributeName:kdetailCellTitleColor,NSFontAttributeName:[UIFont systemFontOfSize:15.0f]} range:NSMakeRange(3,shopText.length - 3)];
[self.shopLabel setAttributedText:shopAttr];
if (questionDetail.storePath == nil || questionDetail.storePath == NULL || [questionDetail.storePath isEqual:[NSNull null]]) {
self.shopLabel.text = @"商场:";
self.shopLabel.textColor = kDetailCellDescribeTextColor;
} else {
NSString *shopText = [NSString stringWithFormat:@"商场:%@", questionDetail.storePath];
NSMutableAttributedString *shopAttr = [[NSMutableAttributedString alloc] initWithString:shopText];
[shopAttr addAttributes:@{NSForegroundColorAttributeName:kDetailCellDescribeTextColor,NSFontAttributeName:[UIFont systemFontOfSize:15.0f]} range:NSMakeRange(0,3)];
[shopAttr addAttributes:@{NSForegroundColorAttributeName:kdetailCellTitleColor,NSFontAttributeName:[UIFont systemFontOfSize:15.0f]} range:NSMakeRange(3,shopText.length - 3)];
[self.shopLabel setAttributedText:shopAttr];
}
// 问题提报人
NSString *peopleText = [NSString stringWithFormat:@"问题提报人:%@", questionDetail.submitUser_name];
NSMutableAttributedString *peopleAttr = [[NSMutableAttributedString alloc] initWithString:peopleText];
......@@ -129,7 +133,7 @@
[self.contentView addConstraint:thumbTop];
// 左边
NSLayoutConstraint *thumbWidth = [NSLayoutConstraint constraintWithItem:_thumbBtn attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:60];
NSLayoutConstraint *thumbWidth = [NSLayoutConstraint constraintWithItem:_thumbBtn attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:80];
[self.contentView addConstraint:thumbWidth];
// 右边
......@@ -174,6 +178,7 @@
{
if (!_shopLabel) {
_shopLabel = [[UILabel alloc] init];
_shopLabel.font = [UIFont systemFontOfSize:15.0];
_shopLabel.translatesAutoresizingMaskIntoConstraints = NO;
[self.contentView addSubview:_shopLabel];
......
......@@ -218,7 +218,7 @@
[self.contentView addConstraint:stateTop];
// 左边
NSLayoutConstraint *stateWidth = [NSLayoutConstraint constraintWithItem:_thumbBtn attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:55];
NSLayoutConstraint *stateWidth = [NSLayoutConstraint constraintWithItem:_thumbBtn attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:80];
[self.contentView addConstraint:stateWidth];
// 右边
......
......@@ -121,6 +121,10 @@
NSLayoutConstraint *overDateBottom = [NSLayoutConstraint constraintWithItem:_introDetailLabel attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:-20];
[self.contentView addConstraint:overDateBottom];
//
// NSLayoutConstraint *overDateh = [NSLayoutConstraint constraintWithItem:_introDetailLabel attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:100];
// [self.contentView addConstraint:overDateh];
}
return _introDetailLabel;
}
......
......@@ -13,9 +13,12 @@
#import <MBProgressHUD.h>
#import "CommonFunc.h"
#import "HttpClient.h"
#import "InspectTaskViewController.h"
#define kInspectNotUploadCell @"InspectNotUploadCell"
@interface InspectNotUploadViewController () <UITableViewDelegate, UITableViewDataSource, UINavigationControllerDelegate, UIImagePickerControllerDelegate , TakePhotoViewDelegate, UIScrollViewDelegate>
@interface InspectNotUploadViewController () <UITableViewDelegate, UITableViewDataSource, UINavigationControllerDelegate, UIImagePickerControllerDelegate , TakePhotoViewDelegate, UIScrollViewDelegate, UIAlertViewDelegate>
@property (nonatomic, strong) UITableView *tableView;
@property (nonatomic, strong) InspectDetailFooterView *footerView;
......@@ -66,6 +69,13 @@
- (void)uploadTaskInfo:(UIButton *)sender
{
int impose = _taskModel.attachmentNumber;
if ((int)_imageNameArray.count < impose) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"提示" message:[NSString stringWithFormat:@"要求图片%d张才能上传!", impose] delegate:self cancelButtonTitle:nil otherButtonTitles:@"确定", nil];
[alert show];
return;
}
NSMutableArray *imageArray = [NSMutableArray array];
for (int i = 0; i < _imageNameArray.count; i++) {
NSString *imageName = _imageNameArray[i];
......@@ -87,7 +97,6 @@
NSString *operId = [[NSUserDefaults standardUserDefaults] objectForKey:@"user_code"];
NSString *operName = [[NSUserDefaults standardUserDefaults] objectForKey:@"user_name"];
NSLog(@"self = %@, 1= %@, 2 = %@", self.praiseUuid, self.store_uuid, self.questionUuid);
NSString *url = [NSString stringWithFormat:@"%@%@%@?time=%@&operId=%@&operName=%@",kRedStarURL, kUpLoadInspectResult, self.praiseUuid, dateString, operId, operName];
url = [url stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding];
......@@ -103,8 +112,13 @@
NSLog(@"上传检查点parameters = %@", parameters);
[httpClient uploadInspectResultWithParameters:parameters completion:^(id response, NSError *error) {
NSLog(@"ressssss =%@ errorrrrr = %@", response, error);
NSLog(@"上传检查点 respose =%@ error = %@", response, error);
if (response[@"success"]) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"提示" message:@"检查点上报成功!" delegate:self cancelButtonTitle:nil otherButtonTitles:@"确定", nil];
alert.delegate = self;
alert.tag = 39429234;
[alert show];
}
[MBProgressHUD hideHUDForView:self.view animated:YES];
}];
......@@ -244,6 +258,8 @@
cell.titleDetailLabel.text = [NSString stringWithFormat:@"要求图片%d张", _taskModel.attachmentNumber];
cell.introLabel.text = @"参考说明";
cell.introDetailLabel.text = [NSString stringWithFormat:@"%@", _taskModel.reference];
// cell.introDetailLabel.backgroundColor = [UIColor greenColor];
// [cell.introDetailLabel loadHTMLString:[NSString stringWithFormat:@"%@", _taskModel.reference] baseURL:nil];
return cell;
}
......@@ -266,6 +282,17 @@
return CGFLOAT_MIN;
}
#pragma mark - UIAlertViewDelegate
-(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
if (buttonIndex == 0 && alertView.tag == 39429234) {
[self.navigationController popViewControllerAnimated:YES];
NSNotificationCenter *notification = [NSNotificationCenter defaultCenter];
[notification postNotificationName:@"kReloadTableView" object:self];
}
}
#pragma mark - lazy loading
- (UITableView *)tableView
......
......@@ -77,6 +77,9 @@
cell.titleDetailLabel.text = [NSString stringWithFormat:@"要求图片%d张", _taskModel.attachmentNumber];
cell.introLabel.text = @"参考说明";
cell.introDetailLabel.text = [NSString stringWithFormat:@"%@", _taskModel.reference];
// cell.introDetailLabel.backgroundColor = [UIColor greenColor];
// [cell.introDetailLabel loadHTMLString:[NSString stringWithFormat:@"%@", _taskModel.reference] baseURL:nil];
return cell;
}
......
......@@ -10,7 +10,7 @@
@interface TaskListModel : NSObject
@property (nonatomic, copy) NSString *beginDate;
@property (nonatomic, copy) NSArray *categories;
@property (nonatomic, strong) NSArray *categories;
@property (nonatomic, copy) NSString *commentId;
@property (nonatomic, copy) NSString *create_id;
@property (nonatomic, copy) NSString *create_operName;
......@@ -35,4 +35,6 @@
@property (nonatomic, copy) NSString *uuid;
@property (nonatomic, copy) NSString *version;
@property (nonatomic, copy) NSString *storePath;
@property (nonatomic, copy) NSString *gradeCount;
@property (nonatomic, strong) NSArray *published;
@end
......@@ -81,6 +81,11 @@
[self requestInspectList];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(requestCurrentList)
name:@"kReloadTableView"
object:nil];
}
- (void)viewWillAppear:(BOOL)animated
......@@ -105,6 +110,50 @@
}
#pragma mark - Private
- (void)requestCurrentList
{
NSString *url = [NSString stringWithFormat:@"%@%@", kRedStarURL, kInspectListURL];
HttpClient *httpCilent = [[HttpClient alloc] initWithUrl:url];
NSDictionary *parameters = @{
@"queryOrders":@[@{@"field":@"lastModifyInfo"}],
@"pageNumber":@(0),
@"pageSize":@(20)
};
[MBProgressHUD showHUDAddedTo:self.view animated:YES];
[httpCilent getInspectListWithParameters:parameters completion:^(id response, NSError *error) {
NSLog(@"巡检列表%@", response);
NSDictionary *dataDict = response[@"data"];
NSArray *dataArray = dataDict[@"records"];
NSMutableArray *taskArray = [NSMutableArray array];
for (NSDictionary *dict in dataArray) {
TaskListModel *taskList = [[TaskListModel alloc] init];
[taskList setValuesForKeysWithDictionary:dict];
[taskArray addObject:taskList];
}
_taskListDataArray = taskArray;
if (_taskListDataArray.count == 0) {
self.noDataView.backgroundColor = [UIColor whiteColor];
[MBProgressHUD hideHUDForView:self.view animated:YES];
} else {
self.tableView.delegate = self;
self.tableView.dataSource = self;
[MBProgressHUD hideHUDForView:self.view animated:YES];
}
[self.tableView reloadData];
}];
}
- (void)taxisBtnCilck:(UIButton *)sender
{
NSLog(@"拍讯");
......
......@@ -37,7 +37,8 @@
@property (nonatomic, copy) NSString *version;
@property (nonatomic, copy) NSString *storePath;
@property (nonatomic, copy) NSString *gradeCount;
@property (nonatomic, strong) NSArray *published;
+ (instancetype)taskDetailModelWithDict:(NSDictionary *)dict;
- (instancetype)initWithDict:(NSDictionary *)dict;
......
......@@ -75,6 +75,11 @@
// 口碑巡检明细
[self requestRankingDetail];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(requestCurrentList)
name:@"kReloadTableView"
object:nil];
}
- (void)didReceiveMemoryWarning {
......@@ -86,6 +91,36 @@
#pragma mark - Private Methods
- (void)requestCurrentList
{
NSString *url = [NSString stringWithFormat:@"%@%@%@/%@",kRedStarURL, kInspectDetailURL, self.uuid, self.store_uuid];
HttpClient *httpClient = [[HttpClient alloc] initWithUrl:url];
__block InspectTaskViewController *weakSelf = self;
[MBProgressHUD showHUDAddedTo:self.view animated:YES];
[httpClient getPraiseDetailWithParameters:nil completion:^(id response, NSError *error) {
NSLog(@"口碑巡检明细PraiseDetail = %@", response);
NSDictionary *dataDict = response[@"data"];
TaskDetailModel *taskDetail = [TaskDetailModel taskDetailModelWithDict:dataDict];
weakSelf.detailHeaderView.taskDetail = taskDetail;
_taskDetail = taskDetail;
NSArray *dataArray = dataDict[@"categories"];
NSMutableArray *tgArray = [NSMutableArray array];
for (NSDictionary *dict in dataArray) {
TaskGroup *taskGroup = [TaskGroup taskGroupWithDict:dict];
[tgArray addObject:taskGroup];
}
_taskData = tgArray;
[MBProgressHUD hideHUDForView:self.view animated:YES];
[self.tableView reloadData];
}];
}
// 返回上一页面
- (void)doBack:(UIBarButtonItem *)sender
{
......@@ -155,7 +190,7 @@
TaskModel *task = taskGroup.answers[indexPath.row];
cell.task = task;
cell.titleLabel.text = [NSString stringWithFormat:@"%@、%@", task.lineNo ,task.title];
cell.titleLabel.text = [NSString stringWithFormat:@"%d、%@", (int)indexPath.row + 1 ,task.title];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
......
......@@ -20,6 +20,8 @@
NSInteger _section;
UILabel *_gradeLabel;
UIImageView *_gradeImageView;
UIView *_lineView;
}
@end
......@@ -50,9 +52,9 @@
UIButton *bgButton = [UIButton buttonWithType:UIButtonTypeCustom];
bgButton.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
bgButton.contentEdgeInsets = UIEdgeInsetsMake(0, 0, 0, 10);
bgButton.titleEdgeInsets = UIEdgeInsetsMake(0, 30, 0, 0);
bgButton.titleEdgeInsets = UIEdgeInsetsMake(0, 5, 0, 0);
[bgButton setTitleColor:kLightBlack forState:UIControlStateNormal];
bgButton.titleLabel.font = [UIFont systemFontOfSize:18.0];
bgButton.titleLabel.font = [UIFont systemFontOfSize:17.0];
[bgButton addTarget:self action:@selector(headBtnClick) forControlEvents:UIControlEventTouchUpInside];
bgButton.backgroundColor = [UIColor whiteColor];
[self addSubview:bgButton];
......@@ -79,10 +81,15 @@
} else {
UILabel *gradeLabel = [[UILabel alloc] init];
gradeLabel.textAlignment = NSTextAlignmentCenter;
gradeLabel.textColor = kLightBlack;
gradeLabel.font = [UIFont systemFontOfSize:16.0];
[self addSubview:gradeLabel];
gradeLabel.text = [NSString stringWithFormat:@"第%d名", (int)section + 1];
NSString *rankStr = [NSString stringWithFormat:@"第 %d 名", (int)section + 1];
NSMutableAttributedString *rankAttr = [[NSMutableAttributedString alloc] initWithString:rankStr];
[rankAttr addAttributes:@{NSForegroundColorAttributeName:kRankHeadTitleTextColor,NSFontAttributeName:[UIFont systemFontOfSize:14.0f]} range:NSMakeRange(0,1)];
[rankAttr addAttributes:@{NSForegroundColorAttributeName:kGradeNumberTextColor} range:NSMakeRange(1,rankStr.length - 2)];
[rankAttr addAttribute:NSFontAttributeName value:[UIFont fontWithName:@"Arial-BoldMT" size:18.0] range:NSMakeRange(1,rankStr.length - 2)];
[rankAttr addAttributes:@{NSForegroundColorAttributeName:kRankHeadTitleTextColor,NSFontAttributeName:[UIFont systemFontOfSize:14.0f]} range:NSMakeRange(rankStr.length - 1,1)];
[gradeLabel setAttributedText:rankAttr];
_gradeLabel = gradeLabel;
}
_section = section;
......@@ -92,6 +99,11 @@
[_bgView addSubview:pushButton];
_pushButton = pushButton;
UIView *lineView = [[UIView alloc] init];
[self addSubview:lineView];
lineView.backgroundColor = kSeparateLineColor;
_lineView = lineView;
}
return self;
......@@ -109,7 +121,11 @@
{
_rankListModel = rankListModel;
[_bgButton setTitle:rankListModel.store_name forState:UIControlStateNormal];
_scoreLabel.text = [NSString stringWithFormat:@"%@ 分",rankListModel.score];
if (rankListModel.score == nil || rankListModel.score == NULL || [rankListModel.score isEqual:[NSNull null]]) {
_scoreLabel.text = [NSString stringWithFormat:@"0"];
} else {
_scoreLabel.text = [NSString stringWithFormat:@"%@",rankListModel.score];
}
}
......@@ -136,14 +152,14 @@
_bgView.frame = self.bounds;
_bgButton.frame = CGRectMake(30, 0, 0.3 * 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.3 * kScreenWidth, 50);
_scoreLabel.frame = CGRectMake(0.4 * kScreenWidth, 0, 0.25 * kScreenWidth, 50);
if (_section < 3) {
_gradeImageView.frame = CGRectMake(0.8 * kScreenWidth, 9, 36, 33);
} else {
_gradeLabel.frame = CGRectMake(0.7 * kScreenWidth, 0, 0.3 * kScreenWidth, 50);
}
_pushButton.frame = CGRectMake(30 + 0.3 * kScreenWidth, 0, 0.7 * kScreenWidth - 30, self.bounds.size.height);;
_lineView.frame = CGRectMake(0, self.bounds.size.height - 0.5, kScreenWidth, 0.5);
}
......
......@@ -116,38 +116,47 @@
NSString *username = [[NSUserDefaults standardUserDefaults] objectForKey:@"username"];
NSString *password = [[NSUserDefaults standardUserDefaults] objectForKey:@"password"];
self.loginView.usernameTextFiled.text = username;
self.loginView.passwordTextFiled.text = password;
HttpClient *httpClient = [[HttpClient alloc] initWithLogin];
UIWindow *window = [[UIApplication sharedApplication].windows lastObject];
[MBProgressHUD showHUDAddedTo:window animated:YES];
[httpClient loginWithUsername:username password:password completion:^(id response, NSError *error) {
NSLog(@"登陆 respo = %@", response);
NSLog(@"error = %@", error);
if ([response[@"message"] isEqualToString:@"ok"]) {
// 保存登陆信息
NSUserDefaults *userDefault = [NSUserDefaults standardUserDefaults];
[userDefault setObject:username forKey:@"username"];
[userDefault setObject:password forKey:@"password"];
[userDefault setObject:response[@"message"] forKey:@"loginMessage"];
NSDictionary *dict = response[@"data"];
NSString *user_code = dict[@"user_code"];
NSString *user_name = dict[@"user_name"];
NSString *user_uuid = dict[@"user_uuid"];
[userDefault setObject:user_code forKey:@"user_code"];
[userDefault setObject:user_name forKey:@"user_name"];
[userDefault setObject:user_uuid forKey:@"user_uuid"];
self.rootTBC = [[RootTabBarController alloc] init];
[MBProgressHUD hideHUDForView:window animated:YES];
[self presentViewController:_rootTBC animated:YES completion:nil];
} else {
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"提示" message:[NSString stringWithFormat:@"%@", response[@"message"]] delegate:nil cancelButtonTitle:@"确定" otherButtonTitles:nil, nil];
[MBProgressHUD hideHUDForView:window animated:YES];
[alertView show];
}
}];
if (self.loginView.usernameTextFiled.text.length == 0 || self.loginView.passwordTextFiled.text.length == 0) {
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"提示" message:@"账号、密码不能为空" delegate:nil cancelButtonTitle:@"确定" otherButtonTitles:nil, nil];
[alertView show];
return;
} else {
HttpClient *httpClient = [[HttpClient alloc] initWithLogin];
UIWindow *window = [[UIApplication sharedApplication].windows lastObject];
[MBProgressHUD showHUDAddedTo:window animated:YES];
[httpClient loginWithUsername:username password:password completion:^(id response, NSError *error) {
NSLog(@"登陆 respo = %@", response);
NSLog(@"error = %@", error);
if ([response[@"message"] isEqualToString:@"ok"]) {
// 保存登陆信息
NSUserDefaults *userDefault = [NSUserDefaults standardUserDefaults];
[userDefault setObject:username forKey:@"username"];
[userDefault setObject:password forKey:@"password"];
[userDefault setObject:response[@"message"] forKey:@"loginMessage"];
NSDictionary *dict = response[@"data"];
NSString *user_code = dict[@"user_code"];
NSString *user_name = dict[@"user_name"];
NSString *user_uuid = dict[@"user_uuid"];
[userDefault setObject:user_code forKey:@"user_code"];
[userDefault setObject:user_name forKey:@"user_name"];
[userDefault setObject:user_uuid forKey:@"user_uuid"];
self.rootTBC = [[RootTabBarController alloc] init];
[MBProgressHUD hideHUDForView:window animated:YES];
[self presentViewController:_rootTBC animated:YES completion:nil];
} else {
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"提示" message:[NSString stringWithFormat:@"%@", response[@"message"]] delegate:nil cancelButtonTitle:@"确定" otherButtonTitles:nil, nil];
[MBProgressHUD hideHUDForView:window animated:YES];
[alertView show];
}
}];
}
}
}
......
......@@ -25,11 +25,11 @@
// 2.title
CGFloat titleX = self.bounds.size.width / 2;
CGFloat titleX = imageW + imageX + 4;
CGFloat titleY = 1;
CGFloat titleW = self.bounds.size.width / 2;
CGFloat titleW = self.bounds.size.width - (imageW + imageX + 4);
CGFloat titleH = self.bounds.size.height - titleY;
self.titleLabel.frame = CGRectMake(titleX, titleY, titleW, titleH);
self.titleLabel.frame = CGRectMake(titleX , titleY, titleW, titleH);
}
......
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