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
5e2b2364
Commit
5e2b2364
authored
9 years ago
by
admin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
口碑标准 附件功能完成
parent
b3e1d946
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
658 additions
and
254 deletions
+658
-254
project.pbxproj
redstar.xcodeproj/project.pbxproj
+6
-0
UserInterfaceState.xcuserstate
...userdata/admin.xcuserdatad/UserInterfaceState.xcuserstate
+0
-0
AttachmentTableViewCell.m
...le/Announce/AnnounceDetail/Cell/AttachmentTableViewCell.m
+12
-8
AttachmentModel.h
...es/Module/Announce/AnnounceDetail/Model/AttachmentModel.h
+14
-0
AttachmentModel.m
...es/Module/Announce/AnnounceDetail/Model/AttachmentModel.m
+13
-0
AnnoDetailViewController.m
.../AnnounceDetail/ViewController/AnnoDetailViewController.m
+113
-12
AddPictureViewController.m
...ture/AddPicture/ViewController/AddPictureViewController.m
+24
-17
PictureTextTableCell.m
...unction/Picture/PictureDetail/Cell/PictureTextTableCell.m
+1
-1
PictureStoryViewController.m
...PictureDetail/ViewController/PictureStoryViewController.m
+25
-1
SOPViewController.m
...n/Standar/SOPCategarys/ViewController/SOPViewController.m
+200
-5
InspectListViewController.m
...ct/InspectList/ViewController/InspectListViewController.m
+0
-1
SearchViewController.m
...Classes/Module/Home/ViewController/SearchViewController.m
+250
-209
No files found.
redstar.xcodeproj/project.pbxproj
View file @
5e2b2364
...
...
@@ -153,6 +153,7 @@
84ECCF181C01FA2600EA4960
/* QuestionDetailModel.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
84ECCF171C01FA2600EA4960
/* QuestionDetailModel.m */
;
};
84ECCF1B1C0210F000EA4960
/* CommentModel.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
84ECCF1A1C0210F000EA4960
/* CommentModel.m */
;
};
84ED5DD81BF2E64300A1BB6D
/* ScreenView.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
84ED5DD71BF2E64300A1BB6D
/* ScreenView.m */
;
};
84EE92771C2FFDEB000EF5BF
/* AttachmentModel.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
84EE92761C2FFDEB000EF5BF
/* AttachmentModel.m */
;
};
84F1669B1BE715E40061D350
/* ZanButton.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
84F1669A1BE715E40061D350
/* ZanButton.m */
;
};
84F30DA41BFC19F200CBAD13
/* RankListModel.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
84F30DA31BFC19F200CBAD13
/* RankListModel.m */
;
};
84F57C461BEC388A00DDEEB1
/* CommentView.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
84F57C451BEC388A00DDEEB1
/* CommentView.m */
;
};
...
...
@@ -477,6 +478,8 @@
84ECCF1A1C0210F000EA4960
/* CommentModel.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
CommentModel.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>"
;
};
84EE92751C2FFDEB000EF5BF
/* AttachmentModel.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
AttachmentModel.h
;
sourceTree
=
"<group>"
;
};
84EE92761C2FFDEB000EF5BF
/* AttachmentModel.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
AttachmentModel.m
;
sourceTree
=
"<group>"
;
};
84F166991BE715E40061D350
/* ZanButton.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
ZanButton.h
;
sourceTree
=
"<group>"
;
};
84F1669A1BE715E40061D350
/* ZanButton.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
ZanButton.m
;
sourceTree
=
"<group>"
;
};
84F30DA21BFC19F200CBAD13
/* RankListModel.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
RankListModel.h
;
sourceTree
=
"<group>"
;
};
...
...
@@ -1477,6 +1480,8 @@
children
=
(
849B2F751C0CABE6005D809F
/* AnnounceDetailModel.h */
,
849B2F761C0CABE6005D809F
/* AnnounceDetailModel.m */
,
84EE92751C2FFDEB000EF5BF
/* AttachmentModel.h */
,
84EE92761C2FFDEB000EF5BF
/* AttachmentModel.m */
,
);
path
=
Model
;
sourceTree
=
"<group>"
;
...
...
@@ -2419,6 +2424,7 @@
8473E3881C1BBFF600960257
/* InspectTaskDetailCell.m in Sources */
,
84F57C9C1BECA73800DDEEB1
/* StarBar.m in Sources */
,
84F57C4C1BEC785E00DDEEB1
/* AddQuestionViewController.m in Sources */
,
84EE92771C2FFDEB000EF5BF
/* AttachmentModel.m in Sources */
,
84D2F5201C2D213400651EFB
/* AttachmentTableViewCell.m in Sources */
,
84C9729F1C1ADD17003A3276
/* PictureCommentTableCell.m in Sources */
,
849A18461C152EBA00071600
/* AddPictureTableCell.m in Sources */
,
...
...
This diff is collapsed.
Click to expand it.
redstar.xcworkspace/xcuserdata/admin.xcuserdatad/UserInterfaceState.xcuserstate
View file @
5e2b2364
No preview for this file type
This diff is collapsed.
Click to expand it.
redstar/Classes/Module/Announce/AnnounceDetail/Cell/AttachmentTableViewCell.m
View file @
5e2b2364
...
...
@@ -14,21 +14,23 @@
{
if
(
!
_nameBtn
)
{
_nameBtn
=
[[
UIButton
alloc
]
init
];
_nameBtn
.
backgroundColor
=
[
UIColor
grayColor
];
_nameBtn
.
translatesAutoresizingMaskIntoConstraints
=
NO
;
[
_nameBtn
setTitleColor
:
kNavigationBarColor
forState
:
UIControlStateNormal
];
_nameBtn
.
titleLabel
.
font
=
[
UIFont
systemFontOfSize
:
15
.
0
];
_nameBtn
.
contentHorizontalAlignment
=
UIControlContentHorizontalAlignmentLeft
;
_nameBtn
.
layer
.
cornerRadius
=
4
.
0
;
[
self
.
contentView
addSubview
:
_nameBtn
];
NSLayoutConstraint
*
lineViewTop
=
[
NSLayoutConstraint
constraintWithItem
:
_nameBtn
attribute
:
NSLayoutAttributeTop
relatedBy
:
NSLayoutRelationEqual
toItem
:
self
.
contentView
attribute
:
NSLayoutAttributeTop
multiplier
:
1
.
0
constant
:
5
];
[
self
.
contentView
addConstraint
:
lineViewTop
];
NSLayoutConstraint
*
lineViewRight
=
[
NSLayoutConstraint
constraintWithItem
:
_nameBtn
attribute
:
NSLayoutAttributeRight
relatedBy
:
NSLayoutRelationEqual
toItem
:
self
.
contentView
attribute
:
NSLayoutAttributeCenterX
multiplier
:
1
.
0
constant
:-
2
0
];
NSLayoutConstraint
*
lineViewRight
=
[
NSLayoutConstraint
constraintWithItem
:
_nameBtn
attribute
:
NSLayoutAttributeRight
relatedBy
:
NSLayoutRelationEqual
toItem
:
self
.
downloadBtn
attribute
:
NSLayoutAttributeLeft
multiplier
:
1
.
0
constant
:-
1
0
];
[
self
.
contentView
addConstraint
:
lineViewRight
];
NSLayoutConstraint
*
lineViewBottom
=
[
NSLayoutConstraint
constraintWithItem
:
_nameBtn
attribute
:
NSLayoutAttributeBottom
relatedBy
:
NSLayoutRelationEqual
toItem
:
self
.
contentView
attribute
:
NSLayoutAttributeBottom
multiplier
:
1
.
0
constant
:-
5
];
[
self
.
contentView
addConstraint
:
lineViewBottom
];
NSLayoutConstraint
*
lineViewLeft
=
[
NSLayoutConstraint
constraintWithItem
:
_nameBtn
attribute
:
NSLayoutAttributeLeft
relatedBy
:
NSLayoutRelationEqual
toItem
:
self
.
contentView
attribute
:
NSLayoutAttributeLeft
multiplier
:
1
.
0
constant
:
1
0
];
NSLayoutConstraint
*
lineViewLeft
=
[
NSLayoutConstraint
constraintWithItem
:
_nameBtn
attribute
:
NSLayoutAttributeLeft
relatedBy
:
NSLayoutRelationEqual
toItem
:
self
.
contentView
attribute
:
NSLayoutAttributeLeft
multiplier
:
1
.
0
constant
:
2
0
];
[
self
.
contentView
addConstraint
:
lineViewLeft
];
NSLayoutConstraint
*
lineViewHeight
=
[
NSLayoutConstraint
constraintWithItem
:
_nameBtn
attribute
:
NSLayoutAttributeHeight
relatedBy
:
NSLayoutRelationEqual
toItem
:
nil
attribute
:
NSLayoutAttributeNotAnAttribute
multiplier
:
1
.
0
constant
:
35
];
...
...
@@ -42,22 +44,24 @@
{
if
(
!
_downloadBtn
)
{
_downloadBtn
=
[[
UIButton
alloc
]
init
];
_downloadBtn
.
backgroundColor
=
[
UIColor
grayColor
];
_downloadBtn
.
titleLabel
.
font
=
[
UIFont
systemFontOfSize
:
15
.
0
];
_downloadBtn
.
translatesAutoresizingMaskIntoConstraints
=
NO
;
[
_downloadBtn
setTitle
:
@"下载"
forState
:
UIControlStateNormal
];
[
_downloadBtn
setTitle
:
@"已下载"
forState
:
UIControlStateSelected
];
_downloadBtn
.
layer
.
cornerRadius
=
4
.
0
;
[
self
.
contentView
addSubview
:
_downloadBtn
];
NSLayoutConstraint
*
lineViewTop
=
[
NSLayoutConstraint
constraintWithItem
:
_downloadBtn
attribute
:
NSLayoutAttributeTop
relatedBy
:
NSLayoutRelationEqual
toItem
:
self
.
contentView
attribute
:
NSLayoutAttributeTop
multiplier
:
1
.
0
constant
:
5
];
NSLayoutConstraint
*
lineViewTop
=
[
NSLayoutConstraint
constraintWithItem
:
_downloadBtn
attribute
:
NSLayoutAttributeTop
relatedBy
:
NSLayoutRelationEqual
toItem
:
self
.
contentView
attribute
:
NSLayoutAttributeTop
multiplier
:
1
.
0
constant
:
8
];
[
self
.
contentView
addConstraint
:
lineViewTop
];
NSLayoutConstraint
*
lineViewRight
=
[
NSLayoutConstraint
constraintWithItem
:
_downloadBtn
attribute
:
NSLayoutAttributeRight
relatedBy
:
NSLayoutRelationEqual
toItem
:
self
.
contentView
attribute
:
NSLayoutAttributeRight
multiplier
:
1
.
0
constant
:-
20
];
[
self
.
contentView
addConstraint
:
lineViewRight
];
NSLayoutConstraint
*
lineViewBottom
=
[
NSLayoutConstraint
constraintWithItem
:
_downloadBtn
attribute
:
NSLayoutAttributeBottom
relatedBy
:
NSLayoutRelationEqual
toItem
:
self
.
contentView
attribute
:
NSLayoutAttributeBottom
multiplier
:
1
.
0
constant
:-
5
];
NSLayoutConstraint
*
lineViewBottom
=
[
NSLayoutConstraint
constraintWithItem
:
_downloadBtn
attribute
:
NSLayoutAttributeBottom
relatedBy
:
NSLayoutRelationEqual
toItem
:
self
.
contentView
attribute
:
NSLayoutAttributeBottom
multiplier
:
1
.
0
constant
:-
8
];
[
self
.
contentView
addConstraint
:
lineViewBottom
];
NSLayoutConstraint
*
lineView
Left
=
[
NSLayoutConstraint
constraintWithItem
:
_downloadBtn
attribute
:
NSLayoutAttributeLeft
relatedBy
:
NSLayoutRelationEqual
toItem
:
self
.
contentView
attribute
:
NSLayoutAttributeCenterX
multiplier
:
1
.
0
constant
:
1
0
];
[
self
.
contentView
addConstraint
:
lineView
Left
];
NSLayoutConstraint
*
lineView
Width
=
[
NSLayoutConstraint
constraintWithItem
:
_downloadBtn
attribute
:
NSLayoutAttributeWidth
relatedBy
:
NSLayoutRelationEqual
toItem
:
nil
attribute
:
NSLayoutAttributeNotAnAttribute
multiplier
:
1
.
0
constant
:
8
0
];
[
self
.
contentView
addConstraint
:
lineView
Width
];
}
return
_downloadBtn
;
}
...
...
This diff is collapsed.
Click to expand it.
redstar/Classes/Module/Announce/AnnounceDetail/Model/AttachmentModel.h
0 → 100644
View file @
5e2b2364
//
// AttachmentModel.h
// redstar
//
// Created by admin on 15/12/27.
// Copyright © 2015年 ZWF. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface
AttachmentModel
:
NSObject
@property
(
nonatomic
,
strong
)
NSString
*
fileName
;
@property
(
nonatomic
,
strong
)
NSString
*
fileUrl
;
@end
This diff is collapsed.
Click to expand it.
redstar/Classes/Module/Announce/AnnounceDetail/Model/AttachmentModel.m
0 → 100644
View file @
5e2b2364
//
// AttachmentModel.m
// redstar
//
// Created by admin on 15/12/27.
// Copyright © 2015年 ZWF. All rights reserved.
//
#import "AttachmentModel.h"
@implementation
AttachmentModel
@end
This diff is collapsed.
Click to expand it.
redstar/Classes/Module/Announce/AnnounceDetail/ViewController/AnnoDetailViewController.m
View file @
5e2b2364
...
...
@@ -10,6 +10,7 @@
#import "AnnounceDetailHeadView.h"
#import "AnnoContentTableViewCell.h"
#import "AnnounceDetailFootView.h"
#import "AttachmentModel.h"
#import "HttpClient.h"
...
...
@@ -17,14 +18,18 @@
#import "AttachmentTableViewCell.h"
#import <AFNetworking.h>
#define kAnnounceContentCell @"AnnoContentTableViewCell"
#define kAttachmentTableViewCell @"AttachmentTableViewCell"
@interface
AnnoDetailViewController
()
<
UITableViewDataSource
,
UITableViewDelegate
>
@interface
AnnoDetailViewController
()
<
UITableViewDataSource
,
UITableViewDelegate
,
UIDocumentInteractionControllerDelegate
>
@property
(
nonatomic
,
strong
)
UITableView
*
tableView
;
@property
(
nonatomic
,
strong
)
AnnounceDetailHeadView
*
headerView
;
@property
(
nonatomic
,
strong
)
AnnounceDetailFootView
*
footerView
;
@property
(
nonatomic
,
strong
)
AnnounceDetailModel
*
annoDetail
;
@property
(
nonatomic
,
strong
)
NSMutableArray
*
attachmentArray
;
@end
@implementation
AnnoDetailViewController
...
...
@@ -33,6 +38,8 @@
{
[
super
viewDidLoad
];
self
.
attachmentArray
=
[
NSMutableArray
array
];
[
self
setNav
];
[
self
requestAnnoDetail
];
...
...
@@ -50,6 +57,12 @@
AnnounceDetailModel
*
annoDetail
=
[
AnnounceDetailModel
announceDetailModelWithDict
:
dict
];
_annoDetail
=
annoDetail
;
for
(
NSDictionary
*
attachmentDict
in
_annoDetail
.
attachmentUrls
)
{
AttachmentModel
*
atta
=
[[
AttachmentModel
alloc
]
init
];
[
atta
setValuesForKeysWithDictionary
:
attachmentDict
];
[
_attachmentArray
addObject
:
atta
];
}
self
.
tableView
.
delegate
=
self
;
self
.
tableView
.
dataSource
=
self
;
}];
...
...
@@ -98,12 +111,80 @@
-
(
void
)
showFile
:
(
UIButton
*
)
sender
{
NSInteger
row
=
sender
.
tag
-
998473
;
AttachmentModel
*
atta
=
_attachmentArray
[
row
];
NSArray
*
paths
=
NSSearchPathForDirectoriesInDomains
(
NSDocumentDirectory
,
NSUserDomainMask
,
YES
);
NSString
*
path
=
paths
.
lastObject
;
NSString
*
url
=
[
NSString
stringWithFormat
:
@"%@/%@"
,
path
,
atta
.
fileName
];
NSFileManager
*
fileManager
=
[
NSFileManager
defaultManager
];
if
([
fileManager
fileExistsAtPath
:
url
])
{
UIDocumentInteractionController
*
docController
=
[
UIDocumentInteractionController
interactionControllerWithURL
:[
NSURL
fileURLWithPath
:
url
]];
//为该对象初始化一个加载路径
docController
.
delegate
=
self
;
//设置代理
[
docController
presentPreviewAnimated
:
YES
];
}
else
{
UIAlertView
*
alert
=
[[
UIAlertView
alloc
]
initWithTitle
:
@"提示"
message
:
@"文件不存在,请先下载在查看!"
delegate
:
self
cancelButtonTitle
:
nil
otherButtonTitles
:
@"确定"
,
nil
];
[
alert
show
];
}
}
-
(
UIViewController
*
)
documentInteractionControllerViewControllerForPreview
:
(
UIDocumentInteractionController
*
)
controller
{
return
self
;
}
-
(
void
)
downloadFile
:
(
UIButton
*
)
sender
{
NSInteger
row
=
sender
.
tag
-
998473
;
AttachmentModel
*
atta
=
_attachmentArray
[
row
];
NSArray
*
paths
=
NSSearchPathForDirectoriesInDomains
(
NSDocumentDirectory
,
NSUserDomainMask
,
YES
);
NSString
*
path
=
paths
.
lastObject
;
[
self
downloadFileURL
:[
NSString
stringWithFormat
:
@"%@%@"
,
kRedStarURL
,
atta
.
fileUrl
]
savePath
:
path
fileName
:
atta
.
fileName
];
}
-
(
void
)
downloadFileURL
:
(
NSString
*
)
aUrl
savePath
:
(
NSString
*
)
aSavePath
fileName
:
(
NSString
*
)
aFileName
{
NSFileManager
*
fileManager
=
[
NSFileManager
defaultManager
];
//检查本地文件是否已存在
NSString
*
fileName
=
[
NSString
stringWithFormat
:
@"%@/%@"
,
aSavePath
,
aFileName
];
//检查附件是否存在
if
([
fileManager
fileExistsAtPath
:
fileName
])
{
NSLog
(
@"存在了"
);
}
else
{
NSLog
(
@"不存在"
);
//创建附件存储目录
if
(
!
[
fileManager
fileExistsAtPath
:
aSavePath
])
{
[
fileManager
createDirectoryAtPath
:
aSavePath
withIntermediateDirectories
:
YES
attributes
:
nil
error
:
nil
];
}
//下载附件
NSURL
*
url
=
[[
NSURL
alloc
]
initWithString
:
aUrl
];
NSURLRequest
*
request
=
[
NSURLRequest
requestWithURL
:
url
];
AFHTTPRequestOperation
*
operation
=
[[
AFHTTPRequestOperation
alloc
]
initWithRequest
:
request
];
operation
.
inputStream
=
[
NSInputStream
inputStreamWithURL
:
url
];
operation
.
outputStream
=
[
NSOutputStream
outputStreamToFileAtPath
:
fileName
append
:
NO
];
//下载进度控制
//已完成下载
[
operation
setCompletionBlockWithSuccess
:
^
(
AFHTTPRequestOperation
*
operation
,
id
responseObject
)
{
NSLog
(
@"下载成功"
);
[
self
.
tableView
reloadData
];
}
failure
:
^
(
AFHTTPRequestOperation
*
operation
,
NSError
*
error
)
{
NSLog
(
@"下载失败"
);
}];
[
operation
start
];
}
}
-
(
void
)
didReceiveMemoryWarning
{
...
...
@@ -112,15 +193,24 @@
}
#pragma mark - UITableView Delegate/DataSource
-
(
NSInteger
)
numberOfSectionsInTableView
:
(
UITableView
*
)
tableView
{
return
2
;
}
-
(
NSInteger
)
tableView
:
(
UITableView
*
)
tableView
numberOfRowsInSection
:
(
NSInteger
)
section
{
return
1
+
_annoDetail
.
attachmentUrls
.
count
;
if
(
section
==
0
)
{
return
1
;
}
else
{
return
_attachmentArray
.
count
;
}
}
// cell显示的内容
-
(
UITableViewCell
*
)
tableView
:
(
UITableView
*
)
tableView
cellForRowAtIndexPath
:
(
NSIndexPath
*
)
indexPath
{
if
(
indexPath
.
row
==
0
)
{
if
(
indexPath
.
section
==
0
)
{
AnnoContentTableViewCell
*
cell
=
[
tableView
dequeueReusableCellWithIdentifier
:
kAnnounceContentCell
];
if
(
!
cell
)
{
cell
=
[[
AnnoContentTableViewCell
alloc
]
initWithStyle
:
UITableViewCellStyleValue1
reuseIdentifier
:
kAnnounceContentCell
];
...
...
@@ -139,21 +229,34 @@
if
(
!
cell
)
{
cell
=
[[
AttachmentTableViewCell
alloc
]
initWithStyle
:
UITableViewCellStyleValue1
reuseIdentifier
:
kAttachmentTableViewCell
];
}
NSDictionary
*
dict
=
_annoDetail
.
attachmentUrls
[
indexPath
.
row
-
1
];
NSString
*
name
=
dict
[
@"fileName"
]
;
AttachmentModel
*
atta
=
_attachmentArray
[
indexPath
.
row
];
NSString
*
name
=
atta
.
fileName
;
[
cell
.
nameBtn
setTitle
:
name
forState
:
UIControlStateNormal
];
[
cell
.
downloadBtn
setTitle
:
@"下载"
forState
:
UIControlStateNormal
];
[
cell
.
nameBtn
addTarget
:
self
action
:
@selector
(
showFile
:
)
forControlEvents
:
UIControlEventTouchUpInside
];
[
cell
.
downloadBtn
addTarget
:
self
action
:
@selector
(
downloadFile
:
)
forControlEvents
:
UIControlEventTouchUpInside
];
cell
.
downloadBtn
.
tag
=
998473
+
indexPath
.
row
;
cell
.
nameBtn
.
tag
=
998473
+
indexPath
.
row
;
NSArray
*
paths
=
NSSearchPathForDirectoriesInDomains
(
NSDocumentDirectory
,
NSUserDomainMask
,
YES
);
NSString
*
path
=
paths
.
lastObject
;
NSString
*
url
=
[
NSString
stringWithFormat
:
@"%@/%@"
,
path
,
atta
.
fileName
];
NSFileManager
*
fileManager
=
[
NSFileManager
defaultManager
];
if
([
fileManager
fileExistsAtPath
:
url
])
{
cell
.
downloadBtn
.
selected
=
YES
;
cell
.
downloadBtn
.
backgroundColor
=
[
UIColor
grayColor
];
}
else
{
cell
.
downloadBtn
.
selected
=
NO
;
cell
.
downloadBtn
.
backgroundColor
=
[
UIColor
colorWithRed
:
47
/
255
.
0
green
:
209
/
255
.
0
blue
:
92
/
255
.
0
alpha
:
1
.
0
];
}
return
cell
;
}
}
-
(
UITableView
*
)
tableView
{
if
(
!
_tableView
)
{
...
...
@@ -165,7 +268,6 @@
_tableView
.
rowHeight
=
UITableViewAutomaticDimension
;
_tableView
.
estimatedRowHeight
=
100
.
0
;
_tableView
.
tableHeaderView
=
self
.
headerView
;
_tableView
.
tableFooterView
=
self
.
footerView
;
[
_tableView
registerClass
:[
AnnoContentTableViewCell
class
]
forCellReuseIdentifier
:
kAnnounceContentCell
];
[
_tableView
registerClass
:[
AttachmentTableViewCell
class
]
forCellReuseIdentifier
:
kAttachmentTableViewCell
];
[
self
.
view
addSubview
:
_tableView
];
...
...
@@ -198,8 +300,7 @@
-
(
AnnounceDetailFootView
*
)
footerView
{
if
(
!
_footerView
)
{
_footerView
=
[[
AnnounceDetailFootView
alloc
]
initWithFrame
:
CGRectMake
(
0
,
0
,
kScreenWidth
,
120
)];
_footerView
.
backgroundColor
=
[
UIColor
whiteColor
];
_footerView
=
[[
AnnounceDetailFootView
alloc
]
initWithFrame
:
CGRectMake
(
0
,
0
,
kScreenWidth
,
40
)];
}
return
_footerView
;
}
...
...
This diff is collapsed.
Click to expand it.
redstar/Classes/Module/Function/Picture/AddPicture/ViewController/AddPictureViewController.m
View file @
5e2b2364
...
...
@@ -134,6 +134,8 @@
_praiseUuid
=
response
[
@"data"
];
}];
}
_rowNumber
++
;
[
self
.
tableView
reloadData
];
}
else
{
NSIndexPath
*
indexPath
=
[
NSIndexPath
indexPathForRow
:(
_rowNumber
-
2
)
inSection
:
0
];
...
...
@@ -143,22 +145,29 @@
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
);
}];
if
((
_imageNameArray
.
count
==
_rowNumber
-
2
)
&&
cell
.
titleTextView
.
text
.
length
!=
0
)
{
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
];
}
else
{
UIAlertView
*
alert
=
[[
UIAlertView
alloc
]
initWithTitle
:
@"提示"
message
:
@"必须有图片和图片说明!"
delegate
:
self
cancelButtonTitle
:
nil
otherButtonTitles
:
@"确定"
,
nil
];
[
alert
show
];
}
}
_rowNumber
++
;
[
self
.
tableView
reloadData
];
}
-
(
void
)
saveImage
:
(
UIImage
*
)
currentImage
{
...
...
@@ -382,8 +391,6 @@
[
cell
.
photoButton
removeTarget
:
self
action
:
@selector
(
createImagePicker
:
)
forControlEvents
:
UIControlEventTouchUpInside
];
[
cell
.
photoButton
addTarget
:
self
action
:
@selector
(
showBigPic
:
)
forControlEvents
:
UIControlEventTouchUpInside
];
cell
.
titleTextView
.
userInteractionEnabled
=
NO
;
}
}
cell
.
titleTextView
.
delegate
=
self
;
...
...
This diff is collapsed.
Click to expand it.
redstar/Classes/Module/Function/Picture/PictureDetail/Cell/PictureTextTableCell.m
View file @
5e2b2364
...
...
@@ -29,7 +29,7 @@
[
self
.
contentView
addConstraint
:
titleRight
];
// 高度
NSLayoutConstraint
*
titleHeight
=
[
NSLayoutConstraint
constraintWithItem
:
_bigImageView
attribute
:
NSLayoutAttributeHeight
relatedBy
:
NSLayoutRelationEqual
toItem
:
nil
attribute
:
NSLayoutAttributeNotAnAttribute
multiplier
:
1
.
0
constant
:
1
5
0
];
NSLayoutConstraint
*
titleHeight
=
[
NSLayoutConstraint
constraintWithItem
:
_bigImageView
attribute
:
NSLayoutAttributeHeight
relatedBy
:
NSLayoutRelationEqual
toItem
:
nil
attribute
:
NSLayoutAttributeNotAnAttribute
multiplier
:
1
.
0
constant
:
1
7
0
];
[
self
.
contentView
addConstraint
:
titleHeight
];
}
return
_bigImageView
;
...
...
This diff is collapsed.
Click to expand it.
redstar/Classes/Module/Function/Picture/PictureDetail/ViewController/PictureStoryViewController.m
View file @
5e2b2364
...
...
@@ -306,7 +306,6 @@
PicTextModel
*
picText
=
_picTextArray
[
indexPath
.
row
];
NSURL
*
imageUrl
=
[
NSURL
URLWithString
:[
NSString
stringWithFormat
:
@"%@%@"
,
kRedStarURL
,
picText
.
fileUrl
]];
[
cell
.
bigImageView
sd_setImageWithURL
:
imageUrl
placeholderImage
:[
UIImage
imageNamed
:
@"default_pic"
]];
cell
.
descriptionLabel
.
text
=
[
NSString
stringWithFormat
:
@"%@"
,
picText
.
descriptionText
];
cell
.
selectionStyle
=
UITableViewCellSelectionStyleNone
;
return
cell
;
...
...
@@ -321,6 +320,31 @@
}
}
//裁剪图片
-
(
UIImage
*
)
cutImage
:
(
UIImage
*
)
image
{
//压缩图片
CGSize
newSize
;
CGImageRef
imageRef
=
nil
;
if
((
image
.
size
.
width
/
image
.
size
.
height
)
<
(((
kScreenWidth
-
20
*
3
)
/
2
)
/
90
))
{
newSize
.
width
=
image
.
size
.
width
;
newSize
.
height
=
image
.
size
.
width
*
90
/
((
kScreenWidth
-
20
*
3
)
/
2
);
imageRef
=
CGImageCreateWithImageInRect
([
image
CGImage
],
CGRectMake
(
0
,
fabs
(
image
.
size
.
height
-
newSize
.
height
)
/
2
,
newSize
.
width
,
newSize
.
height
));
}
else
{
newSize
.
height
=
image
.
size
.
height
;
newSize
.
width
=
image
.
size
.
height
*
((
kScreenWidth
-
20
*
3
)
/
2
)
/
90
;
imageRef
=
CGImageCreateWithImageInRect
([
image
CGImage
],
CGRectMake
(
fabs
(
image
.
size
.
width
-
newSize
.
width
)
/
2
,
0
,
newSize
.
width
,
newSize
.
height
));
}
return
[
UIImage
imageWithCGImage
:
imageRef
];
}
// 自定义section
-
(
UIView
*
)
tableView
:
(
UITableView
*
)
tableView
viewForHeaderInSection
:
(
NSInteger
)
section
{
...
...
This diff is collapsed.
Click to expand it.
redstar/Classes/Module/Function/Standar/SOPCategarys/ViewController/SOPViewController.m
View file @
5e2b2364
...
...
@@ -11,10 +11,14 @@
#import "GroupItems.h"
#import "SOPTableView.h"
#import "HttpClient.h"
#import "AttachmentTableViewCell.h"
#import "AttachmentModel.h"
#define kAttachmentTableCell @"sopAttachmentCell"
#define SELECTED_VIEW_CONTROLLER_TAG 39998
@interface
SOPViewController
()
<
GroupTabBarDelegate
,
SOPTableViewDelegate
>
@interface
SOPViewController
()
<
GroupTabBarDelegate
,
SOPTableViewDelegate
,
UITableViewDelegate
,
UITableViewDataSource
,
UIDocumentInteractionControllerDelegate
>
@property
(
nonatomic
,
strong
)
GroupTabBar
*
groupTabBar
;
@property
(
nonatomic
,
strong
)
NSArray
*
titleArray
;
...
...
@@ -33,6 +37,10 @@
@property
(
nonatomic
,
strong
)
UIButton
*
resetBtn
;
@property
(
nonatomic
,
strong
)
UIButton
*
queryBtn
;
@property
(
nonatomic
,
strong
)
UIView
*
bgView
;
@property
(
nonatomic
,
strong
)
UITableView
*
tableView
;
@property
(
nonatomic
,
strong
)
NSMutableArray
*
attachmentArray
;
@end
...
...
@@ -49,6 +57,8 @@
self
.
navigationController
.
navigationBar
.
translucent
=
NO
;
}
self
.
attachmentArray
=
[
NSMutableArray
array
];
self
.
titleArray
=
[
NSArray
arrayWithObjects
:
@"质量管理"
,
@"价格管理"
,
@"现场服务"
,
@"售后服务"
,
@"环境管理"
,
@"现场管理"
,
@"400呼叫管理"
,
@"单品管理"
,
nil
];
...
...
@@ -79,16 +89,140 @@
NSString
*
url
=
[
NSString
stringWithFormat
:
@"%@%@"
,
kRedStarURL
,
kGetAttachmentsURL
];
HttpClient
*
http
=
[[
HttpClient
alloc
]
initWithUrl
:
url
];
NSDictionary
*
parameters
=
@{
@"type"
:
@"sop"
,
// @"category1":_titleArray[_groupTabBar.selectNumber],
// @"category2":_detailTitle
@"category1"
:
@"11"
,
@"category2"
:
@"22"
@"encode"
:
@"123"
};
[
http
getAttachmentsWithParameters
:
parameters
completion
:
^
(
id
response
,
NSError
*
error
)
{
NSLog
(
@"7.1 口碑标注附件列表 = %@, error = %@"
,
response
,
error
);
NSArray
*
dataArray
=
response
[
@"data"
];
for
(
NSDictionary
*
attaDict
in
dataArray
)
{
AttachmentModel
*
atta
=
[[
AttachmentModel
alloc
]
init
];
[
atta
setValuesForKeysWithDictionary
:
attaDict
];
[
_attachmentArray
addObject
:
atta
];
}
CGFloat
tableH
=
_attachmentArray
.
count
*
45
;
if
(
!
_bgView
)
{
_bgView
=
[[
UIView
alloc
]
initWithFrame
:
CGRectMake
(
0
,
0
,
kScreenWidth
,
kScreenHeight
)];
UITapGestureRecognizer
*
tapGR
=
[[
UITapGestureRecognizer
alloc
]
initWithTarget
:
self
action
:
@selector
(
closeRedView
)];
[
_bgView
addGestureRecognizer
:
tapGR
];
}
CGRect
toFrame
=
CGRectMake
(
0
,
0
,
kScreenWidth
-
50
,
tableH
+
40
);
if
(
!
_tableView
)
{
_tableView
=
[[
UITableView
alloc
]
initWithFrame
:
toFrame
style
:
UITableViewStyleGrouped
];
_tableView
.
backgroundColor
=
[
UIColor
whiteColor
];
}
_tableView
.
delegate
=
self
;
_tableView
.
dataSource
=
self
;
[
self
.
view
addSubview
:
_bgView
];
[
self
.
view
insertSubview
:
_tableView
aboveSubview
:
_bgView
];
_bgView
.
alpha
=
0
;
_bgView
.
backgroundColor
=
[
UIColor
blackColor
];
_tableView
.
alpha
=
0
.
0
;
_tableView
.
center
=
CGPointMake
(
_bgView
.
center
.
x
,
_bgView
.
center
.
y
-
74
);
[
UIView
animateWithDuration
:
0
.
3
animations
:
^
{
_bgView
.
alpha
=
0
.
6
;
_tableView
.
alpha
=
1
.
0
;
}];
}];
}
-
(
void
)
closeRedView
{
[
UIView
animateWithDuration
:
0
.
3
animations
:
^
{
_bgView
.
alpha
=
.
0
f
;
_tableView
.
alpha
=
0
.
0
;
}
completion
:^
(
BOOL
finished
)
{
[
_bgView
removeFromSuperview
];
[
_tableView
removeFromSuperview
];
}];
}
-
(
void
)
showFile
:
(
UIButton
*
)
sender
{
NSInteger
row
=
sender
.
tag
-
998473
;
AttachmentModel
*
atta
=
_attachmentArray
[
row
];
NSArray
*
paths
=
NSSearchPathForDirectoriesInDomains
(
NSDocumentDirectory
,
NSUserDomainMask
,
YES
);
NSString
*
path
=
paths
.
lastObject
;
NSString
*
url
=
[
NSString
stringWithFormat
:
@"%@/%@"
,
path
,
atta
.
fileName
];
NSFileManager
*
fileManager
=
[
NSFileManager
defaultManager
];
if
([
fileManager
fileExistsAtPath
:
url
])
{
UIDocumentInteractionController
*
docController
=
[
UIDocumentInteractionController
interactionControllerWithURL
:[
NSURL
fileURLWithPath
:
url
]];
//为该对象初始化一个加载路径
docController
.
delegate
=
self
;
//设置代理
[
docController
presentPreviewAnimated
:
YES
];
}
else
{
UIAlertView
*
alert
=
[[
UIAlertView
alloc
]
initWithTitle
:
@"提示"
message
:
@"文件不存在,请先下载在查看!"
delegate
:
self
cancelButtonTitle
:
nil
otherButtonTitles
:
@"确定"
,
nil
];
[
alert
show
];
}
}
-
(
UIViewController
*
)
documentInteractionControllerViewControllerForPreview
:
(
UIDocumentInteractionController
*
)
controller
{
return
self
;
}
-
(
void
)
downloadFile
:
(
UIButton
*
)
sender
{
NSInteger
row
=
sender
.
tag
-
998473
;
AttachmentModel
*
atta
=
_attachmentArray
[
row
];
NSArray
*
paths
=
NSSearchPathForDirectoriesInDomains
(
NSDocumentDirectory
,
NSUserDomainMask
,
YES
);
NSString
*
path
=
paths
.
lastObject
;
[
self
downloadFileURL
:[
NSString
stringWithFormat
:
@"%@%@"
,
kRedStarURL
,
atta
.
fileUrl
]
savePath
:
path
fileName
:
atta
.
fileName
];
}
-
(
void
)
downloadFileURL
:
(
NSString
*
)
aUrl
savePath
:
(
NSString
*
)
aSavePath
fileName
:
(
NSString
*
)
aFileName
{
NSFileManager
*
fileManager
=
[
NSFileManager
defaultManager
];
//检查本地文件是否已存在
NSString
*
fileName
=
[
NSString
stringWithFormat
:
@"%@/%@"
,
aSavePath
,
aFileName
];
//检查附件是否存在
if
([
fileManager
fileExistsAtPath
:
fileName
])
{
NSLog
(
@"存在了"
);
}
else
{
NSLog
(
@"不存在"
);
//创建附件存储目录
if
(
!
[
fileManager
fileExistsAtPath
:
aSavePath
])
{
[
fileManager
createDirectoryAtPath
:
aSavePath
withIntermediateDirectories
:
YES
attributes
:
nil
error
:
nil
];
}
//下载附件
NSURL
*
url
=
[[
NSURL
alloc
]
initWithString
:
aUrl
];
NSURLRequest
*
request
=
[
NSURLRequest
requestWithURL
:
url
];
AFHTTPRequestOperation
*
operation
=
[[
AFHTTPRequestOperation
alloc
]
initWithRequest
:
request
];
operation
.
inputStream
=
[
NSInputStream
inputStreamWithURL
:
url
];
operation
.
outputStream
=
[
NSOutputStream
outputStreamToFileAtPath
:
fileName
append
:
NO
];
//下载进度控制
//已完成下载
[
operation
setCompletionBlockWithSuccess
:
^
(
AFHTTPRequestOperation
*
operation
,
id
responseObject
)
{
NSLog
(
@"下载成功"
);
[
self
.
tableView
reloadData
];
}
failure
:
^
(
AFHTTPRequestOperation
*
operation
,
NSError
*
error
)
{
NSLog
(
@"下载失败"
);
}];
[
operation
start
];
}
}
-
(
void
)
setupNav
{
UILabel
*
customLab
=
[[
UILabel
alloc
]
initWithFrame
:
CGRectMake
(
0
,
0
,
40
,
30
)];
...
...
@@ -177,7 +311,68 @@
{
[
self
.
navigationController
dismissViewControllerAnimated
:
YES
completion
:
nil
];
}
#pragma mark - UITableView Delegate/DataSource
-
(
NSInteger
)
numberOfSectionsInTableView
:
(
UITableView
*
)
tableView
{
return
1
;
}
-
(
NSInteger
)
tableView
:
(
UITableView
*
)
tableView
numberOfRowsInSection
:
(
NSInteger
)
section
{
return
_attachmentArray
.
count
;
}
// cell显示的内容
-
(
UITableViewCell
*
)
tableView
:
(
UITableView
*
)
tableView
cellForRowAtIndexPath
:
(
NSIndexPath
*
)
indexPath
{
AttachmentTableViewCell
*
cell
=
[
tableView
dequeueReusableCellWithIdentifier
:
kAttachmentTableCell
];
if
(
!
cell
)
{
cell
=
[[
AttachmentTableViewCell
alloc
]
initWithStyle
:
UITableViewCellStyleValue1
reuseIdentifier
:
kAttachmentTableCell
];
}
AttachmentModel
*
atta
=
_attachmentArray
[
indexPath
.
row
];
NSString
*
name
=
atta
.
fileName
;
[
cell
.
nameBtn
setTitle
:
name
forState
:
UIControlStateNormal
];
[
cell
.
nameBtn
addTarget
:
self
action
:
@selector
(
showFile
:
)
forControlEvents
:
UIControlEventTouchUpInside
];
[
cell
.
downloadBtn
addTarget
:
self
action
:
@selector
(
downloadFile
:
)
forControlEvents
:
UIControlEventTouchUpInside
];
cell
.
downloadBtn
.
tag
=
998473
+
indexPath
.
row
;
cell
.
nameBtn
.
tag
=
998473
+
indexPath
.
row
;
NSArray
*
paths
=
NSSearchPathForDirectoriesInDomains
(
NSDocumentDirectory
,
NSUserDomainMask
,
YES
);
NSString
*
path
=
paths
.
lastObject
;
NSString
*
url
=
[
NSString
stringWithFormat
:
@"%@/%@"
,
path
,
atta
.
fileName
];
NSFileManager
*
fileManager
=
[
NSFileManager
defaultManager
];
if
([
fileManager
fileExistsAtPath
:
url
])
{
cell
.
downloadBtn
.
selected
=
YES
;
cell
.
downloadBtn
.
backgroundColor
=
[
UIColor
grayColor
];
}
else
{
cell
.
downloadBtn
.
selected
=
NO
;
cell
.
downloadBtn
.
backgroundColor
=
[
UIColor
colorWithRed
:
47
/
255
.
0
green
:
209
/
255
.
0
blue
:
92
/
255
.
0
alpha
:
1
.
0
];
}
return
cell
;
}
-
(
UIView
*
)
tableView
:
(
UITableView
*
)
tableView
viewForHeaderInSection
:
(
NSInteger
)
section
{
UIView
*
view
=
[[
UIView
alloc
]
initWithFrame
:
CGRectMake
(
0
,
0
,
kScreenWidth
,
40
)];
UILabel
*
label
=
[[
UILabel
alloc
]
initWithFrame
:
CGRectMake
(
15
,
0
,
kScreenWidth
-
20
,
40
)];
label
.
text
=
@"附件"
;
label
.
textColor
=
kNavigationBarColor
;
label
.
font
=
[
UIFont
systemFontOfSize
:
14
.
0
];
[
view
addSubview
:
label
];
return
view
;
}
-
(
CGFloat
)
tableView
:
(
UITableView
*
)
tableView
heightForHeaderInSection
:
(
NSInteger
)
section
{
return
40
;
}
#pragma mark - SOPTableViewDelegate
-
(
void
)
selectRowWithDetailTitle
:
(
NSString
*
)
detailTitle
...
...
This diff is collapsed.
Click to expand it.
redstar/Classes/Module/Function/WordOfMouth/Inspect/InspectList/ViewController/InspectListViewController.m
View file @
5e2b2364
...
...
@@ -116,7 +116,6 @@
-
(
void
)
requestMoreList
{
_page
++
;
NSLog
(
@"_page = %d"
,
(
int
)
_page
);
NSString
*
url
=
[
NSString
stringWithFormat
:
@"%@%@"
,
kRedStarURL
,
kInspectListURL
];
HttpClient
*
httpCilent
=
[[
HttpClient
alloc
]
initWithUrl
:
url
];
NSDictionary
*
parameters
=
@{
...
...
This diff is collapsed.
Click to expand it.
redstar/Classes/Module/Home/ViewController/SearchViewController.m
View file @
5e2b2364
...
...
@@ -49,14 +49,17 @@
#import <MJRefresh.h>
#import "SearchViewController.h"
#import "PicCategoryViewController.h"
@interface
SearchViewController
()
<
UITableViewDelegate
,
UITableViewDataSource
>
@property
(
nonatomic
,
strong
)
UITableView
*
tableView
;
@property
(
nonatomic
,
strong
)
NSMutableArray
*
titleArray
;
// 问题与知识
@property
(
nonatomic
,
strong
)
NSMutableArray
*
sectionArray
;
// section标题
@property
(
nonatomic
,
strong
)
NSMutableArray
*
allQuestionArray
;
// 问题与知识
@property
(
nonatomic
,
strong
)
NSMutableArray
*
taskListDataArray
;
// 问题与知识
@property
(
nonatomic
,
strong
)
NSMutableArray
*
allRankListArray
;
@property
(
nonatomic
,
strong
)
NSMutableArray
*
allPraiseListArray
;
@end
@implementation
SearchViewController
...
...
@@ -64,9 +67,7 @@
-
(
void
)
viewDidLoad
{
[
super
viewDidLoad
];
//NSMutableArray *titleArray = [[NSUserDefaults standardUserDefaults] objectForKey:@"function"];
NSArray
*
titleArray
=
[
NSArray
arrayWithObjects
:
@"口碑巡检"
,
@"口碑报告"
,
@"问题知识"
,
nil
];
self
.
titleArray
=
[
NSMutableArray
arrayWithArray
:
titleArray
];
self
.
sectionArray
=
[
NSMutableArray
array
];
UILabel
*
customLab
=
[[
UILabel
alloc
]
initWithFrame
:
CGRectMake
(
0
,
0
,
100
,
30
)];
[
customLab
setTextColor
:[
UIColor
whiteColor
]];
...
...
@@ -90,30 +91,34 @@
}
[
MBProgressHUD
showHUDAddedTo
:
self
.
view
animated
:
YES
];
if
([
self
.
titleArray
containsObject
:
@"口碑巡检"
])
{
self
.
taskListDataArray
=
[
NSMutableArray
array
];
if
(
_taskListDataArray
.
count
==
0
)
{
[
_titleArray
removeObject
:
@"口碑巡检"
];
}
[
self
requestAllTaskList
];
NSArray
*
permissions
=
[[
NSUserDefaults
standardUserDefaults
]
objectForKey
:
@"permissions"
];
// 口碑报告 商场风采 图说口碑 口碑标准 问题知识 口碑巡检
if
([
permissions
containsObject
:
@"500201"
])
{
[
self
requestRankingList
];
}
if
([
self
.
titleArray
containsObject
:
@"口碑报告"
])
{
self
.
allRankListArray
=
[
NSMutableArray
array
];
if
(
_allRankListArray
.
count
==
0
)
{
[
_titleArray
removeObject
:
@"口碑报告"
];
}
[
self
request
AllRank
List
];
[
self
requestPicturePraise
];
if
([
permissions
containsObject
:
@"500501"
]
||
[
permissions
containsObject
:
@"500502"
])
{
[
self
request
Question
List
];
}
if
([
self
.
titleArray
containsObject
:
@"问题知识"
])
{
self
.
allQuestionArray
=
[
NSMutableArray
array
];
if
(
_allRankListArray
.
count
==
0
)
{
[
_titleArray
removeObject
:
@"问题知识"
];
}
[
self
requestAllQuestion
];
if
([
permissions
containsObject
:
@"500101"
]
||
[
permissions
containsObject
:
@"500102"
])
{
[
self
requestInspectList
];
}
self
.
allRankListArray
=
[
NSMutableArray
array
];
self
.
taskListDataArray
=
[
NSMutableArray
array
];
self
.
allQuestionArray
=
[
NSMutableArray
array
];
self
.
allPraiseListArray
=
[
NSMutableArray
array
];
}
-
(
void
)
didReceiveMemoryWarning
{
...
...
@@ -134,105 +139,67 @@
// 更多按钮点击事件
-
(
void
)
moreButtonClick
:
(
UIButton
*
)
sender
{
if
(
_titleArray
.
count
==
5
)
{
UIButton
*
button
=
(
UIButton
*
)
sender
;
UINavigationController
*
nav
;
if
(
button
.
tag
-
332892
==
0
)
{
InspectListViewController
*
inspectListVC
=
[[
InspectListViewController
alloc
]
init
];
nav
=
[[
UINavigationController
alloc
]
initWithRootViewController
:
inspectListVC
];
}
else
{
QuestionViewController
*
questionVC
=
[[
QuestionViewController
alloc
]
init
];
nav
=
[[
UINavigationController
alloc
]
initWithRootViewController
:
questionVC
];
}
[
nav
.
navigationBar
setBarTintColor
:
kNavigationBarColor
];
[
nav
.
navigationBar
setTitleTextAttributes
:[
NSDictionary
dictionaryWithObjectsAndKeys
:[
UIColor
whiteColor
],
NSForegroundColorAttributeName
,
nil
]];
[
self
presentViewController
:
nav
animated
:
YES
completion
:
nil
];
}
else
{
UIButton
*
button
=
(
UIButton
*
)
sender
;
UINavigationController
*
nav
;
if
(
button
.
tag
-
332892
==
0
)
{
InspectListViewController
*
inspectListVC
=
[[
InspectListViewController
alloc
]
init
];
nav
=
[[
UINavigationController
alloc
]
initWithRootViewController
:
inspectListVC
];
}
else
if
(
button
.
tag
-
332892
==
1
)
{
RankingListViewController
*
rankingListVC
=
[[
RankingListViewController
alloc
]
init
];
nav
=
[[
UINavigationController
alloc
]
initWithRootViewController
:
rankingListVC
];
}
else
{
QuestionViewController
*
questionVC
=
[[
QuestionViewController
alloc
]
init
];
nav
=
[[
UINavigationController
alloc
]
initWithRootViewController
:
questionVC
];
}
[
nav
.
navigationBar
setBarTintColor
:
kNavigationBarColor
];
[
nav
.
navigationBar
setTitleTextAttributes
:[
NSDictionary
dictionaryWithObjectsAndKeys
:[
UIColor
whiteColor
],
NSForegroundColorAttributeName
,
nil
]];
[
self
presentViewController
:
nav
animated
:
YES
completion
:
nil
];
NSInteger
section
=
sender
.
tag
-
332892
;
UINavigationController
*
nav
;
if
([
_sectionArray
[
section
]
isEqualToString
:
@"在线抽查"
])
{
SpotCheckOnLineViewController
*
spotOnline
=
[[
SpotCheckOnLineViewController
alloc
]
init
];
nav
=
[[
UINavigationController
alloc
]
initWithRootViewController
:
spotOnline
];
}
else
if
([
_sectionArray
[
section
]
isEqualToString
:
@"口碑巡检"
])
{
InspectListViewController
*
inspectListVC
=
[[
InspectListViewController
alloc
]
init
];
nav
=
[[
UINavigationController
alloc
]
initWithRootViewController
:
inspectListVC
];
}
else
if
([
_sectionArray
[
section
]
isEqualToString
:
@"口碑标准"
])
{
StandardViewController
*
standardVC
=
[[
StandardViewController
alloc
]
init
];
nav
=
[[
UINavigationController
alloc
]
initWithRootViewController
:
standardVC
];
}
else
if
([
_sectionArray
[
section
]
isEqualToString
:
@"图说口碑"
])
{
PicCategoryViewController
*
pictureVC
=
[[
PicCategoryViewController
alloc
]
init
];
nav
=
[[
UINavigationController
alloc
]
initWithRootViewController
:
pictureVC
];
}
else
if
([
_sectionArray
[
section
]
isEqualToString
:
@"问题知识"
])
{
QuestionViewController
*
questionVC
=
[[
QuestionViewController
alloc
]
init
];
nav
=
[[
UINavigationController
alloc
]
initWithRootViewController
:
questionVC
];
}
else
if
([
_sectionArray
[
section
]
isEqualToString
:
@"口碑报告"
]){
RankingListViewController
*
rankingListVC
=
[[
RankingListViewController
alloc
]
init
];
nav
=
[[
UINavigationController
alloc
]
initWithRootViewController
:
rankingListVC
];
}
else
if
([
_sectionArray
[
section
]
isEqualToString
:
@"查看抽查"
]){
LookOnLineViewController
*
lookOnLine
=
[[
LookOnLineViewController
alloc
]
init
];
nav
=
[[
UINavigationController
alloc
]
initWithRootViewController
:
lookOnLine
];
}
else
if
([
_sectionArray
[
section
]
isEqualToString
:
@"商场风采"
])
{
PictureViewController
*
pic
=
[[
PictureViewController
alloc
]
init
];
pic
.
come
=
@"首页"
;
pic
.
category
=
@"store"
;
nav
=
[[
UINavigationController
alloc
]
initWithRootViewController
:
pic
];
}
[
nav
.
navigationBar
setBarTintColor
:
kNavigationBarColor
];
[
nav
.
navigationBar
setTitleTextAttributes
:[
NSDictionary
dictionaryWithObjectsAndKeys
:[
UIColor
whiteColor
],
NSForegroundColorAttributeName
,
nil
]];
[
self
presentViewController
:
nav
animated
:
YES
completion
:
nil
];
}
-
(
void
)
requestAllTaskList
#pragma mark - 请求数据
-
(
void
)
requestRankingList
{
NSString
*
url
3
=
[
NSString
stringWithFormat
:
@"%@%@"
,
kRedStarURL
,
kInspect
ListURL
];
HttpClient
*
httpCilent
3
=
[[
HttpClient
alloc
]
initWithUrl
:
url3
];
NSDictionary
*
parameters
3
=
@{
@"keyword"
:
self
.
customStr
,
@"userUuid"
:
[[
NSUserDefaults
standardUserDefaults
]
objectForKey
:
@"user_uuid"
]
,
@"queryOrders"
:
@[@{
@"field"
:
@"lastModifyInfo"
}]
,
@"pageNumber"
:
@
(
0
),
@"pageSize"
:
@
(
10
)
};
[
httpCilent
3
getInspectListWithParameters
:
parameters3
completion
:
^
(
id
response
,
NSError
*
error
)
{
NSLog
(
@"
巡检列表
%@"
,
response
);
NSString
*
url
=
[
NSString
stringWithFormat
:
@"%@%@"
,
kRedStarURL
,
kRanking
ListURL
];
HttpClient
*
httpCilent
=
[[
HttpClient
alloc
]
initWithUrl
:
url
];
NSDictionary
*
parameters
=
@{
@"keyword"
:
self
.
customStr
,
@"praiseUuid"
:
@""
,
@"statisMode"
:
@
(
0
)
,
@"pageNumber"
:
@
(
0
)
,
@"pageSize"
:
@
(
10
)
};
[
httpCilent
getRankingListWithParameters
:
parameters
completion
:
^
(
id
response
,
NSError
*
error
)
{
NSLog
(
@"
口碑报告response =
%@"
,
response
);
NSDictionary
*
dataDict
=
response
[
@"data"
];
NSArray
*
dataArray
=
dataDict
[
@"records"
];
NSMutableArray
*
inspectTempArr
=
[
NSMutableArray
array
];
for
(
NSDictionary
*
dict
in
dataArray
)
{
TaskListModel
*
taskList
=
[[
TaskListModel
alloc
]
init
];
[
taskList
setValuesForKeysWithDictionary
:
dict
];
[
inspectTempArr
addObject
:
taskList
];
}
_taskListDataArray
=
inspectTempArr
;
if
(
_taskListDataArray
.
count
!=
0
)
{
if
(
!
[
_titleArray
containsObject
:
@"口碑巡检"
])
{
[
_titleArray
addObject
:
@"口碑巡检"
];
}
}
[
self
.
tableView
reloadData
];
[
MBProgressHUD
hideHUDForView
:
self
.
view
animated
:
YES
];
}];
}
-
(
void
)
requestAllRankList
{
NSString
*
url1
=
[
NSString
stringWithFormat
:
@"%@%@"
,
kRedStarURL
,
kRankingListURL
];
HttpClient
*
httpCilent1
=
[[
HttpClient
alloc
]
initWithUrl
:
url1
];
NSDictionary
*
parameters1
=
@{
@"praiseUuid"
:
@"5a7417015157efa6015158f52be8004e"
,
@"statisMode"
:
@
(
0
),
@"keyword"
:
self
.
customStr
};
[
httpCilent1
getRankingListWithParameters
:
parameters1
completion
:
^
(
id
response
,
NSError
*
error
)
{
NSLog
(
@"口碑报告response = %@"
,
response
);
if
([(
NSArray
*
)
response
[
@"data"
]
count
]
==
0
)
{
return
;
}
NSArray
*
dataArray
=
response
[
@"data"
];
NSMutableArray
*
tgArray
=
[
NSMutableArray
array
];
NSMutableArray
*
rankTempArr
=
[
NSMutableArray
array
];
for
(
NSDictionary
*
ListDict
in
dataArray
)
{
RankListModel
*
rankList
=
[
RankListModel
rankListModelWithDict
:
ListDict
];
[
rankTempArr
addObject
:
rankList
];
[
tgArray
addObject
:
rankList
];
}
_allRankListArray
=
(
NSMutableArray
*
)[
self
sortRankListWithRankListArray
:
rankTempArr
];
_allRankListArray
=
(
NSMutableArray
*
)[
self
sortRankListWithRankListArray
:
tgArray
];
for
(
int
i
=
0
;
i
<
_allRankListArray
.
count
;
i
++
)
{
RankListModel
*
rank
=
_allRankListArray
[
i
];
...
...
@@ -243,68 +210,141 @@
rank
.
index
=
rank
.
score
==
prevRank
.
score
?
prevRank
.
index
:
i
+
1
;
}
}
if
(
_allRankListArray
.
count
!=
0
)
{
if
(
!
[
_titleArray
containsObject
:
@"口碑报告"
])
{
[
_titleArray
addObject
:
@"口碑报告"
];
}
[
_sectionArray
addObject
:
@"口碑报告"
];
}
[
self
.
tableView
reloadData
];
[
MBProgressHUD
hideHUDForView
:
self
.
view
animated
:
YES
];
}];
}
-
(
NSArray
*
)
sortRankListWithRankListArray
:
(
NSMutableArray
*
)
allRanking
{
NSArray
*
sortedArray
=
[
allRanking
sortedArrayUsingComparator
:
^
NSComparisonResult
(
RankListModel
*
p1
,
RankListModel
*
p2
){
//
return [p2.score compare:p1.score];
//
return [p2.score compare:p1.score];
return
[
@
(
p2
.
score
)
compare
:
@
(
p1
.
score
)];
}];
return
sortedArray
;
}
-
(
void
)
requestAllQuestion
-
(
void
)
requestInspectList
{
NSString
*
url2
=
[
NSString
stringWithFormat
:
@"%@%@"
,
kRedStarURL
,
kQuestionListURL
];
NSString
*
url
=
[
NSString
stringWithFormat
:
@"%@%@"
,
kRedStarURL
,
kInspectListURL
];
NSLog
(
@"uuuurl = %@"
,
url
);
HttpClient
*
httpCilent
=
[[
HttpClient
alloc
]
initWithUrl
:
url
];
NSDictionary
*
parameters
=
@{
@"keyword"
:
self
.
customStr
,
@"userUuid"
:
[[
NSUserDefaults
standardUserDefaults
]
objectForKey
:
@"user_uuid"
],
@"queryOrders"
:
@[@{
@"field"
:
@"lastModifyInfo"
,
@"direction"
:
@"desc"
}],
@"pageNumber"
:
@
(
0
),
@"pageSize"
:
@
(
10
)
};
NSLog
(
@"parrrrr = %@"
,
parameters
);
[
httpCilent
getInspectListWithParameters
:
parameters
completion
:
^
(
id
response
,
NSError
*
error
)
{
NSLog
(
@"巡检列表%@"
,
response
);
NSLog
(
@"error = %@"
,
error
);
NSDictionary
*
dataDict
=
response
[
@"data"
];
NSArray
*
dataArray
=
dataDict
[
@"records"
];
for
(
NSDictionary
*
dict
in
dataArray
)
{
TaskListModel
*
taskList
=
[[
TaskListModel
alloc
]
init
];
[
taskList
setValuesForKeysWithDictionary
:
dict
];
[
_taskListDataArray
addObject
:
taskList
];
}
if
(
_taskListDataArray
.
count
!=
0
)
{
[
_sectionArray
addObject
:
@"口碑巡检"
];
}
[
self
.
tableView
reloadData
];
[
MBProgressHUD
hideHUDForView
:
self
.
view
animated
:
YES
];
}];
}
-
(
void
)
requestQuestionList
{
// 初始化数组
// 请求地址
NSString
*
urlStr
=
[
NSString
stringWithFormat
:
@"%@%@"
,
kRedStarURL
,
kQuestionListURL
];
NSString
*
user_uuid
=
[[
NSUserDefaults
standardUserDefaults
]
objectForKey
:
@"user_uuid"
];
NSDictionary
*
parameters2
=
@{
@"keyword"
:
self
.
customStr
,
@"user"
:
user_uuid
,
@"scope"
:
@"all"
,
@"pageNumber"
:
@
(
0
),
@"pageSize"
:
@
(
10
)
};
__block
SearchViewController
*
weakSelf
=
self
;
HttpClient
*
httpClient2
=
[[
HttpClient
alloc
]
initWithUrl
:
url2
];
[
httpClient2
getQuestionListWithParameters
:
parameters2
completion
:
^
(
id
response
,
NSError
*
error
)
{
// 请求参数
NSDictionary
*
parameters
=
@{
@"keyword"
:
self
.
customStr
,
@"user"
:
user_uuid
,
@"scope"
:
@"all"
,
@"pageNumber"
:
@
(
0
),
@"pageSize"
:
@
(
10
)
};
// 发起请求
HttpClient
*
httpClient
=
[[
HttpClient
alloc
]
initWithUrl
:
urlStr
];
//
// 请求问题列表
[
httpClient
getQuestionListWithParameters
:
parameters
completion
:
^
(
id
response
,
NSError
*
error
)
{
NSDictionary
*
dataDict
=
(
NSDictionary
*
)
response
[
@"data"
];
NSDictionary
*
recordsDict
=
(
NSDictionary
*
)
dataDict
[
@"records"
];
NSLog
(
@"问题与知识列表recods = %@"
,
response
);
NSMutableArray
*
questionTempArr
=
[
NSMutableArray
array
];
NSLog
(
@"error = %@"
,
error
);
for
(
NSDictionary
*
questionDict
in
recordsDict
)
{
QuestionModel
*
question
=
[[
QuestionModel
alloc
]
init
];
[
question
setValuesForKeysWithDictionary
:
questionDict
];
[
questionTempArr
addObject
:
question
];
[
_allQuestionArray
addObject
:
question
];
}
weakSelf
.
allQuestionArray
=
questionTempArr
;
if
(
_allQuestionArray
.
count
!=
0
)
{
if
(
!
[
_titleArray
containsObject
:
@"问题知识"
])
{
[
_titleArray
addObject
:
@"问题知识"
];
}
[
_sectionArray
addObject
:
@"问题知识"
];
}
[
self
.
tableView
reloadData
];
[
MBProgressHUD
hideHUDForView
:
self
.
view
animated
:
YES
];
}];
}
-
(
void
)
requestPicturePraise
{
// 请求地址
NSString
*
urlStr
=
[
NSString
stringWithFormat
:
@"%@%@"
,
kRedStarURL
,
kQueryPicturePraiseURL
];
NSString
*
user_uuid
=
[[
NSUserDefaults
standardUserDefaults
]
objectForKey
:
@"user_uuid"
];
NSDictionary
*
parameters
=
@{
@"keyword"
:
self
.
customStr
,
@"scope"
:
@"all"
,
@"user"
:
user_uuid
,
@"type"
:
@"store"
,
@"pageNumber"
:
@
(
0
),
@"pageSize"
:
@
(
10
)
};
// 发起请求
HttpClient
*
httpClient
=
[[
HttpClient
alloc
]
initWithUrl
:
urlStr
];
[
MBProgressHUD
showHUDAddedTo
:
self
.
view
animated
:
YES
];
// 请求问题列表
[
httpClient
queryPicturePraiseWithParameters
:
parameters
completion
:
^
(
id
response
,
NSError
*
error
)
{
NSLog
(
@"图说口碑 response = %@ error = %@"
,
response
,
error
);
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
=
tempArray
;
if
(
_allPraiseListArray
.
count
!=
0
)
{
[
_sectionArray
addObject
:
@"商场风采"
];
}
[
self
.
tableView
reloadData
];
[
MBProgressHUD
hideHUDForView
:
self
.
view
animated
:
YES
];
}];
}
// 返回上一页面
-
(
void
)
doBack
:
(
UIBarButtonItem
*
)
sender
...
...
@@ -313,39 +353,44 @@
}
#pragma mark - TableView Delegate/DataSource
#pragma mark - TableView Delegate/DataSource
-
(
NSInteger
)
numberOfSectionsInTableView
:
(
UITableView
*
)
tableView
{
return
_
title
Array
.
count
;
return
_
section
Array
.
count
;
}
-
(
NSInteger
)
tableView
:
(
UITableView
*
)
tableView
numberOfRowsInSection
:
(
NSInteger
)
section
{
NSUInteger
s1
=
[
_titleArray
indexOfObject
:
@"口碑巡检"
];
NSUInteger
s2
=
[
_titleArray
indexOfObject
:
@"口碑报告"
];
NSUInteger
s3
=
[
_titleArray
indexOfObject
:
@"问题知识"
];
if
([
_titleArray
[
section
]
isEqualToString
:
@"口碑巡检"
]
&&
section
==
s1
)
{
NSUInteger
s2
=
[
_sectionArray
indexOfObject
:
@"口碑报告"
];
NSUInteger
s4
=
[
_sectionArray
indexOfObject
:
@"商场风采"
];
NSUInteger
s3
=
[
_sectionArray
indexOfObject
:
@"问题知识"
];
NSUInteger
s1
=
[
_sectionArray
indexOfObject
:
@"口碑巡检"
];
if
([
_sectionArray
[
section
]
isEqualToString
:
@"口碑巡检"
]
&&
section
==
s1
)
{
return
_taskListDataArray
.
count
;
}
else
if
([
_
title
Array
[
section
]
isEqualToString
:
@"口碑报告"
]
&&
section
==
s2
)
{
}
else
if
([
_
section
Array
[
section
]
isEqualToString
:
@"口碑报告"
]
&&
section
==
s2
)
{
return
_allRankListArray
.
count
+
1
;
}
else
if
([
_
title
Array
[
section
]
isEqualToString
:
@"问题知识"
]
&&
section
==
s3
)
{
}
else
if
([
_
section
Array
[
section
]
isEqualToString
:
@"问题知识"
]
&&
section
==
s3
)
{
return
_allQuestionArray
.
count
;
}
else
if
([
_sectionArray
[
section
]
isEqualToString
:
@"商场风采"
]
&&
section
==
s4
)
{
return
_allPraiseListArray
.
count
;
}
else
{
return
0
;
}
}
// cell显示的内容
-
(
UITableViewCell
*
)
tableView
:
(
UITableView
*
)
tableView
cellForRowAtIndexPath
:
(
NSIndexPath
*
)
indexPath
{
NSUInteger
s2
=
[
_sectionArray
indexOfObject
:
@"口碑报告"
];
NSUInteger
s4
=
[
_sectionArray
indexOfObject
:
@"商场风采"
];
NSUInteger
s3
=
[
_sectionArray
indexOfObject
:
@"问题知识"
];
NSUInteger
s1
=
[
_sectionArray
indexOfObject
:
@"口碑巡检"
];
NSUInteger
s1
=
[
_titleArray
indexOfObject
:
@"口碑巡检"
];
NSUInteger
s2
=
[
_titleArray
indexOfObject
:
@"口碑报告"
];
NSUInteger
s3
=
[
_titleArray
indexOfObject
:
@"问题知识"
];
if
([
_titleArray
[
indexPath
.
section
]
isEqualToString
:
@"口碑巡检"
]
&&
indexPath
.
section
==
s1
)
{
if
([
_sectionArray
[
indexPath
.
section
]
isEqualToString
:
@"口碑巡检"
]
&&
indexPath
.
section
==
s1
)
{
InspectListCell
*
cell
=
[
tableView
dequeueReusableCellWithIdentifier
:
kHomeInspectListCell
];
if
(
!
cell
)
{
cell
=
[[
InspectListCell
alloc
]
initWithStyle
:
UITableViewCellStyleValue1
reuseIdentifier
:
kHomeInspectListCell
];
...
...
@@ -358,7 +403,7 @@
image
=
[
image
resizableImageWithCapInsets
:
UIEdgeInsetsZero
resizingMode
:
UIImageResizingModeTile
];
cell
.
alreadyView
.
image
=
image
;
return
cell
;
}
else
if
([
_
title
Array
[
indexPath
.
section
]
isEqualToString
:
@"口碑报告"
]
&&
indexPath
.
section
==
s2
)
{
}
else
if
([
_
section
Array
[
indexPath
.
section
]
isEqualToString
:
@"口碑报告"
]
&&
indexPath
.
section
==
s2
)
{
if
(
indexPath
.
row
==
0
)
{
HomeTitleTableCell
*
cell
=
[
tableView
dequeueReusableCellWithIdentifier
:
kHomeTitleTableCell
];
if
(
!
cell
)
{
...
...
@@ -373,11 +418,11 @@
}
RankListModel
*
rankList
=
_allRankListArray
[
indexPath
.
row
-
1
];
cell
.
rankList
=
rankList
;
cell
.
gradeImageView
.
image
=
[
UIImage
imageNamed
:[
NSString
stringWithFormat
:
@"medal_0%d"
,
rankList
.
index
]];
cell
.
gradeImageView
.
image
=
[
UIImage
imageNamed
:[
NSString
stringWithFormat
:
@"medal_0%d"
,
rankList
.
index
+
1
]];
cell
.
selectionStyle
=
UITableViewCellSelectionStyleNone
;
return
cell
;
}
}
else
if
([
_
title
Array
[
indexPath
.
section
]
isEqualToString
:
@"问题知识"
]
&&
indexPath
.
section
==
s3
)
{
}
else
if
([
_
section
Array
[
indexPath
.
section
]
isEqualToString
:
@"问题知识"
]
&&
indexPath
.
section
==
s3
)
{
// 问题与知识
QuestionListTableCell
*
cell
=
[
tableView
dequeueReusableCellWithIdentifier
:
kHomeQuestionListTableCell
];
if
(
!
cell
)
{
...
...
@@ -387,68 +432,64 @@
QuestionModel
*
question
=
_allQuestionArray
[
indexPath
.
row
];
cell
.
question
=
question
;
return
cell
;
}
else
if
([
_sectionArray
[
indexPath
.
section
]
isEqualToString
:
@"商场风采"
]
&&
indexPath
.
section
==
s4
)
{
PictureTableCell
*
cell
=
[
tableView
dequeueReusableCellWithIdentifier
:
kHomePictureListCell
];
if
(
!
cell
)
{
cell
=
[[
PictureTableCell
alloc
]
initWithStyle
:
UITableViewCellStyleValue1
reuseIdentifier
:
kHomePictureListCell
];
}
cell
.
pictureList
=
_allPraiseListArray
[
indexPath
.
row
];
return
cell
;
}
else
{
return
nil
;
}
}
// cell点击事件
-
(
void
)
tableView
:
(
UITableView
*
)
tableView
didSelectRowAtIndexPath
:
(
NSIndexPath
*
)
indexPath
{
if
(
_titleArray
.
count
==
5
)
{
if
(
indexPath
.
section
==
0
)
{
InspectTaskViewController
*
inspectTaskVC
=
[[
InspectTaskViewController
alloc
]
init
];
TaskListModel
*
taskList
=
self
.
taskListDataArray
[
indexPath
.
row
];
inspectTaskVC
.
uuid
=
taskList
.
uuid
;
inspectTaskVC
.
store_uuid
=
taskList
.
store_uuid
;
inspectTaskVC
.
multiplier
=
(
CGFloat
)
taskList
.
reportCount
/
taskList
.
questionCount
;
self
.
hidesBottomBarWhenPushed
=
YES
;
[
self
.
navigationController
pushViewController
:
inspectTaskVC
animated
:
YES
]
;
}
else
{
QuestionDetailViewController
*
questionDetailVC
=
[[
QuestionDetailViewController
alloc
]
init
]
;
QuestionModel
*
question
=
self
.
allQuestionArray
[
indexPath
.
row
];
questionDetailVC
.
questionUuid
=
question
.
uuid
;
self
.
hidesBottomBarWhenPushed
=
YES
;
[
self
.
navigationController
pushViewController
:
questionDetailVC
animated
:
YES
]
;
NSUInteger
s2
=
[
_sectionArray
indexOfObject
:
@"口碑报告"
];
NSUInteger
s4
=
[
_sectionArray
indexOfObject
:
@"商场风采"
];
NSUInteger
s3
=
[
_sectionArray
indexOfObject
:
@"问题知识"
];
NSUInteger
s1
=
[
_sectionArray
indexOfObject
:
@"口碑巡检"
];
if
([
_sectionArray
[
indexPath
.
section
]
isEqualToString
:
@"口碑巡检"
]
&&
indexPath
.
section
==
s1
)
{
InspectTaskViewController
*
inspectTaskVC
=
[[
InspectTaskViewController
alloc
]
init
]
;
TaskListModel
*
taskList
=
self
.
taskListDataArray
[
indexPath
.
row
]
;
inspectTaskVC
.
uuid
=
taskList
.
uuid
;
inspectTaskVC
.
store_uuid
=
taskList
.
store_uuid
;
inspectTaskVC
.
multiplier
=
(
CGFloat
)
taskList
.
reportCount
/
taskList
.
questionCount
;
self
.
hidesBottomBarWhenPushed
=
YES
;
[
self
.
navigationController
pushViewController
:
inspectTaskVC
animated
:
YES
];
}
else
if
([
_sectionArray
[
indexPath
.
section
]
isEqualToString
:
@"口碑报告"
]
&&
indexPath
.
section
==
s2
)
{
if
(
indexPath
.
row
==
0
)
{
return
;
}
RankListModel
*
rankList
=
_allRankListArray
[
indexPath
.
row
-
1
];
RankDetailViewController
*
rankDetailVC
=
[[
RankDetailViewController
alloc
]
init
];
rankDetailVC
.
indexRow
=
rankList
.
index
;
rankDetailVC
.
uuid
=
rankList
.
uuid
;
rankDetailVC
.
store_uuid
=
rankList
.
store_uuid
;
rankDetailVC
.
storeAddress
=
rankList
.
storeAddress
;
rankDetailVC
.
storePictures
=
rankList
.
storePictures
;
self
.
hidesBottomBarWhenPushed
=
YES
;
[
self
.
navigationController
pushViewController
:
rankDetailVC
animated
:
YES
];
}
else
if
([
_sectionArray
[
indexPath
.
section
]
isEqualToString
:
@"问题知识"
]
&&
indexPath
.
section
==
s3
)
{
QuestionDetailViewController
*
questionDetailVC
=
[[
QuestionDetailViewController
alloc
]
init
];
QuestionModel
*
question
=
self
.
allQuestionArray
[
indexPath
.
row
];
questionDetailVC
.
questionUuid
=
question
.
uuid
;
self
.
hidesBottomBarWhenPushed
=
YES
;
[
self
.
navigationController
pushViewController
:
questionDetailVC
animated
:
YES
];
}
else
if
([
_sectionArray
[
indexPath
.
section
]
isEqualToString
:
@"商场风采"
]
&&
indexPath
.
section
==
s4
)
{
PictureListModel
*
picList
=
_allPraiseListArray
[
indexPath
.
row
];
PictureStoryViewController
*
storyVC
=
[[
PictureStoryViewController
alloc
]
init
];
storyVC
.
uuid
=
picList
.
uuid
;
self
.
hidesBottomBarWhenPushed
=
YES
;
[
self
.
navigationController
pushViewController
:
storyVC
animated
:
YES
];
}
else
{
if
(
indexPath
.
section
==
0
)
{
InspectTaskViewController
*
inspectTaskVC
=
[[
InspectTaskViewController
alloc
]
init
];
TaskListModel
*
taskList
=
self
.
taskListDataArray
[
indexPath
.
row
];
inspectTaskVC
.
uuid
=
taskList
.
uuid
;
inspectTaskVC
.
store_uuid
=
taskList
.
store_uuid
;
inspectTaskVC
.
multiplier
=
(
CGFloat
)
taskList
.
reportCount
/
taskList
.
questionCount
;
self
.
hidesBottomBarWhenPushed
=
YES
;
[
self
.
navigationController
pushViewController
:
inspectTaskVC
animated
:
YES
];
}
else
if
(
indexPath
.
section
==
1
)
{
if
(
indexPath
.
row
==
0
)
{
NSLog
(
@"不能点击"
);
}
else
{
RankListModel
*
rankList
=
_allRankListArray
[
indexPath
.
row
-
1
];
RankDetailViewController
*
rankDetailVC
=
[[
RankDetailViewController
alloc
]
init
];
rankDetailVC
.
indexRow
=
indexPath
.
section
-
2
;
rankDetailVC
.
uuid
=
rankList
.
uuid
;
rankDetailVC
.
store_uuid
=
rankList
.
store_uuid
;
rankDetailVC
.
storeAddress
=
rankList
.
storeAddress
;
rankDetailVC
.
storePictures
=
rankList
.
storePictures
;
self
.
hidesBottomBarWhenPushed
=
YES
;
[
self
.
navigationController
pushViewController
:
rankDetailVC
animated
:
YES
];
}
}
else
{
QuestionDetailViewController
*
questionDetailVC
=
[[
QuestionDetailViewController
alloc
]
init
];
QuestionModel
*
question
=
self
.
allQuestionArray
[
indexPath
.
row
];
questionDetailVC
.
questionUuid
=
question
.
uuid
;
self
.
hidesBottomBarWhenPushed
=
YES
;
[
self
.
navigationController
pushViewController
:
questionDetailVC
animated
:
YES
];
}
return
;
}
}
...
...
@@ -495,7 +536,7 @@
titleLabel
.
translatesAutoresizingMaskIntoConstraints
=
NO
;
titleLabel
.
textColor
=
kPictureCellDetailsColor
;
titleLabel
.
font
=
[
UIFont
systemFontOfSize
:
17
.
0
];
titleLabel
.
text
=
_
title
Array
[
section
];
titleLabel
.
text
=
_
section
Array
[
section
];
[
sectionView
addSubview
:
titleLabel
];
...
...
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