Commit fff7b6b9 authored by admin's avatar admin

图说口碑 列表、详情 逻辑

parent f8c90bc0
......@@ -87,6 +87,10 @@
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 */; };
84C972961C1ABE08003A3276 /* PicScreenView.m in Sources */ = {isa = PBXBuildFile; fileRef = 84C972951C1ABE08003A3276 /* PicScreenView.m */; };
84C972991C1ADB9C003A3276 /* PictureDetailTableCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 84C972981C1ADB9C003A3276 /* PictureDetailTableCell.m */; };
84C9729C1C1ADC5B003A3276 /* PictureTextTableCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 84C9729B1C1ADC5B003A3276 /* PictureTextTableCell.m */; };
84C9729F1C1ADD17003A3276 /* PictureCommentTableCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 84C9729E1C1ADD17003A3276 /* PictureCommentTableCell.m */; };
84CC34CC1C093C2F002F10E2 /* OnLineTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 84CC34C11C093C2F002F10E2 /* OnLineTableViewCell.m */; };
84CC34CD1C093C2F002F10E2 /* OnLineFooterView.m in Sources */ = {isa = PBXBuildFile; fileRef = 84CC34C41C093C2F002F10E2 /* OnLineFooterView.m */; };
84CC34CE1C093C2F002F10E2 /* OnLineViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 84CC34C71C093C2F002F10E2 /* OnLineViewController.m */; };
......@@ -315,6 +319,14 @@
84C9574B1BDB344900083584 /* UIView+Frame.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIView+Frame.h"; sourceTree = "<group>"; };
84C9574C1BDB344900083584 /* UIView+Frame.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIView+Frame.m"; sourceTree = "<group>"; };
84C9574F1BDB38AA00083584 /* redstar.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = redstar.pch; sourceTree = "<group>"; };
84C972941C1ABE08003A3276 /* PicScreenView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PicScreenView.h; sourceTree = "<group>"; };
84C972951C1ABE08003A3276 /* PicScreenView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PicScreenView.m; sourceTree = "<group>"; };
84C972971C1ADB9C003A3276 /* PictureDetailTableCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PictureDetailTableCell.h; sourceTree = "<group>"; };
84C972981C1ADB9C003A3276 /* PictureDetailTableCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PictureDetailTableCell.m; sourceTree = "<group>"; };
84C9729A1C1ADC5B003A3276 /* PictureTextTableCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PictureTextTableCell.h; sourceTree = "<group>"; };
84C9729B1C1ADC5B003A3276 /* PictureTextTableCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PictureTextTableCell.m; sourceTree = "<group>"; };
84C9729D1C1ADD17003A3276 /* PictureCommentTableCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PictureCommentTableCell.h; sourceTree = "<group>"; };
84C9729E1C1ADD17003A3276 /* PictureCommentTableCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PictureCommentTableCell.m; sourceTree = "<group>"; };
84CC34C01C093C2F002F10E2 /* OnLineTableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OnLineTableViewCell.h; sourceTree = "<group>"; };
84CC34C11C093C2F002F10E2 /* OnLineTableViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OnLineTableViewCell.m; sourceTree = "<group>"; };
84CC34C31C093C2F002F10E2 /* OnLineFooterView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OnLineFooterView.h; sourceTree = "<group>"; };
......@@ -961,6 +973,12 @@
8490C4C81BF9DEF0006B6569 /* Cell */ = {
isa = PBXGroup;
children = (
84C972971C1ADB9C003A3276 /* PictureDetailTableCell.h */,
84C972981C1ADB9C003A3276 /* PictureDetailTableCell.m */,
84C9729A1C1ADC5B003A3276 /* PictureTextTableCell.h */,
84C9729B1C1ADC5B003A3276 /* PictureTextTableCell.m */,
84C9729D1C1ADD17003A3276 /* PictureCommentTableCell.h */,
84C9729E1C1ADD17003A3276 /* PictureCommentTableCell.m */,
);
path = Cell;
sourceTree = "<group>";
......@@ -1003,6 +1021,8 @@
8490C4CF1BF9DEF0006B6569 /* View */ = {
isa = PBXGroup;
children = (
84C972941C1ABE08003A3276 /* PicScreenView.h */,
84C972951C1ABE08003A3276 /* PicScreenView.m */,
);
path = View;
sourceTree = "<group>";
......@@ -2030,6 +2050,7 @@
84A6738E1C0BE2D0000F828E /* OnLineCompleteCell.m in Sources */,
84CC34D41C094476002F10E2 /* StandardViewController.m in Sources */,
84FD8A0A1BDA01D1006E442A /* MineViewController.m in Sources */,
84C972991C1ADB9C003A3276 /* PictureDetailTableCell.m in Sources */,
848A20271C183FCB00422FAB /* OnLineResultViewController.m in Sources */,
848699B21BDF810900859DFE /* InspectListViewController.m in Sources */,
84BB16A21C191A7F00383A64 /* OnLineResultFootView.m in Sources */,
......@@ -2084,11 +2105,13 @@
8480BEAC1C143A1600E2F18F /* CategoryTableView.m in Sources */,
84F57C9C1BECA73800DDEEB1 /* StarBar.m in Sources */,
84F57C4C1BEC785E00DDEEB1 /* AddQuestionViewController.m in Sources */,
84C9729F1C1ADD17003A3276 /* PictureCommentTableCell.m in Sources */,
849A18461C152EBA00071600 /* AddPictureTableCell.m in Sources */,
84D80EB51BF714BE00A10EA4 /* GroupItems.m in Sources */,
84A673BE1C0C7AEB000F828E /* AnnoTableViewCell.m in Sources */,
84C9574D1BDB344900083584 /* UIBarButtonItem+Create.m in Sources */,
84AD4F3D1BF4894D00BFB37C /* RankDetailView.m in Sources */,
84C972961C1ABE08003A3276 /* PicScreenView.m in Sources */,
84ECCF1B1C0210F000EA4960 /* CommentModel.m in Sources */,
84E0ABCD1BFB082E001C8F45 /* TaskDetailModel.m in Sources */,
8490C4D31BF9DEF0006B6569 /* PictureTableCell.m in Sources */,
......@@ -2101,6 +2124,7 @@
84846E9A1BE07CDF0010550A /* RankingListCell.m in Sources */,
84A673911C0C2681000F828E /* FunctionViewController.m in Sources */,
848699B61BDF812F00859DFE /* RankingListViewController.m in Sources */,
84C9729C1C1ADC5B003A3276 /* PictureTextTableCell.m in Sources */,
84D825821BDD35E000CC61F7 /* HomeHeaderView.m in Sources */,
849A18431C152CEE00071600 /* AddPictureViewController.m in Sources */,
8480BEA61C14378C00E2F18F /* ScopeTableView.m in Sources */,
......
{
"images" : [
{
"size" : "40x40",
"idiom" : "ipad",
"filename" : "Icon-40.png",
"size" : "29x29",
"idiom" : "iphone",
"filename" : "Icon-Small.png",
"scale" : "1x"
},
{
"size" : "29x29",
"idiom" : "iphone",
"filename" : "Icon-Small@2x.png",
"scale" : "2x"
},
{
"size" : "29x29",
"idiom" : "iphone",
"filename" : "Icon-Small@3x.png",
"scale" : "3x"
},
{
"size" : "40x40",
"idiom" : "ipad",
"idiom" : "iphone",
"filename" : "Icon-40@2x.png",
"scale" : "2x"
},
{
"size" : "40x40",
"idiom" : "iphone",
"filename" : "Icon-40@3x.png",
"scale" : "3x"
},
{
"size" : "57x57",
"idiom" : "iphone",
"filename" : "Icon.png",
"scale" : "1x"
},
{
"size" : "57x57",
"idiom" : "iphone",
"filename" : "Icon@2x.png",
"scale" : "2x"
},
{
"size" : "60x60",
"idiom" : "iphone",
......@@ -19,27 +49,33 @@
"scale" : "2x"
},
{
"size" : "72x72",
"size" : "60x60",
"idiom" : "iphone",
"filename" : "Icon-60@3x.png",
"scale" : "3x"
},
{
"size" : "29x29",
"idiom" : "ipad",
"filename" : "Icon-72.png",
"filename" : "Icon-Small.png",
"scale" : "1x"
},
{
"size" : "72x72",
"size" : "29x29",
"idiom" : "ipad",
"filename" : "Icon-72@2x.png",
"filename" : "Icon-Small@2x.png",
"scale" : "2x"
},
{
"size" : "76x76",
"size" : "40x40",
"idiom" : "ipad",
"filename" : "Icon-76.png",
"filename" : "Icon-40.png",
"scale" : "1x"
},
{
"size" : "76x76",
"size" : "40x40",
"idiom" : "ipad",
"filename" : "Icon-76@2x.png",
"filename" : "Icon-40@2x.png",
"scale" : "2x"
},
{
......@@ -55,63 +91,32 @@
"scale" : "2x"
},
{
"size" : "29x29",
"idiom" : "iphone",
"filename" : "Icon-Small.png",
"size" : "72x72",
"idiom" : "ipad",
"filename" : "Icon-72.png",
"scale" : "1x"
},
{
"size" : "29x29",
"idiom" : "iphone",
"filename" : "Icon-Small@2x.png",
"size" : "72x72",
"idiom" : "ipad",
"filename" : "Icon-72@2x.png",
"scale" : "2x"
},
{
"size" : "57x57",
"idiom" : "iphone",
"filename" : "Icon.png",
"size" : "76x76",
"idiom" : "ipad",
"filename" : "Icon-76.png",
"scale" : "1x"
},
{
"size" : "57x57",
"idiom" : "iphone",
"filename" : "Icon@2x.png",
"scale" : "2x"
},
{
"size" : "29x29",
"idiom" : "iphone",
"filename" : "Icon-Small@3x.png",
"scale" : "3x"
},
{
"size" : "40x40",
"idiom" : "iphone",
"filename" : "Icon-40@3x.png",
"scale" : "3x"
},
{
"size" : "60x60",
"idiom" : "iphone",
"filename" : "Icon-60@3x.png",
"scale" : "3x"
},
{
"size" : "40x40",
"idiom" : "iphone",
"filename" : "Icon-40@2x.png",
"scale" : "2x"
},
{
"size" : "29x29",
"size" : "76x76",
"idiom" : "ipad",
"filename" : "Icon-Small.png",
"scale" : "1x"
"filename" : "Icon-76@2x.png",
"scale" : "2x"
},
{
"size" : "29x29",
"idiom" : "ipad",
"filename" : "Icon-Small@2x.png",
"size" : "83.5x83.5",
"scale" : "2x"
}
],
......
......@@ -79,4 +79,30 @@
// 获取问题分类
#define kQuestionCategoryURL @"redstar-server/rest/question/queryCategory?groupUuid="
/**
* 图说口碑相关URL
*/
// 保存图说口碑
#define kSavePicturePraiseURL @"redstar-server/rest/legendpraise/save?time="
// 上传口碑图片
#define kUpLoadPictureURL @"redstar-server/rest/legendpraise/"
// 提交图说口碑
#define kSubmitPicturePraiseURL @"redstar-server/rest/legendpraise/"
// 查询图说口碑
#define kQueryPicturePraiseURL @"redstar-server/rest/legendpraise/query"
// 图说口碑明细
#define kPicturePraiseDetailURL @"redstar-server/rest/legendpraise/get/"
// 口碑点赞
#define kPicturePraiseLikeURL @"redstar-server/rest/legendpraise/like/"
// 口碑取消点赞
#define kPicturePraiseCancelLikeURL @"redstar-server/rest/legendpraise/cancel_like/"
#endif /* Url_h */
//
// PictureCommentTableCell.h
// redstar
//
// Created by admin on 15/12/11.
// Copyright © 2015年 ZWF. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface PictureCommentTableCell : UITableViewCell
@property (nonatomic, strong) UILabel *suggestLabel; // 评论
@property (nonatomic, strong) UILabel *peopleLabel; // 评论人
@property (nonatomic, strong) UILabel *positionLabel; // 职位
@property (nonatomic, strong) UILabel *dateLabel; // 时间
@end
//
// PictureCommentTableCell.m
// redstar
//
// Created by admin on 15/12/11.
// Copyright © 2015年 ZWF. All rights reserved.
//
#import "PictureCommentTableCell.h"
@implementation PictureCommentTableCell
#pragma mark - lazy loading
- (UILabel *)suggestLabel
{
if (!_suggestLabel) {
_suggestLabel = [[UILabel alloc] init];
_suggestLabel.font = [UIFont systemFontOfSize:15.0];
_suggestLabel.textColor = kLightBlack;
_suggestLabel.translatesAutoresizingMaskIntoConstraints = NO;
_suggestLabel.numberOfLines = 0;
[self.contentView addSubview:_suggestLabel];
// 顶端
NSLayoutConstraint *titleTop = [NSLayoutConstraint constraintWithItem:_suggestLabel attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeTop multiplier:1.0 constant:12];
[self.contentView addConstraint:titleTop];
// 左边
NSLayoutConstraint *titleLeft = [NSLayoutConstraint constraintWithItem:_suggestLabel attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeLeft multiplier:1.0 constant:20];
[self.contentView addConstraint:titleLeft];
// 右边
NSLayoutConstraint *titleRight = [NSLayoutConstraint constraintWithItem:_suggestLabel attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeRight multiplier:1.0 constant:-20];
[self.contentView addConstraint:titleRight];
}
return _suggestLabel;
}
- (UILabel *)peopleLabel
{
if (!_peopleLabel) {
_peopleLabel = [[UILabel alloc] init];
_peopleLabel.font = [UIFont systemFontOfSize:15.0];
_peopleLabel.textColor = kLightGray;
_peopleLabel.translatesAutoresizingMaskIntoConstraints = NO;
[self.contentView addSubview:_peopleLabel];
// 顶端
NSLayoutConstraint *titleTop = [NSLayoutConstraint constraintWithItem:_peopleLabel attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.suggestLabel attribute:NSLayoutAttributeBottom multiplier:1.0 constant:7];
[self.contentView addConstraint:titleTop];
// 左边
NSLayoutConstraint *titleLeft = [NSLayoutConstraint constraintWithItem:_peopleLabel attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeLeft multiplier:1.0 constant:20];
[self.contentView addConstraint:titleLeft];
// 右边
NSLayoutConstraint *titleRight = [NSLayoutConstraint constraintWithItem:_peopleLabel attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.dateLabel attribute:NSLayoutAttributeLeft multiplier:1.0 constant:-10];
[self.contentView addConstraint:titleRight];
// 高度
NSLayoutConstraint *titleBottom = [NSLayoutConstraint constraintWithItem:_peopleLabel attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:-10];
[self.contentView addConstraint:titleBottom];
}
return _peopleLabel;
}
- (UILabel *)dateLabel
{
if (!_dateLabel) {
_dateLabel = [[UILabel alloc] init];
_dateLabel.font = [UIFont systemFontOfSize:15.0];
_dateLabel.textColor = kLightGray;
_dateLabel.translatesAutoresizingMaskIntoConstraints = NO;
[self.contentView addSubview:_dateLabel];
// 顶端
NSLayoutConstraint *titleTop = [NSLayoutConstraint constraintWithItem:_dateLabel attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.suggestLabel attribute:NSLayoutAttributeBottom multiplier:1.0 constant:7];
[self.contentView addConstraint:titleTop];
// 右边
NSLayoutConstraint *titleWidth = [NSLayoutConstraint constraintWithItem:_dateLabel attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:150];
[self.contentView addConstraint:titleWidth];
// 高度
NSLayoutConstraint *titleBottom = [NSLayoutConstraint constraintWithItem:_dateLabel attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:-10];
[self.contentView addConstraint:titleBottom];
}
return _dateLabel;
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
@end
//
// PictureDetailTableCell.h
// redstar
//
// Created by admin on 15/12/11.
// Copyright © 2015年 ZWF. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "ZanButton.h"
@interface PictureDetailTableCell : UITableViewCell
@property (nonatomic, strong) UILabel *titleLabel;
@property (nonatomic, strong) UILabel *contentLabel;
@property (nonatomic, strong) ZanButton *thumbBtn;
@end
//
// PictureDetailTableCell.m
// redstar
//
// Created by admin on 15/12/11.
// Copyright © 2015年 ZWF. All rights reserved.
//
#import "PictureDetailTableCell.h"
@implementation PictureDetailTableCell
#pragma mark - lazy loading
- (UILabel *)titleLabel
{
if (!_titleLabel) {
_titleLabel = [[UILabel alloc] init];
_titleLabel.translatesAutoresizingMaskIntoConstraints = NO;
[self.contentView addSubview:_titleLabel];
// 顶端
NSLayoutConstraint *stateTop = [NSLayoutConstraint constraintWithItem:_titleLabel attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeTop multiplier:1.0 constant:10];
[self.contentView addConstraint:stateTop];
// 左边
NSLayoutConstraint *stateLeft = [NSLayoutConstraint constraintWithItem:_titleLabel attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeLeft multiplier:1.0 constant:20];
[self.contentView addConstraint:stateLeft];
// 右边
NSLayoutConstraint *stateRight = [NSLayoutConstraint constraintWithItem:_titleLabel attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.thumbBtn attribute:NSLayoutAttributeLeft multiplier:1.0 constant:-5];
[self.contentView addConstraint:stateRight];
// 高度
NSLayoutConstraint *stateHeight = [NSLayoutConstraint constraintWithItem:_titleLabel attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:25];
[self.contentView addConstraint:stateHeight];
}
return _titleLabel;
}
- (UILabel *)contentLabel
{
if (!_contentLabel) {
_contentLabel = [[UILabel alloc] init];
_contentLabel.translatesAutoresizingMaskIntoConstraints = NO;
_contentLabel.numberOfLines = 0;
[self.contentView addSubview:_contentLabel];
// 顶端
NSLayoutConstraint *stateTop = [NSLayoutConstraint constraintWithItem:_contentLabel attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.titleLabel attribute:NSLayoutAttributeBottom multiplier:1.0 constant:3];
[self.contentView addConstraint:stateTop];
// 左边
NSLayoutConstraint *stateLeft = [NSLayoutConstraint constraintWithItem:_contentLabel attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeLeft multiplier:1.0 constant:20];
[self.contentView addConstraint:stateLeft];
// 右边
NSLayoutConstraint *stateRight = [NSLayoutConstraint constraintWithItem:_contentLabel attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeRight multiplier:1.0 constant:-20];
[self.contentView addConstraint:stateRight];
// 高度
NSLayoutConstraint *stateBotom = [NSLayoutConstraint constraintWithItem:_contentLabel attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:-10];
[self.contentView addConstraint:stateBotom];
}
return _contentLabel;
}
- (ZanButton *)thumbBtn
{
if (!_thumbBtn) {
_thumbBtn = [[ZanButton alloc] init];
[_thumbBtn setImage:[UIImage imageNamed:@"commend"] forState:UIControlStateNormal];
[_thumbBtn setImage:[UIImage imageNamed:@"commend_after"] forState:UIControlStateSelected];
_thumbBtn.translatesAutoresizingMaskIntoConstraints = NO;
[_thumbBtn setTitle:@"200" forState:UIControlStateNormal];
_thumbBtn.titleLabel.font = [UIFont systemFontOfSize:16.0];
[_thumbBtn setTitleColor:kNavigationBarColor forState:UIControlStateNormal];
[self.contentView addSubview:_thumbBtn];
// 顶端
NSLayoutConstraint *thumbTop = [NSLayoutConstraint constraintWithItem:_thumbBtn attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeTop multiplier:1.0 constant:12];
[self.contentView addConstraint:thumbTop];
// // 左边
NSLayoutConstraint *thumbWidth = [NSLayoutConstraint constraintWithItem:_thumbBtn attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:75];
[self.contentView addConstraint:thumbWidth];
// 右边
NSLayoutConstraint *thumbRight = [NSLayoutConstraint constraintWithItem:_thumbBtn attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeRight multiplier:1.0 constant:-10];
[self.contentView addConstraint:thumbRight];
// 高度
NSLayoutConstraint *thumbHeight = [NSLayoutConstraint constraintWithItem:_thumbBtn attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:20];
[self.contentView addConstraint:thumbHeight];
}
return _thumbBtn;
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
@end
//
// PictureTextTableCell.h
// redstar
//
// Created by admin on 15/12/11.
// Copyright © 2015年 ZWF. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface PictureTextTableCell : UITableViewCell
@end
//
// PictureTextTableCell.m
// redstar
//
// Created by admin on 15/12/11.
// Copyright © 2015年 ZWF. All rights reserved.
//
#import "PictureTextTableCell.h"
@implementation PictureTextTableCell
- (void)awakeFromNib {
// Initialization code
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
@end
......@@ -8,7 +8,24 @@
#import "PictureStoryViewController.h"
@interface PictureStoryViewController ()
#import "PictureDetailTableCell.h"
#import "PictureTextTableCell.h"
#import "PictureCommentTableCell.h"
#import "HttpClient.h"
#import "CommentView.h"
#import <MBProgressHUD.h>
#import "CommentModel.h"
#define kPictureDetailTableCell @"PictureDetailTableViewCell"
#define kPictureTextTableCell @"PictureTextTableViewCell"
#define kPictureCommentTableCell @"pictureCommentTableViewCell"
@interface PictureStoryViewController () <UITableViewDelegate, UITableViewDataSource, UITextViewDelegate>
@property (nonatomic, strong) UITableView *tableView;
@property (nonatomic, assign) int clickNumber;
@property (nonatomic, strong) UIView *backGroundView;
@property (nonatomic, strong) CommentView *commentView;
@end
......@@ -26,15 +43,37 @@
self.view.backgroundColor = [UIColor whiteColor];
[self setupNav];
self.tableView.delegate = self;
self.tableView.dataSource = self;
_clickNumber = 0;
[self requestPicturePraiseDetail];
}
#pragma mark - Private Methods
- (void)requestPicturePraiseDetail
{
NSString *user_uuid = [[NSUserDefaults standardUserDefaults] objectForKey:@"user_uuid"];
NSString *url = [NSString stringWithFormat:@"%@%@%@?userUuid=%@", kRedStarURL, kPicturePraiseDetailURL, @"uuid", user_uuid];
[MBProgressHUD showHUDAddedTo:self.view animated:YES];
HttpClient *http = [[HttpClient alloc] initWithUrl:url];
[http getPicturePraiseDetailWithCompletion:^(id response, NSError *error) {
NSLog(@"图说口碑详情 res ===%@, error = %@", response, error);
[MBProgressHUD hideHUDForView:self.view animated:YES];
}];
}
- (void)setupNav
{
UILabel *customLab = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 40, 30)];
[customLab setTextColor:[UIColor whiteColor]];
[customLab setText:@"图说口碑"];
[customLab setText:@"图说口碑详情"];
customLab.font = [UIFont boldSystemFontOfSize:19];
self.navigationItem.titleView = customLab;
......@@ -51,22 +90,425 @@
-(void)doBack:(id)sender
{
[self.navigationController dismissViewControllerAnimated:YES completion:nil];
[self.navigationController popViewControllerAnimated:YES];
}
- (void)addZan:(ZanButton *)sender
{
// if ([_questionDetailModel.state isEqualToString:@"created"]) {
// UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"提示" message:@"当前问题尚未解决,暂不能点赞!" delegate:self cancelButtonTitle:nil otherButtonTitles:@"确定", nil];
// [alert show];
// return;
// }
_clickNumber++;
if (_clickNumber > 4) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"提示" message:@"您点赞过于频繁,请稍后再试!" delegate:self cancelButtonTitle:nil otherButtonTitles:@"确定", nil];
[alert show];
return;
}
sender.selected = !sender.selected;
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"];
if (sender.selected) {
// 点赞
NSString *url = [NSString stringWithFormat:@"%@%@%@?time=%@&operId=%@&operName=%@", kRedStarURL, kPicturePraiseLikeURL, @"uuid", dateString, operId, operName];
url = [url stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding];
HttpClient *httpClient = [[HttpClient alloc] initWithUrl:url];
[httpClient getLikePicturePraiseWithCompletion:^(id response, NSError *error) {
NSLog(@"图说口碑 点赞 response=%@, error = %@", response, error);
if (response[@"success"]) {
int likeCount = [sender.titleLabel.text intValue];
[sender setTitle:[NSString stringWithFormat:@"%d", likeCount + 1] forState:UIControlStateNormal];
} else {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"警告" message:@"点赞失败!" delegate:self cancelButtonTitle:@"确定" otherButtonTitles:nil, nil];
[alert show];
}
}];
} else {
// 取消点赞
NSString *url = [NSString stringWithFormat:@"%@%@%@?time=%@&operId=%@&operName=%@", kRedStarURL, kPicturePraiseCancelLikeURL, @"uuid", dateString, operId, operName];
url = [url stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding];
HttpClient *httpClient = [[HttpClient alloc] initWithUrl:url];
[httpClient cancelLikePicturePraiseWithCompletion:^(id response, NSError *error) {
NSLog(@"图说口碑 取消点赞response = %@ error = %@" , response, error);
if (response[@"success"]) {
int likeCount = [sender.titleLabel.text intValue];
[sender setTitle:[NSString stringWithFormat:@"%d", likeCount - 1] forState:UIControlStateNormal];
} else {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"警告" message:@"取消点赞失败!" delegate:self cancelButtonTitle:@"确定" otherButtonTitles:nil, nil];
[alert show];
}
}];
}
}
- (void)addComment:(UIButton *)sender
{
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];
_backGroundView.alpha = 0;
_backGroundView.backgroundColor = [UIColor blackColor];
CGRect toFrame = CGRectMake(0, self.view.frame.size.height - kCommentViewHeight, kScreenWidth, kCommentViewHeight);
CGRect fromFrame = CGRectMake(0, kScreenHeight, kScreenWidth, kCommentViewHeight);
_commentView.frame = fromFrame;
[UIView animateWithDuration:0.3 animations:^{
_backGroundView.alpha = 0.6;
_commentView.frame = toFrame;
}];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
// 提交评论
- (void)submitComment:(UIButton *)sender
{
// 提示框
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"提示" message:@"您确定要提交评论吗?" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"确定", nil];
alert.tag = 3652234;
alert.delegate = self;
[alert show];
}
/*
#pragma mark - Navigation
- (void)closeBackGroundView
{
CGRect fromFrame = CGRectMake(0, kScreenHeight, kScreenWidth, kCommentViewHeight);
[UIView animateWithDuration:0.3 animations:^{
_backGroundView.alpha = .0f;
_commentView.frame = fromFrame;
} completion:^(BOOL finished) {
[_backGroundView removeFromSuperview];
[_commentView removeFromSuperview];
}];
}
// 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.
#pragma mark - UITableView DataSource/Delegate
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 3;
}
*/
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
if (section == 0) {
return 1;
} else if (section == 1) {
return 2;
} else {
return 2;
}
}
// cell显示的内容
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
if (indexPath.section == 0) {
PictureDetailTableCell *cell=[tableView dequeueReusableCellWithIdentifier:kPictureDetailTableCell];
if (!cell) {
cell = [[PictureDetailTableCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:kPictureDetailTableCell];
}
// 标题
NSString *titleLabelText = [NSString stringWithFormat:@"标题:回访短信延迟问题咨询"];
NSMutableAttributedString *titleLabelAttr = [[NSMutableAttributedString alloc] initWithString:titleLabelText];
[titleLabelAttr addAttributes:@{NSForegroundColorAttributeName:kDetailCellDescribeTextColor,NSFontAttributeName:[UIFont systemFontOfSize:15.0f]} range:NSMakeRange(0,3)];
[titleLabelAttr addAttributes:@{NSForegroundColorAttributeName:kdetailCellTitleColor,NSFontAttributeName:[UIFont systemFontOfSize:15.0f]} range:NSMakeRange(3,titleLabelText.length - 3)];
[cell.titleLabel setAttributedText:titleLabelAttr];
// 内容
NSString *contentLabelText = [NSString stringWithFormat:@"内容:系统跟单维护在订单当天发出回访短信,此时商品可能尚未送达到客户,引起消费者的疑问和不解,进而引起客人额度不满或投诉。建议集团把短信时间回访延后1-2天,也避免由此引起的顾客抱怨。"];
NSMutableAttributedString *contentLabelAttr = [[NSMutableAttributedString alloc] initWithString:contentLabelText];
NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc]init];
[paragraphStyle setLineSpacing:5];
[contentLabelAttr addAttributes:@{NSForegroundColorAttributeName:kDetailCellDescribeTextColor,NSFontAttributeName:[UIFont systemFontOfSize:15.0f]} range:NSMakeRange(0,3)];
[contentLabelAttr addAttributes:@{NSForegroundColorAttributeName:kdetailCellTitleColor,NSFontAttributeName:[UIFont systemFontOfSize:15.0f]} range:NSMakeRange(3,contentLabelAttr.length - 3)];
[contentLabelAttr addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, contentLabelText.length)];
[cell.contentLabel setAttributedText:contentLabelAttr];
[cell.thumbBtn addTarget:self action:@selector(addZan:) forControlEvents:UIControlEventTouchUpInside];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
return cell;
} else if (indexPath.section == 1) {
PictureTextTableCell *cell=[tableView dequeueReusableCellWithIdentifier:kPictureTextTableCell];
if (!cell) {
cell = [[PictureTextTableCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:kPictureTextTableCell];
}
cell.selectionStyle = UITableViewCellSelectionStyleNone;
return cell;
} else {
PictureCommentTableCell *cell=[tableView dequeueReusableCellWithIdentifier:kPictureCommentTableCell];
if (!cell) {
cell = [[PictureCommentTableCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:kPictureCommentTableCell];
}
cell.suggestLabel.text = [NSString stringWithFormat:@"干的不错!"];
cell.peopleLabel.text = [NSString stringWithFormat:@"集团某总"];
cell.dateLabel.text = [NSString stringWithFormat:@"2015-12-11 18:52:29"];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
return cell;
}
}
// 自定义section
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
if (section == 2) {
// 创建sectionView
UIView *sectionView = [[UIView alloc] init];
sectionView.userInteractionEnabled = YES;
sectionView.backgroundColor = kInspectSectionBackGroundColor;
// 创建标题label
UILabel *titleLabel = [[UILabel alloc] init];
titleLabel.translatesAutoresizingMaskIntoConstraints = NO;
titleLabel.textColor = kHomeSectionTitleTextColor;
titleLabel.font = [UIFont systemFontOfSize:16.0];
titleLabel.text = @"评论";
[sectionView addSubview:titleLabel];
NSLayoutConstraint *titleLabelTop = [NSLayoutConstraint constraintWithItem:titleLabel attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:sectionView attribute:NSLayoutAttributeTop multiplier:1.0 constant:2];
[sectionView addConstraint:titleLabelTop];
NSLayoutConstraint *titleLabelLeft = [NSLayoutConstraint constraintWithItem:titleLabel attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:sectionView attribute:NSLayoutAttributeLeft multiplier:1.0 constant:20];
[sectionView addConstraint:titleLabelLeft];
NSLayoutConstraint *titleLabelWidth = [NSLayoutConstraint constraintWithItem:titleLabel attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:80];
[sectionView addConstraint:titleLabelWidth];
NSLayoutConstraint *titleLabelBottom = [NSLayoutConstraint constraintWithItem:titleLabel attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:sectionView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0];
[sectionView addConstraint:titleLabelBottom];
// 创建标题label
UIButton *titleBtn = [[UIButton alloc] init];
titleBtn.translatesAutoresizingMaskIntoConstraints = NO;
[titleBtn setTitle:@"添加评论" forState:UIControlStateNormal];
[titleBtn setTitleColor:kNavigationBarColor forState:UIControlStateNormal];
titleBtn.titleLabel.font = [UIFont systemFontOfSize:14.0];
titleBtn.layer.borderColor = kNavigationBarCGColor;
titleBtn.layer.borderWidth = 1.0;
titleBtn.layer.cornerRadius = 5;
[titleBtn addTarget:self action:@selector(addComment:) forControlEvents:UIControlEventTouchUpInside];
titleBtn.backgroundColor = [UIColor whiteColor];
[sectionView addSubview:titleBtn];
NSLayoutConstraint *titleBtnTop = [NSLayoutConstraint constraintWithItem:titleBtn attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:sectionView attribute:NSLayoutAttributeTop multiplier:1.0 constant:10];
[sectionView addConstraint:titleBtnTop];
NSLayoutConstraint *titleBtnRight = [NSLayoutConstraint constraintWithItem:titleBtn attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:sectionView attribute:NSLayoutAttributeRight multiplier:1.0 constant:-20];
[sectionView addConstraint:titleBtnRight];
NSLayoutConstraint *titleBtnWidth = [NSLayoutConstraint constraintWithItem:titleBtn attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:80];
[sectionView addConstraint:titleBtnWidth];
NSLayoutConstraint *titleBtnBottom = [NSLayoutConstraint constraintWithItem:titleBtn attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:sectionView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:-10];
[sectionView addConstraint:titleBtnBottom];
return sectionView;
}
else {
return nil;
}
}
// section高度
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
if (section == 2) {
return 50;
} else {
return CGFLOAT_MIN;
}
}
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
{
return CGFLOAT_MIN;
}
#pragma mark - UItextDelegate
- (void)textViewDidBeginEditing:(UITextView *)textView
{
[UIView animateWithDuration:0.3 animations:^{
_commentView.frame = CGRectMake(0, self.view.frame.size.height - kCommentViewHeight - 173, kScreenWidth, kCommentViewHeight);
}];
}
- (void)textViewDidEndEditing:(UITextView *)textView
{
[UIView animateWithDuration:0.3 animations:^{
_commentView.frame = CGRectMake(0, self.view.frame.size.height - kCommentViewHeight, kScreenWidth, kCommentViewHeight);
}];
}
- (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text
{
if (![text isEqualToString:@""]) {
_commentView.placeholderLabel2.hidden = YES;
}
if ([text isEqualToString:@""] && range.location == 0 && range.length == 1) {
_commentView.placeholderLabel2.hidden = NO;
}
if ([text isEqualToString:@"\n"]) {
[_commentView.contentTextView resignFirstResponder];
if (textView.text.length != 0) {
_commentView.placeholderLabel2.hidden = YES;
} else {
_commentView.placeholderLabel2.hidden = NO;
}
return NO;
}
if (range.location>=200) {
return NO;
}
else {
return YES;
}
return YES;
}
#pragma mark - UIAlertViewDelegate
-(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
// 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":_questionUuid,
// @"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.tag = 455232;
// [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];
// }
// } else if (alertView.tag == 455232) {
// // 刷新当前问题详情的评论列表
// if (buttonIndex == 0) {
// NSString *user_uuid = [[NSUserDefaults standardUserDefaults] objectForKey:@"user_uuid"];
// NSString *url = [NSString stringWithFormat:@"%@%@%@?userUuid=%@", kRedStarURL, kQuestionDetailURL, _questionUuid ,user_uuid];
//
// HttpClient *httpClient = [[HttpClient alloc] initWithUrl:url];
// [MBProgressHUD showHUDAddedTo:self.view animated:YES];
// [httpClient getQuestionDetailWithParameters:nil completion:^(id response, NSError *error) {
// NSDictionary *dict = response[@"data"];
// NSLog(@"问题详情 = %@", dict);
// QuestionDetailModel *quesDetail = [[QuestionDetailModel alloc] init];
// [quesDetail setValuesForKeysWithDictionary:dict];
// _questionDetailModel = quesDetail;
//
// NSArray *commentArray = _questionDetailModel.comments;
// NSMutableArray *tempArray = [NSMutableArray array];
// for (NSDictionary *dict in commentArray) {
// CommentModel *comment = [[CommentModel alloc] init];
// [comment setValuesForKeysWithDictionary:dict];
// [tempArray addObject:comment];
// }
// _allCommentArray = tempArray;
// [self.tableView reloadData];
// [MBProgressHUD hideHUDForView:self.view animated:YES];
//
// }];
// }
// }
}
#pragma mark - lazy Laoding
- (UITableView *)tableView
{
if (!_tableView) {
_tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStyleGrouped];
_tableView.translatesAutoresizingMaskIntoConstraints = NO;
_tableView.rowHeight = UITableViewAutomaticDimension;
_tableView.estimatedRowHeight = 200.0;
[_tableView registerClass:[PictureDetailTableCell class] forCellReuseIdentifier:kPictureDetailTableCell];
[_tableView registerClass:[PictureTextTableCell class] forCellReuseIdentifier:kPictureTextTableCell];
[_tableView registerClass:[PictureCommentTableCell class] forCellReuseIdentifier:kPictureCommentTableCell];
[self.view addSubview:_tableView];
NSLayoutConstraint *tableTop = [NSLayoutConstraint constraintWithItem:_tableView 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];
[self.view addConstraint:tableLeft];
NSLayoutConstraint *tableRight = [NSLayoutConstraint constraintWithItem:_tableView 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];
[self.view addConstraint:tableBottom];
}
return _tableView;
}
@end
//
// PicScreenView.h
// redstar
//
// Created by admin on 15/12/11.
// Copyright © 2015年 ZWF. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "GroupTabBar.h"
#import "ScopeTableView.h"
#import "StateTableView.h"
#import "TimeTableView.h"
@interface PicScreenView : UIView
@property (nonatomic, strong) GroupTabBar *groupTabBar; // 重置
@property (nonatomic, strong) UIButton *resetBtn; // 重置
@property (nonatomic, strong) UIButton *submitBtn; // 提交
@property (nonatomic, strong) ScopeTableView *scopeTableView;
@property (nonatomic, strong) UITextView *textView1;
@property (nonatomic, strong) UITextView *textView2;
@property (nonatomic, strong) StateTableView *stateTableView;
@property (nonatomic, strong) TimeTableView *timeTableView;
@end
//
// PicScreenView.m
// redstar
//
// Created by admin on 15/12/11.
// Copyright © 2015年 ZWF. All rights reserved.
//
#import "PicScreenView.h"
#import "GroupItems.h"
#define SELECTED_VIEW_CONTROLLER_TAG 23656534
@interface PicScreenView ()<GroupTabBarDelegate, UITextViewDelegate>
@property (nonatomic, strong) UIView *backView;
@property (nonatomic, strong) UILabel *placeholderLabel1;
@property (nonatomic, strong) UILabel *placeholderLabel2;
@end
@implementation PicScreenView
- (instancetype)init
{
self = [super init];
if (self) {
[self setup];
}
return self;
}
- (instancetype)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
[self setup];
}
return self;
}
- (void)setup
{
self.groupTabBar = [[GroupTabBar alloc] initWithFrame:CGRectMake(0, 0, 100, 250)];
_groupTabBar.delegate = self;
[self addSubview:_groupTabBar];
self.scopeTableView = [[ScopeTableView alloc] init];
GroupItems *scopeItem = [[GroupItems alloc] initWithTitle:@"问题范围" view:_scopeTableView];
self.textView1 = [[UITextView alloc] init];
_textView1.delegate = self;
_textView1.tag = 9991;
self.placeholderLabel1 = [[UILabel alloc] initWithFrame:CGRectMake(5, 0, 100, 30)];
self.placeholderLabel1.text = @"请输入标题...";
self.placeholderLabel1.font = [UIFont systemFontOfSize:15.0];
self.placeholderLabel1.textColor = kOnLineCellDetailColor;
[self.textView1 addSubview:self.placeholderLabel1];
GroupItems *textViewItem1 = [[GroupItems alloc] initWithTitle:@"标题类似于" view:_textView1];
self.textView2 = [[UITextView alloc] init];
_textView2.delegate = self;
_textView2.tag = 9992;
self.placeholderLabel2 = [[UILabel alloc] initWithFrame:CGRectMake(5, 0, 100, 30)];
self.placeholderLabel2.text = @"请输入关键字...";
self.placeholderLabel2.font = [UIFont systemFontOfSize:15.0];
self.placeholderLabel2.textColor = kOnLineCellDetailColor;
[self.textView2 addSubview:self.placeholderLabel2];
GroupItems *textViewItem2 = [[GroupItems alloc] initWithTitle:@"关键字类似于" view:_textView2];
self.stateTableView = [[StateTableView alloc] init];
GroupItems *stateItem = [[GroupItems alloc] initWithTitle:@"问题状态" view:_stateTableView];
self.timeTableView = [[TimeTableView alloc] init];
GroupItems *timeItem = [[GroupItems alloc] initWithTitle:@"时间段" view:_timeTableView];
[self insertSubview:_scopeTableView belowSubview:_groupTabBar];
[self insertSubview:_textView1 belowSubview:_groupTabBar];
[self insertSubview:_textView2 belowSubview:_groupTabBar];
[self insertSubview:_stateTableView belowSubview:_groupTabBar];
[self insertSubview:_timeTableView belowSubview:_groupTabBar];
_groupTabBar.items = @[scopeItem, textViewItem1, textViewItem2, stateItem, timeItem];
[_groupTabBar showIndex:0];
self.backView.backgroundColor = [UIColor whiteColor];
[self.resetBtn setTitle:@"重置" forState:UIControlStateNormal];
[self.submitBtn setTitle:@"提交" forState:UIControlStateNormal];
}
- (void)switchView:(UIView *)view
{
UIView *currentView = [self viewWithTag:SELECTED_VIEW_CONTROLLER_TAG];
[currentView removeFromSuperview];
currentView = nil;
view.frame = CGRectMake(self.groupTabBar.frame.size.width,0,kScreenWidth - self.groupTabBar.frame.size.width, self.groupTabBar.size.height);
view.tag = SELECTED_VIEW_CONTROLLER_TAG;
[self insertSubview:view belowSubview:_groupTabBar];
}
- (UIView *)backView
{
if (!_backView) {
_backView = [[UIView alloc] init];
_backView.translatesAutoresizingMaskIntoConstraints = NO;
[self addSubview:_backView];
NSLayoutConstraint *lineViewTop = [NSLayoutConstraint constraintWithItem:_backView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.groupTabBar attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0];
[self addConstraint:lineViewTop];
NSLayoutConstraint *lineViewRight = [NSLayoutConstraint constraintWithItem:_backView attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeRight multiplier:1.0 constant:0];
[self addConstraint:lineViewRight];
NSLayoutConstraint *lineViewBottom = [NSLayoutConstraint constraintWithItem:_backView attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0];
[self addConstraint:lineViewBottom];
NSLayoutConstraint *lineViewLeft = [NSLayoutConstraint constraintWithItem:_backView attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeLeft multiplier:1.0 constant:0];
[self addConstraint:lineViewLeft];
}
return _backView;
}
- (UIButton *)resetBtn
{
if (!_resetBtn) {
_resetBtn = [[UIButton alloc] init];
_resetBtn.backgroundColor = [UIColor grayColor];
_resetBtn.translatesAutoresizingMaskIntoConstraints = NO;
_resetBtn.layer.cornerRadius = 4.0;
[self.backView addSubview:_resetBtn];
NSLayoutConstraint *lineViewTop = [NSLayoutConstraint constraintWithItem:_resetBtn attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.backView attribute:NSLayoutAttributeTop multiplier:1.0 constant:7.5];
[self.backView addConstraint:lineViewTop];
NSLayoutConstraint *lineViewRight = [NSLayoutConstraint constraintWithItem:_resetBtn attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.backView attribute:NSLayoutAttributeCenterX multiplier:1.0 constant:-20];
[self.backView addConstraint:lineViewRight];
NSLayoutConstraint *lineViewBottom = [NSLayoutConstraint constraintWithItem:_resetBtn attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.backView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:-7.5];
[self.backView addConstraint:lineViewBottom];
NSLayoutConstraint *lineViewLeft = [NSLayoutConstraint constraintWithItem:_resetBtn attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.backView attribute:NSLayoutAttributeLeft multiplier:1.0 constant:20];
[self.backView addConstraint:lineViewLeft];
}
return _resetBtn;
}
- (UIButton *)submitBtn
{
if (!_submitBtn) {
_submitBtn = [[UIButton alloc] init];
_submitBtn.backgroundColor = kNavigationBarColor;
_submitBtn.translatesAutoresizingMaskIntoConstraints = NO;
_submitBtn.layer.cornerRadius = 4.0;
[self.backView addSubview:_submitBtn];
NSLayoutConstraint *lineViewTop = [NSLayoutConstraint constraintWithItem:_submitBtn attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.backView attribute:NSLayoutAttributeTop multiplier:1.0 constant:7.5];
[self.backView addConstraint:lineViewTop];
NSLayoutConstraint *lineViewRight = [NSLayoutConstraint constraintWithItem:_submitBtn attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.backView attribute:NSLayoutAttributeRight multiplier:1.0 constant:-20];
[self.backView addConstraint:lineViewRight];
NSLayoutConstraint *lineViewBottom = [NSLayoutConstraint constraintWithItem:_submitBtn attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.backView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:-7.5];
[self.backView addConstraint:lineViewBottom];
NSLayoutConstraint *lineViewLeft = [NSLayoutConstraint constraintWithItem:_submitBtn attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.backView attribute:NSLayoutAttributeCenterX multiplier:1.0 constant:20];
[self.backView addConstraint:lineViewLeft];
}
return _submitBtn;
}
#pragma mark - UITextView Delegate
- (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text {
if (![text isEqualToString:@""]) {
if (textView.tag == 9991) {
self.placeholderLabel1.hidden = YES;
} else {
self.placeholderLabel2.hidden = YES;
}
}
if ([text isEqualToString:@""] && range.location == 0 && range.length == 1) {
if (textView.tag == 9991) {
self.placeholderLabel1.hidden = NO;
} else {
self.placeholderLabel2.hidden = NO;
}
}
if ([text isEqualToString:@"\n"]) {
[self.textView1 resignFirstResponder];
[self.textView2 resignFirstResponder];
if (textView.tag == 9991) {
if (textView.text.length != 0) {
self.placeholderLabel1.hidden = YES;
} else {
self.placeholderLabel1.hidden = NO;
}
} else {
if (textView.text.length != 0) {
self.placeholderLabel2.hidden = YES;
} else {
self.placeholderLabel2.hidden = NO;
}
}
return NO;
}
return YES;
}
@end
......@@ -14,17 +14,23 @@
#import "AddPictureViewController.h"
#import "TaxisView.h"
#import "ScreenView.h"
#import "PicScreenView.h"
#import "MenuView.h"
#import "NoDataView.h"
#import "HttpClient.h"
#import <MBProgressHUD.h>
#import <MJRefresh.h>
#define kPictureTableViewCell @"pictureTabelViewCell"
@interface PictureViewController () <UITableViewDelegate, UITableViewDataSource, ScreenTableDelegate, TaxisViewDelegate, InspectTableViewDelegate>
@interface PictureViewController () <UITableViewDelegate, UITableViewDataSource, TaxisViewDelegate,ScopeTableViewDelegate, StateTableViewDelegate, TimeTableViewDelegate >
@property (nonatomic, strong) MenuView *menuView;
@property (nonatomic, strong) TaxisView *taxisView;
@property (nonatomic, strong) ScreenView *screenView;
@property (nonatomic, strong) PicScreenView *screenView;
@property (nonatomic, strong) MenuButton *selctedButton;
@property (nonatomic, strong) UIView *bgView;
......@@ -34,10 +40,15 @@
@property (nonatomic, strong) UITableView *tableView;
@property (nonatomic, strong) NSArray *test1Array;
@property (nonatomic, strong) NSArray *test2Array;
@property (nonatomic, strong) NSArray *test3Array;
@property (nonatomic, strong) NoDataView *noDataView;
@property (nonatomic, assign) NSInteger scopeRow;
@property (nonatomic, assign) NSInteger stateRow;
@property (nonatomic, assign) NSInteger timeRow;
@property (nonatomic, assign) NSMutableArray *allPraiseListArray;
@property (nonatomic, assign) int page;
@end
@implementation PictureViewController
......@@ -48,7 +59,11 @@
[self setupNav];
[self setupTableView];
self.allPraiseListArray = [NSMutableArray array];
self.tableView.delegate = self;
self.tableView.dataSource = self;
self.menuView.backgroundColor = kInspectSectionBackGroundColor;
if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0) {
self.edgesForExtendedLayout = UIRectEdgeNone;
......@@ -58,15 +73,13 @@
}
// 初始化
self.test1Array = [NSArray arrayWithObjects:@"【服务口碑现场】第二期",@"讲述红星人自己的故事",@"【服务口碑现场】第一期", nil];
self.test2Array = [NSArray arrayWithObjects:@"把第一次客户投诉变成商场服务提升的契机,变成商场服务提升的契机。",@"变成商场服务提升的契机,变成商场服务提升的契机。",@"把第一次客户投诉变成商场服务提升的契机,变成商场服务提升的契机。", nil];
self.test3Array = [NSArray arrayWithObjects:@"2015-08-26",@"2015-08-09",@"2015-07-31", nil];
[self requestPicturePraise];
_page = 0;
}
#pragma mark - Private Methods
- (void)setupNav
{
UILabel *customLab = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 40, 30)];
......@@ -98,24 +111,87 @@
[self.navigationController dismissViewControllerAnimated:YES completion:nil];
}
- (void)setupTableView
{
[self.tableView registerClass:[PictureTableCell class] forCellReuseIdentifier:kPictureTableViewCell];
}
- (void)addClick:(UIButton *)sender
{
AddPictureViewController *addPic = [[AddPictureViewController alloc] init];
[self.navigationController pushViewController:addPic animated:YES];
}
- (void)requestPicturePraise
{
// 请求地址
NSString *urlStr = [NSString stringWithFormat:@"%@%@", kRedStarURL, kQueryPicturePraiseURL];
NSString *user_uuid = [[NSUserDefaults standardUserDefaults] objectForKey:@"user_uuid"];
NSDictionary *parameters = @{
@"user":user_uuid,
@"scope":@"all",
@"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);
// if (_allPraiseListArray.count == 0) {
// weakSelf.noDataView.backgroundColor = [UIColor whiteColor];
// } else {
// self.tableView.delegate = self;
// self.tableView.dataSource = self;
// self.menuView.backgroundColor = kInspectSectionBackGroundColor;
// self.tableView.footer = [MJRefreshAutoNormalFooter footerWithRefreshingBlock:^{
// [self requestMoreList];
// }];
// [self.tableView reloadData];
// }
[MBProgressHUD hideHUDForView:self.view animated:YES];
}];
}
- (void)requestMoreList
{
_page++;
NSString *urlStr = [NSString stringWithFormat:@"%@%@", kRedStarURL, kQueryPicturePraiseURL];
NSString *user_uuid = [[NSUserDefaults standardUserDefaults] objectForKey:@"user_uuid"];
NSDictionary *parameters = @{
@"user":user_uuid,
@"scope":@"all",
@"pageNumber":@(_page),
@"pageSize":@(10)
};
// 发起请求
HttpClient *httpClient = [[HttpClient alloc] initWithUrl:urlStr];
// 请求问题列表
[httpClient queryPicturePraiseWithParameters:parameters completion:^(id response, NSError *error) {
NSMutableArray *tempArray = [NSMutableArray array];
if (tempArray.count < 10) {
[self.tableView.footer noticeNoMoreData];
} else {
[self.tableView.footer endRefreshing];
}
self.menuView.backgroundColor = kInspectSectionBackGroundColor;
[self.tableView reloadData];
}];
}
- (void)dropCilck:(MenuButton *)sender
{
sender.isDrop = !sender.isDrop;
if (_selctedButton.tag == sender.tag) {
if (sender.isDrop) {
if (sender.tag == 4001) {
[self showRedView];
......@@ -131,7 +207,6 @@
[self closeGreenView];
}
sender.selected = NO;
}
} else {
// 前一次选中的按钮 选中状态置为NO
......@@ -194,7 +269,6 @@
[UIView animateWithDuration:0.3 animations:^{
_bgView.alpha = 0.6;
_taxisView.alpha = 1.0;
// _taxisView.frame = toFrame;
}];
}
......@@ -206,7 +280,6 @@
[_selctedButton setTitleColor:kInspectSectionButtonTextColor forState:UIControlStateNormal];
[UIView animateWithDuration:0.3 animations:^{
_bgView.alpha = .0f;
//_taxisView.frame = fromFrame;
_taxisView.alpha = 0.0;
} completion:^(BOOL finished) {
[_bgView removeFromSuperview];
......@@ -223,9 +296,10 @@
[_bgView addGestureRecognizer:tapGR];
}
if (!_screenView) {
_screenView = [[ScreenView alloc] initWithTitleArray:[NSArray arrayWithObjects:@"待解决", @"已解决",@"已作废",nil]];
_screenView.delegate = self;
_screenView.inspectTableView.inspectDelegate = self;
_screenView = [[PicScreenView alloc] init];
_screenView.scopeTableView.scopeDeleagte = self;
_screenView.stateTableView.stateDeleagte = self;
_screenView.timeTableView.timeDeleagte = self;
_screenView.backgroundColor = [UIColor whiteColor];
}
......@@ -236,13 +310,12 @@
_bgView.alpha = 0;
_bgView.backgroundColor = [UIColor blackColor];
CGRect toFrame = CGRectMake(0, 45, kScreenWidth, kScreenViewHeight);
CGRect fromFrame = CGRectMake(0, -kScreenViewHeight, kScreenWidth, kScreenViewHeight);
_screenView.frame = fromFrame;
CGRect toFrame = CGRectMake(0, 45, kScreenWidth, 310);
_screenView.alpha = 0.0;
_screenView.frame = toFrame;
[UIView animateWithDuration:0.3 animations:^{
_bgView.alpha = 0.6;
_screenView.frame = toFrame;
_screenView.alpha = 1.0;
}];
}
......@@ -252,151 +325,303 @@
_selctedButton.isDrop = NO;
_selctedButton.selected = NO;
[_selctedButton setTitleColor:kInspectSectionButtonTextColor forState:UIControlStateNormal];
CGRect fromFrame = CGRectMake(0, -kScreenViewHeight, kScreenWidth, kScreenViewHeight);
[UIView animateWithDuration:0.3 animations:^{
_bgView.alpha = .0f;
_screenView.frame = fromFrame;
_screenView.alpha = 0.0;
} completion:^(BOOL finished) {
[_bgView removeFromSuperview];
[_screenView removeFromSuperview];
}];
}
// 重置按钮
- (void)resetClick:(UIButton *)sender
{
NSInteger selectedIndex = 0;
NSIndexPath *selectedIndexPath = [NSIndexPath indexPathForRow:selectedIndex inSection:0];
[_screenView.scopeTableView selectRowAtIndexPath:selectedIndexPath animated:NO scrollPosition:UITableViewScrollPositionNone];
[_screenView.stateTableView selectRowAtIndexPath:selectedIndexPath animated:NO scrollPosition:UITableViewScrollPositionNone];
[_screenView.timeTableView selectRowAtIndexPath:selectedIndexPath animated:NO scrollPosition:UITableViewScrollPositionNone];
_screenView.textView1.text = @"";
_screenView.textView2.text = @"";
#pragma mark - UITableView Delegate/DataSource
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return _test1Array.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
}
// 提交按钮
- (void)submitClick:(UIButton *)sender
{
PictureTableCell *cell=[tableView dequeueReusableCellWithIdentifier:kPictureTableViewCell];
if (!cell) {
cell = [[PictureTableCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:kPictureTableViewCell];
// 请求地址
NSString *urlStr = [NSString stringWithFormat:@"%@%@", kRedStarURL, kQueryPicturePraiseURL];
NSString *user_uuid = [[NSUserDefaults standardUserDefaults] objectForKey:@"user_uuid"];
NSMutableDictionary *parameters = [NSMutableDictionary dictionaryWithObjectsAndKeys:
user_uuid,@"user",
@(0),@"pageNumber",
@(10),@"pageSize", nil];
// 发起请求
HttpClient *httpClient = [[HttpClient alloc] initWithUrl:urlStr];
//
__block PictureViewController *weakSelf = self;
[MBProgressHUD showHUDAddedTo:self.view animated:YES];
if (_screenView.groupTabBar.selectNumber == 0) {
if (_scopeRow == 0) {
[parameters setObject:@"all" forKey:@"scope"];
} else {
[parameters setObject:@"mine" forKey:@"scope"];
}
cell.titleLabel.text = _test1Array[indexPath.row];
cell.detailsLabel.text = _test2Array[indexPath.row];
cell.dateLabel.text = [NSString stringWithFormat:@"发布时间: %@", _test3Array[indexPath.row]];
[cell.thumbBtn setTitle:@"220" forState:UIControlStateNormal];
[cell.commentBtn setTitle:@"18" forState:UIControlStateNormal];
return cell;
NSArray *array = @[@{@"field":@"scope",
@"direction":@"asc"}];
[parameters setObject:array forKey:@"queryOrders"];
} else if (_screenView.groupTabBar.selectNumber == 1) {
[parameters setObject:_screenView.textView1.text forKey:@"contentLike"];
NSArray *array = @[@{@"field":@"title",
@"direction":@"asc"}];
[parameters setObject:array forKey:@"queryOrders"];
} else if (_screenView.groupTabBar.selectNumber == 2) {
[parameters setObject:_screenView.textView2.text forKey:@"keyword"];
NSArray *array = @[@{@"field":@"keyword",
@"direction":@"asc"}];
[parameters setObject:array forKey:@"queryOrders"];
} else if (_screenView.groupTabBar.selectNumber == 3) {
} else if (_screenView.groupTabBar.selectNumber == 4) {
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
// 当前时间
NSDate *today = [NSDate date];
NSString *todayStr = [dateFormatter stringFromDate:today];
if (_timeRow == 0) {
} else if (_timeRow == 1) {
NSDate *week = [today dateByAddingTimeInterval:-60*60*24*7];
NSString *weekStr = [dateFormatter stringFromDate:week];
[parameters setObject:weekStr forKey:@"submitTimeFrom"];
[parameters setObject:todayStr forKey:@"submitTimeTo"];
} else if (_timeRow == 2) {
NSDate *oneMonth = [self getPriousorLaterDateFromDate:today withMonth:-1];
NSString *oneMonthStr = [dateFormatter stringFromDate:oneMonth];
NSLog(@"oneMonth = %@", oneMonthStr);
[parameters setObject:oneMonthStr forKey:@"submitTimeFrom"];
[parameters setObject:todayStr forKey:@"submitTimeTo"];
} else if (_timeRow == 3) {
NSDate *threeMonth = [self getPriousorLaterDateFromDate:today withMonth:-3];
NSString *threeMonthStr = [dateFormatter stringFromDate:threeMonth];
[parameters setObject:threeMonthStr forKey:@"submitTimeFrom"];
[parameters setObject:todayStr forKey:@"submitTimeTo"];
} else if (_timeRow == 4) {
NSDate *oneYear = [self getPriousorLaterDateFromDate:today withMonth:-12];
NSString *oneYearStr = [dateFormatter stringFromDate:oneYear];
[parameters setObject:oneYearStr forKey:@"submitTimeFrom"];
[parameters setObject:todayStr forKey:@"submitTimeTo"];
} else {
NSDate *oneYear = [self getPriousorLaterDateFromDate:today withMonth:-12];
NSString *oneYearStr = [dateFormatter stringFromDate:oneYear];
[parameters setObject:oneYearStr forKey:@"submitTimeTo"];
}
NSArray *array = @[@{@"field":@"submitTime",
@"direction":@"asc"}];
[parameters setObject:array forKey:@"queryOrders"];
}
NSLog(@"parameters = %@",parameters);
// 请求问题列表
[httpClient getQuestionListWithParameters:parameters completion:^(id response, NSError *error) {
NSLog(@"图说口碑 列表recods = %@", response);
NSMutableArray *tempArray = [NSMutableArray array];
_allPraiseListArray = tempArray;
if (_allPraiseListArray.count == 0) {
if (_tableView) {
[_tableView removeFromSuperview];
_tableView = nil;
}
weakSelf.noDataView.backgroundColor = [UIColor whiteColor];
[MBProgressHUD hideHUDForView:weakSelf.view animated:YES];
[weakSelf closeGreenView];
} else {
if (_noDataView) {
[_noDataView removeFromSuperview];
_noDataView = nil;
}
weakSelf.tableView.delegate = weakSelf;
weakSelf.tableView.dataSource = weakSelf;
[weakSelf.tableView reloadData];
[MBProgressHUD hideHUDForView:weakSelf.view animated:YES];
[weakSelf closeGreenView];
}
self.menuView.backgroundColor = kInspectSectionBackGroundColor;
}];
}
// cell的高度
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
- (NSDate *)getPriousorLaterDateFromDate:(NSDate *)date withMonth:(int)month
{
return 123;
NSDateComponents *comps = [[NSDateComponents alloc] init];
[comps setMonth:month];
NSCalendar *calender = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar];
NSDate *mDate = [calender dateByAddingComponents:comps toDate:date options:0];
return mDate;
}
// section高度
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
#pragma mark - MoreScreenDelegate
- (void)scopeTableViewClick:(NSInteger)row
{
return 45;
_scopeRow = row;
}
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
- (void)stateTableViewClick:(NSInteger)row
{
return 0;
_stateRow = row;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
- (void)timeTableViewClick:(NSInteger)row
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"提示" message:@"该功能正在努力开发中!" delegate:self cancelButtonTitle:nil otherButtonTitles:@"确定", nil];
[alert show];
// PictureStoryViewController *storyVC = [[PictureStoryViewController alloc] init];
// [self.navigationController pushViewController:storyVC animated:YES];
_timeRow = row;
}
// 自定义section
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
#pragma mark - TaxisDelegate
- (void)timeChange:(UIButton *)sender
{
// 创建sectionView
UIView *sectionView = [[UIView alloc] init];
sectionView.userInteractionEnabled = YES;
sectionView.backgroundColor = kInspectSectionBackGroundColor;
// 请求地址
NSString *urlStr = [NSString stringWithFormat:@"%@%@", kRedStarURL, kQueryPicturePraiseURL];
NSString *user_uuid = [[NSUserDefaults standardUserDefaults] objectForKey:@"user_uuid"];
UIView *lineView = [[UIView alloc] init];
lineView.translatesAutoresizingMaskIntoConstraints = NO;
lineView.backgroundColor = kSeparateLineColor;
[sectionView addSubview:lineView];
NSArray *queryOrders;
if (sender.tag - kTAxisBtnTag == 1) {
queryOrders = @[];
NSLayoutConstraint *lineTop = [NSLayoutConstraint constraintWithItem:lineView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:sectionView attribute:NSLayoutAttributeTop multiplier:1.0 constant:0];
[sectionView addConstraint:lineTop];
} else if (sender.tag - kTAxisBtnTag == 2) {
NSLayoutConstraint *lineLeft = [NSLayoutConstraint constraintWithItem:lineView attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:sectionView attribute:NSLayoutAttributeCenterX multiplier:1.0 constant:-0.5];
[sectionView addConstraint:lineLeft];
queryOrders = @[@{@"field":@"likeCount",
@"direction":@"desc"}];
NSLayoutConstraint *lineWidth = [NSLayoutConstraint constraintWithItem:lineView attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:1];
[sectionView addConstraint:lineWidth];
} else {
queryOrders = @[@{@"field":@"likeCount",
@"direction":@"asc"}];
}
NSLayoutConstraint *lineBottom = [NSLayoutConstraint constraintWithItem:lineView attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:sectionView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0];
[sectionView addConstraint:lineBottom];
NSDictionary *parameters = @{@"user":user_uuid,
@"scope":@"all",
@"pageNumber":@(0),
@"pageSize":@(20),
@"queryOrders":queryOrders
};
MenuButton *taxiButton = [[MenuButton alloc] init];
taxiButton.translatesAutoresizingMaskIntoConstraints = NO;
[taxiButton setTitleColor:kInspectSectionButtonTextColor forState:UIControlStateNormal];
[taxiButton setImage:[UIImage imageNamed:@"sort_icon"] forState:UIControlStateNormal];
taxiButton.titleLabel.font = [UIFont systemFontOfSize:14.0];
[taxiButton setTitle:@"排序" forState:UIControlStateNormal];
[sectionView addSubview:taxiButton];
// 发起请求
HttpClient *httpClient = [[HttpClient alloc] initWithUrl:urlStr];
[MBProgressHUD showHUDAddedTo:self.view animated:YES];
MenuButton *screenButton = [[MenuButton alloc] init];
screenButton.translatesAutoresizingMaskIntoConstraints = NO;
[screenButton setTitleColor:kInspectSectionButtonTextColor forState:UIControlStateNormal];
[screenButton setImage:[UIImage imageNamed:@"filter_icon"] forState:UIControlStateNormal];
screenButton.titleLabel.font = [UIFont systemFontOfSize:14.0];
[screenButton setTitle:@"筛选" forState:UIControlStateNormal];
[sectionView addSubview:screenButton];
taxiButton.tag = 4001;
[taxiButton addTarget:self action:@selector(dropCilck:) forControlEvents:UIControlEventTouchUpInside];
[screenButton addTarget:self action:@selector(dropCilck:) forControlEvents:UIControlEventTouchUpInside];
// 请求问题列表
[httpClient queryPicturePraiseWithParameters:parameters completion:^(id response, NSError *error) {
NSLog(@"图说口碑 按点赞数 resp = %@ error = %@", response ,error);
[MBProgressHUD hideHUDForView:self.view animated:YES];
}];
// taxiButton布局
NSLayoutConstraint *taxiButtonTop = [NSLayoutConstraint constraintWithItem:taxiButton attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:sectionView attribute:NSLayoutAttributeTop multiplier:1.0 constant:0];
[sectionView addConstraint:taxiButtonTop];
NSLayoutConstraint *taxiButtonLeft = [NSLayoutConstraint constraintWithItem:taxiButton attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:sectionView attribute:NSLayoutAttributeLeft multiplier:1.0 constant:0];
[sectionView addConstraint:taxiButtonLeft];
[self closeRedView];
}
NSLayoutConstraint *taxiButtonWidth = [NSLayoutConstraint constraintWithItem:taxiButton attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:screenButton attribute:NSLayoutAttributeWidth multiplier:1.0 constant:0];
[sectionView addConstraint:taxiButtonWidth];
NSLayoutConstraint *taxiButtonBottom = [NSLayoutConstraint constraintWithItem:taxiButton attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:sectionView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0];
[sectionView addConstraint:taxiButtonBottom];
// screenButton布局
NSLayoutConstraint *screenButtonTop = [NSLayoutConstraint constraintWithItem:screenButton attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:sectionView attribute:NSLayoutAttributeTop multiplier:1.0 constant:0];
[sectionView addConstraint:screenButtonTop];
#pragma mark - UITableView Delegate/DataSource
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return 2;
}
NSLayoutConstraint *screenButtonRight = [NSLayoutConstraint constraintWithItem:screenButton attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:sectionView attribute:NSLayoutAttributeRight multiplier:1.0 constant:0];
[sectionView addConstraint:screenButtonRight];
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
PictureTableCell *cell=[tableView dequeueReusableCellWithIdentifier:kPictureTableViewCell];
if (!cell) {
cell = [[PictureTableCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:kPictureTableViewCell];
}
cell.titleLabel.text = @"【服务口碑现场】第二期";
cell.detailsLabel.text = @"把第一次客户投诉变成商场服务提升的契机,变成商场服务提升的契机。";
cell.dateLabel.text = [NSString stringWithFormat:@"发布时间: 2015-08-26"];
[cell.thumbBtn setTitle:@"220" forState:UIControlStateNormal];
[cell.commentBtn setTitle:@"18" forState:UIControlStateNormal];
return cell;
}
NSLayoutConstraint *screenButtonLeft = [NSLayoutConstraint constraintWithItem:screenButton attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:taxiButton attribute:NSLayoutAttributeRight multiplier:1.0 constant:0];
[sectionView addConstraint:screenButtonLeft];
NSLayoutConstraint *screenButtonBottom = [NSLayoutConstraint constraintWithItem:screenButton attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:sectionView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0];
[sectionView addConstraint:screenButtonBottom];
// section高度
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
return CGFLOAT_MIN;
}
return sectionView;
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
{
return CGFLOAT_MIN;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
PictureStoryViewController *storyVC = [[PictureStoryViewController alloc] init];
[self.navigationController pushViewController:storyVC animated:YES];
}
#pragma mark - lazy loading
- (MenuView *)menuView
{
if (!_menuView) {
_menuView = [[MenuView alloc] init];
_menuView.translatesAutoresizingMaskIntoConstraints = NO;
[_menuView.taxiButton addTarget:self action:@selector(dropCilck:) forControlEvents:UIControlEventTouchUpInside];
[_menuView.screenButton addTarget:self action:@selector(dropCilck:) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:_menuView];
NSLayoutConstraint *menuTop = [NSLayoutConstraint constraintWithItem:_menuView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeTop multiplier:1.0 constant:0];
[self.view addConstraint:menuTop];
NSLayoutConstraint *menuLeft = [NSLayoutConstraint constraintWithItem:_menuView attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeLeft multiplier:1.0 constant:0];
[self.view addConstraint:menuLeft];
NSLayoutConstraint *menuRight = [NSLayoutConstraint constraintWithItem:_menuView attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeRight multiplier:1.0 constant:0];
[self.view addConstraint:menuRight];
NSLayoutConstraint *menuHeight = [NSLayoutConstraint constraintWithItem:_menuView attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:45];
[self.view addConstraint:menuHeight];
}
return _menuView;
}
- (UITableView *)tableView
{
if (!_tableView) {
_tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain];
_tableView.translatesAutoresizingMaskIntoConstraints = NO;
_tableView.delegate = self;
_tableView.dataSource = self;
_tableView.showsVerticalScrollIndicator = NO;
_tableView.showsHorizontalScrollIndicator = NO;
_tableView.tableFooterView = [[UIView alloc] init];
_tableView.rowHeight = UITableViewAutomaticDimension;
_tableView.estimatedRowHeight = 150.0;
[_tableView registerClass:[PictureTableCell class] forCellReuseIdentifier:kPictureTableViewCell];
[self.view addSubview:_tableView];
NSLayoutConstraint *tableTop = [NSLayoutConstraint constraintWithItem:_tableView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeTop multiplier:1.0 constant:0];
NSLayoutConstraint *tableTop = [NSLayoutConstraint constraintWithItem:_tableView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeTop multiplier:1.0 constant:45];
[self.view addConstraint:tableTop];
NSLayoutConstraint *tableLeft = [NSLayoutConstraint constraintWithItem:_tableView attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeLeft multiplier:1.0 constant:0];
......@@ -411,19 +636,27 @@
return _tableView;
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (NoDataView *)noDataView
{
if (!_noDataView) {
_noDataView = [[NoDataView alloc] init];
_noDataView.translatesAutoresizingMaskIntoConstraints = NO;
[self.view addSubview:_noDataView];
/*
#pragma mark - Navigation
NSLayoutConstraint *tableTop = [NSLayoutConstraint constraintWithItem:_noDataView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeTop multiplier:1.0 constant:45];
[self.view addConstraint:tableTop];
// 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.
NSLayoutConstraint *tableLeft = [NSLayoutConstraint constraintWithItem:_noDataView attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeLeft multiplier:1.0 constant:0];
[self.view addConstraint:tableLeft];
NSLayoutConstraint *tableRight = [NSLayoutConstraint constraintWithItem:_noDataView attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeRight multiplier:1.0 constant:0];
[self.view addConstraint:tableRight];
NSLayoutConstraint *tableBottom = [NSLayoutConstraint constraintWithItem:_noDataView attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0];
[self.view addConstraint:tableBottom];
}
return _noDataView;
}
*/
@end
......@@ -102,29 +102,6 @@
#pragma mark - Private Methods
//- (void)requestGroupTitle
//{
// NSString *url = [NSString stringWithFormat:@"%@%@", kRedStarURL, kQuestionGroupURL];
// HttpClient *httpClient = [[HttpClient alloc] initWithUrl:url];
// // 请求问题列表
// [httpClient getQuestionGroupWithCompletion:^(id response, NSError *error) {
// NSLog(@"请求问题专业分组 res = %@", response);
// NSLog(@"请求问题专业分组 error = %@", error);
// if (response[@"success"]) {
// NSDictionary *dataDict = response[@"data"];
// NSArray *array = dataDict[@"records"];
// NSMutableArray *titleArray = [NSMutableArray array];
// for (NSDictionary *dict in array) {
// NSString *name = dict[@"name"];
// [titleArray addObject:name];
// }
// NSLog(@"titleArray 2222= %@", titleArray);
// [[NSUserDefaults standardUserDefaults] setObject:titleArray forKey:@"groupTitle"];
// }
//
// }];
//}
- (void)requestQuestionList
{
// 请求地址
......@@ -202,7 +179,7 @@
}
[_allQuestionArray addObjectsFromArray:tempArray];
if (tempArray.count < 5) {
if (tempArray.count < 10) {
[self.tableView.footer noticeNoMoreData];
} else {
[self.tableView.footer endRefreshing];
......
......@@ -124,6 +124,7 @@
}];
}
- (void)addComment:(UIButton *)sender
{
NSArray *permissions = [[NSUserDefaults standardUserDefaults] objectForKey:@"permissions"];
......
......@@ -88,4 +88,30 @@ typedef void (^completionBlock) (id response, NSError *error);
// 获取问题专业组
- (void)getQuestionCategoryWithCompletion:(completionBlock)completion;
/**
* 图说口碑相关URL
*/
// 保存图说口碑
- (void)savePicturePraiseWithParameters:(id)parameters completion:(completionBlock)completion;
// 上传口碑图片
- (void)upLoadPraisePictureWithParameters:(id)parameters completion:(completionBlock)completion;
// 提交图说口碑
- (void)submitPicturePraiseWithCompletion:(completionBlock)completion;
// 查询图说口碑
- (void)queryPicturePraiseWithParameters:(id)parameters completion:(completionBlock)completion;
// 图说口碑明细
- (void)getPicturePraiseDetailWithCompletion:(completionBlock)completion;
// 口碑点赞
- (void)getLikePicturePraiseWithCompletion:(completionBlock)completion;
// 口碑取消点赞
- (void)cancelLikePicturePraiseWithCompletion:(completionBlock)completion;
@end
......@@ -323,4 +323,78 @@
}];
}
/**
* 图说口碑相关URL
*/
// 保存图说口碑
- (void)savePicturePraiseWithParameters:(id)parameters completion:(completionBlock)completion
{
[self postParameters:parameters completion:^(id response, NSError *error) {
if (completion) {
completion (response, error);
}
}];
}
// 上传口碑图片
- (void)upLoadPraisePictureWithParameters:(id)parameters completion:(completionBlock)completion
{
[self postParameters:parameters completion:^(id response, NSError *error) {
if (completion) {
completion (response, error);
}
}];
}
// 提交图说口碑
- (void)submitPicturePraiseWithCompletion:(completionBlock)completion
{
[self postParameters:nil completion:^(id response, NSError *error) {
if (completion) {
completion (response, error);
}
}];
}
// 查询图说口碑
- (void)queryPicturePraiseWithParameters:(id)parameters completion:(completionBlock)completion
{
[self postParameters:parameters completion:^(id response, NSError *error) {
if (completion) {
completion (response, error);
}
}];
}
// 图说口碑明细
- (void)getPicturePraiseDetailWithCompletion:(completionBlock)completion
{
[self getParameters:nil completion:^(id response, NSError *error) {
if (completion) {
completion (response, error);
}
}];
}
// 口碑点赞
- (void)getLikePicturePraiseWithCompletion:(completionBlock)completion
{
[self postParameters:nil completion:^(id response, NSError *error) {
if (completion) {
completion (response, error);
}
}];
}
// 口碑取消点赞
- (void)cancelLikePicturePraiseWithCompletion:(completionBlock)completion
{
[self postParameters:nil completion:^(id response, NSError *error) {
if (completion) {
completion (response, error);
}
}];
}
@end
......@@ -92,8 +92,6 @@
[_delegate timeChange:button];
}
}
......
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