Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
X
xffruit
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张杰
xffruit
Commits
f27c3520
Commit
f27c3520
authored
Aug 16, 2015
by
陈俊俊
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
行情反馈接口
parent
9f7df76f
Hide whitespace changes
Inline
Side-by-side
Showing
34 changed files
with
755 additions
and
202 deletions
+755
-202
project.pbxproj
XFFruit.xcodeproj/project.pbxproj
+6
-10
ICRHTTPController.h
XFFruit/Controllers/HTTPController/ICRHTTPController.h
+14
-0
ICRHTTPController.m
XFFruit/Controllers/HTTPController/ICRHTTPController.m
+118
-24
NSDate+FormatterAdditions.h
XFFruit/General/Categories/NSDate+FormatterAdditions.h
+1
-1
NSDate+FormatterAdditions.m
XFFruit/General/Categories/NSDate+FormatterAdditions.m
+3
-1
Contents.json
XFFruit/Images.xcassets/Survey/finish.imageset/Contents.json
+22
-0
finish.png
XFFruit/Images.xcassets/Survey/finish.imageset/finish.png
+0
-0
finish@2x.png
XFFruit/Images.xcassets/Survey/finish.imageset/finish@2x.png
+0
-0
Contents.json
...uit/Images.xcassets/Survey/initial.imageset/Contents.json
+22
-0
initial.png
XFFruit/Images.xcassets/Survey/initial.imageset/initial.png
+0
-0
initial@2x.png
...it/Images.xcassets/Survey/initial.imageset/initial@2x.png
+0
-0
Contents.json
...it/Images.xcassets/Survey/insurvey.imageset/Contents.json
+22
-0
insurvey.png
...uit/Images.xcassets/Survey/insurvey.imageset/insurvey.png
+0
-0
insurvey@2x.png
.../Images.xcassets/Survey/insurvey.imageset/insurvey@2x.png
+0
-0
ICRAppMacro.h
XFFruit/Macro/ICRAppMacro.h
+1
-0
IBTCommon.m
XFFruit/Utilities/IBTUIKit/IBTCommon.m
+2
-1
ICRUserUtil.h
XFFruit/Utilities/UserUtil/ICRUserUtil.h
+0
-1
BoltMaskView.h
XFFruit/ViewControllers/Survey/Views/BoltMaskView.h
+4
-0
BoltMaskView.m
XFFruit/ViewControllers/Survey/Views/BoltMaskView.m
+141
-7
MaskCell.m
XFFruit/ViewControllers/Survey/Views/MaskCell.m
+1
-1
SortMaskView.h
XFFruit/ViewControllers/Survey/Views/SortMaskView.h
+3
-0
SortMaskView.m
XFFruit/ViewControllers/Survey/Views/SortMaskView.m
+15
-5
StartTimeView.m
XFFruit/ViewControllers/Survey/Views/StartTimeView.m
+3
-2
SurveyListCell.m
XFFruit/ViewControllers/Survey/Views/SurveyListCell.m
+21
-20
SurveyResultCell.m
XFFruit/ViewControllers/Survey/Views/SurveyResultCell.m
+9
-8
sort.png
XFFruit/ViewControllers/Survey/Views/sort.png
+0
-0
NewSurveyViewController.h
...wControllers/Survey/controllers/NewSurveyViewController.h
+3
-0
NewSurveyViewController.m
...wControllers/Survey/controllers/NewSurveyViewController.m
+128
-35
ResultDetailViewController.h
...ntrollers/Survey/controllers/ResultDetailViewController.h
+1
-1
ResultDetailViewController.m
...ntrollers/Survey/controllers/ResultDetailViewController.m
+18
-1
SurveyDetailViewController.m
...ntrollers/Survey/controllers/SurveyDetailViewController.m
+86
-50
SurveyViewController.m
...ViewControllers/Survey/controllers/SurveyViewController.m
+105
-32
SurveyResult.h
XFFruit/ViewControllers/Survey/models/SurveyResult.h
+1
-1
SurveyUser.h
XFFruit/ViewControllers/Survey/models/SurveyUser.h
+5
-1
No files found.
XFFruit.xcodeproj/project.pbxproj
View file @
f27c3520
...
...
@@ -60,7 +60,6 @@
7217E9EC1B72364300FE5C1D
/* HPTextViewInternal.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
7217E9D61B72364300FE5C1D
/* HPTextViewInternal.m */
;
};
7217E9EE1B72364300FE5C1D
/* MaskCell.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
7217E9D91B72364300FE5C1D
/* MaskCell.m */
;
};
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 */
;
};
7217E9F21B72364300FE5C1D
/* StartTimeView.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
7217E9DF1B72364300FE5C1D
/* StartTimeView.m */
;
};
7217E9F31B72364300FE5C1D
/* SurveyCell.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
7217E9E11B72364300FE5C1D
/* SurveyCell.m */
;
};
...
...
@@ -436,7 +435,6 @@
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>"
;
};
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>"
;
};
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>"
;
};
...
...
@@ -868,7 +866,6 @@
7217E9D81B72364300FE5C1D
/* MaskCell.h */
,
7217E9D91B72364300FE5C1D
/* MaskCell.m */
,
7217E9DA1B72364300FE5C1D
/* maskEnable.png */
,
7217E9DB1B72364300FE5C1D
/* sort.png */
,
7217E9F51B724A7600FE5C1D
/* mask.png */
,
7217E9DC1B72364300FE5C1D
/* SortMaskView.h */
,
7217E9DD1B72364300FE5C1D
/* SortMaskView.m */
,
...
...
@@ -1877,7 +1874,6 @@
C1E0930A1AC8FC94003B7126
/* Localizable.strings in Resources */
,
C123A9191B25CBAD003C0C36
/* selected_star@2x.png in Resources */
,
7217E9EF1B72364300FE5C1D
/* maskEnable.png in Resources */
,
7217E9F01B72364300FE5C1D
/* sort.png in Resources */
,
7217E9F61B724A7600FE5C1D
/* mask.png in Resources */
,
);
runOnlyForDeploymentPostprocessing
=
0
;
...
...
@@ -2330,7 +2326,7 @@
IPHONEOS_DEPLOYMENT_TARGET
=
7.0
;
MTL_ENABLE_DEBUG_INFO
=
YES
;
ONLY_ACTIVE_ARCH
=
YES
;
PROVISIONING_PROFILE
=
"
251ce065-a08f-44fd-bd52-f79372f4e47e
"
;
PROVISIONING_PROFILE
=
"
a12432a9-50b3-4cef-bae7-dcb35f965ce4
"
;
SDKROOT
=
iphoneos
;
TARGETED_DEVICE_FAMILY
=
"1,2"
;
USER_HEADER_SEARCH_PATHS
=
"${SRCROOT}/**"
;
...
...
@@ -2368,7 +2364,7 @@
GCC_WARN_UNUSED_VARIABLE
=
YES
;
IPHONEOS_DEPLOYMENT_TARGET
=
7.0
;
MTL_ENABLE_DEBUG_INFO
=
NO
;
PROVISIONING_PROFILE
=
"
251ce065-a08f-44fd-bd52-f79372f4e47e
"
;
PROVISIONING_PROFILE
=
"
a12432a9-50b3-4cef-bae7-dcb35f965ce4
"
;
SDKROOT
=
iphoneos
;
TARGETED_DEVICE_FAMILY
=
"1,2"
;
USER_HEADER_SEARCH_PATHS
=
"${SRCROOT}/**"
;
...
...
@@ -2392,7 +2388,7 @@
"$(PROJECT_DIR)"
,
);
PRODUCT_NAME
=
XFFruit
;
PROVISIONING_PROFILE
=
"
251ce065-a08f-44fd-bd52-f79372f4e47e
"
;
PROVISIONING_PROFILE
=
"
a12432a9-50b3-4cef-bae7-dcb35f965ce4
"
;
USER_HEADER_SEARCH_PATHS
=
"${SRCROOT}/**"
;
};
name
=
Debug
;
...
...
@@ -2413,7 +2409,7 @@
"$(PROJECT_DIR)"
,
);
PRODUCT_NAME
=
XFFruit
;
PROVISIONING_PROFILE
=
"
251ce065-a08f-44fd-bd52-f79372f4e47e
"
;
PROVISIONING_PROFILE
=
"
a12432a9-50b3-4cef-bae7-dcb35f965ce4
"
;
USER_HEADER_SEARCH_PATHS
=
"${SRCROOT}/**"
;
};
name
=
Release
;
...
...
@@ -2436,7 +2432,7 @@
INFOPLIST_FILE
=
XFFruitTests/Info.plist
;
LD_RUNPATH_SEARCH_PATHS
=
"$(inherited) @executable_path/Frameworks @loader_path/Frameworks"
;
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"
;
USER_HEADER_SEARCH_PATHS
=
"${SRCROOT}/**"
;
};
...
...
@@ -2456,7 +2452,7 @@
INFOPLIST_FILE
=
XFFruitTests/Info.plist
;
LD_RUNPATH_SEARCH_PATHS
=
"$(inherited) @executable_path/Frameworks @loader_path/Frameworks"
;
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"
;
USER_HEADER_SEARCH_PATHS
=
"${SRCROOT}/**"
;
};
...
...
XFFruit/Controllers/HTTPController/ICRHTTPController.h
View file @
f27c3520
...
...
@@ -202,8 +202,22 @@ typedef NS_ENUM(NSUInteger, ICRAttachmentType) {
page_size
:(
NSUInteger
)
page_size
success
:(
void
(
^
)(
id
))
succ
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
...
...
XFFruit/Controllers/HTTPController/ICRHTTPController.m
View file @
f27c3520
...
...
@@ -71,7 +71,11 @@ typedef NS_ENUM(NSUInteger, ICRHTTPAction) {
XFFHttp_QuerySurvey
,
XFFHttp_GetSurvey
,
XFFHttp_GetProduct
,
XFFHttp_GetUser
XFFHttp_GetUser
,
XFFHttp_SurveyFinish
,
//行情反馈图片
XFFHttp_ResultChart
,
XFFHttp_GetResults
};
static
NSString
*
const
ICRHTTPInterface
[]
=
{
...
...
@@ -123,8 +127,11 @@ static NSString * const ICRHTTPInterface[] = {
[
XFFHttp_QuerySurvey
]
=
@"survey/query_survey"
,
[
XFFHttp_GetSurvey
]
=
@"survey/get_survey"
,
[
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
[]
=
{
...
...
@@ -1338,27 +1345,8 @@ acceptTypeJson:YES
void
(
^
success
)(
AFHTTPRequestOperation
*
operation
,
id
responseObject
)
=
^
(
AFHTTPRequestOperation
*
operation
,
id
responseObject
)
{
CLog
(
@"%@"
,
responseObject
);
if
(
IsDictObject
(
responseObject
))
{
void
(
^
complete
)(
void
)
=
^
(
void
){
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
);
}
if
(
succ
)
{
succ
(
responseObject
);
}
};
void
(
^
failure
)(
AFHTTPRequestOperation
*
operation
,
NSError
*
error
)
=
^
(
AFHTTPRequestOperation
*
operation
,
NSError
*
error
)
{
...
...
@@ -1507,6 +1495,112 @@ acceptTypeJson:YES
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
XFFruit/General/Categories/NSDate+FormatterAdditions.h
View file @
f27c3520
...
...
@@ -51,7 +51,7 @@
// yyyy-MM-dd HH:mm:ss
-
(
NSString
*
)
httpParameterString
;
-
(
NSString
*
)
coverStringFromString
;
// yymmddhhmmssSSS
-
(
NSString
*
)
mobileIDDateString
;
...
...
XFFruit/General/Categories/NSDate+FormatterAdditions.m
View file @
f27c3520
...
...
@@ -292,7 +292,9 @@
-
(
NSString
*
)
httpParameterString
{
return
[
self
stringWithFormatter
:
@"%Y-%m-%d %H:%M:%S"
];
}
-
(
NSString
*
)
coverStringFromString
{
return
[
self
stringWithFormatter
:
@"%Y.%m.%d"
];
}
-
(
NSString
*
)
mobileIDDateString
{
return
[
self
stringWithFormatter
:
@"%y%m%d%H%M%S000"
];
}
...
...
XFFruit/Images.xcassets/Survey/finish.imageset/Contents.json
0 → 100644
View file @
f27c3520
{
"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
XFFruit/Images.xcassets/Survey/finish.imageset/finish.png
0 → 100644
View file @
f27c3520
3.91 KB
XFFruit/Images.xcassets/Survey/finish.imageset/finish@2x.png
0 → 100644
View file @
f27c3520
4.47 KB
XFFruit/Images.xcassets/Survey/initial.imageset/Contents.json
0 → 100644
View file @
f27c3520
{
"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
XFFruit/Images.xcassets/Survey/initial.imageset/initial.png
0 → 100644
View file @
f27c3520
4.13 KB
XFFruit/Images.xcassets/Survey/initial.imageset/initial@2x.png
0 → 100644
View file @
f27c3520
4.78 KB
XFFruit/Images.xcassets/Survey/insurvey.imageset/Contents.json
0 → 100644
View file @
f27c3520
{
"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
XFFruit/Images.xcassets/Survey/insurvey.imageset/insurvey.png
0 → 100644
View file @
f27c3520
4.16 KB
XFFruit/Images.xcassets/Survey/insurvey.imageset/insurvey@2x.png
0 → 100644
View file @
f27c3520
4.4 KB
XFFruit/Macro/ICRAppMacro.h
View file @
f27c3520
...
...
@@ -27,6 +27,7 @@
//new HTTP
#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"
...
...
XFFruit/Utilities/IBTUIKit/IBTCommon.m
View file @
f27c3520
...
...
@@ -177,10 +177,11 @@
}
+
(
NSString
*
)
stringFromDate
:
(
NSDate
*
)
aDate
{
NSDateFormatter
*
formatter
=
[[
NSDateFormatter
alloc
]
init
];
[
formatter
setDateFormat
:
@"yyyy
.MM.
dd"
];
[
formatter
setDateFormat
:
@"yyyy
-MM-
dd"
];
NSString
*
dateString
=
[
formatter
stringFromDate
:
aDate
];
return
dateString
;
}
+
(
NSString
*
)
dictionaryToJson
:
(
id
)
dic
{
...
...
XFFruit/Utilities/UserUtil/ICRUserUtil.h
View file @
f27c3520
...
...
@@ -28,7 +28,6 @@
@property
(
copy
,
nonatomic
)
NSString
*
currentStoreID
;
@property
(
copy
,
nonatomic
)
NSString
*
uniqueID
;
+
(
instancetype
)
sharedInstance
;
-
(
BOOL
)
saveArchive
;
...
...
XFFruit/ViewControllers/Survey/Views/BoltMaskView.h
View file @
f27c3520
...
...
@@ -10,6 +10,8 @@
@protocol
BoltMaskViewDelegate
<
NSObject
>
-
(
void
)
getBoltValueSelectRow
:
(
NSString
*
)
state
;
-
(
void
)
getTitleLike
:(
NSString
*
)
titleLike
;
-
(
void
)
getBillNumber
:(
NSString
*
)
billNumber
;
@end
...
...
@@ -18,4 +20,6 @@
@property
(
nonatomic
,
strong
)
NSMutableArray
*
dataArr
;
@property
(
nonatomic
,
weak
)
id
<
BoltMaskViewDelegate
>
delegate
;
-
(
instancetype
)
initWithFrame
:(
CGRect
)
frame
state
:(
NSString
*
)
state
title
:(
NSString
*
)
title
bill
:(
NSString
*
)
bill
;
@end
XFFruit/ViewControllers/Survey/Views/BoltMaskView.m
View file @
f27c3520
...
...
@@ -8,33 +8,70 @@
#import "BoltMaskView.h"
#import "MaskCell.h"
#define TableHeight
3
5
#define TableHeight
4
5
#define LeftMargin 80
#define TotalHeight
176
#define TotalHeight
224
#define LeftHeight 44
@interface
BoltMaskView
()
@interface
BoltMaskView
()
<
UITextFieldDelegate
>
{
UIView
*
_leftView
;
UIButton
*
_currentBtn
;
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
@implementation
BoltMaskView
-
(
instancetype
)
initWithFrame
:(
CGRect
)
frame
{
-
(
instancetype
)
initWithFrame
:(
CGRect
)
frame
state
:(
NSString
*
)
state
title
:(
NSString
*
)
title
bill
:(
NSString
*
)
bill
{
self
=
[
super
initWithFrame
:
frame
];
if
(
self
)
{
self
.
title
=
title
;
self
.
billNumber
=
bill
;
self
.
state
=
state
;
[
self
createView
];
[
self
createRightView
];
[
self
preferData
];
}
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 - 创建视图
-
(
void
)
createView
{
_leftView
=
[[
UIView
alloc
]
initWithFrame
:
CGRectMake
(
0
,
0
,
LeftMargin
,
self
.
frame
.
size
.
height
)];
[
self
addSubview
:
_leftView
];
NSArray
*
arr
=
@[
@"按状态"
,
@"条件一"
,
@"条件二"
,
@"条件三"
];
NSArray
*
arr
=
@[
@"按状态"
,
@"条件一"
,
@"条件二"
];
for
(
NSInteger
i
=
0
;
i
<
arr
.
count
;
i
++
)
{
UIButton
*
button
=
[
UIButton
buttonWithType
:
UIButtonTypeSystem
];
button
.
frame
=
CGRectMake
(
0
,
LeftHeight
*
i
,
LeftMargin
,
LeftHeight
);
...
...
@@ -50,19 +87,84 @@
[
button
addTarget
:
self
action
:
@selector
(
leftBtnClick
:
)
forControlEvents
:
UIControlEventTouchUpInside
];
[
_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
.
backgroundColor
=
[
UIColor
whiteColor
];
self
.
tableView
.
delegate
=
self
;
self
.
tableView
.
dataSource
=
self
;
[
self
addSubview
:
self
.
tableView
];
}
-
(
void
)
leftBtnClick
:
(
UIButton
*
)
btn
{
_currentBtn
.
enabled
=
YES
;
btn
.
enabled
=
NO
;
_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 - 协议
-
(
NSInteger
)
numberOfSectionsInTableView
:
(
UITableView
*
)
tableView
{
...
...
@@ -102,11 +204,43 @@
cell
.
Commitbtn
.
hidden
=
NO
;
_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
{
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
XFFruit/ViewControllers/Survey/Views/MaskCell.m
View file @
f27c3520
...
...
@@ -9,7 +9,7 @@
#import "MaskCell.h"
#define TitleSize 14
#define LeftMargin 20
#define TableHeight
3
5
#define TableHeight
4
5
#define BtnSize 14
@implementation
MaskCell
...
...
XFFruit/ViewControllers/Survey/Views/SortMaskView.h
View file @
f27c3520
...
...
@@ -13,7 +13,10 @@
@end
@interface
SortMaskView
:
UIView
<
UITableViewDataSource
,
UITableViewDelegate
>
-
(
instancetype
)
initWithFrame
:
(
CGRect
)
frame
withOrderDirection
:
(
NSString
*
)
orderDirection
;
@property
(
nonatomic
,
strong
)
UITableView
*
tableView
;
@property
(
nonatomic
,
strong
)
NSMutableArray
*
dataArr
;
@property
(
nonatomic
,
weak
)
id
<
SortMaskViewDelegate
>
delegate
;
@end
XFFruit/ViewControllers/Survey/Views/SortMaskView.m
View file @
f27c3520
...
...
@@ -8,23 +8,30 @@
#import "SortMaskView.h"
#import "MaskCell.h"
#define TableHeight
3
5
#define TableHeight
4
5
@interface
SortMaskView
()
{
NSIndexPath
*
_currentIndexPath
;
NSString
*
_orderDirection
;
}
@end
@implementation
SortMaskView
-
(
instancetype
)
initWithFrame
:(
CGRect
)
frame
{
-
(
instancetype
)
initWithFrame
:(
CGRect
)
frame
withOrderDirection
:(
NSString
*
)
orderDirection
{
self
=
[
super
initWithFrame
:
frame
];
if
(
self
)
{
self
.
tableView
=
[[
UITableView
alloc
]
initWithFrame
:
self
.
bounds
style
:(
UITableViewStylePlain
)];
self
.
tableView
.
backgroundColor
=
[
UIColor
redColor
];
self
.
tableView
.
delegate
=
self
;
self
.
tableView
.
dataSource
=
self
;
[
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
;
}
...
...
@@ -64,8 +71,11 @@
MaskCell
*
cell
=
(
MaskCell
*
)[
tableView
cellForRowAtIndexPath
:
indexPath
];
cell
.
Commitbtn
.
hidden
=
NO
;
_currentIndexPath
=
indexPath
;
[
self
.
delegate
getSortValueSelectRow
:
@"s"
];
if
(
indexPath
.
row
==
0
)
{
[
self
.
delegate
getSortValueSelectRow
:
@"asc"
];
}
else
{
[
self
.
delegate
getSortValueSelectRow
:
@"desc"
];
}
}
...
...
XFFruit/ViewControllers/Survey/Views/StartTimeView.m
View file @
f27c3520
...
...
@@ -39,9 +39,10 @@
_timePicker
.
backgroundColor
=
[
UIColor
whiteColor
];
_timePicker
.
datePickerMode
=
UIDatePickerModeDate
;
_timePicker
.
locale
=
[[
NSLocale
alloc
]
initWithLocaleIdentifier
:
@"zh_CN"
];
// 设置最小时间段,防止用户的出现已过去的时间
_timePicker
.
minimumDate
=
[
NSDate
date
];
//
// 设置最小时间段,防止用户的出现已过去的时间
//
_timePicker.minimumDate = [NSDate date];
[
_bgView
addSubview
:
_timePicker
];
}
...
...
XFFruit/ViewControllers/Survey/Views/SurveyListCell.m
View file @
f27c3520
...
...
@@ -31,8 +31,8 @@
{
self
.
stateBtn
=
[
UIButton
buttonWithType
:
UIButtonTypeCustom
];
self
.
stateBtn
.
frame
=
CGRectMake
(
TopMargin
*
2
,
TopMargin
,
LeftMargin
-
TopMargin
*
3
,
20
);
self
.
stateBtn
.
titleLabel
.
font
=
FontSize
(
ContentSize
);
[
self
.
stateBtn
setTitleColor
:[
UIColor
whiteColor
]
forState
:
UIControlStateNormal
];
//
self.stateBtn.titleLabel.font = FontSize(ContentSize);
//
[self.stateBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
self
.
stateBtn
.
enabled
=
NO
;
self
.
titleLabel
=
[[
UILabel
alloc
]
initWithFrame
:(
CGRectMake
(
LeftMargin
,
TopMargin
,
ScreenSize
.
width
-
LeftMargin
,
TitleHeight
))];
...
...
@@ -72,29 +72,30 @@
-
(
void
)
setSurvey
:
(
Survey
*
)
survey
{
self
.
titleLabel
.
text
=
survey
.
title
;
self
.
billnumberLabel
.
text
=
survey
.
billNumber
;
self
.
productnameLabel
.
text
=
survey
.
productName
;
self
.
begindateLabel
.
text
=
survey
.
beginDate
;
self
.
enddateLabel
.
text
=
survey
.
endDate
;
NSString
*
stateStr
=
@""
;
self
.
billnumberLabel
.
text
=
[
NSString
stringWithFormat
:
@"单号:%@"
,
survey
.
billNumber
]
;
self
.
productnameLabel
.
text
=
[
NSString
stringWithFormat
:
@"商品:%@[%@]"
,
survey
.
productName
,
survey
.
productCode
]
;
self
.
begindateLabel
.
text
=
[
NSString
stringWithFormat
:
@"开始时间:%@"
,[
survey
.
beginDate
substringToIndex
:
10
]]
;
self
.
enddateLabel
.
text
=
[
NSString
stringWithFormat
:
@"结束时间:%@"
,[
survey
.
endDate
substringToIndex
:
10
]]
;
//
NSString *stateStr = @"";
if
([
survey
.
state
isEqualToString
:
@"initial"
])
{
[
self
.
stateBtn
setBackgroundColor
:[
UIColor
redColor
]];
stateStr
=
@"未提交"
;
// [self.stateBtn setBackgroundColor:[UIColor redColor]];
// stateStr = @"未提交";
[
self
.
stateBtn
setImage
:[
UIImage
imageNamed
:
@"initial"
]
forState
:
UIControlStateDisabled
];
}
else
if
([
survey
.
state
isEqualToString
:
@"submitted"
])
{
[
self
.
stateBtn
setBackgroundColor
:[
UIColor
greenColor
]];
stateStr
=
@"已提交"
;
// [self.stateBtn setBackgroundColor:[UIColor greenColor]];
// stateStr = @"已提交";
[
self
.
stateBtn
setImage
:[
UIImage
imageNamed
:
@"insurvey"
]
forState
:
UIControlStateDisabled
];
}
else
if
([
survey
.
state
isEqualToString
:
@"insurvey"
])
{
[
self
.
stateBtn
setBackgroundColor
:[
UIColor
grayColor
]];
stateStr
=
@"调研中"
;
// [self.stateBtn setBackgroundColor:[UIColor grayColor]];
// stateStr = @"调研中";
[
self
.
stateBtn
setImage
:[
UIImage
imageNamed
:
@"insurvey"
]
forState
:
UIControlStateDisabled
];
}
else
if
([
survey
.
state
isEqualToString
:
@"finished"
])
{
[
self
.
stateBtn
setBackgroundColor
:[
UIColor
blackColor
]];
stateStr
=
@"已完成"
;
//
[self.stateBtn setBackgroundColor:[UIColor blackColor]];
// 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
{
...
...
XFFruit/ViewControllers/Survey/Views/SurveyResultCell.m
View file @
f27c3520
...
...
@@ -32,9 +32,10 @@
self
.
imageBtn
=
[
UIButton
buttonWithType
:
UIButtonTypeCustom
];
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
.
textColor
=
HexColor
(
TitleColor
);
self
.
userNameLabel
.
font
=
FontSize
(
TitleSize
);
self
.
userNameLabel
=
[[
UILabel
alloc
]
initWithFrame
:(
CGRectMake
(
CGRectGetMaxX
(
self
.
imageBtn
.
frame
)
+
TopMargin
,
TopMargin
,
ScreenSize
.
width
-
TopMargin
*
2
-
LeftWidth
,
TitleHeight
*
2
))];
self
.
userNameLabel
.
numberOfLines
=
0
;
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
.
textColor
=
HexColor
(
ContentColor
);
...
...
@@ -68,11 +69,11 @@
-
(
void
)
setSurveyResult
:
(
SurveyResult
*
)
surveyResult
{
[
self
.
imageBtn
setBackgroundImage
:[
UIImage
imageNamed
:
@"no_image_default"
]
forState
:
UIControlStateNormal
];
self
.
userNameLabel
.
text
=
surveyResult
.
unit
;
self
.
placeLabel
.
text
=
surveyResult
.
place
;
self
.
priceLabel
.
text
=
surveyResult
.
price
;
self
.
capacityLabel
.
text
=
surveyResult
.
capacity
;
self
.
qualityLabel
.
text
=
surveyResult
.
quality
;
self
.
userNameLabel
.
text
=
[
NSString
stringWithFormat
:
@"反馈人:%@[%@]"
,
surveyResult
.
userName
,
surveyResult
.
feedbackTime
]
;
self
.
placeLabel
.
text
=
[
NSString
stringWithFormat
:
@"产地:%@"
,
surveyResult
.
place
]
;
self
.
priceLabel
.
text
=
[
NSString
stringWithFormat
:
@"价格:%@"
,
surveyResult
.
price
]
;
self
.
capacityLabel
.
text
=
[
NSString
stringWithFormat
:
@"市场容量:%@"
,
surveyResult
.
capacity
]
;
self
.
qualityLabel
.
text
=
[
NSString
stringWithFormat
:
@"质量情况:%@"
,
surveyResult
.
quality
]
;
}
-
(
void
)
setSelected
:
(
BOOL
)
selected
animated
:
(
BOOL
)
animated
{
...
...
XFFruit/ViewControllers/Survey/Views/sort.png
deleted
100644 → 0
View file @
9f7df76f
3.86 KB
XFFruit/ViewControllers/Survey/controllers/NewSurveyViewController.h
View file @
f27c3520
...
...
@@ -8,6 +8,9 @@
#import "ICRBaseViewController.h"
#import "Survey.h"
@interface
NewSurveyViewController
:
ICRBaseViewController
@property
(
nonatomic
,
strong
)
Survey
*
survey
;
@end
XFFruit/ViewControllers/Survey/controllers/NewSurveyViewController.m
View file @
f27c3520
...
...
@@ -45,13 +45,13 @@ typedef enum : NSUInteger {
BOOL
_isClickStart
;
StartTimeView
*
_startTimeView
;
}
@property
(
nonatomic
,
strong
)
NSString
*
surveyTitle
;
@property
(
nonatomic
,
strong
)
NSString
*
productCode
;
@property
(
nonatomic
,
strong
)
NSString
*
product
Uuid
;
@property
(
nonatomic
,
strong
)
NSString
*
product
Name
;
@property
(
nonatomic
,
strong
)
NSString
*
beginDate
;
@property
(
nonatomic
,
strong
)
NSString
*
endDate
;
@property
(
nonatomic
,
strong
)
NSString
*
remark
;
@property
(
nonatomic
,
strong
)
NSString
*
titleStr
;
@property
(
nonatomic
,
strong
)
NSString
*
productCode
Str
;
@property
(
nonatomic
,
strong
)
NSString
*
product
NameStr
;
@property
(
nonatomic
,
strong
)
NSString
*
product
UuidStr
;
@property
(
nonatomic
,
strong
)
NSString
*
beginDate
Str
;
@property
(
nonatomic
,
strong
)
NSString
*
endDate
Str
;
@property
(
nonatomic
,
strong
)
NSString
*
remark
Str
;
@property
(
nonatomic
,
strong
)
NSMutableArray
*
users
;
@end
...
...
@@ -60,8 +60,9 @@ typedef enum : NSUInteger {
-
(
void
)
viewDidLoad
{
[
super
viewDidLoad
];
self
.
title
=
@"新建行情调研"
;
[
self
initData
];
[
self
createTableView
];
[
self
createTableView
];
}
-
(
void
)
initData
{
_dataArr
=
[
NSMutableArray
array
];
...
...
@@ -119,9 +120,9 @@ typedef enum : NSUInteger {
}
}
-
(
BOOL
)
checkSurvey
{
self
.
surveyTitle
=
_titleField
.
text
;
self
.
remark
=
_noteTextView
.
text
;
if
(
self
.
surveyTitle
.
length
==
0
||
self
.
productUuid
.
length
==
0
||
self
.
productName
.
length
==
0
||
self
.
users
.
count
<=
0
||
self
.
beginDate
.
length
==
0
||
self
.
endDate
.
length
==
0
)
{
self
.
titleStr
=
_titleField
.
text
;
self
.
remark
Str
=
_noteTextView
.
text
;
if
(
self
.
titleStr
.
length
==
0
||
self
.
productUuidStr
.
length
==
0
||
self
.
productNameStr
.
length
==
0
||
self
.
productCodeStr
.
length
==
0
||
self
.
users
.
count
<=
0
||
self
.
beginDateStr
.
length
==
0
||
self
.
endDateStr
.
length
==
0
)
{
UIAlertView
*
alert
=
[[
UIAlertView
alloc
]
initWithTitle
:
@"提示信息"
message
:
@"信息不完整"
delegate
:
nil
cancelButtonTitle
:
@"确定"
otherButtonTitles
:
nil
,
nil
];
[
alert
show
];
return
NO
;
...
...
@@ -142,6 +143,7 @@ typedef enum : NSUInteger {
if
(
success
==
1
)
{
//成功
[
IBTLoadingView
showTips
:
@"操作成功"
];
[
self
clearAllInformation
];
}
else
{
[
IBTLoadingView
showTips
:
message
];
...
...
@@ -152,20 +154,55 @@ typedef enum : NSUInteger {
[
IBTLoadingView
hideHUDWithText
:
nil
];
[
IBTLoadingView
showTips
:
data
];
};
NSDictionary
*
dict
=
@{
@"billnumber"
:
@""
,
@"title"
:
self
.
surveyTitle
,
id
uuidObject
=
[
NSNull
null
];
if
(
self
.
survey
.
uuid
.
length
>
0
){
uuidObject
=
self
.
survey
.
uuid
;
}
id
billNumberObject
=
[
NSNull
null
];
if
(
self
.
survey
.
billNumber
>
0
)
{
billNumberObject
=
self
.
survey
.
billNumber
;
}
NSDictionary
*
dict
=
@{
@"uuid"
:
uuidObject
,
@"billnumber"
:
billNumberObject
,
@"title"
:
[
IBTCommon
checkString
:
self
.
titleStr
],
@"state"
:
state
,
@"productUuid"
:
self
.
productUuid
,
@"productCode"
:
self
.
productCode
,
@"productName"
:
self
.
productName
,
@"beginDate"
:
self
.
beginDate
,
@"endDate"
:
self
.
endDate
,
@"remark"
:
self
.
remark
,
@"productUuid"
:
[
IBTCommon
checkString
:
self
.
productUuidStr
]
,
@"productCode"
:
[
IBTCommon
checkString
:
self
.
productCodeStr
]
,
@"productName"
:
[
IBTCommon
checkString
:
self
.
productNameStr
]
,
@"beginDate"
:
[
IBTCommon
checkString
:
self
.
beginDateStr
]
,
@"endDate"
:
[
IBTCommon
checkString
:
self
.
endDateStr
]
,
@"remark"
:
[
IBTCommon
checkString
:
self
.
remarkStr
]
,
@"users"
:
self
.
users
};
[
IBTLoadingView
showProgressLabel
:
msg
];
[[
ICRHTTPController
sharedController
]
saveSurveyWithAuthenticode
:
dict
success
:
succ
failure
:
fail
];
}
-
(
void
)
clearAllInformation
{
_titleField
.
text
=
@""
;
_productLabel
.
text
=
@"请输入商品"
;
_productLabel
.
textColor
=
HexColor
(
@"bbbbbb"
);
_startDateLabel
.
text
=
@"选择日期"
;
_startDateLabel
.
textColor
=
HexColor
(
@"bbbbbb"
);
_endDateLabel
.
text
=
@"选择日期"
;
_endDateLabel
.
textColor
=
HexColor
(
@"bbbbbb"
);
_personLabel
.
text
=
@"选择调研人员"
;
_personLabel
.
textColor
=
HexColor
(
@"bbbbbb"
);
_noteTextView
.
text
=
@"输入备注"
;
_noteTextView
.
textColor
=
HexColor
(
@"bbbbbb"
);
//清空数据
self
.
titleStr
=
@""
;
self
.
productCodeStr
=
@""
;
self
.
productNameStr
=
@""
;
self
.
productUuidStr
=
@""
;
self
.
beginDateStr
=
@""
;
self
.
endDateStr
=
@""
;
[
self
.
users
removeAllObjects
];
self
.
remarkStr
=
@""
;
}
#pragma mark - 协议方法
-
(
NSInteger
)
numberOfSectionsInTableView
:
(
UITableView
*
)
tableView
{
...
...
@@ -200,7 +237,10 @@ typedef enum : NSUInteger {
_titleField
.
returnKeyType
=
UIReturnKeyDone
;
_titleField
.
delegate
=
self
;
[
cell
.
contentView
addSubview
:
_titleField
];
if
(
self
.
survey
)
{
_titleField
.
text
=
[
IBTCommon
checkString
:
self
.
survey
.
title
];
self
.
titleStr
=
[
IBTCommon
checkString
:
self
.
survey
.
title
];
}
}
else
if
(
indexPath
.
row
==
_dataArr
.
count
-
1
){
_noteTextView
=
[[
HPGrowingTextView
alloc
]
initWithFrame
:
CGRectMake
(
100
+
LeftMargin
,
0
,
ScreenSize
.
width
-
100
-
LeftMargin
*
2
-
10
,
TableHeight
)];
_noteTextView
.
contentInset
=
UIEdgeInsetsMake
(
5
,
5
,
5
,
0
);
...
...
@@ -212,7 +252,10 @@ typedef enum : NSUInteger {
_noteTextView
.
returnKeyType
=
UIReturnKeyDone
;
_noteTextView
.
placeholder
=
@"输入备注内容"
;
[
cell
.
contentView
addSubview
:
_noteTextView
];
if
(
self
.
survey
)
{
_noteTextView
.
text
=
[
IBTCommon
checkString
:
self
.
survey
.
remark
];
self
.
remarkStr
=
[
IBTCommon
checkString
:
self
.
survey
.
remark
];
}
CGRect
lineFrame
=
cell
.
lineLabel
.
frame
;
lineFrame
.
origin
.
y
=
TableHeight
*
2
-
1
;
cell
.
lineLabel
.
frame
=
lineFrame
;
...
...
@@ -225,22 +268,65 @@ typedef enum : NSUInteger {
if
(
indexPath
.
row
==
1
)
{
contentLabel
.
text
=
@"选择商品"
;
_productLabel
=
contentLabel
;
[
self
preferDataInProductLabel
];
}
else
if
(
indexPath
.
row
==
2
){
contentLabel
.
text
=
@"选择日期"
;
_startDateLabel
=
contentLabel
;
if
(
self
.
survey
)
{
if
(
self
.
survey
.
beginDate
.
length
>
9
)
{
_startDateLabel
.
text
=
[[
IBTCommon
checkString
:
self
.
survey
.
beginDate
]
substringToIndex
:
10
];
}
_startDateLabel
.
textColor
=
HexColor
(
@"444444"
);
self
.
beginDateStr
=
[
IBTCommon
checkString
:
self
.
survey
.
beginDate
];
}
}
else
if
(
indexPath
.
row
==
3
){
contentLabel
.
text
=
@"选择日期"
;
_endDateLabel
=
contentLabel
;
if
(
self
.
survey
)
{
if
(
self
.
survey
.
endDate
.
length
>
9
)
{
_endDateLabel
.
text
=
[[
IBTCommon
checkString
:
self
.
survey
.
endDate
]
substringToIndex
:
10
];
}
_endDateLabel
.
textColor
=
HexColor
(
@"444444"
);
self
.
endDateStr
=
[
IBTCommon
checkString
:
self
.
survey
.
endDate
];
}
}
else
if
(
indexPath
.
row
==
4
){
contentLabel
.
text
=
@"选择调研人员"
;
_personLabel
=
contentLabel
;
[
self
preferDataInPersonLabel
];
}
}
}
-
(
void
)
preferDataInPersonLabel
{
if
(
self
.
survey
)
{
if
(
self
.
survey
.
users
.
count
>
0
)
{
NSString
*
personStr
=
@""
;
for
(
SurveyUser
*
surveyUser
in
self
.
survey
.
users
)
{
if
(
personStr
.
length
==
0
)
{
personStr
=
[
personStr
stringByAppendingFormat
:
@"%@"
,
surveyUser
.
userName
];
}
else
{
personStr
=
[
personStr
stringByAppendingFormat
:
@"、%@"
,
surveyUser
.
userName
];
}
}
_personLabel
.
text
=
personStr
;
_personLabel
.
textColor
=
HexColor
(
@"444444"
);
}
if
(
self
.
users
>
0
)
{
[
self
.
users
addObjectsFromArray
:
self
.
survey
.
users
];
}
}
}
-
(
void
)
preferDataInProductLabel
{
if
(
self
.
survey
)
{
_productLabel
.
text
=
[
IBTCommon
checkString
:
self
.
survey
.
productName
];
_productLabel
.
textColor
=
HexColor
(
@"444444"
);
self
.
productCodeStr
=
[
IBTCommon
checkString
:
self
.
survey
.
productCode
];
self
.
productNameStr
=
[
IBTCommon
checkString
:
self
.
survey
.
productName
];
self
.
productUuidStr
=
[
IBTCommon
checkString
:
self
.
survey
.
productUuid
];
}
}
-
(
CGFloat
)
tableView
:
(
UITableView
*
)
tableView
heightForRowAtIndexPath
:
(
NSIndexPath
*
)
indexPath
{
if
(
indexPath
.
row
==
5
){
return
TableHeight
*
2
;
...
...
@@ -265,7 +351,11 @@ typedef enum : NSUInteger {
[
self
.
users
removeAllObjects
];
}
for
(
SurveyUser
*
user
in
users
)
{
textStr
=
[
textStr
stringByAppendingFormat
:
@"%@、"
,
user
.
userName
];
if
(
textStr
.
length
==
0
)
{
textStr
=
[
textStr
stringByAppendingFormat
:
@"%@"
,
user
.
userName
];
}
else
{
textStr
=
[
textStr
stringByAppendingFormat
:
@"、%@"
,
user
.
userName
];
}
[
self
.
users
addObject
:[
user
dictForCommit
]];
}
_personLabel
.
text
=
textStr
;
...
...
@@ -278,9 +368,9 @@ typedef enum : NSUInteger {
cvc
.
choseProduct
=
^
(
Product
*
product
){
_productLabel
.
text
=
[
NSString
stringWithFormat
:
@"%@[%@]"
,
product
.
name
,
product
.
code
];
_productLabel
.
textColor
=
HexColor
(
@"444444"
);
self
.
productName
=
product
.
name
;
self
.
productUuid
=
product
.
uuid
;
self
.
productCode
=
product
.
code
;
self
.
productName
Str
=
product
.
name
;
self
.
productUuid
Str
=
product
.
uuid
;
self
.
productCode
Str
=
product
.
code
;
};
cvc
.
isMoreChose
=
NO
;
[
self
PushViewController
:
cvc
animated
:
YES
];
...
...
@@ -308,16 +398,14 @@ typedef enum : NSUInteger {
[
self
clearDatePickView
];
}
-
(
void
)
okTimeView
:
(
NSDate
*
)
time
{
NSDateFormatter
*
df
=
[[
NSDateFormatter
alloc
]
init
];
df
.
dateFormat
=
@"yyyy年MM月dd日"
;
if
(
_isClickStart
)
{
_startDateLabel
.
textColor
=
HexColor
(
@"444444"
);
_startDateLabel
.
text
=
[
df
stringFromDate
:
time
];
self
.
beginDate
=
[
time
httpParameterString
];
_startDateLabel
.
text
=
[
IBTCommon
stringFromDate
:
time
];
self
.
beginDate
Str
=
[
time
httpParameterString
];
}
else
{
_endDateLabel
.
textColor
=
HexColor
(
@"444444"
);
_endDateLabel
.
text
=
[
df
stringFromDate
:
time
];
self
.
endDate
=
[
time
httpParameterString
];
_endDateLabel
.
text
=
[
IBTCommon
stringFromDate
:
time
];
self
.
endDate
Str
=
[
time
httpParameterString
];
}
// 关闭选择器
[
self
clearDatePickView
];
...
...
@@ -334,6 +422,11 @@ typedef enum : NSUInteger {
}];
}
#pragma mark delegate
-
(
BOOL
)
growingTextViewShouldReturn
:
(
HPGrowingTextView
*
)
growingTextView
{
[
_noteTextView
resignFirstResponder
];
...
...
XFFruit/ViewControllers/Survey/controllers/ResultDetailViewController.h
View file @
f27c3520
...
...
@@ -9,5 +9,5 @@
#import "ICRBaseViewController.h"
@interface
ResultDetailViewController
:
ICRBaseViewController
@property
(
nonatomic
,
strong
)
NSString
*
surveyUuid
;
@end
XFFruit/ViewControllers/Survey/controllers/ResultDetailViewController.m
View file @
f27c3520
...
...
@@ -24,13 +24,28 @@
-
(
void
)
viewDidLoad
{
[
super
viewDidLoad
];
self
.
title
=
@"行情反馈列表"
;
[
self
initData
];
[
self
createTableView
];
}
-
(
void
)
initData
{
_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
++
)
{
SurveyResult
*
survey
=
[[
SurveyResult
alloc
]
init
];
survey
.
unit
=
@"南汇8424西瓜调研情况"
;
...
...
@@ -38,6 +53,8 @@
survey
.
price
=
@"南汇842[100213]"
;
survey
.
capacity
=
@"22222222222"
;
survey
.
quality
=
@"费卡接口"
;
survey
.
userName
=
@"张三"
;
survey
.
feedbackTime
=
@"2015-04-05 12:04:06"
;
[
_dataArr
addObject
:
survey
];
}
}
...
...
XFFruit/ViewControllers/Survey/controllers/SurveyDetailViewController.m
View file @
f27c3520
...
...
@@ -9,11 +9,12 @@
#import "SurveyDetailViewController.h"
#import "ResultDetailViewController.h"
#import "SurveyUser.h"
#import "UIImageView+WebCache.h"
#define BottomHeight 50
#define LeftMargin 20
#define LeftWidth 100
#define LeftHeight 30
#define TopMargin 15
typedef
enum
:
NSUInteger
{
...
...
@@ -26,6 +27,7 @@ typedef enum : NSUInteger {
UIScrollView
*
_scrollView
;
UIView
*
_surveyView
;
UIView
*
_bottomView
;
UIImageView
*
_chartImageView
;
}
@property
(
nonatomic
,
strong
)
UILabel
*
billNumberLabel
;
@property
(
nonatomic
,
strong
)
UILabel
*
stateLabel
;
...
...
@@ -41,21 +43,28 @@ typedef enum : NSUInteger {
-
(
void
)
viewDidLoad
{
[
super
viewDidLoad
];
self
.
title
=
@"行情调研详情"
;
[
self
bulifLayout
];
__weak
typeof
(
self
)
weakSelf
=
self
;
void
(
^
succ
)(
id
)
=
^
(
id
data
)
{
[
IBTLoadingView
hideHUDWithText
:
nil
];
__strong
__typeof
(
weakSelf
)
strongSelf
=
weakSelf
;
if
(
data
)
{
NSDictionary
*
dictData
=
data
[
@"data"
];
Survey
*
survey
=
[[
Survey
alloc
]
init
];
[
survey
setValuesForKeysWithDictionary
:
dictData
];
self
.
survey
=
survey
;
[
strongSelf
fetchtSurveyDetail
];
NSInteger
success
=
[
data
[
@"success"
]
integerValue
];
NSString
*
message
=
data
[
@"message"
]
;
if
(
success
==
1
)
{
NSDictionary
*
dictData
=
data
[
@"data"
];
Survey
*
survey
=
[[
Survey
alloc
]
init
];
[
survey
setValuesForKeysWithDictionary
:
dictData
];
self
.
survey
=
survey
;
[
strongSelf
fetchtSurveyDetail
];
}
else
{
[
IBTLoadingView
showTips
:
message
];
}
}
else
{
[
strongSelf
fetchtSurveyDetail
];
}
[
self
createResultChart
];
};
void
(
^
fail
)(
id
)
=
^
(
id
data
)
{
[
IBTLoadingView
hideHUDWithText
:
nil
];
...
...
@@ -65,6 +74,29 @@ typedef enum : NSUInteger {
[[
ICRHTTPController
sharedController
]
getResultWithSurveyUuid
:
self
.
surveyUuid
success
:
succ
failure
:
fail
];
}
-
(
void
)
createResultChart
{
void
(
^
succ
)(
id
)
=
^
(
id
data
)
{
if
(
data
)
{
NSInteger
success
=
[
data
[
@"success"
]
integerValue
];
NSString
*
message
=
data
[
@"message"
]
;
if
(
success
==
1
)
{
NSString
*
dataStr
=
data
[
@"data"
];
NSString
*
urlStr
=
[
NSString
stringWithFormat
:
@"%@/DisplayChart?filename=%@"
,
Server_Url
,
dataStr
];
[
_chartImageView
sd_setImageWithURL
:[
NSURL
URLWithString
:
urlStr
]];
}
else
{
[
IBTLoadingView
showTips
:
message
];
}
}
};
void
(
^
fail
)(
id
)
=
^
(
id
data
)
{
[
IBTLoadingView
hideHUDWithText
:
nil
];
[
IBTLoadingView
showTips
:
data
];
};
[[
ICRHTTPController
sharedController
]
resultChartWithResultUuid
:
self
.
surveyUuid
width
:[
NSNumber
numberWithFloat
:
CGRectGetWidth
(
_chartImageView
.
frame
)]
height
:
[
NSNumber
numberWithFloat
:
CGRectGetHeight
(
_chartImageView
.
frame
)]
success
:
succ
failure
:
fail
];
}
-
(
void
)
fetchtSurveyDetail
{
self
.
billNumberLabel
.
text
=
[
IBTCommon
checkString
:
self
.
survey
.
billNumber
];
if
([
self
.
survey
.
state
isEqualToString
:
@"initial"
])
{
...
...
@@ -84,7 +116,11 @@ typedef enum : NSUInteger {
for
(
NSDictionary
*
userDict
in
self
.
survey
.
users
)
{
SurveyUser
*
surveyUser
=
[[
SurveyUser
alloc
]
init
];
[
surveyUser
setValuesForKeysWithDictionary
:
userDict
];
user
=
[
user
stringByAppendingFormat
:
@"%@、"
,
surveyUser
.
userName
];
if
(
user
.
length
==
0
)
{
user
=
[
user
stringByAppendingFormat
:
@"%@"
,
surveyUser
.
userName
];
}
else
{
user
=
[
user
stringByAppendingFormat
:
@"、%@"
,
surveyUser
.
userName
];
}
}
self
.
titleLabel
.
text
=
[
IBTCommon
checkString
:
self
.
survey
.
title
];
self
.
productLabel
.
text
=
[
IBTCommon
checkString
:
self
.
survey
.
productName
];
...
...
@@ -99,19 +135,17 @@ typedef enum : NSUInteger {
#pragma mark - 视图初始化
-
(
void
)
bulifLayout
{
self
.
view
.
backgroundColor
=
HexColor
(
@"f8f8f8"
);
_scrollView
=
[[
UIScrollView
alloc
]
initWithFrame
:
CGRectMake
(
0
,
0
,
ScreenSize
.
width
,
ScreenSize
.
height
-
64
-
BottomHeight
)];
_scrollView
.
showsHorizontalScrollIndicator
=
NO
;
_scrollView
.
showsVerticalScrollIndicator
=
NO
;
_scrollView
.
backgroundColor
=
HexColor
(
@"f8f8f8"
);
[
self
.
view
addSubview
:
_scrollView
];
UIButton
*
endBtn
=
[
IBTCustomButtom
creatButtonWithFrame
:
CGRectMake
(
LeftMargin
,
ScreenSize
.
height
-
64
-
BottomHeight
+
5
,
ScreenSize
.
width
-
LeftMargin
*
2
,
40
)
target
:
self
sel
:
@selector
(
btnClick
:
)
tag
:
EndTag
image
:
nil
title
:
@"结束"
titleColor
:
[
UIColor
whiteColor
]
isCorner
:
YES
corner
:
8
bgColor
:
HexColor
(
@"f69100"
)];
[
self
.
view
addSubview
:
endBtn
];
_surveyView
=
[[
UIView
alloc
]
initWithFrame
:
CGRectMake
(
0
,
0
,
ScreenSize
.
width
,
LeftHeight
*
9
+
LeftMargin
/
2
)];
_surveyView
=
[[
UIView
alloc
]
initWithFrame
:
CGRectMake
(
0
,
TopMargin
,
ScreenSize
.
width
,
LeftHeight
*
9
+
LeftMargin
/
2
)];
_surveyView
.
backgroundColor
=
[
UIColor
whiteColor
];
[
_scrollView
addSubview
:
_surveyView
];
...
...
@@ -122,16 +156,6 @@ typedef enum : NSUInteger {
[
_surveyView
addSubview
:
tagLabel
];
NSArray
*
leftArr
=
@[
@"单号:"
,
@"状态:"
,
@"标题:"
,
@"商品:"
,
@"开始日期:"
,
@"截止日期:"
,
@"调研人员:"
,
@"备注:"
];
// NSMutableArray *contentArr = [[NSMutableArray alloc]init];
// [contentArr addObject:[IBTCommon checkString:self.survey.billNumber]];
// [contentArr addObject:[IBTCommon checkString:self.survey.state]];
// [contentArr addObject:[IBTCommon checkString:self.survey.title]];
// [contentArr addObject:[IBTCommon checkString:self.survey.productName]];
// [contentArr addObject:[IBTCommon checkString:self.survey.beginDate]];
// [contentArr addObject:[IBTCommon checkString:self.survey.endDate]];
// [contentArr addObject:[IBTCommon checkString:self.survey.productCode]];
// [contentArr addObject:[IBTCommon checkString:self.survey.remark]];
for
(
NSInteger
i
=
0
;
i
<
leftArr
.
count
;
i
++
)
{
UILabel
*
leftLabel
=
[[
UILabel
alloc
]
initWithFrame
:
CGRectMake
(
LeftMargin
,
CGRectGetMaxY
(
tagLabel
.
frame
)
+
LeftHeight
*
i
,
LeftWidth
,
LeftHeight
)];
leftLabel
.
font
=
FontSize
(
17
);
...
...
@@ -144,19 +168,6 @@ typedef enum : NSUInteger {
if
(
i
==
0
)
{
self
.
billNumberLabel
=
rightLabel
;
}
else
if
(
i
==
1
)
{
// if ([contentArr[i] isEqualToString:@"initial"]) {
// rightLabel.textColor = [UIColor redColor];
// rightLabel.text = @"未提交";
// }else if ([contentArr[i] isEqualToString:@"submitted"]) {
// rightLabel.textColor = [UIColor greenColor];
// rightLabel.text = @"已提交";
// }else if ([contentArr[i] isEqualToString:@"insurvey"]) {
// rightLabel.textColor = [UIColor grayColor];
// rightLabel.text = @"调研中";
// }else if ([contentArr[i] isEqualToString:@"finished"]) {
// rightLabel.textColor = [UIColor blackColor];
// rightLabel.text = @"已完成";
// }
self
.
stateLabel
=
rightLabel
;
}
else
if
(
i
==
2
){
self
.
titleLabel
=
rightLabel
;
...
...
@@ -176,7 +187,7 @@ typedef enum : NSUInteger {
}
_bottomView
=
[[
UIView
alloc
]
initWithFrame
:
CGRectMake
(
0
,
CGRectGetMaxY
(
_surveyView
.
frame
),
ScreenSize
.
width
,
200
)];
_bottomView
=
[[
UIView
alloc
]
initWithFrame
:
CGRectMake
(
0
,
CGRectGetMaxY
(
_surveyView
.
frame
)
+
TopMargin
,
ScreenSize
.
width
,
200
)];
_bottomView
.
backgroundColor
=
[
UIColor
whiteColor
];
[
_scrollView
addSubview
:
_bottomView
];
...
...
@@ -184,35 +195,60 @@ typedef enum : NSUInteger {
UILabel
*
resultLabel
=
[[
UILabel
alloc
]
initWithFrame
:
CGRectMake
(
LeftMargin
/
2
,
10
,
LeftWidth
*
2
,
LeftHeight
)];
resultLabel
.
text
=
@"【行情反馈】"
;
resultLabel
.
font
=
FontSize
(
17
);
resultLabel
.
textColor
=
[
UIColor
blueColor
];
[
_bottomView
addSubview
:
resultLabel
];
_chartImageView
=
[[
UIImageView
alloc
]
initWithFrame
:
CGRectMake
(
10
,
CGRectGetMaxY
(
resultLabel
.
frame
)
+
10
,
CGRectGetWidth
(
_bottomView
.
frame
)
-
20
,
CGRectGetHeight
(
_bottomView
.
frame
)
-
LeftHeight
-
20
)];
[
_bottomView
addSubview
:
_chartImageView
];
UIButton
*
btn
=
[
IBTCustomButtom
creatButtonWithFrame
:
CGRectMake
(
CGRectGetWidth
(
_bottomView
.
frame
)
-
100
,
10
,
100
,
LeftHeight
)
target
:
self
sel
:
@selector
(
btnClick
:
)
tag
:
DetailTag
image
:
nil
title
:
@">>查看详情"
titleColor
:
[
UIColor
blueColor
]
isCorner
:
NO
corner
:
0
bgColor
:
nil
];
[
_bottomView
addSubview
:
btn
];
}
if
([
self
.
survey
.
state
isEqualToString
:
@"finished"
])
{
endBtn
.
hidden
=
YES
;
CGRect
scrollViewFrame
=
_scrollView
.
frame
;
scrollViewFrame
.
size
.
height
=
ScreenSize
.
height
-
64
;
_scrollView
.
frame
=
scrollViewFrame
;
}
-
(
void
)
createSurvey
{
}
-
(
void
)
btnClick
:
(
UIButton
*
)
btn
{
if
(
btn
.
tag
==
DetailTag
)
{
ResultDetailViewController
*
rvc
=
[
ResultDetailViewController
new
];
rvc
.
surveyUuid
=
self
.
surveyUuid
;
[
self
PushViewController
:
rvc
animated
:
YES
];
}
else
if
(
btn
.
tag
==
EndTag
){
[
self
finishSurveyRequest
];
}
}
#pragma mark - 结束行情调研
-
(
void
)
finishSurveyRequest
{
void
(
^
succ
)(
id
)
=
^
(
id
data
)
{
[
IBTLoadingView
hideHUDWithText
:
nil
];
if
(
data
)
{
NSInteger
success
=
[
data
[
@"success"
]
integerValue
];
NSString
*
message
=
data
[
@"message"
]
;
if
(
success
==
1
)
{
}
else
{
[
IBTLoadingView
showTips
:
message
];
}
}
else
{
[
IBTLoadingView
showTips
:
@"返回异常"
];
}
};
void
(
^
fail
)(
id
)
=
^
(
id
data
)
{
[
IBTLoadingView
hideHUDWithText
:
nil
];
[
IBTLoadingView
showTips
:
data
];
};
[
IBTLoadingView
showProgressLabel
:
@"正在加载..."
];
[[
ICRHTTPController
sharedController
]
surveyFinishWithUuid
:
self
.
surveyUuid
success
:
succ
failure
:
fail
];
}
-
(
void
)
setNoteHeight
{
CGFloat
height
=
[
self
.
noteLabel
calculateHeight
];
...
...
@@ -228,10 +264,10 @@ typedef enum : NSUInteger {
CGRect
bottomFrame
=
_bottomView
.
frame
;
bottomFrame
.
origin
.
y
=
CGRectGetMaxY
(
_surveyView
.
frame
);
bottomFrame
.
origin
.
y
=
CGRectGetMaxY
(
_surveyView
.
frame
)
+
TopMargin
;
_bottomView
.
frame
=
bottomFrame
;
_scrollView
.
contentSize
=
CGSizeMake
(
ScreenSize
.
width
,
totalHeight
+
CGRectGetHeight
(
_bottomView
.
frame
));
_scrollView
.
contentSize
=
CGSizeMake
(
ScreenSize
.
width
,
totalHeight
+
CGRectGetHeight
(
_bottomView
.
frame
)
+
TopMargin
*
2
);
}
...
...
XFFruit/ViewControllers/Survey/controllers/SurveyViewController.m
View file @
f27c3520
...
...
@@ -12,7 +12,7 @@
#import "SortMaskView.h"
#import "BoltMaskView.h"
#import "SurveyDetailViewController.h"
#import "NewSurveyViewController.h"
#define TopMargin 44
#define TableHeight 120
...
...
@@ -38,6 +38,12 @@ typedef enum : NSUInteger {
}
@property
(
nonatomic
,
strong
)
NSMutableArray
*
dataArr
;
@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
...
...
@@ -46,19 +52,20 @@ typedef enum : NSUInteger {
-
(
void
)
viewDidLoad
{
[
super
viewDidLoad
];
self
.
title
=
@"行情调研"
;
self
.
view
.
backgroundColor
=
XXFBgColor
;
[
self
initData
];
[
self
createTableView
];
[
self
createTableView
];
[
self
getData
];
}
-
(
void
)
initData
{
self
.
dataArr
=
[
NSMutableArray
array
];
[
self
fetchtSurveyList
];
}
-
(
void
)
getData
{
__weak
typeof
(
self
)
weakSelf
=
self
;
void
(
^
succ
)(
id
)
=
^
(
id
data
)
{
[
IBTLoadingView
hideHUDWithText
:
nil
];
__strong
__typeof
(
weakSelf
)
strongSelf
=
weakSelf
;
[
strongSelf
fetchtSurveyList
];
[
strongSelf
fetchtSurveyList
:
data
];
};
void
(
^
fail
)(
id
)
=
^
(
id
data
)
{
[
IBTLoadingView
hideHUDWithText
:
nil
];
...
...
@@ -66,32 +73,58 @@ typedef enum : NSUInteger {
};
[
IBTLoadingView
showProgressLabel
:
@"正在加载..."
];
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
=
@{
@"billNumberLike"
:
billObject
,
@"state"
:
stateObject
,
@"titleLike"
:
titleObject
,
@"orderField"
:
[
NSNull
null
],
@"orderDirection"
:
orderObject
,
@"userUuid"
:
userUtil
.
userId
,
@"pageNumber"
:
@
(
0
),
@"pageSize"
:
@
(
20
)};
[[
ICRHTTPController
sharedController
]
querySurveyWithBillData
:
dict
success
:
succ
failure
:
fail
];
}
#pragma mark -成功
-
(
void
)
fetchtSurveyList
{
ICRDatabaseFetchBlock
fetchBlk
=
^
FMResultSet
*
(
FMDatabase
*
db
)
{
NSString
*
sql
=
[
NSString
stringWithFormat
:
@"SELECT * FROM %@ ORDER BY %@"
,
[
Survey
TableName
],
@"uuid"
];
return
[
db
executeQuery
:
sql
];
};
__weak
typeof
(
self
)
weakSelf
=
self
;
ICRDatabaseFetchResultsBlock
fetchResultsBlk
=
^
(
NSArray
*
fetchedObjects
)
{
__strong
__typeof
(
weakSelf
)
strongSelf
=
weakSelf
;
[
strongSelf
.
dataArr
removeAllObjects
];
[
strongSelf
.
dataArr
addObjectsFromArray
:
fetchedObjects
];
[
strongSelf
.
tableView
reloadData
];
};
ICRDataBaseController
*
dbCtrl
=
[
ICRDataBaseController
sharedController
];
[
dbCtrl
runFetchForClass
:[
Survey
class
]
fetchBlock
:
fetchBlk
fetchResultsBlock
:
fetchResultsBlk
];
-
(
void
)
fetchtSurveyList
:
(
id
)
data
{
if
(
data
)
{
NSInteger
success
=
[
data
[
@"success"
]
integerValue
];
NSString
*
message
=
data
[
@"message"
]
;
if
(
success
==
1
)
{
if
(
self
.
dataArr
.
count
>
0
)
{
[
self
.
dataArr
removeAllObjects
];
}
NSArray
*
recodesArr
=
data
[
@"data"
][
@"records"
];
for
(
NSDictionary
*
surveyDict
in
recodesArr
)
{
Survey
*
survey
=
[[
Survey
alloc
]
init
];
[
survey
setValuesForKeysWithDictionary
:
surveyDict
];
[
self
.
dataArr
addObject
:
survey
];
}
[
self
.
tableView
reloadData
];
}
else
{
[
IBTLoadingView
showTips
:
message
];
}
}
else
{
[
IBTLoadingView
showTips
:
@" 无记录 "
];
}
}
-
(
void
)
createTableView
{
...
...
@@ -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
.
backgroundColor
=
[
UIColor
whiteColor
];
self
.
tableView
.
delegate
=
self
;
self
.
tableView
.
dataSource
=
self
;
[
self
.
view
addSubview
:
self
.
tableView
];
...
...
@@ -119,12 +151,28 @@ typedef enum : NSUInteger {
#pragma mark - 确定
-
(
void
)
sureClick
{
//请求
[
self
getData
];
//还原数据
if
(
_sortView
)
{
[
self
hiddenSortMaskView
:
YES
];
}
if
(
_boltView
)
{
[
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
;
}
...
...
@@ -144,8 +192,8 @@ typedef enum : NSUInteger {
}
else
{
[
btn
setImage
:[
UIImage
imageNamed
:
@"select_arrow_up_text"
]
forState
:
UIControlStateNormal
];
if
(
_sortView
==
nil
)
{
_sortView
=
[[
SortMaskView
alloc
]
initWithFrame
:
CGRectMake
(
0
,
-
105
,
ScreenSize
.
width
,
105
)];
_sortView
.
dataArr
=
[[
NSMutableArray
alloc
]
initWithObjects
:
@"
默认排序"
,
@"默认排序"
,
@"默认排序"
,
nil
];
_sortView
=
[[
SortMaskView
alloc
]
initWithFrame
:
CGRectMake
(
0
,
-
105
,
ScreenSize
.
width
,
105
)
withOrderDirection
:
self
.
orderDirection
];
_sortView
.
dataArr
=
[[
NSMutableArray
alloc
]
initWithObjects
:
@"
按时间顺序"
,
@"按时间逆序"
,
nil
];
_sortView
.
delegate
=
self
;
[
_maskView
addSubview
:
_sortView
];
[
UIView
animateWithDuration
:
0
.
25
animations
:
^
{
...
...
@@ -170,10 +218,10 @@ typedef enum : NSUInteger {
}
else
{
[
btn
setImage
:[
UIImage
imageNamed
:
@"selected-filter_with_text"
]
forState
:
UIControlStateNormal
];
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
.
delegate
=
self
;
_boltView
.
dataArr
=
[[
NSMutableArray
alloc
]
initWithObjects
:
@"
默认排序1"
,
@"默认排序1"
,
@"默认排序1"
,
nil
];
_boltView
.
dataArr
=
[[
NSMutableArray
alloc
]
initWithObjects
:
@"
不限"
,
@"未提交"
,
@"已提交"
,
@"调研中"
,
nil
];
[
_maskView
addSubview
:
_boltView
];
[
UIView
animateWithDuration
:
0
.
25
animations
:
^
{
CGRect
sortFrame
=
_boltView
.
frame
;
...
...
@@ -189,6 +237,7 @@ typedef enum : NSUInteger {
}
-
(
void
)
hiddenSortMaskView
:
(
BOOL
)
isHide
{
currentBtn
=
nil
;
[
_sortBtn
setImage
:[
UIImage
imageNamed
:
@"black_arrow_down_with_text"
]
forState
:
UIControlStateNormal
];
if
(
isHide
==
NO
)
{
[
_sortView
removeFromSuperview
];
...
...
@@ -207,6 +256,7 @@ typedef enum : NSUInteger {
}
}
-
(
void
)
hiddenBoltMaskView
:
(
BOOL
)
isHide
{
currentBtn
=
nil
;
[
_boltBtn
setImage
:[
UIImage
imageNamed
:
@"black_filter_with_text"
]
forState
:
UIControlStateNormal
];
if
(
isHide
==
NO
)
{
[
_boltView
removeFromSuperview
];
...
...
@@ -226,11 +276,21 @@ typedef enum : NSUInteger {
}
#pragma mark - sortDelegate
-
(
void
)
getSortValueSelectRow
:
(
NSString
*
)
state
{
self
.
orderDirection
=
state
;
NSLog
(
@"%@"
,
state
);
}
-
(
void
)
getBoltValueSelectRow
:
(
NSString
*
)
state
{
self
.
state
=
state
;
NSLog
(
@"%@"
,
state
);
}
-
(
void
)
getTitleLike
:
(
NSString
*
)
titleLike
{
self
.
titleLike
=
titleLike
;
NSLog
(
@"%@"
,
titleLike
);
}
-
(
void
)
getBillNumber
:
(
NSString
*
)
billNumber
{
self
.
billNumberLike
=
billNumber
;
NSLog
(
@"%@"
,
billNumber
);
}
#pragma mark - 协议方法
-
(
NSInteger
)
numberOfSectionsInTableView
:
(
UITableView
*
)
tableView
{
...
...
@@ -256,13 +316,22 @@ typedef enum : NSUInteger {
}
-
(
void
)
tableView
:
(
UITableView
*
)
tableView
didSelectRowAtIndexPath
:
(
NSIndexPath
*
)
indexPath
{
Survey
DetailViewController
*
svc
=
[
SurveyDetailViewController
new
]
;
Survey
*
survey
=
nil
;
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
.
surveyUuid
=
survey
.
uuid
;
[
self
PushViewController
:
svc
animated
:
YES
];
}
[
self
PushViewController
:
svc
animated
:
YES
];
}
...
...
@@ -274,6 +343,10 @@ typedef enum : NSUInteger {
-
(
void
)
viewWillAppear
:
(
BOOL
)
animated
{
[
super
viewWillAppear
:
animated
];
}
-
(
void
)
didReceiveMemoryWarning
{
[
super
didReceiveMemoryWarning
];
}
...
...
XFFruit/ViewControllers/Survey/models/SurveyResult.h
View file @
f27c3520
...
...
@@ -18,7 +18,7 @@
@property
(
nonatomic
,
strong
)
NSString
*
place
;
//产地
@property
(
nonatomic
,
strong
)
NSString
*
capacity
;
//市场容量
@property
(
nonatomic
,
strong
)
NSString
*
quality
;
//质量情况
@property
(
nonatomic
,
strong
)
NS
Date
*
feedbackTime
;
//反馈时间
@property
(
nonatomic
,
strong
)
NS
String
*
feedbackTime
;
//反馈时间
@property
(
nonatomic
,
strong
)
NSArray
*
attachmnets
;
//附件列表
@end
XFFruit/ViewControllers/Survey/models/SurveyUser.h
View file @
f27c3520
...
...
@@ -12,5 +12,9 @@
@property
(
nonatomic
,
strong
)
NSString
*
userUuid
;
//用户UUid
@property
(
nonatomic
,
strong
)
NSString
*
userCode
;
//用户编码
@property
(
nonatomic
,
strong
)
NSString
*
userName
;
//用户名称
@property
(
nonatomic
,
strong
)
NSString
*
uuid
;
@property
(
nonatomic
,
strong
)
NSString
*
uuid
;
//唯一标识
@end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment