Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
红
红星美凯龙管理在线APP IOS
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
张杰
红星美凯龙管理在线APP IOS
Commits
1cc64c97
Commit
1cc64c97
authored
Nov 22, 2015
by
admin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
上传新问题接口完成
parent
9ca5e7e9
Show whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
269 additions
and
43 deletions
+269
-43
project.pbxproj
redstar.xcodeproj/project.pbxproj
+14
-0
UserInterfaceState.xcuserstate
...userdata/admin.xcuserdatad/UserInterfaceState.xcuserstate
+0
-0
AppDelegate.m
redstar/Classes/AppDelegate/AppDelegate.m
+1
-1
Url.h
redstar/Classes/Macro/Url.h
+4
-0
AddQuestionFooterView.m
...unction/Question/AddQuestion/View/AddQuestionFooterView.m
+1
-2
AddQuestionViewController.h
...on/AddQuestion/ViewController/AddQuestionViewController.h
+0
-1
AddQuestionViewController.m
...on/AddQuestion/ViewController/AddQuestionViewController.m
+109
-9
QuestionDetailViewController.m
...stionDetail/ViewController/QuestionDetailViewController.m
+35
-18
QuestionViewController.m
...tion/QuestionList/ViewController/QuestionViewController.m
+3
-2
TakePhotoView.h
...on/WordOfMouth/Inspect/InspectDetail/View/TakePhotoView.h
+1
-1
TakePhotoView.m
...on/WordOfMouth/Inspect/InspectDetail/View/TakePhotoView.m
+6
-6
InspectSettleViewController.m
...nspectDetail/ViewController/InspectSettleViewController.m
+3
-1
CommonFunc.h
redstar/Classes/Tools/CommonFunc/CommonFunc.h
+2
-2
CommonFunc.m
redstar/Classes/Tools/CommonFunc/CommonFunc.m
+13
-0
HttpClient.h
redstar/Classes/Tools/HttpClient/HttpClient.h
+3
-0
HttpClient.m
redstar/Classes/Tools/HttpClient/HttpClient.m
+10
-0
RedStarTools.h
redstar/Classes/Tools/RedStarTools/RedStarTools.h
+19
-0
RedStarTools.m
redstar/Classes/Tools/RedStarTools/RedStarTools.m
+45
-0
No files found.
redstar.xcodeproj/project.pbxproj
View file @
1cc64c97
...
...
@@ -79,6 +79,7 @@
84E420471BE88AE000689976
/* RootTabBarController.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
84E420461BE88AE000689976
/* RootTabBarController.m */
;
};
84ECCF181C01FA2600EA4960
/* QuestionDetailModel.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
84ECCF171C01FA2600EA4960
/* QuestionDetailModel.m */
;
};
84ECCF1B1C0210F000EA4960
/* CommentModel.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
84ECCF1A1C0210F000EA4960
/* CommentModel.m */
;
};
84ECCF1F1C021E7F00EA4960
/* RedStarTools.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
84ECCF1E1C021E7F00EA4960
/* RedStarTools.m */
;
};
84ED5DD81BF2E64300A1BB6D
/* ScreenView.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
84ED5DD71BF2E64300A1BB6D
/* ScreenView.m */
;
};
84F1669B1BE715E40061D350
/* ZanButton.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
84F1669A1BE715E40061D350
/* ZanButton.m */
;
};
84F30DA41BFC19F200CBAD13
/* RankListModel.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
84F30DA31BFC19F200CBAD13
/* RankListModel.m */
;
};
...
...
@@ -257,6 +258,8 @@
84ECCF171C01FA2600EA4960
/* QuestionDetailModel.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
QuestionDetailModel.m
;
sourceTree
=
"<group>"
;
};
84ECCF191C0210F000EA4960
/* CommentModel.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
CommentModel.h
;
sourceTree
=
"<group>"
;
};
84ECCF1A1C0210F000EA4960
/* CommentModel.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
CommentModel.m
;
sourceTree
=
"<group>"
;
};
84ECCF1D1C021E7F00EA4960
/* RedStarTools.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
RedStarTools.h
;
sourceTree
=
"<group>"
;
};
84ECCF1E1C021E7F00EA4960
/* RedStarTools.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
RedStarTools.m
;
sourceTree
=
"<group>"
;
};
84ED5DD61BF2E64300A1BB6D
/* ScreenView.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
ScreenView.h
;
sourceTree
=
"<group>"
;
};
84ED5DD71BF2E64300A1BB6D
/* ScreenView.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
ScreenView.m
;
sourceTree
=
"<group>"
;
};
84F166991BE715E40061D350
/* ZanButton.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
ZanButton.h
;
sourceTree
=
"<group>"
;
};
...
...
@@ -925,6 +928,7 @@
84970E261BD8DEFE00C1728A
/* Tools */
=
{
isa
=
PBXGroup
;
children
=
(
84ECCF1C1C021E6A00EA4960
/* RedStarTools */
,
8490C4C01BF9A394006B6569
/* PageControl */
,
8419EAD11BEDC976002635ED
/* HttpClient */
,
8419EABB1BEDA8F9002635ED
/* Menu */
,
...
...
@@ -1161,6 +1165,15 @@
path
=
Model
;
sourceTree
=
"<group>"
;
};
84ECCF1C1C021E6A00EA4960
/* RedStarTools */
=
{
isa
=
PBXGroup
;
children
=
(
84ECCF1D1C021E7F00EA4960
/* RedStarTools.h */
,
84ECCF1E1C021E7F00EA4960
/* RedStarTools.m */
,
);
path
=
RedStarTools
;
sourceTree
=
"<group>"
;
};
84F166981BE715D20061D350
/* ZanButton */
=
{
isa
=
PBXGroup
;
children
=
(
...
...
@@ -1564,6 +1577,7 @@
84970E391BD8E0B300C1728A
/* LoginView.m in Sources */
,
84DB9BC41BDCD4B600822CC4
/* CustomDropMenuView.m in Sources */
,
84CF0ED81BE9AC7E00C855CE
/* InspectSettleViewController.m in Sources */
,
84ECCF1F1C021E7F00EA4960
/* RedStarTools.m in Sources */
,
84ECCF181C01FA2600EA4960
/* QuestionDetailModel.m in Sources */
,
84846E9A1BE07CDF0010550A
/* RankingListCell.m in Sources */
,
848699B61BDF812F00859DFE
/* RankingListViewController.m in Sources */
,
...
...
redstar.xcworkspace/xcuserdata/admin.xcuserdatad/UserInterfaceState.xcuserstate
View file @
1cc64c97
No preview for this file type
redstar/Classes/AppDelegate/AppDelegate.m
View file @
1cc64c97
...
...
@@ -9,7 +9,6 @@
#import "AppDelegate.h"
#import "LoginViewController.h"
#import "RootTabBarController.h"
@interface
AppDelegate
()
@end
...
...
@@ -27,6 +26,7 @@
LoginViewController
*
loginVC
=
[[
LoginViewController
alloc
]
init
];
self
.
window
.
rootViewController
=
loginVC
;
return
YES
;
}
...
...
redstar/Classes/Macro/Url.h
View file @
1cc64c97
...
...
@@ -42,4 +42,8 @@
// 取消点赞
#define kCancelLikeURL @"redstar-server/rest/question/cancel_like/"
// 上传新问题
#define kUpLoadQuestionURL @"redstar-server/rest/question/submit"
#endif
/* Url_h */
redstar/Classes/Module/Function/Question/AddQuestion/View/AddQuestionFooterView.m
View file @
1cc64c97
...
...
@@ -76,8 +76,6 @@
}
#pragma mark - UITextView Delegate
-
(
BOOL
)
textView
:
(
UITextView
*
)
textView
shouldChangeTextInRange
:
(
NSRange
)
range
replacementText
:
(
NSString
*
)
text
{
if
(
!
[
text
isEqualToString
:
@""
])
{
_placeholderLabel1
.
hidden
=
YES
;
...
...
@@ -93,6 +91,7 @@
}
#pragma mark - lazy loading
-
(
UIImageView
*
)
backImageView1
{
if
(
!
_backImageView1
)
{
...
...
redstar/Classes/Module/Function/Question/AddQuestion/ViewController/AddQuestionViewController.h
View file @
1cc64c97
...
...
@@ -9,5 +9,4 @@
#import <UIKit/UIKit.h>
@interface
AddQuestionViewController
:
UIViewController
@end
redstar/Classes/Module/Function/Question/AddQuestion/ViewController/AddQuestionViewController.m
View file @
1cc64c97
...
...
@@ -12,6 +12,11 @@
#import "AddQuestionFooterView.h"
#import "CheckPicViewController.h"
#import "CommonFunc.h"
#import "HttpClient.h"
#import "RedStarTools.h"
#import <MBProgressHUD.h>
#define kAddQuestionCell @"addQuestionTableViewCell"
@interface
AddQuestionViewController
()
<
UITableViewDelegate
,
UITableViewDataSource
,
TakePhotoViewDelegate
,
UINavigationControllerDelegate
,
UIImagePickerControllerDelegate
>
...
...
@@ -20,10 +25,15 @@
@property
(
nonatomic
,
strong
)
AddQuestionFooterView
*
footerView
;
@property
(
nonatomic
,
strong
)
NSArray
*
titleArray
;
@property
(
nonatomic
,
strong
)
NSString
*
imageMD5
;
@end
@implementation
AddQuestionViewController
-
(
void
)
viewDidLoad
{
[
super
viewDidLoad
];
...
...
@@ -52,6 +62,7 @@
// takePhoto代理
self
.
footerView
.
takePhotoView
.
delegate
=
self
;
[
self
.
footerView
.
reportBtn
addTarget
:
self
action
:
@selector
(
upLoadQuestionPic
:
)
forControlEvents
:
UIControlEventTouchUpInside
];
}
-
(
void
)
didReceiveMemoryWarning
{
...
...
@@ -61,9 +72,75 @@
#pragma mark - Private Methods
-
(
void
)
upLoadQuestionPic
:
(
UIButton
*
)
sender
{
[[
RedStarTools
sharedInstance
]
loadLocalData
];
NSMutableArray
*
localData
=
[
RedStarTools
sharedInstance
].
localDatas
;
NSDictionary
*
parameters
;
if
(
localData
.
count
==
0
)
{
parameters
=
@{
@"category"
:
@"环境物业"
,
@"group"
:
@"基础环境"
,
@"title"
:
@"测试数据"
,
@"content"
:
self
.
footerView
.
titleTextView
.
text
};
}
else
{
NSMutableArray
*
imageArray
=
[
NSMutableArray
array
];
for
(
int
i
=
0
;
i
<
localData
.
count
;
i
++
)
{
NSString
*
imageName
=
[
NSString
stringWithFormat
:
@"%@"
,
localData
[
i
]];
NSString
*
fullPath
=
[[
NSHomeDirectory
()
stringByAppendingPathComponent
:
@"Documents"
]
stringByAppendingPathComponent
:
imageName
];
UIImage
*
image
=
[
UIImage
imageWithContentsOfFile
:
fullPath
];
NSData
*
imageData
=
UIImageJPEGRepresentation
(
image
,
0
.
5
);
NSString
*
imageBase64
=
[
imageData
base64EncodedStringWithOptions
:
0
];
NSMutableDictionary
*
dict
=
[
NSMutableDictionary
dictionary
];
[
dict
setObject
:
imageBase64
forKey
:
@"fileContent"
];
[
dict
setObject
:
imageName
forKey
:
@"fileName"
];
[
dict
setObject
:
@
(
i
)
forKey
:
@"index"
];
[
imageArray
addObject
:
dict
];
}
parameters
=
@{
@"category"
:
@"环境物业"
,
@"group"
:
@"基础环境"
,
@"title"
:
@"测试数据"
,
@"content"
:
self
.
footerView
.
titleTextView
.
text
,
@"attachments"
:
imageArray
};
}
NSDate
*
date
=
[
NSDate
date
];
NSTimeZone
*
zone
=
[
NSTimeZone
systemTimeZone
];
NSInteger
interval
=
[
zone
secondsFromGMTForDate
:
date
];
NSDate
*
localeDate
=
[
date
dateByAddingTimeInterval
:
interval
];
NSDateFormatter
*
dateFormatter
=
[[
NSDateFormatter
alloc
]
init
];
[
dateFormatter
setDateFormat
:
@"YYYY-MM-dd+hh:mm:ss"
];
NSString
*
dateString
=
[
dateFormatter
stringFromDate
:
localeDate
];
NSString
*
operId
=
[[
NSUserDefaults
standardUserDefaults
]
objectForKey
:
@"user_code"
];
NSString
*
operName
=
[[
NSUserDefaults
standardUserDefaults
]
objectForKey
:
@"user_name"
];
NSString
*
url
=
[
NSString
stringWithFormat
:
@"%@%@?time=%@&operId=%@&operName=%@"
,
kRedStarURL
,
kUpLoadQuestionURL
,
dateString
,
operId
,
operName
];
url
=
[
url
stringByAddingPercentEscapesUsingEncoding
:
NSUTF8StringEncoding
];
HttpClient
*
client
=
[[
HttpClient
alloc
]
initWithUrl
:
url
];
[
MBProgressHUD
showHUDAddedTo
:
self
.
view
animated
:
YES
];
[
client
uploadNewQuestionWithParameters
:
parameters
completion
:
^
(
id
response
,
NSError
*
error
)
{
NSLog
(
@"上传 response= %@, error = %@"
,
response
,
error
);
if
(
response
[
@"success"
])
{
[
RedStarTools
sharedInstance
].
localDatas
=
[
NSMutableArray
array
];
[[
RedStarTools
sharedInstance
]
saveLocalData
];
[
MBProgressHUD
hideHUDForView
:
self
.
view
animated
:
YES
];
}
}];
}
// 返回上一页面
-
(
void
)
doBack
:
(
UIBarButtonItem
*
)
sender
{
[
RedStarTools
sharedInstance
].
localDatas
=
[
NSMutableArray
array
];
[[
RedStarTools
sharedInstance
]
saveLocalData
];
[
self
.
navigationController
popViewControllerAnimated
:
YES
];
}
...
...
@@ -100,13 +177,17 @@
-
(
void
)
createImagePicker
{
// 创建相册
UIImagePickerController
*
pc
=
[[
UIImagePickerController
alloc
]
init
];
pc
.
allowsEditing
=
YES
;
pc
.
delegate
=
self
;
// 推出
[
self
presentViewController
:
pc
animated
:
YES
completion
:
nil
];
if
(
!
[
UIImagePickerController
isSourceTypeAvailable
:
UIImagePickerControllerSourceTypeCamera
])
{
UIAlertView
*
alert
=
[[
UIAlertView
alloc
]
initWithTitle
:
nil
message
:
@"Unable to find the camera"
delegate
:
nil
cancelButtonTitle
:
nil
otherButtonTitles
:
@"OK"
,
nil
];
[
alert
show
];
}
else
{
UIImagePickerController
*
picker
=
[[
UIImagePickerController
alloc
]
init
];
picker
.
delegate
=
self
;
picker
.
sourceType
=
UIImagePickerControllerSourceTypeCamera
;
picker
.
modalTransitionStyle
=
UIModalTransitionStyleFlipHorizontal
;
picker
.
videoQuality
=
UIImagePickerControllerQualityTypeLow
;
[
self
presentViewController
:
picker
animated
:
YES
completion
:
nil
];
}
}
-
(
void
)
takePhotoShowPicture
:
(
UIButton
*
)
btn
...
...
@@ -116,13 +197,32 @@
[
self
.
navigationController
pushViewController
:
checkVC
animated
:
YES
];
}
// 保存图片至沙盒
-
(
void
)
saveImage
:
(
UIButton
*
)
button
{
UIImage
*
currentImage
=
button
.
imageView
.
image
;
NSData
*
imageData
=
UIImageJPEGRepresentation
(
currentImage
,
0
.
5
);
self
.
imageMD5
=
[
CommonFunc
md5Data
:
imageData
];
// 获取沙盒目录
NSString
*
fullPath
=
[[
NSHomeDirectory
()
stringByAppendingPathComponent
:
@"Documents"
]
stringByAppendingPathComponent
:
_imageMD5
];
[[
RedStarTools
sharedInstance
].
localDatas
addObject
:
_imageMD5
];
[[
RedStarTools
sharedInstance
]
saveLocalData
];
// 将图片写入文件
[
imageData
writeToFile
:
fullPath
atomically
:
NO
];
}
#pragma mark - UIImagePickerController 代理方法
-
(
void
)
imagePickerController
:
(
UIImagePickerController
*
)
picker
didFinishPickingMediaWithInfo
:
(
NSDictionary
*
)
info
{
UIImage
*
image
=
[
info
objectForKey
:
UIImagePickerController
Edited
Image
];
UIImage
*
image
=
[
info
objectForKey
:
UIImagePickerController
Original
Image
];
// 创建一个新的控件
UIButton
*
newButton
=
[
self
.
footerView
.
takePhotoView
createButtonWithImage
:
image
selector
:
@selector
(
takePhotoShowPicture
:
)];
UIButton
*
newButton
=
[
self
.
footerView
.
takePhotoView
createButtonWithImage
:
image
];
[
newButton
addTarget
:
self
action
:
@selector
(
takePhotoShowPicture
:
)
forControlEvents
:
UIControlEventTouchUpInside
];
// 保存图片至沙盒
[
self
saveImage
:
newButton
];
[
self
.
footerView
.
takePhotoView
insertSubview
:
newButton
atIndex
:
self
.
footerView
.
takePhotoView
.
subviews
.
count
-
1
];
[
self
.
footerView
.
takePhotoView
.
allImages
addObject
:
image
];
...
...
redstar/Classes/Module/Function/Question/QuestionDetail/ViewController/QuestionDetailViewController.m
View file @
1cc64c97
...
...
@@ -225,10 +225,11 @@
NSString
*
dateString
=
[
dateFormatter
stringFromDate
:
localeDate
];
NSDictionary
*
dict
=
[[
NSUserDefaults
standardUserDefaults
]
objectForKey
:
@"loginData"
];
NSString
*
operId
=
dict
[
@"user_code"
];
NSString
*
operName
=
dict
[
@"user_name"
];
NSString
*
operId
=
[[
NSUserDefaults
standardUserDefaults
]
objectForKey
:
@"user_code"
];
NSString
*
operName
=
[[
NSUserDefaults
standardUserDefaults
]
objectForKey
:
@"user_name"
];
if
(
sender
.
selected
)
{
// 点赞
NSString
*
url
=
[
NSString
stringWithFormat
:
@"%@%@%@?time=%@&operId=%@&operName=%@"
,
kRedStarURL
,
kAddLikeURL
,
_questionUuid
,
dateString
,
operId
,
operName
];
url
=
[
url
stringByAddingPercentEscapesUsingEncoding
:
NSUTF8StringEncoding
];
...
...
@@ -242,11 +243,27 @@
[
alert
show
];
}
}];
}
else
{
// 取消点赞
NSString
*
url
=
[
NSString
stringWithFormat
:
@"%@%@%@?time=%@&operId=%@&operName=%@"
,
kRedStarURL
,
kCancelLikeURL
,
_questionUuid
,
dateString
,
operId
,
operName
];
url
=
[
url
stringByAddingPercentEscapesUsingEncoding
:
NSUTF8StringEncoding
];
HttpClient
*
httpClient
=
[[
HttpClient
alloc
]
initWithUrl
:
url
];
[
httpClient
likeCountWithParameters
:
nil
completion
:
^
(
id
response
,
NSError
*
error
)
{
NSLog
(
@"取消点赞response = %@"
,
response
);
if
(
response
[
@"success"
])
{
int
likeCount
=
[
sender
.
titleLabel
.
text
intValue
];
[
sender
setTitle
:[
NSString
stringWithFormat
:
@"%d"
,
likeCount
-
1
]
forState
:
UIControlStateNormal
];
}
else
{
UIAlertView
*
alert
=
[[
UIAlertView
alloc
]
initWithTitle
:
@"警告"
message
:
@"取消点赞失败!"
delegate
:
self
cancelButtonTitle
:
@"确定"
otherButtonTitles
:
nil
,
nil
];
[
alert
show
];
}
}];
}
}
#pragma mark - UITableView Delegate/DataSource
-
(
NSInteger
)
numberOfSectionsInTableView
:
(
UITableView
*
)
tableView
{
...
...
redstar/Classes/Module/Function/Question/QuestionList/ViewController/QuestionViewController.m
View file @
1cc64c97
...
...
@@ -21,6 +21,7 @@
#import "NoDataView.h"
#import <MBProgressHUD.h>
#import "RedStarTools.h"
#define kQuestionListCell @"questionListTableViewCell"
#define kThumbTag 745645
...
...
@@ -148,7 +149,7 @@
UIButton
*
rightButton
=
[[
UIButton
alloc
]
initWithFrame
:
CGRectMake
(
0
,
0
,
60
,
20
)];
[
rightButton
setTitle
:
@"新增问题"
forState
:
UIControlStateNormal
];
[
rightButton
addTarget
:
self
action
:
@selector
(
addClick
:
)
forControlEvents
:
UIControlEventTouchUpInside
];
[
rightButton
addTarget
:
self
action
:
@selector
(
add
Question
Click
:
)
forControlEvents
:
UIControlEventTouchUpInside
];
[
rightButton
setTitleColor
:[
UIColor
whiteColor
]
forState
:
UIControlStateNormal
];
rightButton
.
titleLabel
.
font
=
[
UIFont
systemFontOfSize
:
15
];
UIBarButtonItem
*
rightButtonItem
=
[[
UIBarButtonItem
alloc
]
initWithCustomView
:
rightButton
];
...
...
@@ -221,7 +222,7 @@
}
}
-
(
void
)
addClick
:
(
UIButton
*
)
sender
-
(
void
)
add
Question
Click
:
(
UIButton
*
)
sender
{
AddQuestionViewController
*
addQuestionVC
=
[[
AddQuestionViewController
alloc
]
init
];
[
self
.
navigationController
pushViewController
:
addQuestionVC
animated
:
YES
];
...
...
redstar/Classes/Module/Function/WordOfMouth/Inspect/InspectDetail/View/TakePhotoView.h
View file @
1cc64c97
...
...
@@ -21,5 +21,5 @@
@property
(
nonatomic
,
strong
)
UIViewController
*
viewController
;
@property
(
nonatomic
,
assign
)
id
<
TakePhotoViewDelegate
>
delegate
;
-
(
UIButton
*
)
createButtonWithImage
:(
UIImage
*
)
image
selector
:(
SEL
)
selector
;
-
(
UIButton
*
)
createButtonWithImage
:(
UIImage
*
)
image
;
@end
redstar/Classes/Module/Function/WordOfMouth/Inspect/InspectDetail/View/TakePhotoView.m
View file @
1cc64c97
...
...
@@ -7,7 +7,7 @@
//
#import "TakePhotoView.h"
#import "CheckPicViewController.h"
#define kScreenWidth [UIScreen mainScreen].bounds.size.width
#define imageH 110 // 图片高度
...
...
@@ -31,24 +31,23 @@
self
=
[
super
initWithFrame
:
frame
];
if
(
self
)
{
UIImage
*
image
=
[
UIImage
imageNamed
:
kAddImage
];
UIButton
*
btn
=
[
self
createButtonWithImage
:
image
selector
:
@selector
(
addNewButton
:
)
];
UIButton
*
btn
=
[
self
createButtonWithImage
:
image
];
btn
.
backgroundColor
=
[
UIColor
lightGrayColor
];
[
btn
addTarget
:
self
action
:
@selector
(
addNewButton
:
)
forControlEvents
:
UIControlEventTouchUpInside
];
[
btn
setTitleColor
:
kLightGray
forState
:
UIControlStateNormal
];
[
self
addSubview
:
btn
];
// 初始化数组
self
.
allImages
=
[
NSMutableArray
array
];
}
return
self
;
}
-
(
UIButton
*
)
createButtonWithImage
:(
UIImage
*
)
image
selector
:(
SEL
)
selector
-
(
UIButton
*
)
createButtonWithImage
:(
UIImage
*
)
image
{
UIButton
*
addBtn
=
[
UIButton
buttonWithType
:
UIButtonTypeCustom
];
[
addBtn
setImage
:
image
forState
:
UIControlStateNormal
];
addBtn
.
tag
=
self
.
subviews
.
count
;
[
addBtn
addTarget
:
self
action
:
selector
forControlEvents
:
UIControlEventTouchUpInside
];
// 添加长按手势,用作删除. 加号按钮不添加
if
(
addBtn
.
tag
!=
0
)
{
UILongPressGestureRecognizer
*
gester
=
[[
UILongPressGestureRecognizer
alloc
]
initWithTarget
:
self
action
:
@selector
(
longPress
:
)];
...
...
@@ -57,6 +56,7 @@
return
addBtn
;
}
// 添加显示Image的按钮
-
(
void
)
addNewButton
:(
UIButton
*
)
button
{
...
...
redstar/Classes/Module/Function/WordOfMouth/Inspect/InspectDetail/ViewController/InspectSettleViewController.m
View file @
1cc64c97
...
...
@@ -96,7 +96,9 @@
UIImage
*
image
=
[
info
objectForKey
:
UIImagePickerControllerEditedImage
];
// 创建一个新的控件
UIButton
*
newButton
=
[
self
.
footerView
.
takePhotoView
createButtonWithImage
:
image
selector
:
@selector
(
takePhotoShowPicture
:
)];
UIButton
*
newButton
=
[
self
.
footerView
.
takePhotoView
createButtonWithImage
:
image
];
[
newButton
addTarget
:
self
action
:
@selector
(
takePhotoShowPicture
:
)
forControlEvents
:
UIControlEventTouchUpInside
];
[
self
.
footerView
.
takePhotoView
insertSubview
:
newButton
atIndex
:
self
.
footerView
.
takePhotoView
.
subviews
.
count
-
1
];
[
self
.
footerView
.
takePhotoView
.
allImages
addObject
:
image
];
...
...
redstar/Classes/Tools/CommonFunc/CommonFunc.h
View file @
1cc64c97
...
...
@@ -14,6 +14,7 @@
#define __TEXT( base64 ) [CommonFunc textFromBase64String:base64]
@interface
CommonFunc
:
NSObject
/******************************************************************************
函数名称 : + (NSString *)base64StringFromText:(NSString *)text
函数描述 : 将文本转换为base64格式字符串
...
...
@@ -36,6 +37,5 @@
+
(
NSString
*
)
md5
:(
NSString
*
)
str
;
+
(
NSString
*
)
md5Data
:(
NSData
*
)
data
;
@end
redstar/Classes/Tools/CommonFunc/CommonFunc.m
View file @
1cc64c97
...
...
@@ -251,4 +251,17 @@ static const char encodingTable[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopq
return
[
hash
lowercaseString
];
}
+
(
NSString
*
)
md5Data
:
(
NSData
*
)
data
{
const
char
*
cStr
=
[
data
bytes
];
unsigned
char
result
[
16
];
CC_MD5
(
cStr
,
(
CC_LONG
)
data
.
length
,
result
);
return
[
NSString
stringWithFormat
:
@"%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X"
,
result
[
0
],
result
[
1
],
result
[
2
],
result
[
3
],
result
[
4
],
result
[
5
],
result
[
6
],
result
[
7
],
result
[
8
],
result
[
9
],
result
[
10
],
result
[
11
],
result
[
12
],
result
[
13
],
result
[
14
],
result
[
15
]
];
}
@end
redstar/Classes/Tools/HttpClient/HttpClient.h
View file @
1cc64c97
...
...
@@ -46,4 +46,7 @@ typedef void (^completionBlock) (id response, NSError *error);
// 取消点赞
-
(
void
)
cancelLikeCountWithParameters
:(
id
)
parameters
completion
:(
completionBlock
)
completion
;
// 上传新问题
-
(
void
)
uploadNewQuestionWithParameters
:(
id
)
parameters
completion
:(
completionBlock
)
completion
;
@end
redstar/Classes/Tools/HttpClient/HttpClient.m
View file @
1cc64c97
...
...
@@ -183,4 +183,14 @@
}];
}
// 上传新问题
-
(
void
)
uploadNewQuestionWithParameters
:
(
id
)
parameters
completion
:
(
completionBlock
)
completion
{
[
self
postParameters
:
parameters
completion
:
^
(
id
response
,
NSError
*
error
)
{
if
(
completion
)
{
completion
(
response
,
error
);
}
}];
}
@end
redstar/Classes/Tools/RedStarTools/RedStarTools.h
0 → 100644
View file @
1cc64c97
//
// RedStarTools.h
// redstar
//
// Created by admin on 15/11/23.
// Copyright © 2015年 ZWF. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface
RedStarTools
:
NSObject
@property
(
nonatomic
,
strong
)
NSMutableArray
*
localDatas
;
+
(
RedStarTools
*
)
sharedInstance
;
-
(
void
)
saveLocalData
;
-
(
void
)
loadLocalData
;
@end
redstar/Classes/Tools/RedStarTools/RedStarTools.m
0 → 100644
View file @
1cc64c97
//
// RedStarTools.m
// redstar
//
// Created by admin on 15/11/23.
// Copyright © 2015年 ZWF. All rights reserved.
//
#import "RedStarTools.h"
@implementation
RedStarTools
static
RedStarTools
*
redStarToolsData
=
nil
;
+
(
RedStarTools
*
)
sharedInstance
{
@synchronized
(
self
)
{
if
(
!
redStarToolsData
)
redStarToolsData
=
[[
self
alloc
]
init
];
return
redStarToolsData
;
}
}
-
(
void
)
loadLocalData
{
NSArray
*
paths
=
NSSearchPathForDirectoriesInDomains
(
NSDocumentDirectory
,
NSUserDomainMask
,
YES
);
NSString
*
path
=
[
paths
objectAtIndex
:
0
];
NSString
*
filename
=
[
path
stringByAppendingPathComponent
:
@"local.plist"
];
self
.
localDatas
=
[[
NSMutableArray
alloc
]
initWithContentsOfFile
:
filename
];
if
(
!
self
.
localDatas
)
{
self
.
localDatas
=
[
NSMutableArray
array
];
}
}
-
(
void
)
saveLocalData
{
NSArray
*
paths
=
NSSearchPathForDirectoriesInDomains
(
NSDocumentDirectory
,
NSUserDomainMask
,
YES
);
NSString
*
path
=
[
paths
objectAtIndex
:
0
];
NSString
*
filename
=
[
path
stringByAppendingPathComponent
:
@"local.plist"
];
[
_localDatas
writeToFile
:
filename
atomically
:
YES
];
}
@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