Commit f27c3520 authored by 陈俊俊's avatar 陈俊俊

行情反馈接口

parent 9f7df76f
...@@ -60,7 +60,6 @@ ...@@ -60,7 +60,6 @@
7217E9EC1B72364300FE5C1D /* HPTextViewInternal.m in Sources */ = {isa = PBXBuildFile; fileRef = 7217E9D61B72364300FE5C1D /* HPTextViewInternal.m */; }; 7217E9EC1B72364300FE5C1D /* HPTextViewInternal.m in Sources */ = {isa = PBXBuildFile; fileRef = 7217E9D61B72364300FE5C1D /* HPTextViewInternal.m */; };
7217E9EE1B72364300FE5C1D /* MaskCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 7217E9D91B72364300FE5C1D /* MaskCell.m */; }; 7217E9EE1B72364300FE5C1D /* MaskCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 7217E9D91B72364300FE5C1D /* MaskCell.m */; };
7217E9EF1B72364300FE5C1D /* maskEnable.png in Resources */ = {isa = PBXBuildFile; fileRef = 7217E9DA1B72364300FE5C1D /* maskEnable.png */; }; 7217E9EF1B72364300FE5C1D /* maskEnable.png in Resources */ = {isa = PBXBuildFile; fileRef = 7217E9DA1B72364300FE5C1D /* maskEnable.png */; };
7217E9F01B72364300FE5C1D /* sort.png in Resources */ = {isa = PBXBuildFile; fileRef = 7217E9DB1B72364300FE5C1D /* sort.png */; };
7217E9F11B72364300FE5C1D /* SortMaskView.m in Sources */ = {isa = PBXBuildFile; fileRef = 7217E9DD1B72364300FE5C1D /* SortMaskView.m */; }; 7217E9F11B72364300FE5C1D /* SortMaskView.m in Sources */ = {isa = PBXBuildFile; fileRef = 7217E9DD1B72364300FE5C1D /* SortMaskView.m */; };
7217E9F21B72364300FE5C1D /* StartTimeView.m in Sources */ = {isa = PBXBuildFile; fileRef = 7217E9DF1B72364300FE5C1D /* StartTimeView.m */; }; 7217E9F21B72364300FE5C1D /* StartTimeView.m in Sources */ = {isa = PBXBuildFile; fileRef = 7217E9DF1B72364300FE5C1D /* StartTimeView.m */; };
7217E9F31B72364300FE5C1D /* SurveyCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 7217E9E11B72364300FE5C1D /* SurveyCell.m */; }; 7217E9F31B72364300FE5C1D /* SurveyCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 7217E9E11B72364300FE5C1D /* SurveyCell.m */; };
...@@ -436,7 +435,6 @@ ...@@ -436,7 +435,6 @@
7217E9D81B72364300FE5C1D /* MaskCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MaskCell.h; sourceTree = "<group>"; }; 7217E9D81B72364300FE5C1D /* MaskCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MaskCell.h; sourceTree = "<group>"; };
7217E9D91B72364300FE5C1D /* MaskCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MaskCell.m; sourceTree = "<group>"; }; 7217E9D91B72364300FE5C1D /* MaskCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MaskCell.m; sourceTree = "<group>"; };
7217E9DA1B72364300FE5C1D /* maskEnable.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = maskEnable.png; sourceTree = "<group>"; }; 7217E9DA1B72364300FE5C1D /* maskEnable.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = maskEnable.png; sourceTree = "<group>"; };
7217E9DB1B72364300FE5C1D /* sort.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = sort.png; sourceTree = "<group>"; };
7217E9DC1B72364300FE5C1D /* SortMaskView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SortMaskView.h; sourceTree = "<group>"; }; 7217E9DC1B72364300FE5C1D /* SortMaskView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SortMaskView.h; sourceTree = "<group>"; };
7217E9DD1B72364300FE5C1D /* SortMaskView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SortMaskView.m; sourceTree = "<group>"; }; 7217E9DD1B72364300FE5C1D /* SortMaskView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SortMaskView.m; sourceTree = "<group>"; };
7217E9DE1B72364300FE5C1D /* StartTimeView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StartTimeView.h; sourceTree = "<group>"; }; 7217E9DE1B72364300FE5C1D /* StartTimeView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StartTimeView.h; sourceTree = "<group>"; };
...@@ -868,7 +866,6 @@ ...@@ -868,7 +866,6 @@
7217E9D81B72364300FE5C1D /* MaskCell.h */, 7217E9D81B72364300FE5C1D /* MaskCell.h */,
7217E9D91B72364300FE5C1D /* MaskCell.m */, 7217E9D91B72364300FE5C1D /* MaskCell.m */,
7217E9DA1B72364300FE5C1D /* maskEnable.png */, 7217E9DA1B72364300FE5C1D /* maskEnable.png */,
7217E9DB1B72364300FE5C1D /* sort.png */,
7217E9F51B724A7600FE5C1D /* mask.png */, 7217E9F51B724A7600FE5C1D /* mask.png */,
7217E9DC1B72364300FE5C1D /* SortMaskView.h */, 7217E9DC1B72364300FE5C1D /* SortMaskView.h */,
7217E9DD1B72364300FE5C1D /* SortMaskView.m */, 7217E9DD1B72364300FE5C1D /* SortMaskView.m */,
...@@ -1877,7 +1874,6 @@ ...@@ -1877,7 +1874,6 @@
C1E0930A1AC8FC94003B7126 /* Localizable.strings in Resources */, C1E0930A1AC8FC94003B7126 /* Localizable.strings in Resources */,
C123A9191B25CBAD003C0C36 /* selected_star@2x.png in Resources */, C123A9191B25CBAD003C0C36 /* selected_star@2x.png in Resources */,
7217E9EF1B72364300FE5C1D /* maskEnable.png in Resources */, 7217E9EF1B72364300FE5C1D /* maskEnable.png in Resources */,
7217E9F01B72364300FE5C1D /* sort.png in Resources */,
7217E9F61B724A7600FE5C1D /* mask.png in Resources */, 7217E9F61B724A7600FE5C1D /* mask.png in Resources */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
...@@ -2330,7 +2326,7 @@ ...@@ -2330,7 +2326,7 @@
IPHONEOS_DEPLOYMENT_TARGET = 7.0; IPHONEOS_DEPLOYMENT_TARGET = 7.0;
MTL_ENABLE_DEBUG_INFO = YES; MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES; ONLY_ACTIVE_ARCH = YES;
PROVISIONING_PROFILE = "251ce065-a08f-44fd-bd52-f79372f4e47e"; PROVISIONING_PROFILE = "a12432a9-50b3-4cef-bae7-dcb35f965ce4";
SDKROOT = iphoneos; SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2"; TARGETED_DEVICE_FAMILY = "1,2";
USER_HEADER_SEARCH_PATHS = "${SRCROOT}/**"; USER_HEADER_SEARCH_PATHS = "${SRCROOT}/**";
...@@ -2368,7 +2364,7 @@ ...@@ -2368,7 +2364,7 @@
GCC_WARN_UNUSED_VARIABLE = YES; GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 7.0; IPHONEOS_DEPLOYMENT_TARGET = 7.0;
MTL_ENABLE_DEBUG_INFO = NO; MTL_ENABLE_DEBUG_INFO = NO;
PROVISIONING_PROFILE = "251ce065-a08f-44fd-bd52-f79372f4e47e"; PROVISIONING_PROFILE = "a12432a9-50b3-4cef-bae7-dcb35f965ce4";
SDKROOT = iphoneos; SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2"; TARGETED_DEVICE_FAMILY = "1,2";
USER_HEADER_SEARCH_PATHS = "${SRCROOT}/**"; USER_HEADER_SEARCH_PATHS = "${SRCROOT}/**";
...@@ -2392,7 +2388,7 @@ ...@@ -2392,7 +2388,7 @@
"$(PROJECT_DIR)", "$(PROJECT_DIR)",
); );
PRODUCT_NAME = XFFruit; PRODUCT_NAME = XFFruit;
PROVISIONING_PROFILE = "251ce065-a08f-44fd-bd52-f79372f4e47e"; PROVISIONING_PROFILE = "a12432a9-50b3-4cef-bae7-dcb35f965ce4";
USER_HEADER_SEARCH_PATHS = "${SRCROOT}/**"; USER_HEADER_SEARCH_PATHS = "${SRCROOT}/**";
}; };
name = Debug; name = Debug;
...@@ -2413,7 +2409,7 @@ ...@@ -2413,7 +2409,7 @@
"$(PROJECT_DIR)", "$(PROJECT_DIR)",
); );
PRODUCT_NAME = XFFruit; PRODUCT_NAME = XFFruit;
PROVISIONING_PROFILE = "251ce065-a08f-44fd-bd52-f79372f4e47e"; PROVISIONING_PROFILE = "a12432a9-50b3-4cef-bae7-dcb35f965ce4";
USER_HEADER_SEARCH_PATHS = "${SRCROOT}/**"; USER_HEADER_SEARCH_PATHS = "${SRCROOT}/**";
}; };
name = Release; name = Release;
...@@ -2436,7 +2432,7 @@ ...@@ -2436,7 +2432,7 @@
INFOPLIST_FILE = XFFruitTests/Info.plist; INFOPLIST_FILE = XFFruitTests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_NAME = XFFruitTests; PRODUCT_NAME = XFFruitTests;
PROVISIONING_PROFILE = "251ce065-a08f-44fd-bd52-f79372f4e47e"; PROVISIONING_PROFILE = "a12432a9-50b3-4cef-bae7-dcb35f965ce4";
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/XFFruit.app/XFFruit"; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/XFFruit.app/XFFruit";
USER_HEADER_SEARCH_PATHS = "${SRCROOT}/**"; USER_HEADER_SEARCH_PATHS = "${SRCROOT}/**";
}; };
...@@ -2456,7 +2452,7 @@ ...@@ -2456,7 +2452,7 @@
INFOPLIST_FILE = XFFruitTests/Info.plist; INFOPLIST_FILE = XFFruitTests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_NAME = XFFruitTests; PRODUCT_NAME = XFFruitTests;
PROVISIONING_PROFILE = "251ce065-a08f-44fd-bd52-f79372f4e47e"; PROVISIONING_PROFILE = "a12432a9-50b3-4cef-bae7-dcb35f965ce4";
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/XFFruit.app/XFFruit"; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/XFFruit.app/XFFruit";
USER_HEADER_SEARCH_PATHS = "${SRCROOT}/**"; USER_HEADER_SEARCH_PATHS = "${SRCROOT}/**";
}; };
......
...@@ -202,8 +202,22 @@ typedef NS_ENUM(NSUInteger, ICRAttachmentType) { ...@@ -202,8 +202,22 @@ typedef NS_ENUM(NSUInteger, ICRAttachmentType) {
page_size:(NSUInteger)page_size page_size:(NSUInteger)page_size
success:(void (^)(id))succ success:(void (^)(id))succ
failure:(void (^)(id))fail; failure:(void (^)(id))fail;
//生成行情反馈图片
- (void)resultChartWithResultUuid:(NSString *)uuid
width:(NSNumber *)width
height:(NSNumber *)height
success:(void (^)(id))succ
failure:(void (^)(id))fail;
//结束行情反馈(写)
- (void)surveyFinishWithUuid:(NSString *)uuid
success:(void (^)(id))succ
failure:(void (^)(id))fail;
//获取行情调研单反馈列表
- (void)getResultsWithUuid:(NSString *)uuid
success:(void (^)(id))succ
failure:(void (^)(id))fail;
@end @end
......
...@@ -71,7 +71,11 @@ typedef NS_ENUM(NSUInteger, ICRHTTPAction) { ...@@ -71,7 +71,11 @@ typedef NS_ENUM(NSUInteger, ICRHTTPAction) {
XFFHttp_QuerySurvey, XFFHttp_QuerySurvey,
XFFHttp_GetSurvey, XFFHttp_GetSurvey,
XFFHttp_GetProduct, XFFHttp_GetProduct,
XFFHttp_GetUser XFFHttp_GetUser,
XFFHttp_SurveyFinish,
//行情反馈图片
XFFHttp_ResultChart,
XFFHttp_GetResults
}; };
static NSString * const ICRHTTPInterface[] = { static NSString * const ICRHTTPInterface[] = {
...@@ -123,8 +127,11 @@ static NSString * const ICRHTTPInterface[] = { ...@@ -123,8 +127,11 @@ static NSString * const ICRHTTPInterface[] = {
[XFFHttp_QuerySurvey] = @"survey/query_survey", [XFFHttp_QuerySurvey] = @"survey/query_survey",
[XFFHttp_GetSurvey] = @"survey/get_survey", [XFFHttp_GetSurvey] = @"survey/get_survey",
[XFFHttp_GetProduct] = @"mdata/product/download", [XFFHttp_GetProduct] = @"mdata/product/download",
[XFFHttp_GetUser] = @"user/download" [XFFHttp_GetUser] = @"user/download",
[XFFHttp_SurveyFinish] = @"survey/finish",
//行情反馈生成图片
[XFFHttp_ResultChart] = @"survey/resultchart",
[XFFHttp_GetResults] = @"survey/get_results"
}; };
static NSString * const ICRAttachmentTypeValue[] = { static NSString * const ICRAttachmentTypeValue[] = {
...@@ -1338,27 +1345,8 @@ acceptTypeJson:YES ...@@ -1338,27 +1345,8 @@ acceptTypeJson:YES
void (^success)(AFHTTPRequestOperation *operation, id responseObject) = ^(AFHTTPRequestOperation *operation, id responseObject) { void (^success)(AFHTTPRequestOperation *operation, id responseObject) = ^(AFHTTPRequestOperation *operation, id responseObject) {
CLog(@"%@", responseObject); CLog(@"%@", responseObject);
if (IsDictObject(responseObject)) { if (succ) {
void (^complete)(void) = ^(void){ succ( responseObject );
if (succ) {
[IBTCommon runOnMainThreadWithoutDeadlocking:^{
succ( responseObject );
}];
}
};
ICRDataBaseController *dbCtrl = [ICRDataBaseController sharedController];
[dbCtrl storageEntities:responseObject[ @"data" ][ @"records" ]
objectClass:NSClassFromString( @"Survey" )
deleteLocal:YES
handleData:NULL
complete:complete
fail:fail];
}
else {
if (fail) {
fail( nil );
}
} }
}; };
void (^failure)(AFHTTPRequestOperation *operation, NSError *error) = ^(AFHTTPRequestOperation *operation, NSError *error) { void (^failure)(AFHTTPRequestOperation *operation, NSError *error) = ^(AFHTTPRequestOperation *operation, NSError *error) {
...@@ -1507,6 +1495,112 @@ acceptTypeJson:YES ...@@ -1507,6 +1495,112 @@ acceptTypeJson:YES
failure:failure]; failure:failure];
} }
- (void)resultChartWithResultUuid:(NSString *)uuid
width:(NSNumber *)width
height:(NSNumber *)height
success:(void (^)(id))succ
failure:(void (^)(id))fail{
void (^success)(AFHTTPRequestOperation *operation, id responseObject) = ^(AFHTTPRequestOperation *operation, id responseObject) {
CLog(@"%@", responseObject);
if (IsDictObject(responseObject)) {
if (succ) {
[IBTCommon runOnMainThreadWithoutDeadlocking:^{
succ( responseObject );
}];
}
}
else {
if (fail) {
fail( nil );
}
}
};
void (^failure)(AFHTTPRequestOperation *operation, NSError *error) = ^(AFHTTPRequestOperation *operation, NSError *error) {
CLog(@"%@", error);
if (fail) {
fail( error );
}
};
NSString *urlStr = [[[self class] UrlForPluginHTTPAction:XFFHttp_ResultChart] stringByAppendingFormat:@"/%@?width=%@&height=%@",uuid,width,height];
NSString *encodeUrlStr = [urlStr stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
[self GET:encodeUrlStr
parameters:nil
needToken:NO
acceptTypeJson:YES
success:success
failure:failure];
}
//结束行情反馈(写)
- (void)surveyFinishWithUuid:(NSString *)uuid
success:(void (^)(id))succ
failure:(void (^)(id))fail{
if (!uuid) {
if (fail) {
fail( [[self class] ErrorWithMsg:ERROR_PARAMETER code:0] );
}
return;
}
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 *currentTime = [[NSDate date] httpParameterString];
ICRUserUtil *userUtil = [ICRUserUtil sharedInstance];
NSString *urlStr = [[[self class] UrlForPluginHTTPAction:XFFHttp_SurveyFinish] stringByAppendingFormat:@"/%@?time=%@&operId=%@&operName=%@",uuid,currentTime,userUtil.userCode,userUtil.displayName];
NSString *encodeUrlStr = [urlStr stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
[self GET:encodeUrlStr
parameters:nil
needToken:NO
acceptTypeJson:YES
success:success
failure:failure];
}
//获取行情调研单反馈列表
- (void)getResultsWithUuid:(NSString *)uuid
success:(void (^)(id))succ
failure:(void (^)(id))fail{
if (!uuid) {
if (fail) {
fail( [[self class] ErrorWithMsg:ERROR_PARAMETER code:0] );
}
return;
}
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_GetResults] stringByAppendingFormat:@"/%@",uuid];
NSString *encodeUrlStr = [urlStr stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
[self POST:encodeUrlStr
parameters:nil
needToken:NO
acceptTypeJson:YES
success:success
failure:failure];
}
@end @end
...@@ -51,7 +51,7 @@ ...@@ -51,7 +51,7 @@
// yyyy-MM-dd HH:mm:ss // yyyy-MM-dd HH:mm:ss
- (NSString *)httpParameterString; - (NSString *)httpParameterString;
- (NSString *)coverStringFromString;
// yymmddhhmmssSSS // yymmddhhmmssSSS
- (NSString *)mobileIDDateString; - (NSString *)mobileIDDateString;
......
...@@ -292,7 +292,9 @@ ...@@ -292,7 +292,9 @@
- (NSString *)httpParameterString { - (NSString *)httpParameterString {
return [self stringWithFormatter:@"%Y-%m-%d %H:%M:%S"]; return [self stringWithFormatter:@"%Y-%m-%d %H:%M:%S"];
} }
- (NSString *)coverStringFromString {
return [self stringWithFormatter:@"%Y.%m.%d"];
}
- (NSString *)mobileIDDateString { - (NSString *)mobileIDDateString {
return [self stringWithFormatter:@"%y%m%d%H%M%S000"]; return [self stringWithFormatter:@"%y%m%d%H%M%S000"];
} }
......
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x",
"filename" : "finish.png"
},
{
"idiom" : "universal",
"scale" : "2x",
"filename" : "finish@2x.png"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x",
"filename" : "initial.png"
},
{
"idiom" : "universal",
"scale" : "2x",
"filename" : "initial@2x.png"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x",
"filename" : "insurvey.png"
},
{
"idiom" : "universal",
"scale" : "2x",
"filename" : "insurvey@2x.png"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
//new HTTP //new HTTP
#define HTTP_REST_API_BASE_URL @"http://218.244.151.129:7580/cruiser-server/rest" #define HTTP_REST_API_BASE_URL @"http://218.244.151.129:7580/cruiser-server/rest"
#define Server_Url @"http://218.244.151.129:7580/cruiser-server"
//#define HTTP_REST_API_BASE_URL @"http://218.244.151.129:8281/XFFruit-server/rest" //#define HTTP_REST_API_BASE_URL @"http://218.244.151.129:8281/XFFruit-server/rest"
......
...@@ -177,10 +177,11 @@ ...@@ -177,10 +177,11 @@
} }
+ (NSString *)stringFromDate:(NSDate*)aDate{ + (NSString *)stringFromDate:(NSDate*)aDate{
NSDateFormatter *formatter = [[NSDateFormatter alloc] init]; NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
[formatter setDateFormat:@"yyyy.MM.dd"]; [formatter setDateFormat:@"yyyy-MM-dd"];
NSString *dateString = [formatter stringFromDate:aDate]; NSString *dateString = [formatter stringFromDate:aDate];
return dateString; return dateString;
} }
+ (NSString*)dictionaryToJson:(id)dic + (NSString*)dictionaryToJson:(id)dic
{ {
......
...@@ -28,7 +28,6 @@ ...@@ -28,7 +28,6 @@
@property (copy, nonatomic) NSString *currentStoreID; @property (copy, nonatomic) NSString *currentStoreID;
@property (copy, nonatomic) NSString *uniqueID; @property (copy, nonatomic) NSString *uniqueID;
+ (instancetype)sharedInstance; + (instancetype)sharedInstance;
- (BOOL)saveArchive; - (BOOL)saveArchive;
......
...@@ -10,6 +10,8 @@ ...@@ -10,6 +10,8 @@
@protocol BoltMaskViewDelegate <NSObject> @protocol BoltMaskViewDelegate <NSObject>
- (void)getBoltValueSelectRow:(NSString *)state; - (void)getBoltValueSelectRow:(NSString *)state;
- (void)getTitleLike:(NSString *)titleLike;
- (void)getBillNumber:(NSString *)billNumber;
@end @end
...@@ -18,4 +20,6 @@ ...@@ -18,4 +20,6 @@
@property (nonatomic,strong)NSMutableArray *dataArr; @property (nonatomic,strong)NSMutableArray *dataArr;
@property (nonatomic,weak)id <BoltMaskViewDelegate>delegate; @property (nonatomic,weak)id <BoltMaskViewDelegate>delegate;
- (instancetype)initWithFrame:(CGRect)frame state:(NSString *)state title:(NSString *)title bill:(NSString *)bill;
@end @end
...@@ -8,33 +8,70 @@ ...@@ -8,33 +8,70 @@
#import "BoltMaskView.h" #import "BoltMaskView.h"
#import "MaskCell.h" #import "MaskCell.h"
#define TableHeight 35 #define TableHeight 45
#define LeftMargin 80 #define LeftMargin 80
#define TotalHeight 176 #define TotalHeight 224
#define LeftHeight 44 #define LeftHeight 44
@interface BoltMaskView () @interface BoltMaskView ()<UITextFieldDelegate>
{ {
UIView *_leftView; UIView *_leftView;
UIButton *_currentBtn; UIButton *_currentBtn;
NSIndexPath *_currentIndexPath; NSIndexPath *_currentIndexPath;
UIView *_titleView;
UIView *_billNumberView;
UITextField * _titleFiled;
UITextField *_billFiled;
NSString *_state;
NSString *_billNumber;
NSString *_title;
} }
@property (nonatomic,strong)NSString *state;
@property (nonatomic,strong)NSString *title;
@property (nonatomic,strong)NSString *billNumber;
@end @end
@implementation BoltMaskView @implementation BoltMaskView
- (instancetype)initWithFrame:(CGRect)frame{ - (instancetype)initWithFrame:(CGRect)frame state:(NSString *)state title:(NSString *)title bill:(NSString *)bill{
self = [super initWithFrame:frame]; self = [super initWithFrame:frame];
if (self) { if (self) {
self.title = title;
self.billNumber = bill;
self.state = state;
[self createView]; [self createView];
[self createRightView];
[self preferData];
} }
return self; return self;
} }
- (void)preferData{
//initial(未提交),submitted(已提交),insurvey(调研中)
if ([self.state isEqualToString:@"none"]) {
_currentIndexPath = [NSIndexPath indexPathForRow:0 inSection:0];
}else if ([self.state isEqualToString:@"initial"]) {
_currentIndexPath = [NSIndexPath indexPathForRow:1 inSection:0];
}else if ([self.state isEqualToString:@"submitted"]) {
_currentIndexPath = [NSIndexPath indexPathForRow:2 inSection:0];
}else if ([self.state isEqualToString:@"insurvey"]) {
_currentIndexPath = [NSIndexPath indexPathForRow:3 inSection:0];
}
_titleView.hidden = YES;
if(self.title.length > 0){
_titleFiled.text = self.title;
}
_billNumberView.hidden = YES;
if (self.billNumber.length > 0) {
_billFiled.text = self.billNumber;
}
}
#pragma mark - 创建视图 #pragma mark - 创建视图
- (void)createView - (void)createView
{ {
_leftView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, LeftMargin,self.frame.size.height)]; _leftView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, LeftMargin,self.frame.size.height)];
[self addSubview:_leftView]; [self addSubview:_leftView];
NSArray *arr = @[@"按状态",@"条件一",@"条件二",@"条件三"]; NSArray *arr = @[@"按状态",@"条件一",@"条件二"];
for (NSInteger i = 0; i<arr.count; i++) { for (NSInteger i = 0; i<arr.count; i++) {
UIButton *button = [UIButton buttonWithType:UIButtonTypeSystem]; UIButton *button = [UIButton buttonWithType:UIButtonTypeSystem];
button.frame = CGRectMake(0, LeftHeight * i , LeftMargin ,LeftHeight); button.frame = CGRectMake(0, LeftHeight * i , LeftMargin ,LeftHeight);
...@@ -50,19 +87,84 @@ ...@@ -50,19 +87,84 @@
[button addTarget:self action:@selector(leftBtnClick:) forControlEvents:UIControlEventTouchUpInside]; [button addTarget:self action:@selector(leftBtnClick:) forControlEvents:UIControlEventTouchUpInside];
[_leftView addSubview:button]; [_leftView addSubview:button];
} }
}
- (void)createRightView{
_titleView = [[UIView alloc]initWithFrame:CGRectMake(LeftMargin, 0, ScreenSize.width - LeftMargin, self.frame.size.height)];
_titleView.backgroundColor = [UIColor whiteColor];
[self addSubview:_titleView];
UILabel *titleLabel = [[UILabel alloc]initWithFrame:CGRectMake(10, 20, (ScreenSize.width - LeftMargin - 10*2), 20)];
titleLabel.font = FontSize(15);
titleLabel.text = @"标题类似于:";
[_titleView addSubview:titleLabel];
_titleFiled = [[UITextField alloc]initWithFrame:CGRectMake(10, CGRectGetMaxY(titleLabel.frame) + 10, (ScreenSize.width - LeftMargin - 10*2), 30)];
_titleFiled.textAlignment = NSTextAlignmentLeft;
_titleFiled.textColor = HexColor(@"444444");
_titleFiled.placeholder = @"输入标题";
_titleFiled.borderStyle = UITextBorderStyleRoundedRect;
_titleFiled.font = FontSize(15);
_titleFiled.returnKeyType = UIReturnKeyDone;
_titleFiled.delegate = self;
[_titleView addSubview:_titleFiled];
_billNumberView = [[UIView alloc]initWithFrame:CGRectMake(LeftMargin, 0, ScreenSize.width - LeftMargin, self.frame.size.height)];
_billNumberView.backgroundColor = [UIColor whiteColor];
[self addSubview:_billNumberView];
UILabel *billLabel = [[UILabel alloc]initWithFrame:CGRectMake(10, 20, (ScreenSize.width - LeftMargin - 10*2), 20)];
billLabel.font = FontSize(15);
billLabel.text = @"单号:";
[_billNumberView addSubview:billLabel];
_billFiled = [[UITextField alloc]initWithFrame:CGRectMake(10, CGRectGetMaxY(billLabel.frame) + 10, (ScreenSize.width - LeftMargin - 10*2), 30)];
_billFiled.textAlignment = NSTextAlignmentLeft;
_billFiled.textColor = HexColor(@"444444");
_billFiled.placeholder = @"输入单号";
_billFiled.borderStyle = UITextBorderStyleRoundedRect;
_billFiled.font = FontSize(15);
_billFiled.returnKeyType = UIReturnKeyDone;
_billFiled.delegate = self;
[_billNumberView addSubview:_billFiled];
self.tableView = [[UITableView alloc]initWithFrame:CGRectMake(LeftMargin, 0, ScreenSize.width - LeftMargin, self.frame.size.height) style:(UITableViewStylePlain)]; self.tableView = [[UITableView alloc]initWithFrame:CGRectMake(LeftMargin, 0, ScreenSize.width - LeftMargin, self.frame.size.height) style:(UITableViewStylePlain)];
self.tableView.backgroundColor = [UIColor whiteColor]; self.tableView.backgroundColor = [UIColor whiteColor];
self.tableView.delegate = self; self.tableView.delegate = self;
self.tableView.dataSource = self; self.tableView.dataSource = self;
[self addSubview:self.tableView]; [self addSubview:self.tableView];
} }
- (void)leftBtnClick:(UIButton *)btn{ - (void)leftBtnClick:(UIButton *)btn{
_currentBtn.enabled = YES; _currentBtn.enabled = YES;
btn.enabled = NO; btn.enabled = NO;
_currentBtn = btn; _currentBtn = btn;
[self keyBoardHidden];
switch (btn.tag) {
case 1001://状态
{
self.tableView.hidden = NO;
_titleView.hidden = YES;
_billNumberView.hidden = YES;
}
break;
case 1002://条件二
{
self.tableView.hidden = YES;
_titleView.hidden = YES;
_billNumberView.hidden = NO;
}
break;
case 1003://条件三
{
self.tableView.hidden = YES;
_titleView.hidden = NO;
_billNumberView.hidden = YES;
}
break;
default:
break;
}
} }
#pragma mark - 协议 #pragma mark - 协议
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
...@@ -102,11 +204,43 @@ ...@@ -102,11 +204,43 @@
cell.Commitbtn.hidden = NO; cell.Commitbtn.hidden = NO;
_currentIndexPath = indexPath; _currentIndexPath = indexPath;
[self.delegate getBoltValueSelectRow:@"tt"]; //initial(未提交),submitted(已提交),insurvey(调研中)
NSString *stateStr = @"";
if (indexPath.row == 0) {
stateStr = @"none";
}else if(indexPath.row == 1){
stateStr = @"initial";
}else if(indexPath.row == 2){
stateStr = @"submitted";
}else if(indexPath.row == 3){
stateStr = @"insurvey";
}
[self.delegate getBoltValueSelectRow:stateStr];
} }
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{ - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
return TableHeight; return TableHeight;
} }
- (BOOL)textFieldShouldReturn:(UITextField *)textField{
[self keyBoardHidden];
return YES;
}
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event{
[self keyBoardHidden];
}
- (void)keyBoardHidden{
[_titleFiled resignFirstResponder];
[_billFiled resignFirstResponder];
}
- (void)textFieldDidEndEditing:(UITextField *)textField{
if (textField == _titleFiled) {
[self.delegate getTitleLike:_titleFiled.text];
}else if(textField == _billFiled){
[self.delegate getBillNumber:_billFiled.text];
}
}
@end @end
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
#import "MaskCell.h" #import "MaskCell.h"
#define TitleSize 14 #define TitleSize 14
#define LeftMargin 20 #define LeftMargin 20
#define TableHeight 35 #define TableHeight 45
#define BtnSize 14 #define BtnSize 14
@implementation MaskCell @implementation MaskCell
......
...@@ -13,7 +13,10 @@ ...@@ -13,7 +13,10 @@
@end @end
@interface SortMaskView : UIView<UITableViewDataSource,UITableViewDelegate> @interface SortMaskView : UIView<UITableViewDataSource,UITableViewDelegate>
- (instancetype)initWithFrame:(CGRect)frame withOrderDirection:(NSString *)orderDirection;
@property (nonatomic,strong)UITableView *tableView; @property (nonatomic,strong)UITableView *tableView;
@property (nonatomic,strong)NSMutableArray *dataArr; @property (nonatomic,strong)NSMutableArray *dataArr;
@property (nonatomic,weak)id <SortMaskViewDelegate>delegate; @property (nonatomic,weak)id <SortMaskViewDelegate>delegate;
@end @end
...@@ -8,23 +8,30 @@ ...@@ -8,23 +8,30 @@
#import "SortMaskView.h" #import "SortMaskView.h"
#import "MaskCell.h" #import "MaskCell.h"
#define TableHeight 35 #define TableHeight 45
@interface SortMaskView () @interface SortMaskView ()
{ {
NSIndexPath *_currentIndexPath; NSIndexPath *_currentIndexPath;
NSString *_orderDirection;
} }
@end @end
@implementation SortMaskView @implementation SortMaskView
- (instancetype)initWithFrame:(CGRect)frame{ - (instancetype)initWithFrame:(CGRect)frame withOrderDirection:(NSString *)orderDirection{
self = [super initWithFrame:frame]; self = [super initWithFrame:frame];
if (self) { if (self) {
self.tableView = [[UITableView alloc]initWithFrame:self.bounds style:(UITableViewStylePlain)]; self.tableView = [[UITableView alloc]initWithFrame:self.bounds style:(UITableViewStylePlain)];
self.tableView.backgroundColor = [UIColor redColor];
self.tableView.delegate = self; self.tableView.delegate = self;
self.tableView.dataSource = self; self.tableView.dataSource = self;
[self addSubview:self.tableView]; [self addSubview:self.tableView];
if (orderDirection.length >0) {
if ([orderDirection isEqualToString:@"asc"]) {
_currentIndexPath = [NSIndexPath indexPathForRow:0 inSection:0];
}else{
_currentIndexPath = [NSIndexPath indexPathForRow:1 inSection:0];
}
}
} }
return self; return self;
} }
...@@ -64,8 +71,11 @@ ...@@ -64,8 +71,11 @@
MaskCell *cell = (MaskCell *)[tableView cellForRowAtIndexPath:indexPath]; MaskCell *cell = (MaskCell *)[tableView cellForRowAtIndexPath:indexPath];
cell.Commitbtn.hidden = NO; cell.Commitbtn.hidden = NO;
_currentIndexPath = indexPath; _currentIndexPath = indexPath;
if (indexPath.row == 0) {
[self.delegate getSortValueSelectRow:@"s"]; [self.delegate getSortValueSelectRow:@"asc"];
}else{
[self.delegate getSortValueSelectRow:@"desc"];
}
} }
......
...@@ -39,9 +39,10 @@ ...@@ -39,9 +39,10 @@
_timePicker.backgroundColor = [UIColor whiteColor]; _timePicker.backgroundColor = [UIColor whiteColor];
_timePicker.datePickerMode = UIDatePickerModeDate; _timePicker.datePickerMode = UIDatePickerModeDate;
_timePicker.locale = [[NSLocale alloc]initWithLocaleIdentifier:@"zh_CN"]; _timePicker.locale = [[NSLocale alloc]initWithLocaleIdentifier:@"zh_CN"];
// 设置最小时间段,防止用户的出现已过去的时间 // // 设置最小时间段,防止用户的出现已过去的时间
_timePicker.minimumDate = [NSDate date]; // _timePicker.minimumDate = [NSDate date];
[_bgView addSubview:_timePicker]; [_bgView addSubview:_timePicker];
} }
......
...@@ -31,8 +31,8 @@ ...@@ -31,8 +31,8 @@
{ {
self.stateBtn = [UIButton buttonWithType:UIButtonTypeCustom]; self.stateBtn = [UIButton buttonWithType:UIButtonTypeCustom];
self.stateBtn.frame = CGRectMake(TopMargin *2 , TopMargin, LeftMargin - TopMargin*3, 20); self.stateBtn.frame = CGRectMake(TopMargin *2 , TopMargin, LeftMargin - TopMargin*3, 20);
self.stateBtn.titleLabel.font = FontSize(ContentSize); // self.stateBtn.titleLabel.font = FontSize(ContentSize);
[self.stateBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; // [self.stateBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
self.stateBtn.enabled = NO; self.stateBtn.enabled = NO;
self.titleLabel = [[UILabel alloc]initWithFrame:(CGRectMake(LeftMargin, TopMargin, ScreenSize.width - LeftMargin, TitleHeight))]; self.titleLabel = [[UILabel alloc]initWithFrame:(CGRectMake(LeftMargin, TopMargin, ScreenSize.width - LeftMargin, TitleHeight))];
...@@ -72,29 +72,30 @@ ...@@ -72,29 +72,30 @@
- (void)setSurvey:(Survey *)survey{ - (void)setSurvey:(Survey *)survey{
self.titleLabel.text = survey.title; self.titleLabel.text = survey.title;
self.billnumberLabel.text = survey.billNumber; self.billnumberLabel.text = [NSString stringWithFormat:@"单号:%@",survey.billNumber];
self.productnameLabel.text = survey.productName; self.productnameLabel.text = [NSString stringWithFormat:@"商品:%@[%@]",survey.productName,survey.productCode];
self.begindateLabel.text = survey.beginDate; self.begindateLabel.text = [NSString stringWithFormat:@"开始时间:%@",[survey.beginDate substringToIndex:10]];
self.enddateLabel.text = survey.endDate; self.enddateLabel.text = [NSString stringWithFormat:@"结束时间:%@",[survey.endDate substringToIndex:10]];
NSString *stateStr = @""; // NSString *stateStr = @"";
if ([survey.state isEqualToString:@"initial"]) { if ([survey.state isEqualToString:@"initial"]) {
[self.stateBtn setBackgroundColor:[UIColor redColor]]; // [self.stateBtn setBackgroundColor:[UIColor redColor]];
stateStr = @"未提交"; // stateStr = @"未提交";
[self.stateBtn setImage:[UIImage imageNamed:@"initial"] forState:UIControlStateDisabled];
}else if ([survey.state isEqualToString:@"submitted"]) { }else if ([survey.state isEqualToString:@"submitted"]) {
[self.stateBtn setBackgroundColor:[UIColor greenColor]]; // [self.stateBtn setBackgroundColor:[UIColor greenColor]];
// stateStr = @"已提交";
stateStr = @"已提交"; [self.stateBtn setImage:[UIImage imageNamed:@"insurvey"] forState:UIControlStateDisabled];
}else if ([survey.state isEqualToString:@"insurvey"]) { }else if ([survey.state isEqualToString:@"insurvey"]) {
[self.stateBtn setBackgroundColor:[UIColor grayColor]]; // [self.stateBtn setBackgroundColor:[UIColor grayColor]];
// stateStr = @"调研中";
stateStr = @"调研中"; [self.stateBtn setImage:[UIImage imageNamed:@"insurvey"] forState:UIControlStateDisabled];
}else if ([survey.state isEqualToString:@"finished"]) { }else if ([survey.state isEqualToString:@"finished"]) {
[self.stateBtn setBackgroundColor:[UIColor blackColor]]; // [self.stateBtn setBackgroundColor:[UIColor blackColor]];
// stateStr = @"已完成";
stateStr = @"已完成"; [self.stateBtn setImage:[UIImage imageNamed:@"finish"] forState:UIControlStateDisabled];
} }
[self.stateBtn setTitle:stateStr forState:UIControlStateNormal]; // [self.stateBtn setTitle:stateStr forState:UIControlStateNormal];
} }
- (void)setSelected:(BOOL)selected animated:(BOOL)animated { - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
......
...@@ -32,9 +32,10 @@ ...@@ -32,9 +32,10 @@
self.imageBtn = [UIButton buttonWithType:UIButtonTypeCustom]; self.imageBtn = [UIButton buttonWithType:UIButtonTypeCustom];
self.imageBtn.frame = CGRectMake(TopMargin *2 , TopMargin, LeftWidth, TableHeight - TopMargin*2); self.imageBtn.frame = CGRectMake(TopMargin *2 , TopMargin, LeftWidth, TableHeight - TopMargin*2);
self.userNameLabel = [[UILabel alloc]initWithFrame:(CGRectMake(CGRectGetMaxX(self.imageBtn.frame) + TopMargin, TopMargin, ScreenSize.width - TopMargin*2 - LeftWidth, TitleHeight))]; self.userNameLabel = [[UILabel alloc]initWithFrame:(CGRectMake(CGRectGetMaxX(self.imageBtn.frame) + TopMargin, TopMargin, ScreenSize.width - TopMargin*2 - LeftWidth, TitleHeight * 2))];
self.userNameLabel.textColor = HexColor(TitleColor); self.userNameLabel.numberOfLines = 0;
self.userNameLabel.font = FontSize(TitleSize); self.userNameLabel.textColor = HexColor(ContentColor);
self.userNameLabel.font = FontSize(ContentSize);
self.placeLabel = [[UILabel alloc]initWithFrame:(CGRectMake(CGRectGetMinX(self.userNameLabel.frame), CGRectGetMaxY(self.userNameLabel.frame), CGRectGetWidth(self.userNameLabel.frame), TitleHeight))]; self.placeLabel = [[UILabel alloc]initWithFrame:(CGRectMake(CGRectGetMinX(self.userNameLabel.frame), CGRectGetMaxY(self.userNameLabel.frame), CGRectGetWidth(self.userNameLabel.frame), TitleHeight))];
self.placeLabel.textColor = HexColor(ContentColor); self.placeLabel.textColor = HexColor(ContentColor);
...@@ -68,11 +69,11 @@ ...@@ -68,11 +69,11 @@
- (void)setSurveyResult:(SurveyResult *)surveyResult{ - (void)setSurveyResult:(SurveyResult *)surveyResult{
[self.imageBtn setBackgroundImage:[UIImage imageNamed:@"no_image_default"] forState:UIControlStateNormal]; [self.imageBtn setBackgroundImage:[UIImage imageNamed:@"no_image_default"] forState:UIControlStateNormal];
self.userNameLabel.text = surveyResult.unit; self.userNameLabel.text = [NSString stringWithFormat:@"反馈人:%@[%@]",surveyResult.userName,surveyResult.feedbackTime];
self.placeLabel.text = surveyResult.place; self.placeLabel.text = [NSString stringWithFormat:@"产地:%@",surveyResult.place];
self.priceLabel.text = surveyResult.price; self.priceLabel.text = [NSString stringWithFormat:@"价格:%@",surveyResult.price];
self.capacityLabel.text = surveyResult.capacity; self.capacityLabel.text = [NSString stringWithFormat:@"市场容量:%@",surveyResult.capacity];
self.qualityLabel.text = surveyResult.quality; self.qualityLabel.text = [NSString stringWithFormat:@"质量情况:%@",surveyResult.quality];
} }
- (void)setSelected:(BOOL)selected animated:(BOOL)animated { - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
......
...@@ -8,6 +8,9 @@ ...@@ -8,6 +8,9 @@
#import "ICRBaseViewController.h" #import "ICRBaseViewController.h"
#import "Survey.h"
@interface NewSurveyViewController : ICRBaseViewController @interface NewSurveyViewController : ICRBaseViewController
@property (nonatomic,strong)Survey *survey;
@end @end
...@@ -9,5 +9,5 @@ ...@@ -9,5 +9,5 @@
#import "ICRBaseViewController.h" #import "ICRBaseViewController.h"
@interface ResultDetailViewController : ICRBaseViewController @interface ResultDetailViewController : ICRBaseViewController
@property (nonatomic,strong)NSString *surveyUuid;
@end @end
...@@ -24,13 +24,28 @@ ...@@ -24,13 +24,28 @@
- (void)viewDidLoad { - (void)viewDidLoad {
[super viewDidLoad]; [super viewDidLoad];
self.title = @"行情反馈列表";
[self initData]; [self initData];
[self createTableView]; [self createTableView];
} }
- (void)initData{ - (void)initData{
_dataArr = [NSMutableArray array]; _dataArr = [NSMutableArray array];
void(^succ)(id) = ^(id data) {
[IBTLoadingView hideHUDWithText:nil];
NSLog(@"%@",data);
// [strongSelf fetchtSurveyList:data];
};
void(^fail)(id) = ^(id data) {
[IBTLoadingView hideHUDWithText:nil];
[IBTLoadingView showTips:data];
};
[IBTLoadingView showProgressLabel:@"正在加载..."];
[[ICRHTTPController sharedController] getResultsWithUuid:self.surveyUuid success:succ failure:fail];
for (NSInteger i = 0; i < 4; i++) { for (NSInteger i = 0; i < 4; i++) {
SurveyResult *survey = [[SurveyResult alloc]init]; SurveyResult *survey = [[SurveyResult alloc]init];
survey.unit = @"南汇8424西瓜调研情况"; survey.unit = @"南汇8424西瓜调研情况";
...@@ -38,6 +53,8 @@ ...@@ -38,6 +53,8 @@
survey.price = @"南汇842[100213]"; survey.price = @"南汇842[100213]";
survey.capacity = @"22222222222"; survey.capacity = @"22222222222";
survey.quality = @"费卡接口"; survey.quality = @"费卡接口";
survey.userName = @"张三";
survey.feedbackTime = @"2015-04-05 12:04:06";
[_dataArr addObject:survey]; [_dataArr addObject:survey];
} }
} }
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
#import "SortMaskView.h" #import "SortMaskView.h"
#import "BoltMaskView.h" #import "BoltMaskView.h"
#import "SurveyDetailViewController.h" #import "SurveyDetailViewController.h"
#import "NewSurveyViewController.h"
#define TopMargin 44 #define TopMargin 44
#define TableHeight 120 #define TableHeight 120
...@@ -38,6 +38,12 @@ typedef enum : NSUInteger { ...@@ -38,6 +38,12 @@ typedef enum : NSUInteger {
} }
@property (nonatomic,strong)NSMutableArray *dataArr; @property (nonatomic,strong)NSMutableArray *dataArr;
@property (nonatomic,strong)UITableView *tableView; @property (nonatomic,strong)UITableView *tableView;
@property (nonatomic,strong)NSString *billNumberLike;
@property (nonatomic,strong)NSString *state;//未提交=initial已提交=submitted调研中=insurvey已完成=finished
@property (nonatomic,strong)NSString *titleLike;
@property (nonatomic,strong)NSString *orderField;
@property (nonatomic,strong)NSString *orderDirection;//asc(升序),desc(降序)
@end @end
...@@ -46,19 +52,20 @@ typedef enum : NSUInteger { ...@@ -46,19 +52,20 @@ typedef enum : NSUInteger {
- (void)viewDidLoad { - (void)viewDidLoad {
[super viewDidLoad]; [super viewDidLoad];
self.title = @"行情调研"; self.title = @"行情调研";
self.view.backgroundColor = XXFBgColor;
[self initData]; [self initData];
[self createTableView]; [self createTableView];
[self getData];
} }
- (void)initData{ - (void)initData{
self.dataArr = [NSMutableArray array]; self.dataArr = [NSMutableArray array];
}
[self fetchtSurveyList]; - (void)getData{
__weak typeof(self)weakSelf = self; __weak typeof(self)weakSelf = self;
void(^succ)(id) = ^(id data) { void(^succ)(id) = ^(id data) {
[IBTLoadingView hideHUDWithText:nil]; [IBTLoadingView hideHUDWithText:nil];
__strong __typeof(weakSelf)strongSelf = weakSelf; __strong __typeof(weakSelf)strongSelf = weakSelf;
[strongSelf fetchtSurveyList]; [strongSelf fetchtSurveyList:data];
}; };
void(^fail)(id) = ^(id data) { void(^fail)(id) = ^(id data) {
[IBTLoadingView hideHUDWithText:nil]; [IBTLoadingView hideHUDWithText:nil];
...@@ -66,32 +73,58 @@ typedef enum : NSUInteger { ...@@ -66,32 +73,58 @@ typedef enum : NSUInteger {
}; };
[IBTLoadingView showProgressLabel:@"正在加载..."]; [IBTLoadingView showProgressLabel:@"正在加载..."];
ICRUserUtil *userUtil = [ICRUserUtil sharedInstance]; ICRUserUtil *userUtil = [ICRUserUtil sharedInstance];
id billObject = [NSNull null];
if (self.billNumberLike.length > 0) {
billObject = self.billNumberLike;
}
id stateObject = [NSNull null];
if (self.state.length > 0 && ![self.state isEqualToString:@"none"]) {
stateObject = self.state;
}
id titleObject = [NSNull null];
if (self.titleLike.length > 0) {
billObject = self.titleLike;
}
id orderObject = [NSNull null];
if (self.orderDirection.length > 0) {
orderObject = self.orderDirection;
}
NSDictionary *dict = @{ NSDictionary *dict = @{
@"billNumberLike":billObject,
@"state":stateObject,
@"titleLike":titleObject,
@"orderField":[NSNull null],
@"orderDirection":orderObject,
@"userUuid":userUtil.userId, @"userUuid":userUtil.userId,
@"pageNumber":@(0), @"pageNumber":@(0),
@"pageSize":@(20)}; @"pageSize":@(20)};
[[ICRHTTPController sharedController] querySurveyWithBillData:dict success:succ failure:fail]; [[ICRHTTPController sharedController] querySurveyWithBillData:dict success:succ failure:fail];
} }
#pragma mark -成功 #pragma mark -成功
- (void)fetchtSurveyList{ - (void)fetchtSurveyList:(id)data{
ICRDatabaseFetchBlock fetchBlk = ^FMResultSet *(FMDatabase *db) { if (data) {
NSString * sql = [NSString stringWithFormat:@"SELECT * FROM %@ ORDER BY %@", [Survey TableName], @"uuid"]; NSInteger success = [data[@"success"] integerValue];
return [db executeQuery:sql]; NSString *message = data[@"message"] ;
}; if (success == 1) {
if (self.dataArr.count > 0) {
__weak typeof(self)weakSelf = self; [self.dataArr removeAllObjects];
ICRDatabaseFetchResultsBlock fetchResultsBlk = ^(NSArray *fetchedObjects) { }
__strong __typeof(weakSelf)strongSelf = weakSelf; NSArray *recodesArr = data[ @"data" ][ @"records" ];
[strongSelf.dataArr removeAllObjects]; for (NSDictionary *surveyDict in recodesArr) {
[strongSelf.dataArr addObjectsFromArray:fetchedObjects]; Survey *survey = [[Survey alloc]init];
[strongSelf.tableView reloadData]; [survey setValuesForKeysWithDictionary:surveyDict];
}; [self.dataArr addObject:survey];
}
ICRDataBaseController *dbCtrl = [ICRDataBaseController sharedController]; [self.tableView reloadData];
[dbCtrl runFetchForClass:[Survey class] }else{
fetchBlock:fetchBlk [IBTLoadingView showTips:message];
fetchResultsBlock:fetchResultsBlk]; }
}else{
[IBTLoadingView showTips:@" 无记录 "];
} }
}
- (void)createTableView - (void)createTableView
{ {
...@@ -106,7 +139,6 @@ typedef enum : NSUInteger { ...@@ -106,7 +139,6 @@ typedef enum : NSUInteger {
self.tableView = [[UITableView alloc]initWithFrame:(CGRectMake(0, TopMargin,ScreenSize.width, ScreenSize.height - 64 - TopMargin)) style:(UITableViewStylePlain)]; self.tableView = [[UITableView alloc]initWithFrame:(CGRectMake(0, TopMargin,ScreenSize.width, ScreenSize.height - 64 - TopMargin)) style:(UITableViewStylePlain)];
self.tableView.backgroundColor = [UIColor whiteColor];
self.tableView.delegate = self; self.tableView.delegate = self;
self.tableView.dataSource = self; self.tableView.dataSource = self;
[self.view addSubview:self.tableView]; [self.view addSubview:self.tableView];
...@@ -119,12 +151,28 @@ typedef enum : NSUInteger { ...@@ -119,12 +151,28 @@ typedef enum : NSUInteger {
#pragma mark - 确定 #pragma mark - 确定
- (void)sureClick{ - (void)sureClick{
//请求
[self getData];
//还原数据
if (_sortView) { if (_sortView) {
[self hiddenSortMaskView:YES]; [self hiddenSortMaskView:YES];
} }
if (_boltView) { if (_boltView) {
[self hiddenBoltMaskView:YES]; [self hiddenBoltMaskView:YES];
} }
//清空所有条件
if (self.orderDirection.length > 0) {
self.orderDirection = @"";
}
if (self.billNumberLike.length > 0) {
self.billNumberLike = @"";
}
if (self.titleLike.length > 0) {
self.titleLike = @"";
}
if (self.state.length > 0) {
self.state = @"";
}
self.navigationItem.rightBarButtonItem = nil; self.navigationItem.rightBarButtonItem = nil;
} }
...@@ -144,8 +192,8 @@ typedef enum : NSUInteger { ...@@ -144,8 +192,8 @@ typedef enum : NSUInteger {
}else{ }else{
[btn setImage:[UIImage imageNamed:@"select_arrow_up_text"] forState:UIControlStateNormal]; [btn setImage:[UIImage imageNamed:@"select_arrow_up_text"] forState:UIControlStateNormal];
if (_sortView == nil) { if (_sortView == nil) {
_sortView = [[SortMaskView alloc]initWithFrame:CGRectMake(0, -105, ScreenSize.width, 105)]; _sortView = [[SortMaskView alloc]initWithFrame:CGRectMake(0, -105, ScreenSize.width, 105) withOrderDirection:self.orderDirection];
_sortView.dataArr = [[NSMutableArray alloc]initWithObjects:@"默认排序",@"默认排序",@"默认排序" ,nil]; _sortView.dataArr = [[NSMutableArray alloc]initWithObjects:@"按时间顺序",@"按时间逆序",nil];
_sortView.delegate = self; _sortView.delegate = self;
[_maskView addSubview:_sortView]; [_maskView addSubview:_sortView];
[UIView animateWithDuration:0.25 animations:^{ [UIView animateWithDuration:0.25 animations:^{
...@@ -170,10 +218,10 @@ typedef enum : NSUInteger { ...@@ -170,10 +218,10 @@ typedef enum : NSUInteger {
}else{ }else{
[btn setImage:[UIImage imageNamed:@"selected-filter_with_text"] forState:UIControlStateNormal]; [btn setImage:[UIImage imageNamed:@"selected-filter_with_text"] forState:UIControlStateNormal];
if (_boltView == nil) { if (_boltView == nil) {
_boltView = [[BoltMaskView alloc]initWithFrame:CGRectMake(0, -105, ScreenSize.width, 176)]; _boltView = [[BoltMaskView alloc]initWithFrame:CGRectMake(0, -105, ScreenSize.width, 224) state:self.state title:self.titleLike bill:self.billNumberLike];
_boltView.backgroundColor = HexColor(@"f8f8f8"); _boltView.backgroundColor = HexColor(@"f8f8f8");
_boltView.delegate = self; _boltView.delegate = self;
_boltView.dataArr = [[NSMutableArray alloc]initWithObjects:@"默认排序1",@"默认排序1",@"默认排序1" ,nil]; _boltView.dataArr = [[NSMutableArray alloc]initWithObjects:@"不限",@"未提交",@"已提交" ,@"调研中",nil];
[_maskView addSubview:_boltView]; [_maskView addSubview:_boltView];
[UIView animateWithDuration:0.25 animations:^{ [UIView animateWithDuration:0.25 animations:^{
CGRect sortFrame = _boltView.frame; CGRect sortFrame = _boltView.frame;
...@@ -189,6 +237,7 @@ typedef enum : NSUInteger { ...@@ -189,6 +237,7 @@ typedef enum : NSUInteger {
} }
- (void)hiddenSortMaskView:(BOOL)isHide{ - (void)hiddenSortMaskView:(BOOL)isHide{
currentBtn = nil;
[_sortBtn setImage:[UIImage imageNamed:@"black_arrow_down_with_text"] forState:UIControlStateNormal]; [_sortBtn setImage:[UIImage imageNamed:@"black_arrow_down_with_text"] forState:UIControlStateNormal];
if (isHide == NO) { if (isHide == NO) {
[_sortView removeFromSuperview]; [_sortView removeFromSuperview];
...@@ -207,6 +256,7 @@ typedef enum : NSUInteger { ...@@ -207,6 +256,7 @@ typedef enum : NSUInteger {
} }
} }
- (void)hiddenBoltMaskView:(BOOL)isHide{ - (void)hiddenBoltMaskView:(BOOL)isHide{
currentBtn = nil;
[_boltBtn setImage:[UIImage imageNamed:@"black_filter_with_text"] forState:UIControlStateNormal]; [_boltBtn setImage:[UIImage imageNamed:@"black_filter_with_text"] forState:UIControlStateNormal];
if (isHide == NO) { if (isHide == NO) {
[_boltView removeFromSuperview]; [_boltView removeFromSuperview];
...@@ -226,11 +276,21 @@ typedef enum : NSUInteger { ...@@ -226,11 +276,21 @@ typedef enum : NSUInteger {
} }
#pragma mark - sortDelegate #pragma mark - sortDelegate
- (void)getSortValueSelectRow:(NSString *)state{ - (void)getSortValueSelectRow:(NSString *)state{
self.orderDirection = state;
NSLog(@"%@",state); NSLog(@"%@",state);
} }
- (void)getBoltValueSelectRow:(NSString *)state{ - (void)getBoltValueSelectRow:(NSString *)state{
self.state = state;
NSLog(@"%@",state); NSLog(@"%@",state);
} }
- (void)getTitleLike:(NSString *)titleLike{
self.titleLike = titleLike;
NSLog(@"%@",titleLike);
}
- (void)getBillNumber:(NSString *)billNumber{
self.billNumberLike = billNumber;
NSLog(@"%@",billNumber);
}
#pragma mark - 协议方法 #pragma mark - 协议方法
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
...@@ -256,13 +316,22 @@ typedef enum : NSUInteger { ...@@ -256,13 +316,22 @@ typedef enum : NSUInteger {
} }
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{ {
SurveyDetailViewController *svc = [SurveyDetailViewController new]; Survey *survey = nil;
if (self.dataArr.count > 0) { if (self.dataArr.count > 0) {
Survey *survey = self.dataArr[indexPath.row]; survey = self.dataArr[indexPath.row];
}
if ([survey.state isEqualToString:@"initial"]) {
NewSurveyViewController *nvc = [[NewSurveyViewController alloc]init];
nvc.survey = survey;
[self PushViewController:nvc animated:YES];
}else if([survey.state isEqualToString:@"submitted"] || [survey.state isEqualToString:@"insurvey"]|| [survey.state isEqualToString:@"finished"]){
SurveyDetailViewController *svc = [SurveyDetailViewController new];
svc.survey = survey; svc.survey = survey;
svc.surveyUuid = survey.uuid; svc.surveyUuid = survey.uuid;
[self PushViewController:svc animated:YES];
} }
[self PushViewController:svc animated:YES];
} }
...@@ -274,6 +343,10 @@ typedef enum : NSUInteger { ...@@ -274,6 +343,10 @@ typedef enum : NSUInteger {
- (void)viewWillAppear:(BOOL)animated{
[super viewWillAppear:animated];
}
- (void)didReceiveMemoryWarning { - (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning]; [super didReceiveMemoryWarning];
} }
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
@property (nonatomic,strong)NSString *place;//产地 @property (nonatomic,strong)NSString *place;//产地
@property (nonatomic,strong)NSString *capacity;//市场容量 @property (nonatomic,strong)NSString *capacity;//市场容量
@property (nonatomic,strong)NSString *quality;//质量情况 @property (nonatomic,strong)NSString *quality;//质量情况
@property (nonatomic,strong)NSDate *feedbackTime;//反馈时间 @property (nonatomic,strong)NSString *feedbackTime;//反馈时间
@property (nonatomic,strong)NSArray *attachmnets;//附件列表 @property (nonatomic,strong)NSArray *attachmnets;//附件列表
@end @end
...@@ -12,5 +12,9 @@ ...@@ -12,5 +12,9 @@
@property (nonatomic,strong)NSString *userUuid;//用户UUid @property (nonatomic,strong)NSString *userUuid;//用户UUid
@property (nonatomic,strong)NSString *userCode;//用户编码 @property (nonatomic,strong)NSString *userCode;//用户编码
@property (nonatomic,strong)NSString *userName;//用户名称 @property (nonatomic,strong)NSString *userName;//用户名称
@property (nonatomic,strong)NSString *uuid; @property (nonatomic,strong)NSString *uuid;//唯一标识
@end @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