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
d0d59ebe
Commit
d0d59ebe
authored
9 years ago
by
AvatarC
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' of
https://git.oschina.net/gomoretech/RedstarIOS
into develop_avatar
parents
226c765e
4f6857ed
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
135 additions
and
13 deletions
+135
-13
UserInterfaceState.xcuserstate
...userdata/admin.xcuserdatad/UserInterfaceState.xcuserstate
+0
-0
AddPictureTableCell.m
...le/Function/Picture/AddPicture/Cell/AddPictureTableCell.m
+2
-2
AddPictureViewController.m
...ture/AddPicture/ViewController/AddPictureViewController.m
+122
-7
PictureViewController.m
...icture/PictureList/ViewController/PictureViewController.m
+11
-4
No files found.
redstar.xcworkspace/xcuserdata/admin.xcuserdatad/UserInterfaceState.xcuserstate
View file @
d0d59ebe
No preview for this file type
This diff is collapsed.
Click to expand it.
redstar/Classes/Module/Function/Picture/AddPicture/Cell/AddPictureTableCell.m
View file @
d0d59ebe
...
...
@@ -110,7 +110,7 @@
{
if
(
!
_contentTextView
)
{
_contentTextView
=
[[
UITextView
alloc
]
init
];
_contentTextView
.
tag
=
100
2
;
_contentTextView
.
tag
=
999
2
;
_contentTextView
.
font
=
[
UIFont
systemFontOfSize
:
15
.
0
];
_contentTextView
.
translatesAutoresizingMaskIntoConstraints
=
NO
;
[
self
.
backImageView2
addSubview
:
_contentTextView
];
...
...
@@ -185,7 +185,7 @@
{
if
(
!
_titleTextView
)
{
_titleTextView
=
[[
UITextView
alloc
]
init
];
_titleTextView
.
tag
=
100
1
;
_titleTextView
.
tag
=
999
1
;
_titleTextView
.
font
=
[
UIFont
systemFontOfSize
:
15
.
0
];
_titleTextView
.
translatesAutoresizingMaskIntoConstraints
=
NO
;
[
self
.
backImageView1
addSubview
:
_titleTextView
];
...
...
This diff is collapsed.
Click to expand it.
redstar/Classes/Module/Function/Picture/AddPicture/ViewController/AddPictureViewController.m
View file @
d0d59ebe
...
...
@@ -17,7 +17,7 @@
#define kAddPicTextTableViewCell @"addPicTextTableCell"
#define kAddButtonCell @"addButtonTableViewCell"
@interface
AddPictureViewController
()
<
UITableViewDelegate
,
UITableViewDataSource
,
UINavigationControllerDelegate
,
UIImagePickerControllerDelegate
,
UIActionSheetDelegate
>
@interface
AddPictureViewController
()
<
UITableViewDelegate
,
UITableViewDataSource
,
UINavigationControllerDelegate
,
UIImagePickerControllerDelegate
,
UIActionSheetDelegate
,
UIAlertViewDelegate
,
UITextViewDelegate
>
@property
(
nonatomic
,
strong
)
UITableView
*
tableView
;
@property
(
nonatomic
,
strong
)
NSMutableArray
*
imageNameArray
;
...
...
@@ -26,6 +26,8 @@
@property
(
nonatomic
,
strong
)
UIButton
*
reportButton
;
@property
(
nonatomic
,
strong
)
UIActionSheet
*
selectActionSheet
;
@property
(
nonatomic
,
copy
)
NSString
*
praiseUuid
;
@end
@implementation
AddPictureViewController
...
...
@@ -65,7 +67,16 @@
#pragma mark - Private Mothods
-
(
void
)
uploadInspect
:
(
UIButton
*
)
sender
{
if
(
_imageNameArray
.
count
==
0
)
{
UIAlertView
*
alert
=
[[
UIAlertView
alloc
]
initWithTitle
:
@"提示"
message
:
@"请至少添加一组图片和文字!"
delegate
:
self
cancelButtonTitle
:
nil
otherButtonTitles
:
@"确定"
,
nil
];
[
alert
show
];
return
;
}
// 提示框
UIAlertView
*
alert
=
[[
UIAlertView
alloc
]
initWithTitle
:
@"提示"
message
:
@"您确定要上报口碑吗?"
delegate
:
self
cancelButtonTitle
:
@"取消"
otherButtonTitles
:
@"确定"
,
nil
];
alert
.
tag
=
334281
;
alert
.
delegate
=
self
;
[
alert
show
];
}
-
(
void
)
doBack
:
(
id
)
sender
...
...
@@ -99,6 +110,8 @@
if
(
_rowNumber
==
2
)
{
AddPictureTableCell
*
cell
=
[
_tableView
cellForRowAtIndexPath
:[
NSIndexPath
indexPathForRow
:
0
inSection
:
0
]];
cell
.
titleTextView
.
delegate
=
self
;
cell
.
contentTextView
.
delegate
=
self
;
if
(
cell
.
titleTextView
.
text
.
length
==
0
||
cell
.
contentTextView
.
text
.
length
==
0
)
{
UIAlertView
*
alert
=
[[
UIAlertView
alloc
]
initWithTitle
:
@"提示"
message
:
@"标题、问题与建议描述不能为空!"
delegate
:
self
cancelButtonTitle
:
nil
otherButtonTitles
:
@"确定"
,
nil
];
[
alert
show
];
...
...
@@ -113,9 +126,32 @@
};
[
http1
savePicturePraiseWithParameters
:
parameters
completion
:
^
(
id
response
,
NSError
*
error
)
{
NSLog
(
@"6.1保存图说口碑 resp = %@, error = %@"
,
response
,
error
);
_praiseUuid
=
response
[
@"data"
];
}];
}
}
else
{
NSIndexPath
*
indexPath
=
[
NSIndexPath
indexPathForRow
:(
_rowNumber
-
2
)
inSection
:
0
];
AddPicTextTableViewCell
*
cell
=
[
_tableView
cellForRowAtIndexPath
:
indexPath
];
NSString
*
url
=
[
NSString
stringWithFormat
:
@"%@%@%@/submit_attachment?time=%@&operId=%@&operName=%@"
,
kRedStarURL
,
kUpLoadPictureURL
,
_praiseUuid
,
dateString
,
operId
,
operName
];
url
=
[
url
stringByAddingPercentEscapesUsingEncoding
:
NSUTF8StringEncoding
];
HttpClient
*
http1
=
[[
HttpClient
alloc
]
initWithUrl
:
url
];
NSString
*
imageName
=
_imageNameArray
[
_rowNumber
-
3
];
NSString
*
fullPath
=
[[
NSHomeDirectory
()
stringByAppendingPathComponent
:
@"Documents"
]
stringByAppendingPathComponent
:
imageName
];
UIImage
*
image
=
[
UIImage
imageWithContentsOfFile
:
fullPath
];
NSData
*
imageData
=
UIImageJPEGRepresentation
(
image
,
0
.
5
);
NSString
*
imageBase64
=
[
imageData
base64EncodedStringWithOptions
:
0
];
NSDictionary
*
parameters
=
@{
@"description"
:
cell
.
titleTextView
.
text
,
@"fileName"
:
imageName
,
@"fileContent"
:
imageBase64
};
[
http1
upLoadPraisePictureWithParameters
:
parameters
completion
:
^
(
id
response
,
NSError
*
error
)
{
NSLog
(
@"6.2上传口碑图片 resp = %@, error = %@"
,
response
,
error
);
}];
}
_rowNumber
++
;
[
self
.
tableView
reloadData
];
...
...
@@ -134,6 +170,50 @@
[
imageData
writeToFile
:
fullPath
atomically
:
NO
];
}
#pragma mark - UItextView
-
(
BOOL
)
textView
:
(
UITextView
*
)
textView
shouldChangeTextInRange
:
(
NSRange
)
range
replacementText
:
(
NSString
*
)
text
{
AddPictureTableCell
*
cell
=
[
_tableView
cellForRowAtIndexPath
:[
NSIndexPath
indexPathForRow
:
0
inSection
:
0
]];
if
(
!
[
text
isEqualToString
:
@""
])
{
if
(
textView
.
tag
==
9991
)
{
cell
.
placeholderLabel1
.
hidden
=
YES
;
}
else
{
cell
.
placeholderLabel2
.
hidden
=
YES
;
}
}
if
([
text
isEqualToString
:
@""
]
&&
range
.
location
==
0
&&
range
.
length
==
1
)
{
if
(
textView
.
tag
==
9991
)
{
cell
.
placeholderLabel1
.
hidden
=
NO
;
}
else
{
cell
.
placeholderLabel2
.
hidden
=
NO
;
}
}
if
([
text
isEqualToString
:
@"
\n
"
])
{
[
cell
.
titleTextView
resignFirstResponder
];
[
cell
.
contentTextView
resignFirstResponder
];
if
(
textView
.
tag
==
9991
)
{
if
(
textView
.
text
.
length
!=
0
)
{
cell
.
placeholderLabel1
.
hidden
=
YES
;
}
else
{
cell
.
placeholderLabel1
.
hidden
=
NO
;
}
}
else
{
if
(
textView
.
text
.
length
!=
0
)
{
cell
.
placeholderLabel2
.
hidden
=
YES
;
}
else
{
cell
.
placeholderLabel2
.
hidden
=
NO
;
}
}
return
NO
;
}
return
YES
;
}
#pragma mark - UIImagePickerController 代理方法
-
(
void
)
imagePickerController
:
(
UIImagePickerController
*
)
picker
didFinishPickingMediaWithInfo
:
(
NSDictionary
*
)
info
{
...
...
@@ -177,6 +257,33 @@
}
}
#pragma mark - UIAlertViewDelegte
-
(
void
)
alertView
:
(
UIAlertView
*
)
alertView
clickedButtonAtIndex
:
(
NSInteger
)
buttonIndex
{
if
(
alertView
.
tag
==
334281
)
{
if
(
buttonIndex
==
1
)
{
NSDate
*
date
=
[
NSDate
date
];
NSDateFormatter
*
dateFormatter
=
[[
NSDateFormatter
alloc
]
init
];
[
dateFormatter
setDateFormat
:
@"YYYY-MM-dd+hh:mm:ss"
];
NSString
*
dateString
=
[
dateFormatter
stringFromDate
:
date
];
NSString
*
operId
=
[[
NSUserDefaults
standardUserDefaults
]
objectForKey
:
@"user_code"
];
NSString
*
operName
=
[[
NSUserDefaults
standardUserDefaults
]
objectForKey
:
@"user_name"
];
NSString
*
url
=
[
NSString
stringWithFormat
:
@"%@%@%@/submit?time=%@&operId=%@&operName=%@"
,
kRedStarURL
,
kSubmitPicturePraiseURL
,
_praiseUuid
,
dateString
,
operId
,
operName
];
url
=
[
url
stringByAddingPercentEscapesUsingEncoding
:
NSUTF8StringEncoding
];
HttpClient
*
http1
=
[[
HttpClient
alloc
]
initWithUrl
:
url
];
[
http1
submitPicturePraiseWithCompletion
:
^
(
id
response
,
NSError
*
error
)
{
NSLog
(
@"6.3接口上传口碑图片 res = %@, error = %@"
,
response
,
error
);
if
(
response
[
@"success"
])
{
[
self
.
navigationController
popViewControllerAnimated
:
YES
];
}
}];
}
}
}
#pragma mark - UITableView Delegate/DataSource
-
(
NSInteger
)
tableView
:
(
UITableView
*
)
tableView
numberOfRowsInSection
:
(
NSInteger
)
section
...
...
@@ -191,6 +298,8 @@
if
(
!
cell
)
{
cell
=
[[
AddPictureTableCell
alloc
]
initWithStyle
:
UITableViewCellStyleValue1
reuseIdentifier
:
kAddPicTableViewCell
];
}
cell
.
titleTextView
.
delegate
=
self
;
cell
.
contentTextView
.
delegate
=
self
;
cell
.
selectionStyle
=
UITableViewCellSelectionStyleNone
;
return
cell
;
}
else
if
(
indexPath
.
row
==
_rowNumber
-
1
)
{
...
...
@@ -207,18 +316,24 @@
cell
=
[[
AddPicTextTableViewCell
alloc
]
initWithStyle
:
UITableViewCellStyleValue1
reuseIdentifier
:
kAddPicTextTableViewCell
];
}
if
(
_imageNameArray
.
count
!=
0
)
{
if
(
_rowNumber
-
2
==
_imageNameArray
.
count
)
{
NSString
*
imageName
=
_imageNameArray
[
indexPath
.
row
-
1
];
NSString
*
fullPath
=
[[
NSHomeDirectory
()
stringByAppendingPathComponent
:
@"Documents"
]
stringByAppendingPathComponent
:
imageName
];
UIImage
*
image
=
[
UIImage
imageWithContentsOfFile
:
fullPath
];
UIImage
*
image00
=
[
self
cutImage
:
image
];
[
cell
.
photoButton
setImage
:
image00
forState
:
UIControlStateNormal
];
}
else
{
if
(
indexPath
.
row
==
_rowNumber
-
2
)
{
[
cell
.
photoButton
setImage
:[
UIImage
imageNamed
:
@"add-photo_icon"
]
forState
:
UIControlStateNormal
];
}
else
{
NSString
*
imageName
=
_imageNameArray
[
indexPath
.
row
-
1
];
NSString
*
fullPath
=
[[
NSHomeDirectory
()
stringByAppendingPathComponent
:
@"Documents"
]
stringByAppendingPathComponent
:
imageName
];
UIImage
*
image
=
[
UIImage
imageWithContentsOfFile
:
fullPath
];
UIImage
*
image00
=
[
self
cutImage
:
image
];
[
cell
.
photoButton
setImage
:
image00
forState
:
UIControlStateNormal
];
}
}
cell
.
titleTextView
.
delegate
=
self
;
[
cell
.
photoButton
addTarget
:
self
action
:
@selector
(
createImagePicker
:
)
forControlEvents
:
UIControlEventTouchUpInside
];
return
cell
;
}
...
...
This diff is collapsed.
Click to expand it.
redstar/Classes/Module/Function/Picture/PictureList/ViewController/PictureViewController.m
View file @
d0d59ebe
...
...
@@ -128,7 +128,7 @@
NSString
*
user_uuid
=
[[
NSUserDefaults
standardUserDefaults
]
objectForKey
:
@"user_uuid"
];
NSDictionary
*
parameters
=
@{
@"user"
:
user_uuid
,
@"scope"
:
@"all"
,
//
@"scope":@"all",
@"pageNumber"
:
@
(
0
),
@"pageSize"
:
@
(
10
)
};
...
...
@@ -176,7 +176,6 @@
NSString
*
user_uuid
=
[[
NSUserDefaults
standardUserDefaults
]
objectForKey
:
@"user_uuid"
];
NSDictionary
*
parameters
=
@{
@"user"
:
user_uuid
,
@"scope"
:
@"all"
,
@"pageNumber"
:
@
(
_page
),
@"pageSize"
:
@
(
10
)
};
...
...
@@ -186,9 +185,17 @@
// 请求问题列表
[
httpClient
queryPicturePraiseWithParameters
:
parameters
completion
:
^
(
id
response
,
NSError
*
error
)
{
NSLog
(
@"加载更多的 托说口碑 = %@"
,
response
);
NSDictionary
*
dataDict
=
response
[
@"data"
];
NSArray
*
dataArray
=
dataDict
[
@"records"
];
NSMutableArray
*
tempArray
=
[
NSMutableArray
array
];
for
(
NSDictionary
*
dict
in
dataArray
)
{
PictureListModel
*
picList
=
[[
PictureListModel
alloc
]
init
];
[
picList
setValuesForKeysWithDictionary
:
dict
];
[
tempArray
addObject
:
picList
];
}
[
_allPraiseListArray
addObjectsFromArray
:
tempArray
];
if
(
tempArray
.
count
<
10
)
{
[
self
.
tableView
.
footer
noticeNoMoreData
];
}
else
{
...
...
This diff is collapsed.
Click to expand it.
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