Commit f3198698 authored by n22's avatar n22

接口

parent 55b6c85f
...@@ -347,6 +347,7 @@ ...@@ -347,6 +347,7 @@
FE2FCC881B7492C500BBC6FB /* ResultDetailViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = FE2FCC871B7492C500BBC6FB /* ResultDetailViewController.m */; }; FE2FCC881B7492C500BBC6FB /* ResultDetailViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = FE2FCC871B7492C500BBC6FB /* ResultDetailViewController.m */; };
FE2FCC8B1B74A9EE00BBC6FB /* SurveyResultCell.m in Sources */ = {isa = PBXBuildFile; fileRef = FE2FCC8A1B74A9EE00BBC6FB /* SurveyResultCell.m */; }; FE2FCC8B1B74A9EE00BBC6FB /* SurveyResultCell.m in Sources */ = {isa = PBXBuildFile; fileRef = FE2FCC8A1B74A9EE00BBC6FB /* SurveyResultCell.m */; };
FE4F17251B72FAAB00924DED /* ChosePersonViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = FE4F17241B72FAAB00924DED /* ChosePersonViewController.m */; }; FE4F17251B72FAAB00924DED /* ChosePersonViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = FE4F17241B72FAAB00924DED /* ChosePersonViewController.m */; };
FE7155D91B7B328400595B0A /* Product.m in Sources */ = {isa = PBXBuildFile; fileRef = FE7155D81B7B328400595B0A /* Product.m */; };
FEAE16E91B79C9F9009D9E01 /* ResultView.m in Sources */ = {isa = PBXBuildFile; fileRef = FEAE16E81B79C9F9009D9E01 /* ResultView.m */; }; FEAE16E91B79C9F9009D9E01 /* ResultView.m in Sources */ = {isa = PBXBuildFile; fileRef = FEAE16E81B79C9F9009D9E01 /* ResultView.m */; };
FEAE16EC1B79CAA0009D9E01 /* TPCustomImageVIew.m in Sources */ = {isa = PBXBuildFile; fileRef = FEAE16EB1B79CAA0009D9E01 /* TPCustomImageVIew.m */; }; FEAE16EC1B79CAA0009D9E01 /* TPCustomImageVIew.m in Sources */ = {isa = PBXBuildFile; fileRef = FEAE16EB1B79CAA0009D9E01 /* TPCustomImageVIew.m */; };
FEAE16EF1B79CAE3009D9E01 /* SingleScrollView.m in Sources */ = {isa = PBXBuildFile; fileRef = FEAE16EE1B79CAE3009D9E01 /* SingleScrollView.m */; }; FEAE16EF1B79CAE3009D9E01 /* SingleScrollView.m in Sources */ = {isa = PBXBuildFile; fileRef = FEAE16EE1B79CAE3009D9E01 /* SingleScrollView.m */; };
...@@ -737,6 +738,8 @@ ...@@ -737,6 +738,8 @@
FE2FCC8A1B74A9EE00BBC6FB /* SurveyResultCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SurveyResultCell.m; sourceTree = "<group>"; }; FE2FCC8A1B74A9EE00BBC6FB /* SurveyResultCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SurveyResultCell.m; sourceTree = "<group>"; };
FE4F17231B72FAAB00924DED /* ChosePersonViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ChosePersonViewController.h; sourceTree = "<group>"; }; FE4F17231B72FAAB00924DED /* ChosePersonViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ChosePersonViewController.h; sourceTree = "<group>"; };
FE4F17241B72FAAB00924DED /* ChosePersonViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ChosePersonViewController.m; sourceTree = "<group>"; }; FE4F17241B72FAAB00924DED /* ChosePersonViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ChosePersonViewController.m; sourceTree = "<group>"; };
FE7155D71B7B328400595B0A /* Product.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Product.h; sourceTree = "<group>"; };
FE7155D81B7B328400595B0A /* Product.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Product.m; sourceTree = "<group>"; };
FEAE16E71B79C9F9009D9E01 /* ResultView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ResultView.h; sourceTree = "<group>"; }; FEAE16E71B79C9F9009D9E01 /* ResultView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ResultView.h; sourceTree = "<group>"; };
FEAE16E81B79C9F9009D9E01 /* ResultView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ResultView.m; sourceTree = "<group>"; }; FEAE16E81B79C9F9009D9E01 /* ResultView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ResultView.m; sourceTree = "<group>"; };
FEAE16EA1B79CAA0009D9E01 /* TPCustomImageVIew.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TPCustomImageVIew.h; sourceTree = "<group>"; }; FEAE16EA1B79CAA0009D9E01 /* TPCustomImageVIew.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TPCustomImageVIew.h; sourceTree = "<group>"; };
...@@ -822,6 +825,8 @@ ...@@ -822,6 +825,8 @@
7217E9CE1B72364300FE5C1D /* SurveyResult.m */, 7217E9CE1B72364300FE5C1D /* SurveyResult.m */,
72F56CB01B76EC200077F0C9 /* SurveyUser.h */, 72F56CB01B76EC200077F0C9 /* SurveyUser.h */,
72F56CB11B76EC200077F0C9 /* SurveyUser.m */, 72F56CB11B76EC200077F0C9 /* SurveyUser.m */,
FE7155D71B7B328400595B0A /* Product.h */,
FE7155D81B7B328400595B0A /* Product.m */,
); );
path = models; path = models;
sourceTree = "<group>"; sourceTree = "<group>";
...@@ -1932,6 +1937,7 @@ ...@@ -1932,6 +1937,7 @@
C142D2AC1AC3A155000109A7 /* NSNull+OVNatural.m in Sources */, C142D2AC1AC3A155000109A7 /* NSNull+OVNatural.m in Sources */,
300DD94A1B184B450080EE12 /* ICRPatrolPlan.m in Sources */, 300DD94A1B184B450080EE12 /* ICRPatrolPlan.m in Sources */,
C12C24D11B0BA3C700E1FEBF /* ICRTaskHandleViewController.m in Sources */, C12C24D11B0BA3C700E1FEBF /* ICRTaskHandleViewController.m in Sources */,
FE7155D91B7B328400595B0A /* Product.m in Sources */,
C159188A1AC4615D0013B391 /* ICRHTTPController.m in Sources */, C159188A1AC4615D0013B391 /* ICRHTTPController.m in Sources */,
C123A90D1B25CBAD003C0C36 /* ASStarRatingView.m in Sources */, C123A90D1B25CBAD003C0C36 /* ASStarRatingView.m in Sources */,
C15295AF1B24296500DF60D1 /* ICRQSingleSelectViewController.m in Sources */, C15295AF1B24296500DF60D1 /* ICRQSingleSelectViewController.m in Sources */,
......
...@@ -198,6 +198,19 @@ typedef NS_ENUM(NSUInteger, ICRAttachmentType) { ...@@ -198,6 +198,19 @@ typedef NS_ENUM(NSUInteger, ICRAttachmentType) {
success:(void (^)(id))succ success:(void (^)(id))succ
failure:(void (^)(id))fail; failure:(void (^)(id))fail;
//下载商品信息
- (void)getProductWithPage_number:(NSUInteger)page_number
page_size:(NSUInteger)page_size
success:(void (^)(id))succ
failure:(void (^)(id))fail;
//下载用户信息
- (void)getUserWithPage_number:(NSUInteger)page_number
page_size:(NSUInteger)page_size
success:(void (^)(id))succ
failure:(void (^)(id))fail;
@end @end
...@@ -69,7 +69,9 @@ typedef NS_ENUM(NSUInteger, ICRHTTPAction) { ...@@ -69,7 +69,9 @@ typedef NS_ENUM(NSUInteger, ICRHTTPAction) {
//行情 //行情
XFFHttp_SurveySave, XFFHttp_SurveySave,
XFFHttp_QuerySurvey, XFFHttp_QuerySurvey,
XFFHttp_GetResults XFFHttp_GetResults,
XFFHttp_GetProduct,
XFFHttp_GetUser
}; };
static NSString * const ICRHTTPInterface[] = { static NSString * const ICRHTTPInterface[] = {
...@@ -119,8 +121,9 @@ static NSString * const ICRHTTPInterface[] = { ...@@ -119,8 +121,9 @@ static NSString * const ICRHTTPInterface[] = {
//行情调研 //行情调研
[XFFHttp_SurveySave] = @"survey/save_survey", [XFFHttp_SurveySave] = @"survey/save_survey",
[XFFHttp_QuerySurvey] = @"survey/query_survey", [XFFHttp_QuerySurvey] = @"survey/query_survey",
[XFFHttp_GetResults] = @"survey/get_result" [XFFHttp_GetResults] = @"survey/get_result",
[XFFHttp_GetProduct] = @"mdata/product/download",
[XFFHttp_GetUser] = @"user/download"
}; };
...@@ -1316,7 +1319,12 @@ acceptTypeJson:YES ...@@ -1316,7 +1319,12 @@ acceptTypeJson:YES
ICRUserUtil *userUtil = [ICRUserUtil sharedInstance]; ICRUserUtil *userUtil = [ICRUserUtil sharedInstance];
NSString *urlStr = [[[self class] UrlForPluginHTTPAction:XFFHttp_SurveySave] stringByAppendingFormat:@"?time=%@&operator.id=%@&operator.operName=%@&enterprise=%@",currentTime,userUtil.userCode,userUtil.displayName,userUtil.orgId]; NSString *urlStr = [[[self class] UrlForPluginHTTPAction:XFFHttp_SurveySave] stringByAppendingFormat:@"?time=%@&operator.id=%@&operator.operName=%@&enterprise=%@",currentTime,userUtil.userCode,userUtil.displayName,userUtil.orgId];
NSString *encodeUrlStr = [urlStr stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; NSString *encodeUrlStr = [urlStr stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
[self POST:encodeUrlStr parameters:dict needToken:NO acceptTypeJson:YES success:success failure:failure]; [self POST:encodeUrlStr
parameters:dict
needToken:NO
acceptTypeJson:YES
success:success
failure:failure];
} }
...@@ -1345,7 +1353,12 @@ acceptTypeJson:YES ...@@ -1345,7 +1353,12 @@ acceptTypeJson:YES
ICRUserUtil *userUtil = [ICRUserUtil sharedInstance]; ICRUserUtil *userUtil = [ICRUserUtil sharedInstance];
NSString *urlStr = [[[self class] UrlForPluginHTTPAction:XFFHttp_QuerySurvey] stringByAppendingFormat:@"?enterprise=%@&userUuid=%@&billNumberLike=%@&state=%@&titleLike=%@&orderField=%@&orderDirection=%@&page_number=%@&page_size=%@",userUtil.orgId,userUtil.userId,billNumberLinke,state,titleLike,orderFiled,orderDirection,@(page_number),@(page_size)]; NSString *urlStr = [[[self class] UrlForPluginHTTPAction:XFFHttp_QuerySurvey] stringByAppendingFormat:@"?enterprise=%@&userUuid=%@&billNumberLike=%@&state=%@&titleLike=%@&orderField=%@&orderDirection=%@&page_number=%@&page_size=%@",userUtil.orgId,userUtil.userId,billNumberLinke,state,titleLike,orderFiled,orderDirection,@(page_number),@(page_size)];
NSString *encodeUrlStr = [urlStr stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; NSString *encodeUrlStr = [urlStr stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
[self POST:encodeUrlStr parameters:nil needToken:NO acceptTypeJson:YES success:success failure:failure]; [self POST:encodeUrlStr
parameters:nil
needToken:NO
acceptTypeJson:YES
success:success
failure:failure];
} }
- (void)getResultsWithSurveyUuid:(NSString *)surveyUuid - (void)getResultsWithSurveyUuid:(NSString *)surveyUuid
...@@ -1373,7 +1386,69 @@ acceptTypeJson:YES ...@@ -1373,7 +1386,69 @@ acceptTypeJson:YES
NSString *urlStr = [[[self class] UrlForPluginHTTPAction:XFFHttp_GetResults] stringByAppendingFormat:@"/%@",surveyUuid]; NSString *urlStr = [[[self class] UrlForPluginHTTPAction:XFFHttp_GetResults] stringByAppendingFormat:@"/%@",surveyUuid];
NSString *encodeUrlStr = [urlStr stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; NSString *encodeUrlStr = [urlStr stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
[self POST:encodeUrlStr parameters:NULL needToken:NO acceptTypeJson:YES success:success failure:failure]; [self POST:encodeUrlStr
parameters:NULL
needToken:NO
acceptTypeJson:YES
success:success
failure:failure];
}
-(void)getProductWithPage_number:(NSUInteger)page_number
page_size:(NSUInteger)page_size
success:(void (^)(id))succ
failure:(void (^)(id))fail{
void (^success)(AFHTTPRequestOperation *operation, id responseObject) = ^(AFHTTPRequestOperation *operation, id responseObject) {
CLog(@"%@", responseObject);
if (succ) {
succ( responseObject );
}
};
void (^failure)(AFHTTPRequestOperation *operation, NSError *error) = ^(AFHTTPRequestOperation *operation, NSError *error) {
CLog(@"%@", error);
if (fail) {
fail( error );
}
};
NSString *urlStr = [[[self class] UrlForPluginHTTPAction:XFFHttp_GetProduct] stringByAppendingFormat:@"?start_date=%@&page_number=%@&page_size=%@", [[NSDate date] httpParameterString],@(page_number),@(page_size)];
NSString *encodeUrlStr = [urlStr stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
[self POST:encodeUrlStr
parameters:NULL
needToken:NO
acceptTypeJson:YES
success:success
failure:failure];
}
- (void)getUserWithPage_number:(NSUInteger)page_number
page_size:(NSUInteger)page_size
success:(void (^)(id))succ
failure:(void (^)(id))fail{
void (^success)(AFHTTPRequestOperation *operation, id responseObject) = ^(AFHTTPRequestOperation *operation, id responseObject) {
CLog(@"%@", responseObject);
if (succ) {
succ( responseObject );
}
};
void (^failure)(AFHTTPRequestOperation *operation, NSError *error) = ^(AFHTTPRequestOperation *operation, NSError *error) {
CLog(@"%@", error);
if (fail) {
fail( error );
}
};
NSString *urlStr = [[[self class] UrlForPluginHTTPAction:XFFHttp_GetUser] stringByAppendingFormat:@"?start_date=%@&page_number=%@&page_size=%@", [[NSDate date] httpParameterString],@(page_number),@(page_size)];
NSString *encodeUrlStr = [urlStr stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
[self POST:encodeUrlStr
parameters:NULL
needToken:NO
acceptTypeJson:YES
success:success
failure:failure];
} }
......
...@@ -10,5 +10,5 @@ ...@@ -10,5 +10,5 @@
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>
@interface IBTObject : NSObject @interface IBTObject : NSObject
- (void)setValue:(id)value forUndefinedKey:(NSString *)key;
@end @end
...@@ -9,5 +9,5 @@ ...@@ -9,5 +9,5 @@
#import "IBTObject.h" #import "IBTObject.h"
@implementation IBTObject @implementation IBTObject
- (void)setValue:(id)value forUndefinedKey:(NSString *)key{}
@end @end
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
- (void)bulidLayout - (void)bulidLayout
{ {
self.titleLabel = [[UILabel alloc]initWithFrame:(CGRectMake(LeftMargin, 0, 100, self.totalHeight))]; self.titleLabel = [[UILabel alloc]initWithFrame:(CGRectMake(LeftMargin, 0, self.totalWidth - LeftMargin - BtnSize, self.totalHeight))];
self.titleLabel.textAlignment= NSTextAlignmentLeft; self.titleLabel.textAlignment= NSTextAlignmentLeft;
self.titleLabel.textColor = HexColor(@"666666"); self.titleLabel.textColor = HexColor(@"666666");
self.titleLabel.font = FontSize(TitleSize); self.titleLabel.font = FontSize(TitleSize);
......
...@@ -7,7 +7,8 @@ ...@@ -7,7 +7,8 @@
// //
#import "ICRBaseViewController.h" #import "ICRBaseViewController.h"
typedef void(^ChoseProduct)(NSString *name); #import "Product.h"
typedef void(^ChoseProduct)(Product *product);
@interface ChooseProductViewController : ICRBaseViewController @interface ChooseProductViewController : ICRBaseViewController
......
...@@ -18,7 +18,6 @@ ...@@ -18,7 +18,6 @@
NSMutableArray *_indexArr; NSMutableArray *_indexArr;
NSIndexPath *_currentIndexPath; NSIndexPath *_currentIndexPath;
}@end }@end
@implementation ChooseProductViewController @implementation ChooseProductViewController
...@@ -31,21 +30,36 @@ ...@@ -31,21 +30,36 @@
- (void)initData{ - (void)initData{
_dataArr = [NSMutableArray array]; _dataArr = [NSMutableArray array];
_indexArr = [NSMutableArray array]; _indexArr = [NSMutableArray array];
[_dataArr addObject:@"商品1"]; //获取商品
[_dataArr addObject:@"商品2"]; void(^succ)(id) = ^(id data) {
[_dataArr addObject:@"商品3"]; [IBTLoadingView hideHUDWithText:nil];
[_dataArr addObject:@"商品4"]; if (data) {
[_dataArr addObject:@"商品5"]; NSInteger success = [data[@"success"] integerValue];
[_dataArr addObject:@"商品6"]; NSString *message = data[@"message"];
[_dataArr addObject:@"商品7"]; if (success == 1) {
[_dataArr addObject:@"商品8"]; //成功
[_dataArr addObject:@"商品9"]; NSDictionary *dataDict = data[@"data"];
[_dataArr addObject:@"商品10"]; NSArray *records = dataDict[@"records"];
[_dataArr addObject:@"商品11"]; if (records.count > 0) {
[_dataArr addObject:@"商品12"]; for (NSDictionary *recordDict in records) {
[_dataArr addObject:@"商品13"]; Product *product = [[Product alloc]init];
[_dataArr addObject:@"商品14"]; [product setValuesForKeysWithDictionary:recordDict];
[_dataArr addObject:@"商品15"]; [_dataArr addObject:product];
}
//刷新表格
[_tableView reloadData];
}
}else{
[IBTLoadingView showTips:message];
}
}
};
void(^fail)(id) = ^(id data) {
[IBTLoadingView hideHUDWithText:nil];
[IBTLoadingView showTips:data];
};
[IBTLoadingView showProgressLabel:@"正在加载..."];
[[ICRHTTPController sharedController] getProductWithPage_number:0 page_size:100 success:succ failure:fail];
} }
- (void)bulidLayout - (void)bulidLayout
{ {
...@@ -82,7 +96,14 @@ ...@@ -82,7 +96,14 @@
} }
- (void)sureClick{ - (void)sureClick{
self.choseProduct(_selectTextFiled.text); if(self.isMoreChose){
}else{
if (_dataArr.count > 0) {
Product *product = _dataArr[_currentIndexPath.row];
self.choseProduct(product);
}
}
[self PopViewControllerAnimated:YES]; [self PopViewControllerAnimated:YES];
} }
...@@ -90,6 +111,7 @@ ...@@ -90,6 +111,7 @@
- (void)deletePerson { - (void)deletePerson {
_selectTextFiled.text = @""; _selectTextFiled.text = @"";
[_indexArr removeAllObjects]; [_indexArr removeAllObjects];
_currentIndexPath = nil;
[_tableView reloadData]; [_tableView reloadData];
} }
...@@ -122,9 +144,16 @@ ...@@ -122,9 +144,16 @@
}else{ }else{
cell.Commitbtn.hidden = YES; cell.Commitbtn.hidden = YES;
} }
}else{
cell.Commitbtn.hidden = YES;
}
} }
if (_dataArr.count > 0) {
Product *product = _dataArr[indexPath.row];
NSString *proStr = [NSString stringWithFormat:@"%@[%@]",product.name,product.code];
[cell setTitleStr:proStr];
} }
[cell setTitleStr:_dataArr[indexPath.row]];
return cell; return cell;
} }
...@@ -139,7 +168,8 @@ ...@@ -139,7 +168,8 @@
NSString *personStr = @""; NSString *personStr = @"";
for (NSIndexPath *index in _indexArr) { for (NSIndexPath *index in _indexArr) {
personStr = [personStr stringByAppendingFormat:@"%@、",_dataArr[index.row]]; Product *product = _dataArr[index.row];
personStr = [personStr stringByAppendingFormat:@"%@、",product.name];
} }
_selectTextFiled.text = personStr; _selectTextFiled.text = personStr;
}else{ }else{
...@@ -150,8 +180,8 @@ ...@@ -150,8 +180,8 @@
_currentIndexPath = indexPath; _currentIndexPath = indexPath;
NSString *name = _dataArr[indexPath.row]; Product *procuct = _dataArr[indexPath.row];
_selectTextFiled.text = name; _selectTextFiled.text = procuct.name;
} }
} }
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#import "ChosePersonViewController.h" #import "ChosePersonViewController.h"
#import "MaskCell.h" #import "MaskCell.h"
#import "SurveyUser.h" #import "SurveyUser.h"
#import "SurveyUser.h"
#define TopMargin 50 #define TopMargin 50
#define TableHeight 50 #define TableHeight 50
@interface ChosePersonViewController ()<UITableViewDataSource,UITableViewDelegate,UITextFieldDelegate> @interface ChosePersonViewController ()<UITableViewDataSource,UITableViewDelegate,UITextFieldDelegate>
...@@ -30,11 +31,42 @@ ...@@ -30,11 +31,42 @@
- (void)initData{ - (void)initData{
_dataArr = [NSMutableArray array]; _dataArr = [NSMutableArray array];
_indexArr = [NSMutableArray array]; _indexArr = [NSMutableArray array];
for (NSInteger i = 0; i < 10; i++) {
void(^succ)(id) = ^(id data) {
[IBTLoadingView hideHUDWithText:nil];
if (data) {
NSInteger success = [data[@"success"] integerValue];
NSString *message = data[@"message"];
if (success == 1) {
//成功
NSDictionary *dataDict = data[@"data"];
NSArray *records = dataDict[@"records"];
if (records.count > 0) {
for (NSDictionary *recordDict in records) {
SurveyUser *user = [[SurveyUser alloc]init]; SurveyUser *user = [[SurveyUser alloc]init];
user.userName = [NSString stringWithFormat:@"张三%ld",(long)i]; [user setValuesForKeysWithDictionary:recordDict];
[_dataArr addObject:user]; [_dataArr addObject:user];
} }
//刷新表格
[_tableView reloadData];
}
}else{
[IBTLoadingView showTips:message];
}
}
};
void(^fail)(id) = ^(id data) {
[IBTLoadingView hideHUDWithText:nil];
[IBTLoadingView showTips:data];
};
[IBTLoadingView showProgressLabel:@"正在加载..."];
[[ICRHTTPController sharedController] getUserWithPage_number:0 page_size:100 success:succ failure:fail];
// for (NSInteger i = 0; i < 10; i++) {
// SurveyUser *user = [[SurveyUser alloc]init];
// user.userName = [NSString stringWithFormat:@"张三%ld",(long)i];
// [_dataArr addObject:user];
// }
} }
- (void)bulidLayout - (void)bulidLayout
{ {
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#import "ChooseProductViewController.h" #import "ChooseProductViewController.h"
#import "SurveyUser.h" #import "SurveyUser.h"
#import "Survey.h" #import "Survey.h"
#import "Product.h"
#define LeftMargin 15 #define LeftMargin 15
#define BtnHeight 44 #define BtnHeight 44
#define TableHeight 46 #define TableHeight 46
...@@ -133,7 +134,15 @@ typedef enum : NSUInteger { ...@@ -133,7 +134,15 @@ typedef enum : NSUInteger {
//保存 //保存
void(^succ)(id) = ^(id data) { void(^succ)(id) = ^(id data) {
[IBTLoadingView hideHUDWithText:nil]; [IBTLoadingView hideHUDWithText:nil];
NSLog(@"%@",data); if (data) {
NSInteger success = [data[@"success"] integerValue];
NSString *message = data[@"message"];
if (success == 1) {
//成功
}else{
[IBTLoadingView showTips:message];
}
}
}; };
void(^fail)(id) = ^(id data) { void(^fail)(id) = ^(id data) {
[IBTLoadingView hideHUDWithText:nil]; [IBTLoadingView hideHUDWithText:nil];
...@@ -249,18 +258,17 @@ typedef enum : NSUInteger { ...@@ -249,18 +258,17 @@ typedef enum : NSUInteger {
} }
_personLabel.text = textStr; _personLabel.text = textStr;
_personLabel.textColor = HexColor(@"444444"); _personLabel.textColor = HexColor(@"444444");
// [self.users addObjectsFromArray:users];
}; };
cvc.isMoreChose = YES; cvc.isMoreChose = YES;
[self PushViewController:cvc animated:YES]; [self PushViewController:cvc animated:YES];
}else if(indexPath.row == 1){ }else if(indexPath.row == 1){
ChooseProductViewController *cvc = [ChooseProductViewController new]; ChooseProductViewController *cvc = [ChooseProductViewController new];
cvc.choseProduct = ^(NSString *name){ cvc.choseProduct = ^(Product *product){
_productLabel.text = name; _productLabel.text = [NSString stringWithFormat:@"%@[%@]",product.name,product.code];
_productLabel.textColor = HexColor(@"444444"); _productLabel.textColor = HexColor(@"444444");
self.productName = name; self.productName = product.name;
self.productUuid = name; self.productUuid = product.uuid;
self.productCode = @"123"; self.productCode = product.code;
}; };
cvc.isMoreChose = NO; cvc.isMoreChose = NO;
[self PushViewController:cvc animated:YES]; [self PushViewController:cvc animated:YES];
......
...@@ -52,39 +52,39 @@ typedef enum : NSUInteger { ...@@ -52,39 +52,39 @@ typedef enum : NSUInteger {
- (void)initData{ - (void)initData{
_dataArr = [NSMutableArray array]; _dataArr = [NSMutableArray array];
// //保存 //保存
// void(^succ)(id) = ^(id data) { void(^succ)(id) = ^(id data) {
// [IBTLoadingView hideHUDWithText:nil]; [IBTLoadingView hideHUDWithText:nil];
// NSLog(@"%@",data); NSLog(@"%@",data);
// }; };
// void(^fail)(id) = ^(id data) { void(^fail)(id) = ^(id data) {
// [IBTLoadingView hideHUDWithText:nil]; [IBTLoadingView hideHUDWithText:nil];
// [IBTLoadingView showTips:data]; [IBTLoadingView showTips:data];
// }; };
// [IBTLoadingView showProgressLabel:@"正在保存..."]; [IBTLoadingView showProgressLabel:@"正在保存..."];
// [[ICRHTTPController sharedController] querySurveyWithBillNUmberLinke:@"fdsfds" state:@"initial" titleLike:@"fds" orderFiled:@"fdsafds" orderDirection:@"asc" page_number:1 page_size:10 success:succ failure:fail]; [[ICRHTTPController sharedController] querySurveyWithBillNUmberLinke:@"fdsfds" state:@"initial" titleLike:@"fds" orderFiled:@"fdsafds" orderDirection:@"asc" page_number:1 page_size:10 success:succ failure:fail];
// [[ICRHTTPController sharedController] getResultsWithSurveyUuid:@"111" success:succ failure:fail]; [[ICRHTTPController sharedController] getResultsWithSurveyUuid:@"111" success:succ failure:fail];
for (NSInteger i = 0; i < 4; i++) { // for (NSInteger i = 0; i < 4; i++) {
Survey *survey = [[Survey alloc]init]; // Survey *survey = [[Survey alloc]init];
survey.title = @"南汇8424西瓜调研情况"; // survey.title = @"南汇8424西瓜调研情况";
survey.billnumber = @"150605000001"; // survey.billnumber = @"150605000001";
survey.productname = @"南汇842[100213]"; // survey.productname = @"南汇842[100213]";
survey.productcode = @"22222222222"; // survey.productcode = @"22222222222";
survey.remark = @"费卡接口浪格可放大文化大fdsaf缴费卡接口浪费缴费卡上就付款放假快乐撒即可书法家开发商"; // survey.remark = @"费卡接口浪格可放大文化大fdsaf缴费卡接口浪费缴费卡上就付款放假快乐撒即可书法家开发商";
survey.begindate = [IBTCommon convertToDateFrom:@"2015.05.25"]; // survey.begindate = [IBTCommon convertToDateFrom:@"2015.05.25"];
survey.enddate = [IBTCommon convertToDateFrom:@"2015.08.06"]; // survey.enddate = [IBTCommon convertToDateFrom:@"2015.08.06"];
[_dataArr addObject:survey]; // [_dataArr addObject:survey];
if (i == 0) { // if (i == 0) {
survey.state = @"saved"; // survey.state = @"saved";
}else if (i == 1) { // }else if (i == 1) {
survey.state = @"submitted"; // survey.state = @"submitted";
}else if (i == 2) { // }else if (i == 2) {
survey.state = @"insurvey"; // survey.state = @"insurvey";
}else if (i == 3) { // }else if (i == 3) {
survey.state = @"finished"; // survey.state = @"finished";
} // }
} // }
} }
- (void)createTableView - (void)createTableView
{ {
......
//
// Product.h
// XFFruit
//
// Created by n22 on 15/8/12.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "IBTModel.h"
@interface Product : IBTModel
@property (nonatomic,strong)NSString *uuid;//商品uuid
@property (nonatomic,strong)NSString *code;//商品代码
@property (nonatomic,strong)NSString *brandName;//品牌名称
@property (nonatomic,strong)NSString *name;//品牌名称
@end
//
// Product.m
// XFFruit
//
// Created by n22 on 15/8/12.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "Product.h"
@implementation Product
@end
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