Commit db5156eb authored by admin's avatar admin

展开全部修复

parent ddab2987
......@@ -15,7 +15,6 @@
8409BDFC1C281ACD00354460 /* SelectStoreHeadView.m in Sources */ = {isa = PBXBuildFile; fileRef = 8409BDF21C281ACD00354460 /* SelectStoreHeadView.m */; };
8409BDFD1C281ACD00354460 /* TreeView.m in Sources */ = {isa = PBXBuildFile; fileRef = 8409BDF41C281ACD00354460 /* TreeView.m */; };
8409BDFE1C281ACD00354460 /* SelectStoreViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 8409BDF71C281ACD00354460 /* SelectStoreViewController.m */; };
840ABECC1BE1C29F006E49C5 /* RankDetailViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 840ABECB1BE1C29F006E49C5 /* RankDetailViewController.m */; };
8419EAD41BEDC98F002635ED /* HttpClient.m in Sources */ = {isa = PBXBuildFile; fileRef = 8419EAD31BEDC98F002635ED /* HttpClient.m */; };
841D24F81BEB473C0005CC9F /* CheckPicViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 841D24F71BEB473C0005CC9F /* CheckPicViewController.m */; };
841D24FB1BEB75CA0005CC9F /* QuestionDetailFooterView.m in Sources */ = {isa = PBXBuildFile; fileRef = 841D24FA1BEB75CA0005CC9F /* QuestionDetailFooterView.m */; };
......@@ -96,7 +95,6 @@
84AD4F3D1BF4894D00BFB37C /* RankDetailView.m in Sources */ = {isa = PBXBuildFile; fileRef = 84AD4F3C1BF4894D00BFB37C /* RankDetailView.m */; };
84AD4F3F1BF498A900BFB37C /* ranking.plist in Resources */ = {isa = PBXBuildFile; fileRef = 84AD4F3E1BF498A900BFB37C /* ranking.plist */; };
84AD4F461BF4A9E800BFB37C /* RankHeadView.m in Sources */ = {isa = PBXBuildFile; fileRef = 84AD4F451BF4A9E800BFB37C /* RankHeadView.m */; };
84AD4F491BF4BC0600BFB37C /* RankDetailTableCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 84AD4F481BF4BC0600BFB37C /* RankDetailTableCell.m */; };
84BB16A21C191A7F00383A64 /* OnLineResultFootView.m in Sources */ = {isa = PBXBuildFile; fileRef = 84BB16A11C191A7F00383A64 /* OnLineResultFootView.m */; };
84C9574D1BDB344900083584 /* UIBarButtonItem+Create.m in Sources */ = {isa = PBXBuildFile; fileRef = 84C9574A1BDB344900083584 /* UIBarButtonItem+Create.m */; };
84C9574E1BDB344900083584 /* UIView+Frame.m in Sources */ = {isa = PBXBuildFile; fileRef = 84C9574C1BDB344900083584 /* UIView+Frame.m */; };
......@@ -123,6 +121,10 @@
84D2F5171C2CD3D400651EFB /* SOPViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 84D2F5161C2CD3D400651EFB /* SOPViewController.m */; };
84D2F51A1C2CE67500651EFB /* SOPTableView.m in Sources */ = {isa = PBXBuildFile; fileRef = 84D2F5191C2CE67500651EFB /* SOPTableView.m */; };
84D2F5201C2D213400651EFB /* AttachmentTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 84D2F51F1C2D213400651EFB /* AttachmentTableViewCell.m */; };
84D2F5341C2D739700651EFB /* RankDetailTableCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 84D2F52C1C2D739700651EFB /* RankDetailTableCell.m */; };
84D2F5351C2D739700651EFB /* RankScrollTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 84D2F52E1C2D739700651EFB /* RankScrollTableViewCell.m */; };
84D2F5361C2D739700651EFB /* RankSectionTableCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 84D2F5301C2D739700651EFB /* RankSectionTableCell.m */; };
84D2F5371C2D739700651EFB /* RankDetailViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 84D2F5331C2D739700651EFB /* RankDetailViewController.m */; };
84D3E5F01C04BC8C001FF1DD /* InspectUploadedViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 84D3E5EF1C04BC8C001FF1DD /* InspectUploadedViewController.m */; };
84D3E5F31C04BCD3001FF1DD /* InspectNotUploadViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 84D3E5F21C04BCD3001FF1DD /* InspectNotUploadViewController.m */; };
84D3E5F91C04BD8E001FF1DD /* InspectNotUpLoadCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 84D3E5F81C04BD8E001FF1DD /* InspectNotUpLoadCell.m */; };
......@@ -196,8 +198,6 @@
8409BDF41C281ACD00354460 /* TreeView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TreeView.m; sourceTree = "<group>"; };
8409BDF61C281ACD00354460 /* SelectStoreViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SelectStoreViewController.h; sourceTree = "<group>"; };
8409BDF71C281ACD00354460 /* SelectStoreViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SelectStoreViewController.m; sourceTree = "<group>"; };
840ABECA1BE1C29F006E49C5 /* RankDetailViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RankDetailViewController.h; sourceTree = "<group>"; };
840ABECB1BE1C29F006E49C5 /* RankDetailViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RankDetailViewController.m; sourceTree = "<group>"; };
8419EAD21BEDC98F002635ED /* HttpClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HttpClient.h; sourceTree = "<group>"; };
8419EAD31BEDC98F002635ED /* HttpClient.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HttpClient.m; sourceTree = "<group>"; };
841D24F61BEB473C0005CC9F /* CheckPicViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CheckPicViewController.h; sourceTree = "<group>"; };
......@@ -359,8 +359,6 @@
84AD4F3E1BF498A900BFB37C /* ranking.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = ranking.plist; sourceTree = "<group>"; };
84AD4F441BF4A9E800BFB37C /* RankHeadView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RankHeadView.h; sourceTree = "<group>"; };
84AD4F451BF4A9E800BFB37C /* RankHeadView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RankHeadView.m; sourceTree = "<group>"; };
84AD4F471BF4BC0600BFB37C /* RankDetailTableCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RankDetailTableCell.h; sourceTree = "<group>"; };
84AD4F481BF4BC0600BFB37C /* RankDetailTableCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RankDetailTableCell.m; sourceTree = "<group>"; };
84BB16A01C191A7F00383A64 /* OnLineResultFootView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OnLineResultFootView.h; sourceTree = "<group>"; };
84BB16A11C191A7F00383A64 /* OnLineResultFootView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OnLineResultFootView.m; sourceTree = "<group>"; };
84C957491BDB344900083584 /* UIBarButtonItem+Create.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIBarButtonItem+Create.h"; sourceTree = "<group>"; };
......@@ -414,6 +412,14 @@
84D2F5191C2CE67500651EFB /* SOPTableView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SOPTableView.m; sourceTree = "<group>"; };
84D2F51E1C2D213400651EFB /* AttachmentTableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AttachmentTableViewCell.h; sourceTree = "<group>"; };
84D2F51F1C2D213400651EFB /* AttachmentTableViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AttachmentTableViewCell.m; sourceTree = "<group>"; };
84D2F52B1C2D739700651EFB /* RankDetailTableCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RankDetailTableCell.h; sourceTree = "<group>"; };
84D2F52C1C2D739700651EFB /* RankDetailTableCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RankDetailTableCell.m; sourceTree = "<group>"; };
84D2F52D1C2D739700651EFB /* RankScrollTableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RankScrollTableViewCell.h; sourceTree = "<group>"; };
84D2F52E1C2D739700651EFB /* RankScrollTableViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RankScrollTableViewCell.m; sourceTree = "<group>"; };
84D2F52F1C2D739700651EFB /* RankSectionTableCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RankSectionTableCell.h; sourceTree = "<group>"; };
84D2F5301C2D739700651EFB /* RankSectionTableCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RankSectionTableCell.m; sourceTree = "<group>"; };
84D2F5321C2D739700651EFB /* RankDetailViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RankDetailViewController.h; sourceTree = "<group>"; };
84D2F5331C2D739700651EFB /* RankDetailViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RankDetailViewController.m; sourceTree = "<group>"; };
84D3E5EE1C04BC8C001FF1DD /* InspectUploadedViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectUploadedViewController.h; sourceTree = "<group>"; };
84D3E5EF1C04BC8C001FF1DD /* InspectUploadedViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = InspectUploadedViewController.m; sourceTree = "<group>"; };
84D3E5F11C04BCD3001FF1DD /* InspectNotUploadViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectNotUploadViewController.h; sourceTree = "<group>"; };
......@@ -1003,32 +1009,14 @@
848699AA1BDF810900859DFE /* RankDetail */ = {
isa = PBXGroup;
children = (
84D2F52A1C2D739700651EFB /* Cell */,
84D2F5311C2D739700651EFB /* ViewController */,
84AD4F401BF49FC100BFB37C /* Model */,
84AD4F371BF4842C00BFB37C /* View */,
848699AB1BDF810900859DFE /* Cell */,
848699AC1BDF810900859DFE /* ViewController */,
);
path = RankDetail;
sourceTree = "<group>";
};
848699AB1BDF810900859DFE /* Cell */ = {
isa = PBXGroup;
children = (
84AD4F471BF4BC0600BFB37C /* RankDetailTableCell.h */,
84AD4F481BF4BC0600BFB37C /* RankDetailTableCell.m */,
);
path = Cell;
sourceTree = "<group>";
};
848699AC1BDF810900859DFE /* ViewController */ = {
isa = PBXGroup;
children = (
840ABECA1BE1C29F006E49C5 /* RankDetailViewController.h */,
840ABECB1BE1C29F006E49C5 /* RankDetailViewController.m */,
);
path = ViewController;
sourceTree = "<group>";
};
848699AD1BDF810900859DFE /* RankingList */ = {
isa = PBXGroup;
children = (
......@@ -1916,6 +1904,28 @@
path = ViewController;
sourceTree = "<group>";
};
84D2F52A1C2D739700651EFB /* Cell */ = {
isa = PBXGroup;
children = (
84D2F52B1C2D739700651EFB /* RankDetailTableCell.h */,
84D2F52C1C2D739700651EFB /* RankDetailTableCell.m */,
84D2F52D1C2D739700651EFB /* RankScrollTableViewCell.h */,
84D2F52E1C2D739700651EFB /* RankScrollTableViewCell.m */,
84D2F52F1C2D739700651EFB /* RankSectionTableCell.h */,
84D2F5301C2D739700651EFB /* RankSectionTableCell.m */,
);
path = Cell;
sourceTree = "<group>";
};
84D2F5311C2D739700651EFB /* ViewController */ = {
isa = PBXGroup;
children = (
84D2F5321C2D739700651EFB /* RankDetailViewController.h */,
84D2F5331C2D739700651EFB /* RankDetailViewController.m */,
);
path = ViewController;
sourceTree = "<group>";
};
84DB9BC11BDCD49900822CC4 /* CustomDropMenu */ = {
isa = PBXGroup;
children = (
......@@ -2276,7 +2286,6 @@
buildActionMask = 2147483647;
files = (
8490C4C61BF9CE85006B6569 /* HomeTitleTableCell.m in Sources */,
840ABECC1BE1C29F006E49C5 /* RankDetailViewController.m in Sources */,
8497B62B1C043671007ECBE6 /* InspectTableView.m in Sources */,
8409BDF91C281ACD00354460 /* SelectYetTableViewCell.m in Sources */,
84AD4F261BF4356A00BFB37C /* TaskModel.m in Sources */,
......@@ -2305,6 +2314,7 @@
84CC34CC1C093C2F002F10E2 /* OnLineTableViewCell.m in Sources */,
84945F1B1C2A6A6300C1793C /* AboutMeViewController.m in Sources */,
84E363D21BFAC5200061547E /* TaskListModel.m in Sources */,
84D2F5351C2D739700651EFB /* RankScrollTableViewCell.m in Sources */,
84C9574E1BDB344900083584 /* UIView+Frame.m in Sources */,
848699B01BDF810900859DFE /* InspectListCell.m in Sources */,
846206B51C06AF700015C456 /* RankListHeaderView.m in Sources */,
......@@ -2313,6 +2323,7 @@
84CEB1721C2946EC0072ED0A /* StoreDetailModel.m in Sources */,
8474C5951BE78AE1007DCF19 /* QuestionDetailViewController.m in Sources */,
84970DEF1BD8DD8A00C1728A /* main.m in Sources */,
84D2F5361C2D739700651EFB /* RankSectionTableCell.m in Sources */,
8474A01C1BE368D700315F30 /* HomeCellItem.m in Sources */,
8409BDFD1C281ACD00354460 /* TreeView.m in Sources */,
8409BDFB1C281ACD00354460 /* TreeNodeModel.m in Sources */,
......@@ -2331,6 +2342,7 @@
84AD4F361BF45BEB00BFB37C /* InspectSortTableCell.m in Sources */,
8480BEA21C14326100E2F18F /* MoreScreenView.m in Sources */,
84970E281BD8DEFE00C1728A /* AppDelegate.m in Sources */,
84D2F5341C2D739700651EFB /* RankDetailTableCell.m in Sources */,
8409BDFE1C281ACD00354460 /* SelectStoreViewController.m in Sources */,
849B2F771C0CABE6005D809F /* AnnounceDetailModel.m in Sources */,
8490C4C31BF9A394006B6569 /* CustomPageControl.m in Sources */,
......@@ -2340,7 +2352,6 @@
84D2F51A1C2CE67500651EFB /* SOPTableView.m in Sources */,
84ED5DD81BF2E64300A1BB6D /* ScreenView.m in Sources */,
8474C5831BE751A2007DCF19 /* CommonFunc.m in Sources */,
84AD4F491BF4BC0600BFB37C /* RankDetailTableCell.m in Sources */,
84DC873E1C24E90E00811037 /* AddPicTextTableViewCell.m in Sources */,
848699B31BDF810900859DFE /* InspectTaskViewController.m in Sources */,
84CC34D81C094682002F10E2 /* StandardTableViewCell.m in Sources */,
......@@ -2388,6 +2399,7 @@
846ABDFC1C1EAB160020C331 /* PicTextModel.m in Sources */,
84A673911C0C2681000F828E /* FunctionViewController.m in Sources */,
848699B61BDF812F00859DFE /* RankingListViewController.m in Sources */,
84D2F5371C2D739700651EFB /* RankDetailViewController.m in Sources */,
84C9729C1C1ADC5B003A3276 /* PictureTextTableCell.m in Sources */,
84D825821BDD35E000CC61F7 /* HomeHeaderView.m in Sources */,
849A18431C152CEE00071600 /* AddPictureViewController.m in Sources */,
......
No preview for this file type
redstar/Assets.xcassets/home/unfold_btn.imageset/unfold_btn@2x.png

1.38 KB | W: 0px | H: 0px

redstar/Assets.xcassets/home/unfold_btn.imageset/unfold_btn@2x.png

15.1 KB | W: 0px | H: 0px

redstar/Assets.xcassets/home/unfold_btn.imageset/unfold_btn@2x.png
redstar/Assets.xcassets/home/unfold_btn.imageset/unfold_btn@2x.png
redstar/Assets.xcassets/home/unfold_btn.imageset/unfold_btn@2x.png
redstar/Assets.xcassets/home/unfold_btn.imageset/unfold_btn@2x.png
  • 2-up
  • Swipe
  • Onion skin
redstar/Assets.xcassets/home/unfold_btn.imageset/unfold_btn@3x.png

1.66 KB | W: 0px | H: 0px

redstar/Assets.xcassets/home/unfold_btn.imageset/unfold_btn@3x.png

15.3 KB | W: 0px | H: 0px

redstar/Assets.xcassets/home/unfold_btn.imageset/unfold_btn@3x.png
redstar/Assets.xcassets/home/unfold_btn.imageset/unfold_btn@3x.png
redstar/Assets.xcassets/home/unfold_btn.imageset/unfold_btn@3x.png
redstar/Assets.xcassets/home/unfold_btn.imageset/unfold_btn@3x.png
  • 2-up
  • Swipe
  • Onion skin
......@@ -79,8 +79,10 @@
NSString *url = [NSString stringWithFormat:@"%@%@", kRedStarURL, kGetAttachmentsURL];
HttpClient *http = [[HttpClient alloc] initWithUrl:url];
NSDictionary *parameters = @{@"type":@"sop",
@"category1":_titleArray[_groupTabBar.selectNumber],
@"category2":_detailTitle
// @"category1":_titleArray[_groupTabBar.selectNumber],
// @"category2":_detailTitle
@"category1":@"11",
@"category2":@"22"
};
[http getAttachmentsWithParameters:parameters completion:^(id response, NSError *error) {
NSLog(@"7.1 口碑标注附件列表 = %@, error = %@", response, error);
......
......@@ -29,6 +29,9 @@
@property (nonatomic, copy) NSString *originScore;
@property (nonatomic, copy) NSString *readonlyType;
@property (nonatomic, copy) NSString *orderNo;
@property (nonatomic, assign) int index;
+ (instancetype)taskModelWithDict:(NSDictionary *)dict;
- (instancetype)initWithDict:(NSDictionary *)dict;
@end
......@@ -64,12 +64,13 @@
NSLayoutConstraint *shoppingLeft = [NSLayoutConstraint constraintWithItem:_mainTitleBtn attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeLeft multiplier:1.0 constant:37];
[self.contentView addConstraint:shoppingLeft];
NSLayoutConstraint *shoppingRight = [NSLayoutConstraint constraintWithItem:_mainTitleBtn attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.scoreLabel attribute:NSLayoutAttributeLeft multiplier:1.0 constant:0];
[self.contentView addConstraint:shoppingRight];
NSLayoutConstraint *shoppingHeight = [NSLayoutConstraint constraintWithItem:_mainTitleBtn attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:42];
[self.contentView addConstraint:shoppingHeight];
NSLayoutConstraint *shoppingBottom = [NSLayoutConstraint constraintWithItem:_mainTitleBtn attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:-2];
[self.contentView addConstraint:shoppingBottom];
}
return _mainTitleBtn;
......
//
// RankScrollTableViewCell.h
// redstar
//
// Created by admin on 15/12/25.
// Copyright © 2015年 ZWF. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface RankScrollTableViewCell : UITableViewCell
@property (nonatomic, strong) UIScrollView *scrollView;
@end
//
// RankScrollTableViewCell.m
// redstar
//
// Created by admin on 15/12/25.
// Copyright © 2015年 ZWF. All rights reserved.
//
#import "RankScrollTableViewCell.h"
#import <UIButton+WebCache.h>
@implementation RankScrollTableViewCell
- (UIScrollView *)scrollView
{
if (!_scrollView) {
_scrollView = [[UIScrollView alloc] init];
_scrollView.translatesAutoresizingMaskIntoConstraints = NO;
[self.contentView addSubview:_scrollView];
NSLayoutConstraint *someoneTop = [NSLayoutConstraint constraintWithItem:_scrollView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeTop multiplier:1.0 constant:5];
[self.contentView addConstraint:someoneTop];
NSLayoutConstraint *someoneLeft = [NSLayoutConstraint constraintWithItem:_scrollView attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeLeft multiplier:1.0 constant:20];
[self.contentView addConstraint:someoneLeft];
NSLayoutConstraint *someoneRight = [NSLayoutConstraint constraintWithItem:_scrollView attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeRight multiplier:1.0 constant:-20];
[self.contentView addConstraint:someoneRight];
NSLayoutConstraint *someoneHeight = [NSLayoutConstraint constraintWithItem:_scrollView attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:65];
[self.contentView addConstraint:someoneHeight];
NSLayoutConstraint *someoneBottom = [NSLayoutConstraint constraintWithItem:_scrollView attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:-5];
[self.contentView addConstraint:someoneBottom];
}
return _scrollView;
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
}
@end
//
// RankSectionTableCell.h
// redstar
//
// Created by admin on 15/12/25.
// Copyright © 2015年 ZWF. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface RankSectionTableCell : UITableViewCell
@property (nonatomic, strong) UILabel *categoryLabel;
@property (nonatomic, strong) UILabel *scoreLabel;
@property (nonatomic, strong) UILabel *gradeLabel;
@property (nonatomic, strong) UIImageView *arrowImageView;
@end
//
// RankSectionTableCell.m
// redstar
//
// Created by admin on 15/12/25.
// Copyright © 2015年 ZWF. All rights reserved.
//
#import "RankSectionTableCell.h"
@implementation RankSectionTableCell
- (UILabel *)categoryLabel
{
if (!_categoryLabel) {
_categoryLabel = [[UILabel alloc] init];
_categoryLabel.font = [UIFont systemFontOfSize:17.0];
_categoryLabel.textColor = kLightBlack;
_categoryLabel.translatesAutoresizingMaskIntoConstraints = NO;
[self.contentView addSubview:_categoryLabel];
NSLayoutConstraint *shoppingTop = [NSLayoutConstraint constraintWithItem:_categoryLabel attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeTop multiplier:1.0 constant:0];
[self.contentView addConstraint:shoppingTop];
NSLayoutConstraint *shoppingLeft = [NSLayoutConstraint constraintWithItem:_categoryLabel attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeLeft multiplier:1.0 constant:20];
[self.contentView addConstraint:shoppingLeft];
NSLayoutConstraint *shoppingHeight = [NSLayoutConstraint constraintWithItem:_categoryLabel attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:50];
[self.contentView addConstraint:shoppingHeight];
NSLayoutConstraint *shoppingBottom = [NSLayoutConstraint constraintWithItem:_categoryLabel attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0];
[self.contentView addConstraint:shoppingBottom];
}
return _categoryLabel;
}
- (UILabel *)gradeLabel
{
if (!_gradeLabel) {
_gradeLabel = [[UILabel alloc] init];
_gradeLabel.translatesAutoresizingMaskIntoConstraints = NO;
[self.contentView addSubview:_gradeLabel];
NSLayoutConstraint *shoppingTop = [NSLayoutConstraint constraintWithItem:_gradeLabel attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeTop multiplier:1.0 constant:0];
[self.contentView addConstraint:shoppingTop];
NSLayoutConstraint *shoppingLeft = [NSLayoutConstraint constraintWithItem:_gradeLabel attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.arrowImageView attribute:NSLayoutAttributeLeft multiplier:1.0 constant:0];
[self.contentView addConstraint:shoppingLeft];
NSLayoutConstraint *shoppingWidth = [NSLayoutConstraint constraintWithItem:_gradeLabel attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:60];
[self.contentView addConstraint:shoppingWidth];
NSLayoutConstraint *shoppingBottom = [NSLayoutConstraint constraintWithItem:_gradeLabel attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0];
[self.contentView addConstraint:shoppingBottom];
}
return _gradeLabel;
}
- (UILabel *)scoreLabel
{
if (!_scoreLabel) {
_scoreLabel = [[UILabel alloc] init];
_scoreLabel.translatesAutoresizingMaskIntoConstraints = NO;
[self.contentView addSubview:_scoreLabel];
NSLayoutConstraint *shoppingTop = [NSLayoutConstraint constraintWithItem:_scoreLabel attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeTop multiplier:1.0 constant:0];
[self.contentView addConstraint:shoppingTop];
NSLayoutConstraint *shoppingLeft = [NSLayoutConstraint constraintWithItem:_scoreLabel attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.gradeLabel attribute:NSLayoutAttributeLeft multiplier:1.0 constant:0];
[self.contentView addConstraint:shoppingLeft];
NSLayoutConstraint *shoppingWidth = [NSLayoutConstraint constraintWithItem:_scoreLabel attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:60];
[self.contentView addConstraint:shoppingWidth];
NSLayoutConstraint *shoppingBottom = [NSLayoutConstraint constraintWithItem:_scoreLabel attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0];
[self.contentView addConstraint:shoppingBottom];
}
return _scoreLabel;
}
- (UIImageView *)arrowImageView
{
if (!_arrowImageView) {
_arrowImageView = [[UIImageView alloc] init];
_arrowImageView.translatesAutoresizingMaskIntoConstraints = NO;
[self.contentView addSubview:_arrowImageView];
NSLayoutConstraint *shoppingTop = [NSLayoutConstraint constraintWithItem:_arrowImageView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeTop multiplier:1.0 constant:20];
[self.contentView addConstraint:shoppingTop];
NSLayoutConstraint *shoppingRight = [NSLayoutConstraint constraintWithItem:_arrowImageView attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeRight multiplier:1.0 constant:-20];
[self.contentView addConstraint:shoppingRight];
NSLayoutConstraint *shoppingWidth = [NSLayoutConstraint constraintWithItem:_arrowImageView attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:12.5];
[self.contentView addConstraint:shoppingWidth];
NSLayoutConstraint *shoppingHeight = [NSLayoutConstraint constraintWithItem:_arrowImageView attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:7.5];
[self.contentView addConstraint:shoppingHeight];
}
return _arrowImageView;
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
@end
......@@ -8,6 +8,8 @@
#import "RankDetailViewController.h"
#import "RankDetailTableCell.h"
#import "RankSectionTableCell.h"
#import "RankScrollTableViewCell.h"
#import "RankDetailHeaderView.h"
#import <UIButton+WebCache.h>
#import "RankHeadView.h"
......@@ -21,19 +23,20 @@
#import "CommentView.h"
#import <UIButton+WebCache.h>
#import <RATreeView.h>
#define kRankDetailCell @"RankDetailTableCell"
#define kRankSectionTableCell @"RankSectionTableviewCell"
#define kRankScrollTableViewCell @"RankScrollTableViewCell"
@interface RankDetailViewController () <UITableViewDataSource, UITableViewDelegate, RankHeadViewDelegate, UITextViewDelegate>
@property (nonatomic, strong) UITableView *tableView;
@interface RankDetailViewController () <RATreeViewDelegate, RATreeViewDataSource, UITextViewDelegate>
@property (nonatomic, strong) RATreeView *treeView;
@property (nonatomic, strong) RankDetailHeaderView *rankDetailHeaderView;
@property (nonatomic, strong) NSMutableArray *taskData;
@property (nonatomic, strong) RankDetailHeaderView *rankDetailHeaderView;
@property (nonatomic, strong) UIView *footerView;
@property (nonatomic, strong) NSMutableDictionary *selectedIndexes; // 存放二次展开的cell
@property (nonatomic, strong) UIButton *commentButton;
@property (nonatomic, strong) UIView *backGroundView;
@property (nonatomic, strong) CommentView *commentView;
......@@ -74,23 +77,13 @@
UIBarButtonItem *backItem = [[UIBarButtonItem alloc] initWithCustomView:backBtn];
self.navigationItem.leftBarButtonItem = backItem;
// 初始化容器
self.selectedIndexes = [[NSMutableDictionary alloc] init];
[self.commentButton setTitle:@"添加评论" forState:UIControlStateNormal];
// 请求口碑排名详情
[self requestRankingDetail];
[self.commentButton setTitle:@"添加评论" forState:UIControlStateNormal];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
#pragma mark - Private Methods
- (void)requestRankingDetail
......@@ -104,128 +97,122 @@
NSDictionary *dataDict = response[@"data"];
TaskDetailModel *taskDetail = [TaskDetailModel taskDetailModelWithDict:dataDict];
self.rankDetailHeaderView.taskDetail = taskDetail;
NSArray *dataArray = dataDict[@"categories"];
[self.rankDetailHeaderView.showAllBtn addTarget:self action:@selector(showAllClick:) forControlEvents:UIControlEventTouchUpInside];
[self setupScrollView];
NSArray *dataArray = taskDetail.categories;
NSMutableArray *tgArray = [NSMutableArray array];
for (NSDictionary *dict in dataArray) {
TaskGroup *taskGroup = [TaskGroup taskGroupWithDict:dict];
for (int a = 0; a < taskGroup.answers.count; a++) {
TaskModel *task = taskGroup.answers[a];
task.index = a;
}
[tgArray addObject:taskGroup];
}
_taskData = tgArray;
self.tableView.tableHeaderView = self.rankDetailHeaderView;
self.rankDetailHeaderView.rankDetailView.addressLabel.text = [NSString stringWithFormat:@"%@", self.storeAddress];
self.rankDetailHeaderView.rankDetailView.storePictures = self.storePictures;
[self.tableView registerClass:[RankDetailTableCell class] forCellReuseIdentifier:kRankDetailCell];
[self setupScrollView];
[self.treeView registerClass:[RankSectionTableCell class] forCellReuseIdentifier:kRankSectionTableCell];
[self.treeView registerClass:[RankDetailTableCell class] forCellReuseIdentifier:kRankDetailCell];
[self.treeView registerClass:[RankScrollTableViewCell class] forCellReuseIdentifier:kRankScrollTableViewCell];
}];
}
- (void)addComment:(UIButton *)sender
- (void)setupScrollView
{
NSArray *permissions = [[NSUserDefaults standardUserDefaults] objectForKey:@"permissions"];
if ([permissions containsObject:@"500202"]) {
if (!_backGroundView) {
_backGroundView = [[UIView alloc] initWithFrame:self.view.bounds];
UITapGestureRecognizer *tapGR = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(closeBackGroundView)];
[_backGroundView addGestureRecognizer:tapGR];
}
if (!_commentView) {
_commentView = [[CommentView alloc] init];
_commentView.backgroundColor = [UIColor whiteColor];
}
_commentView.contentTextView.text = @"";
_commentView.contentTextView.delegate = self;
[_commentView.quitBtn addTarget:self action:@selector(closeBackGroundView) forControlEvents:UIControlEventTouchUpInside];
[_commentView.sureBtn addTarget:self action:@selector(submitComment:) forControlEvents:UIControlEventTouchUpInside];
[self.view insertSubview:_backGroundView aboveSubview:_tableView];
[self.view insertSubview:_commentView aboveSubview:_backGroundView];
int imageCount = (int)self.storePictures.count;
CGFloat marginW = 5.0;
CGFloat imageViewW = 90 + 2 * marginW;
CGFloat imageViewH = self.rankDetailHeaderView.rankDetailView.showScrollView.bounds.size.height - 4;
if (imageCount == 0) {
self.rankDetailHeaderView.rankDetailView.showScrollView.contentSize = CGSizeMake(4 *imageViewW, imageViewH + 4);
_backGroundView.alpha = 0;
_backGroundView.backgroundColor = [UIColor blackColor];
for (int i = 0; i < 4; i++) {
UIButton *button = [[UIButton alloc] init];
[button setImage:[UIImage imageNamed:@"default_pic"] forState:UIControlStateNormal];
button.frame = CGRectMake(i * imageViewW + 2, 2, imageViewW - 2 * marginW, imageViewH);
[button addTarget:self action:@selector(showBigPic:) forControlEvents:UIControlEventTouchUpInside];
[self.rankDetailHeaderView.rankDetailView.showScrollView addSubview:button];
}
} else {
self.rankDetailHeaderView.rankDetailView.showScrollView.contentSize = CGSizeMake(imageCount *imageViewW, imageViewH + 4);
CGRect toFrame = CGRectMake(0, self.view.frame.size.height - kCommentViewHeight, kScreenWidth, kCommentViewHeight);
CGRect fromFrame = CGRectMake(0, kScreenHeight, kScreenWidth, kCommentViewHeight);
for (int i = 0; i < imageCount; i++) {
UIButton *button = [[UIButton alloc] init];
NSDictionary *dict = (NSDictionary *)self.storePictures[i];
NSURL *imageUrl = [NSURL URLWithString:[NSString stringWithFormat:@"%@%@", kRedStarURL ,dict[@"fileUrl"]]];
[button sd_setImageWithURL:imageUrl forState:UIControlStateNormal placeholderImage:[UIImage imageNamed:@"default_pic"]];
button.frame = CGRectMake(i * imageViewW + 2, 2, imageViewW - 2 * marginW, imageViewH);
[button addTarget:self action:@selector(showBigPic:) forControlEvents:UIControlEventTouchUpInside];
[self.rankDetailHeaderView.rankDetailView.showScrollView addSubview:button];
}
_commentView.frame = fromFrame;
[UIView animateWithDuration:0.3 animations:^{
_backGroundView.alpha = 0.6;
_commentView.frame = toFrame;
}];
} else {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"提示" message:@"您没有评论的权限!" delegate:self cancelButtonTitle:nil otherButtonTitles:@"确定", nil];
[alert show];
}
}
- (void)textViewDidBeginEditing:(UITextView *)textView
- (void)showBigPic:(UIButton *)btn
{
[UIView animateWithDuration:0.3 animations:^{
_commentView.frame = CGRectMake(0, self.view.frame.size.height - kCommentViewHeight - 173, kScreenWidth, kCommentViewHeight);
}];
CheckPicViewController *checkVC = [[CheckPicViewController alloc] init];
checkVC.checkImage = btn.imageView.image;
[self.navigationController pushViewController:checkVC animated:YES];
}
- (void)textViewDidEndEditing:(UITextView *)textView
// 返回上一页面
- (void)doBack:(UIBarButtonItem *)sender
{
[UIView animateWithDuration:0.3 animations:^{
_commentView.frame = CGRectMake(0, self.view.frame.size.height - kCommentViewHeight, kScreenWidth, kCommentViewHeight);
}];
[self.navigationController popViewControllerAnimated:YES];
}
- (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text
- (void)addComment:(UIButton *)sender
{
if (range.location>=200) {
return NO;
if (!_backGroundView) {
_backGroundView = [[UIView alloc] initWithFrame:self.view.bounds];
UITapGestureRecognizer *tapGR = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(closeBackGroundView)];
[_backGroundView addGestureRecognizer:tapGR];
}
else {
return YES;
if (!_commentView) {
_commentView = [[CommentView alloc] init];
_commentView.backgroundColor = [UIColor whiteColor];
}
}
// 提交评论
- (void)submitComment:(UIButton *)sender
{
NSDate *date = [NSDate date];
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"YYYY-MM-dd+hh:mm:ss"];
NSString *dateString = [dateFormatter stringFromDate:date];
_commentView.contentTextView.text = @"";
_commentView.contentTextView.delegate = self;
[_commentView.quitBtn addTarget:self action:@selector(closeBackGroundView) forControlEvents:UIControlEventTouchUpInside];
[_commentView.sureBtn addTarget:self action:@selector(submitComment:) forControlEvents:UIControlEventTouchUpInside];
[self.view insertSubview:_backGroundView aboveSubview:_treeView];
[self.view insertSubview:_commentView aboveSubview:_backGroundView];
NSString *operId = [[NSUserDefaults standardUserDefaults] objectForKey:@"user_code"];
NSString *operName = [[NSUserDefaults standardUserDefaults] objectForKey:@"user_name"];
_backGroundView.alpha = 0;
_backGroundView.backgroundColor = [UIColor blackColor];
NSString *url = [NSString stringWithFormat:@"%@%@?time=%@&operId=%@&operName=%@", kRedStarURL, kAddCommentURL , dateString , operId, operName];
url = [url stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding];
NSLog(@"url = %@", url);
CGRect toFrame = CGRectMake(0, self.view.frame.size.height - kCommentViewHeight, kScreenWidth, kCommentViewHeight);
CGRect fromFrame = CGRectMake(0, kScreenHeight, kScreenWidth, kCommentViewHeight);
HttpClient *httpClient = [[HttpClient alloc] initWithUrl:url];
NSDictionary *parameters = @{@"entityType":@"question",
@"entityUuid":self.uuid,
@"comment":_commentView.contentTextView.text};
NSLog(@"parameters = %@", parameters);
[MBProgressHUD showHUDAddedTo:self.view animated:YES];
[httpClient submitCommentWithParameters:parameters completion:^(id response, NSError *error) {
NSLog(@"respo = %@, error = %@", response , error);
if ([response[@"message"] isEqualToString:@"ok"]) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"提示" message:@"添加评论成功" delegate:self cancelButtonTitle:nil otherButtonTitles:@"确定", nil];
alert.delegate = self;
[alert show];
[MBProgressHUD hideHUDForView:self.view animated:YES];
} else {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"警告" message:@"添加评论失败" delegate:self cancelButtonTitle:nil otherButtonTitles:@"确定", nil];
[alert show];
[MBProgressHUD hideHUDForView:self.view animated:YES];
}
_commentView.frame = fromFrame;
[UIView animateWithDuration:0.3 animations:^{
_backGroundView.alpha = 0.6;
_commentView.frame = toFrame;
}];
[self closeBackGroundView];
}
// 提交评论
- (void)submitComment:(UIButton *)sender
{
// 提示框
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"提示" message:@"您确定要提交评论吗?" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"确定", nil];
alert.tag = 3652234;
alert.delegate = self;
[alert show];
}
- (void)closeBackGroundView
......@@ -240,87 +227,139 @@
}];
}
// 返回上一页面
- (void)doBack:(UIBarButtonItem *)sender
- (void)showAllClick:(UIButton *)sender
{
[self.navigationController popViewControllerAnimated:YES];
}
- (void)setupScrollView
{
int imageCount = (int)self.storePictures.count;
CGFloat marginW = 5.0;
CGFloat imageViewW = 90 + 2 * marginW;
CGFloat imageViewH = self.rankDetailHeaderView.rankDetailView.showScrollView.bounds.size.height - 4;
if (imageCount == 0) {
self.rankDetailHeaderView.rankDetailView.showScrollView.contentSize = CGSizeMake(4 *imageViewW, imageViewH + 4);
for (int i = 0; i < 4; i++) {
UIButton *button = [[UIButton alloc] init];
[button setImage:[UIImage imageNamed:@"default_pic"] forState:UIControlStateNormal];
button.frame = CGRectMake(i * imageViewW + 2, 2, imageViewW - 2 * marginW, imageViewH);
[button addTarget:self action:@selector(showBigPic:) forControlEvents:UIControlEventTouchUpInside];
[self.rankDetailHeaderView.rankDetailView.showScrollView addSubview:button];
sender.selected = !sender.selected;
if (sender.selected) {
_treeView.expandsChildRowsWhenRowExpands = YES;
for (TaskGroup *taskGroup in self.taskData) {
[_treeView expandRowForItem:taskGroup expandChildren:YES withRowAnimation:RATreeViewRowAnimationFade];
}
} else {
self.rankDetailHeaderView.rankDetailView.showScrollView.contentSize = CGSizeMake(imageCount *imageViewW, imageViewH + 4);
_treeView.expandsChildRowsWhenRowExpands = NO;
for (TaskGroup *taskGroup in self.taskData) {
[_treeView collapseRowForItem:taskGroup collapseChildren:YES withRowAnimation:RATreeViewRowAnimationFade];
}
}
}
for (int i = 0; i < imageCount; i++) {
UIButton *button = [[UIButton alloc] init];
NSDictionary *dict = (NSDictionary *)self.storePictures[i];
NSURL *imageUrl = [NSURL URLWithString:[NSString stringWithFormat:@"%@%@", kRedStarURL ,dict[@"fileUrl"]]];
[button sd_setImageWithURL:imageUrl forState:UIControlStateNormal placeholderImage:[UIImage imageNamed:@"default_pic"]];
button.frame = CGRectMake(i * imageViewW + 2, 2, imageViewW - 2 * marginW, imageViewH);
[button addTarget:self action:@selector(showBigPic:) forControlEvents:UIControlEventTouchUpInside];
[self.rankDetailHeaderView.rankDetailView.showScrollView addSubview:button];
#pragma mark - RAtreeView Delegate/DataSource
- (NSInteger)treeView:(RATreeView *)treeView numberOfChildrenOfItem:(id)item
{
NSInteger level = [treeView levelForCellForItem:item];
if (level == -1) {
return [self.taskData count];
} else if (level == 0) {
TaskGroup *data = item;
return data.answers.count;
} else if (level == 1) {
TaskModel *data = item;
if (data.answerAttachments.count == 0) {
return 0;
} else {
return 1;
}
// return 0;
} else {
return 0;
}
}
- (void)showBigPic:(UIButton *)btn
- (id)treeView:(RATreeView *)treeView child:(NSInteger)index ofItem:(id)item
{
CheckPicViewController *checkVC = [[CheckPicViewController alloc] init];
checkVC.checkImage = btn.imageView.image;
[self.navigationController pushViewController:checkVC animated:YES];
NSInteger level = [treeView levelForCellForItem:item];
if (level == -1) {
return [self.taskData objectAtIndex:index];
} else if (level == 0) {
TaskGroup *data = item;
return data.answers[index];
} else if (level == 1) {
TaskModel *data = item;
if (data.answerAttachments.count == 0) {
return nil;
} else {
return data.answerAttachments;
}
} else {
return nil;
}
}
- (void)showScrollView:(UIButton *)sender
- (UITableViewCell *)treeView:(RATreeView *)treeView cellForItem:(id)item
{
RankDetailTableCell * cell = (RankDetailTableCell *)[[sender superview] superview];
cell.isDrop = !cell.isDrop;
NSIndexPath * path = [self.tableView indexPathForCell:cell];
[_tableView deselectRowAtIndexPath:path animated:TRUE];
BOOL isSelected = ![self cellIsSelected:path];
NSNumber *selectedIndex = [NSNumber numberWithBool:isSelected];
[_selectedIndexes setObject:selectedIndex forKey:path];
NSInteger level = [self.treeView levelForCellForItem:item];
if (cell.isDrop) {
[UIView animateWithDuration:0.2 animations:^{
cell.arrowImageView.transform = CGAffineTransformIdentity;
cell.arrowImageView.transform = CGAffineTransformMakeRotation(M_PI / 2);
}];
NSArray *imgaeUrlArray = cell.task.answerAttachments;
if (level == 0) {
TaskGroup *data = item;
RankSectionTableCell *cell = [self.treeView dequeueReusableCellWithIdentifier:kRankSectionTableCell];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
cell.categoryLabel.text = [NSString stringWithFormat:@"%@", data.category];
NSString *scoreStr = [NSString stringWithFormat:@"%@ 分", data.score];
NSMutableAttributedString *scoreAttr = [[NSMutableAttributedString alloc] initWithString:scoreStr];
[scoreAttr addAttributes:@{NSForegroundColorAttributeName:kNavigationBarColor,NSFontAttributeName:[UIFont systemFontOfSize:19.0f]} range:NSMakeRange(0,scoreAttr.length - 1)];
[scoreAttr addAttributes:@{NSForegroundColorAttributeName:kDetailSmallTitleColor, NSFontAttributeName:[UIFont systemFontOfSize:14.0f]} range:NSMakeRange(scoreAttr.length - 1,1)];
[cell.scoreLabel setAttributedText:scoreAttr];
NSString *rankStr = [NSString stringWithFormat:@"第 %@ 名", data.ranking];
NSMutableAttributedString *rankAttr = [[NSMutableAttributedString alloc] initWithString:rankStr];
[rankAttr addAttributes:@{NSForegroundColorAttributeName:kRankHeadTitleTextColor,NSFontAttributeName:[UIFont systemFontOfSize:14.0f]} range:NSMakeRange(0,1)];
[rankAttr addAttributes:@{NSForegroundColorAttributeName:kGradeNumberTextColor} range:NSMakeRange(1,rankStr.length - 2)];
[rankAttr addAttribute:NSFontAttributeName value:[UIFont fontWithName:@"Arial-BoldMT" size:18.0] range:NSMakeRange(1,rankStr.length - 2)];
[rankAttr addAttributes:@{NSForegroundColorAttributeName:kRankHeadTitleTextColor,NSFontAttributeName:[UIFont systemFontOfSize:14.0f]} range:NSMakeRange(rankStr.length - 1,1)];
[cell.gradeLabel setAttributedText:rankAttr];
cell.arrowImageView.image = [UIImage imageNamed:@"arrow_down"];
return cell;
} else if (level == 1) {// if (level == 1)
TaskModel *data = item;
RankDetailTableCell *cell = [self.treeView dequeueReusableCellWithIdentifier:kRankDetailCell];
if (!cell) {
cell = [[RankDetailTableCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:kRankDetailCell];
}
cell.task = data;
cell.selectionStyle = UITableViewCellSelectionStyleNone;
[cell.mainTitleBtn setTitle:[NSString stringWithFormat:@"%d、%@", (int)(data.index + 1) ,data.title] forState:UIControlStateNormal];
if (data.score == NULL || data.score == nil) {
cell.scoreLabel.text = [NSString stringWithFormat:@"0分"];
} else {
cell.scoreLabel.text = [NSString stringWithFormat:@"%@分", data.score];
}
return cell;
} else {
NSArray *data = item;
RankScrollTableViewCell *cell = [self.treeView dequeueReusableCellWithIdentifier:kRankScrollTableViewCell];
if (!cell) {
cell = [[RankScrollTableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:kRankScrollTableViewCell];
}
cell.selectionStyle = UITableViewCellSelectionStyleNone;
NSMutableArray *urlArray = [NSMutableArray array];
for (NSDictionary *imageUrlDict in imgaeUrlArray) {
for (NSDictionary *imageUrlDict in data) {
NSString *urlStr = [NSString stringWithFormat:@"%@%@", kRedStarURL, imageUrlDict[@"fileUrl"]];
[urlArray addObject:urlStr];
}
CGFloat marginW = 5.0;
CGFloat imageViewW = 90 + 2 * marginW;
cell.scrollView = [[UIScrollView alloc] init];
cell.scrollView.translatesAutoresizingMaskIntoConstraints = NO;
cell.scrollView.contentSize = CGSizeMake((urlArray.count - 1) * imageViewW, 65);
[cell.contentView addSubview:cell.scrollView];
for (int i = 0; i < urlArray.count; i++) {
UIButton *button = [[UIButton alloc] init];
......@@ -344,155 +383,181 @@
NSLayoutConstraint *urlHeight = [NSLayoutConstraint constraintWithItem:button attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:65];
[cell.scrollView addConstraint:urlHeight];
}
NSLayoutConstraint *someoneTop = [NSLayoutConstraint constraintWithItem:cell.scrollView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:cell.contentView attribute:NSLayoutAttributeTop multiplier:1.0 constant:45];
[cell.contentView addConstraint:someoneTop];
NSLayoutConstraint *someoneLeft = [NSLayoutConstraint constraintWithItem:cell.scrollView attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:cell.contentView attribute:NSLayoutAttributeLeft multiplier:1.0 constant:20];
[cell.contentView addConstraint:someoneLeft];
NSLayoutConstraint *someoneRight = [NSLayoutConstraint constraintWithItem:cell.scrollView attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:cell.contentView attribute:NSLayoutAttributeRight multiplier:1.0 constant:-20];
[cell.contentView addConstraint:someoneRight];
NSLayoutConstraint *someoneHeight = [NSLayoutConstraint constraintWithItem:cell.scrollView attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:65];
[cell.contentView addConstraint:someoneHeight];
} else {
return cell;
}
}
- (void)treeView:(RATreeView *)treeView willExpandRowForItem:(id)item
{
NSInteger level = [self.treeView levelForCellForItem:item];
if (level == 0) {
RankSectionTableCell *cell = (RankSectionTableCell *)[_treeView cellForItem:item];
[UIView animateWithDuration:0.2 animations:^{
cell.arrowImageView.transform = CGAffineTransformIdentity;
cell.arrowImageView.transform = CGAffineTransformMakeRotation(-M_PI);
}];
} else if (level == 1) {
RankDetailTableCell *cell = (RankDetailTableCell *)[_treeView cellForItem:item];
[UIView animateWithDuration:0.2 animations:^{
cell.arrowImageView.transform = CGAffineTransformIdentity;
cell.arrowImageView.transform = CGAffineTransformMakeRotation(M_PI / 2);
}];
}
}
- (void)treeView:(RATreeView *)treeView willCollapseRowForItem:(id)item
{
NSInteger level = [self.treeView levelForCellForItem:item];
if (level == 0) {
RankSectionTableCell *cell = (RankSectionTableCell *)[_treeView cellForItem:item];
[UIView animateWithDuration:0.2 animations:^{
cell.arrowImageView.transform = CGAffineTransformIdentity;
cell.arrowImageView.transform = CGAffineTransformMakeRotation(0);
}];
if (cell.scrollView) {
[cell.scrollView removeFromSuperview];
cell.scrollView = nil;
}
} else if (level == 1) {
RankDetailTableCell *cell = (RankDetailTableCell *)[_treeView cellForItem:item];
[UIView animateWithDuration:0.2 animations:^{
cell.arrowImageView.transform = CGAffineTransformIdentity;
cell.arrowImageView.transform = CGAffineTransformMakeRotation(-0);
}];
}
[_tableView beginUpdates];
[_tableView endUpdates];
}
- (BOOL)cellIsSelected:(NSIndexPath *)indexPath {
// Return whether the cell at the specified index path is selected or not
NSNumber *selectedIndex = [_selectedIndexes objectForKey:indexPath];
return selectedIndex == nil ? FALSE : [selectedIndex boolValue];
- (BOOL)treeView:(RATreeView *)treeView canEditRowForItem:(id)item
{
return NO;
}
#pragma mark - UITableView DataSource/Delegate
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
#pragma mark - UItextDelegate
- (void)textViewDidBeginEditing:(UITextView *)textView
{
return _taskData.count;
[UIView animateWithDuration:0.3 animations:^{
_commentView.frame = CGRectMake(0, self.view.frame.size.height - kCommentViewHeight - 173, kScreenWidth, kCommentViewHeight);
}];
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
- (void)textViewDidEndEditing:(UITextView *)textView
{
TaskGroup *taskGroup = _taskData[section];
NSInteger count = taskGroup.isOpened ? taskGroup.answers.count : 0;
return count;
[UIView animateWithDuration:0.3 animations:^{
_commentView.frame = CGRectMake(0, self.view.frame.size.height - kCommentViewHeight, kScreenWidth, kCommentViewHeight);
}];
}
// cell显示的内容
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
- (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text
{
RankDetailTableCell *cell=[tableView dequeueReusableCellWithIdentifier:kRankDetailCell];
if (!cell) {
cell = [[RankDetailTableCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:kRankDetailCell];
}
TaskGroup *taskGroup = _taskData[indexPath.section];
TaskModel *task = taskGroup.answers[indexPath.row];
cell.task = task;
if (![text isEqualToString:@""]) {
_commentView.placeholderLabel2.hidden = YES;
}
cell.selectionStyle = UITableViewCellSelectionStyleNone;
[cell.mainTitleBtn setTitle:[NSString stringWithFormat:@"%d、%@", (int)(indexPath.row + 1) ,task.title] forState:UIControlStateNormal];
if (task.score == NULL || task.score == nil) {
cell.scoreLabel.text = [NSString stringWithFormat:@"0分"];
} else {
cell.scoreLabel.text = [NSString stringWithFormat:@"%@分", task.score];
if ([text isEqualToString:@""] && range.location == 0 && range.length == 1) {
_commentView.placeholderLabel2.hidden = NO;
}
// 按钮点击事件
[cell.mainTitleBtn addTarget:self action:@selector(showScrollView:) forControlEvents:UIControlEventTouchUpInside];
return cell;
}
// cell的点击事件
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
if ([text isEqualToString:@"\n"]) {
[_commentView.contentTextView resignFirstResponder];
if (textView.text.length != 0) {
_commentView.placeholderLabel2.hidden = YES;
} else {
_commentView.placeholderLabel2.hidden = NO;
}
return NO;
}
}
// cell的高度
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
if([self cellIsSelected:indexPath]) {
return 130;
if (range.location>=200) {
return NO;
}
else {
return YES;
}
return 44;
}
// section高度
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
return 50;
}
// foot高度
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
{
return CGFLOAT_MIN;
return YES;
}
// 自定义section
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
#pragma mark - UIAlertViewDelegate
-(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
RankHeadView *headView = [RankHeadView headViewWithTableView:tableView];
headView.delegate = self;
headView.taskGroup = _taskData[section];
return headView;
}
- (void)clickRankHeadView
{
[self.tableView reloadData];
if (alertView.tag == 3652234) {
if (buttonIndex == 0) {
return;
} else {
// 提交数据
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:@"%@%@?time=%@&operId=%@&operName=%@", kRedStarURL, kAddCommentURL , dateString , operId, operName];
url = [url stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding];
NSLog(@"url = %@", url);
HttpClient *httpClient = [[HttpClient alloc] initWithUrl:url];
NSDictionary *parameters = @{@"entityType":@"question",
@"entityUuid":self.uuid,
@"comment":_commentView.contentTextView.text};
NSLog(@"parameters = %@", parameters);
[MBProgressHUD showHUDAddedTo:self.view animated:YES];
[httpClient submitCommentWithParameters:parameters completion:^(id response, NSError *error) {
NSLog(@"respo = %@, error = %@", response , error);
if ([response[@"message"] isEqualToString:@"ok"]) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"提示" message:@"添加评论成功" delegate:self cancelButtonTitle:nil otherButtonTitles:@"确定", nil];
alert.delegate = self;
[alert show];
[MBProgressHUD hideHUDForView:self.view animated:YES];
} else {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"警告" message:@"添加评论失败" delegate:self cancelButtonTitle:nil otherButtonTitles:@"确定", nil];
[alert show];
[MBProgressHUD hideHUDForView:self.view animated:YES];
}
}];
[self closeBackGroundView]; }
}
}
#pragma mark - lazy Laoding
- (UITableView *)tableView
- (RATreeView *)treeView
{
if (!_tableView) {
_tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStyleGrouped];
_tableView.translatesAutoresizingMaskIntoConstraints = NO;
_tableView.delegate = self;
_tableView.dataSource = self;
_tableView.showsVerticalScrollIndicator = NO;
_tableView.showsHorizontalScrollIndicator = NO;
_tableView.tableFooterView = self.footerView;
[self.view addSubview:_tableView];
NSLayoutConstraint *tableTop = [NSLayoutConstraint constraintWithItem:_tableView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeTop multiplier:1.0 constant:0];
if (!_treeView) {
_treeView = [[RATreeView alloc] initWithFrame:CGRectZero];
_treeView.translatesAutoresizingMaskIntoConstraints = NO;
_treeView.delegate = self;
_treeView.dataSource = self;
_treeView.showsVerticalScrollIndicator = NO;
_treeView.showsHorizontalScrollIndicator = NO;
_treeView.treeHeaderView = self.rankDetailHeaderView;
_treeView.treeFooterView = self.footerView;
_treeView.rowHeight = UITableViewAutomaticDimension;
_treeView.estimatedRowHeight = 300.0;
[self.view addSubview:_treeView];
NSLayoutConstraint *tableTop = [NSLayoutConstraint constraintWithItem:_treeView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeTop multiplier:1.0 constant:0];
[self.view addConstraint:tableTop];
NSLayoutConstraint *tableLeft = [NSLayoutConstraint constraintWithItem:_tableView attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeLeft multiplier:1.0 constant:0];
NSLayoutConstraint *tableLeft = [NSLayoutConstraint constraintWithItem:_treeView attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeLeft multiplier:1.0 constant:0];
[self.view addConstraint:tableLeft];
NSLayoutConstraint *tableRight = [NSLayoutConstraint constraintWithItem:_tableView attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeRight multiplier:1.0 constant:0];
NSLayoutConstraint *tableRight = [NSLayoutConstraint constraintWithItem:_treeView attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeRight multiplier:1.0 constant:0];
[self.view addConstraint:tableRight];
NSLayoutConstraint *tableBottom = [NSLayoutConstraint constraintWithItem:_tableView attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0];
NSLayoutConstraint *tableBottom = [NSLayoutConstraint constraintWithItem:_treeView attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0];
[self.view addConstraint:tableBottom];
}
return _tableView;
return _treeView;
}
- (RankDetailHeaderView *)rankDetailHeaderView
{
if (!_rankDetailHeaderView) {
......@@ -509,6 +574,9 @@
[rankAttr addAttributes:@{NSForegroundColorAttributeName:kRankHeadTitleTextColor,NSFontAttributeName:[UIFont systemFontOfSize:14.0f]} range:NSMakeRange(rankStr.length - 1,1)];
[_rankDetailHeaderView.rankDetailView.gradeLabel setAttributedText:rankAttr];
}
self.rankDetailHeaderView.backgroundColor = kSectionBackGroundColor;
self.rankDetailHeaderView.rankDetailView.addressLabel.text = [NSString stringWithFormat:@"%@", self.storeAddress];
self.rankDetailHeaderView.rankDetailView.storePictures = self.storePictures;
}
return _rankDetailHeaderView;
}
......@@ -516,8 +584,11 @@
- (UIView *)footerView
{
if (!_footerView) {
_footerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, 60)];
_footerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, 80)];
UIView *lineView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, 1)];
lineView.backgroundColor = kSeparateLineColor;
[self.footerView addSubview:lineView];
}
return _footerView;
}
......@@ -553,14 +624,5 @@
}
return _commentButton;
}
/*
#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
*/
@end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment