Commit 2069e0d8 authored by admin's avatar admin

接通图说列表接口

parent d0792c43
......@@ -19,6 +19,9 @@
846206B81C06AFCA0015C456 /* RankCommentModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 846206B71C06AFCA0015C456 /* RankCommentModel.m */; };
846206BB1C06AFF50015C456 /* RankCommentCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 846206BA1C06AFF50015C456 /* RankCommentCell.m */; };
8462C6EC1BF5F3BE00344DDD /* MenuButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 8462C6EB1BF5F3BE00344DDD /* MenuButton.m */; };
846ABDF51C1E5E780020C331 /* PictureListModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 846ABDF41C1E5E780020C331 /* PictureListModel.m */; };
846ABDF91C1E74430020C331 /* PictureDetailModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 846ABDF81C1E74430020C331 /* PictureDetailModel.m */; };
846ABDFC1C1EAB160020C331 /* PicTextModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 846ABDFB1C1EAB160020C331 /* PicTextModel.m */; };
84720BC11C0377D300314099 /* CommentWithStarView.m in Sources */ = {isa = PBXBuildFile; fileRef = 84720BC01C0377D300314099 /* CommentWithStarView.m */; };
8473E3881C1BBFF600960257 /* InspectTaskDetailCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 8473E3871C1BBFF600960257 /* InspectTaskDetailCell.m */; };
8473E38B1C1BCFC400960257 /* InspectTitleTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 8473E38A1C1BCFC400960257 /* InspectTitleTableViewCell.m */; };
......@@ -181,6 +184,12 @@
846206BA1C06AFF50015C456 /* RankCommentCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RankCommentCell.m; sourceTree = "<group>"; };
8462C6EA1BF5F3BE00344DDD /* MenuButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MenuButton.h; sourceTree = "<group>"; };
8462C6EB1BF5F3BE00344DDD /* MenuButton.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MenuButton.m; sourceTree = "<group>"; };
846ABDF31C1E5E780020C331 /* PictureListModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PictureListModel.h; sourceTree = "<group>"; };
846ABDF41C1E5E780020C331 /* PictureListModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PictureListModel.m; sourceTree = "<group>"; };
846ABDF71C1E74430020C331 /* PictureDetailModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PictureDetailModel.h; sourceTree = "<group>"; };
846ABDF81C1E74430020C331 /* PictureDetailModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PictureDetailModel.m; sourceTree = "<group>"; };
846ABDFA1C1EAB160020C331 /* PicTextModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PicTextModel.h; sourceTree = "<group>"; };
846ABDFB1C1EAB160020C331 /* PicTextModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PicTextModel.m; sourceTree = "<group>"; };
84720BBF1C0377D300314099 /* CommentWithStarView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CommentWithStarView.h; sourceTree = "<group>"; };
84720BC01C0377D300314099 /* CommentWithStarView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CommentWithStarView.m; sourceTree = "<group>"; };
8473E3861C1BBFF600960257 /* InspectTaskDetailCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectTaskDetailCell.h; sourceTree = "<group>"; };
......@@ -675,6 +684,26 @@
path = View;
sourceTree = "<group>";
};
846ABDF21C1E5E660020C331 /* Model */ = {
isa = PBXGroup;
children = (
846ABDF31C1E5E780020C331 /* PictureListModel.h */,
846ABDF41C1E5E780020C331 /* PictureListModel.m */,
);
path = Model;
sourceTree = "<group>";
};
846ABDF61C1E74360020C331 /* Model */ = {
isa = PBXGroup;
children = (
846ABDF71C1E74430020C331 /* PictureDetailModel.h */,
846ABDF81C1E74430020C331 /* PictureDetailModel.m */,
846ABDFA1C1EAB160020C331 /* PicTextModel.h */,
846ABDFB1C1EAB160020C331 /* PicTextModel.m */,
);
path = Model;
sourceTree = "<group>";
};
8474C5801BE751A2007DCF19 /* CommonFunc */ = {
isa = PBXGroup;
children = (
......@@ -963,6 +992,7 @@
8490C4C71BF9DEF0006B6569 /* PictureDetail */ = {
isa = PBXGroup;
children = (
846ABDF61C1E74360020C331 /* Model */,
8490C4C81BF9DEF0006B6569 /* Cell */,
8490C4C91BF9DEF0006B6569 /* View */,
8490C4CA1BF9DEF0006B6569 /* ViewController */,
......@@ -1002,6 +1032,7 @@
8490C4CB1BF9DEF0006B6569 /* PictureList */ = {
isa = PBXGroup;
children = (
846ABDF21C1E5E660020C331 /* Model */,
8490C4CC1BF9DEF0006B6569 /* Cell */,
8490C4CF1BF9DEF0006B6569 /* View */,
8490C4D01BF9DEF0006B6569 /* ViewController */,
......@@ -2113,15 +2144,18 @@
84C972961C1ABE08003A3276 /* PicScreenView.m in Sources */,
8473E38B1C1BCFC400960257 /* InspectTitleTableViewCell.m in Sources */,
84ECCF1B1C0210F000EA4960 /* CommentModel.m in Sources */,
846ABDF51C1E5E780020C331 /* PictureListModel.m in Sources */,
84E0ABCD1BFB082E001C8F45 /* TaskDetailModel.m in Sources */,
8490C4D31BF9DEF0006B6569 /* PictureTableCell.m in Sources */,
84970E391BD8E0B300C1728A /* LoginView.m in Sources */,
84DB9BC41BDCD4B600822CC4 /* CustomDropMenuView.m in Sources */,
84D3E5F31C04BCD3001FF1DD /* InspectNotUploadViewController.m in Sources */,
846ABDF91C1E74430020C331 /* PictureDetailModel.m in Sources */,
84D3E5F91C04BD8E001FF1DD /* InspectNotUpLoadCell.m in Sources */,
84ECCF181C01FA2600EA4960 /* QuestionDetailModel.m in Sources */,
843D1B9E1C0B3F7600E30002 /* SpotCheckOnLineViewController.m in Sources */,
84846E9A1BE07CDF0010550A /* RankingListCell.m in Sources */,
846ABDFC1C1EAB160020C331 /* PicTextModel.m in Sources */,
84A673911C0C2681000F828E /* FunctionViewController.m in Sources */,
848699B61BDF812F00859DFE /* RankingListViewController.m in Sources */,
84C9729C1C1ADC5B003A3276 /* PictureTextTableCell.m in Sources */,
......
......@@ -127,9 +127,9 @@
// self.tableView.delegate = self;
// self.tableView.dataSource = self;
// // 下拉加载更多
// self.tableView.footer = [MJRefreshAutoNormalFooter footerWithRefreshingBlock:^{
// [self requestMoreList];
// }];
// self.tableView.footer = [MJRefreshBackNormalFooter footerWithRefreshingBlock:^{
// [self requestMoreList];
// }];
// [self.tableView reloadData];
// }
......@@ -418,7 +418,7 @@
self.tableView.delegate = self;
self.tableView.dataSource = self;
// 下拉加载更多
self.tableView.footer = [MJRefreshAutoNormalFooter footerWithRefreshingBlock:^{
self.tableView.footer = [MJRefreshBackNormalFooter footerWithRefreshingBlock:^{
[self requestMoreList];
}];
[self.tableView reloadData];
......@@ -534,7 +534,7 @@
self.tableView.delegate = self;
self.tableView.dataSource = self;
// 下拉加载更多
self.tableView.footer = [MJRefreshAutoNormalFooter footerWithRefreshingBlock:^{
self.tableView.footer = [MJRefreshBackNormalFooter footerWithRefreshingBlock:^{
[self requestMoreList];
}];
[self.tableView reloadData];
......
......@@ -134,9 +134,9 @@
// self.tableView.delegate = self;
// self.tableView.dataSource = self;
// // 下拉加载更多
// self.tableView.footer = [MJRefreshAutoNormalFooter footerWithRefreshingBlock:^{
// [self requestMoreList];
// }];
// self.tableView.footer = [MJRefreshBackNormalFooter footerWithRefreshingBlock:^{
// [self requestMoreList];
// }];
// [self.tableView reloadData];
// }
......@@ -431,7 +431,7 @@
self.tableView.delegate = self;
self.tableView.dataSource = self;
// 下拉加载更多
self.tableView.footer = [MJRefreshAutoNormalFooter footerWithRefreshingBlock:^{
self.tableView.footer = [MJRefreshBackNormalFooter footerWithRefreshingBlock:^{
[self requestMoreList];
}];
[self.tableView reloadData];
......@@ -510,7 +510,7 @@
self.tableView.delegate = self;
self.tableView.dataSource = self;
// 下拉加载更多
self.tableView.footer = [MJRefreshAutoNormalFooter footerWithRefreshingBlock:^{
self.tableView.footer = [MJRefreshBackNormalFooter footerWithRefreshingBlock:^{
[self requestMoreList];
}];
[self.tableView reloadData];
......
......@@ -73,7 +73,6 @@
[_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];
......
......@@ -9,5 +9,7 @@
#import <UIKit/UIKit.h>
@interface PictureTextTableCell : UITableViewCell
@property (nonatomic, strong) UIImageView *bigImageView;
@property (nonatomic, strong) UILabel *descriptionLabel;
@end
......@@ -9,9 +9,56 @@
#import "PictureTextTableCell.h"
@implementation PictureTextTableCell
- (UIImageView *)bigImageView
{
if (!_bigImageView) {
_bigImageView = [[UIImageView alloc] init];
_bigImageView.translatesAutoresizingMaskIntoConstraints = NO;
[self.contentView addSubview:_bigImageView];
// 顶端
NSLayoutConstraint *titleTop = [NSLayoutConstraint constraintWithItem:_bigImageView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeTop multiplier:1.0 constant:5];
[self.contentView addConstraint:titleTop];
// 左边
NSLayoutConstraint *titleLeft = [NSLayoutConstraint constraintWithItem:_bigImageView attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeLeft multiplier:1.0 constant:20];
[self.contentView addConstraint:titleLeft];
// 右边
NSLayoutConstraint *titleRight = [NSLayoutConstraint constraintWithItem:_bigImageView attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeRight multiplier:1.0 constant:-20];
[self.contentView addConstraint:titleRight];
// 高度
NSLayoutConstraint *titleHeight = [NSLayoutConstraint constraintWithItem:_bigImageView attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:150];
[self.contentView addConstraint:titleHeight];
}
return _bigImageView;
}
- (void)awakeFromNib {
// Initialization code
- (UILabel *)descriptionLabel
{
if (!_descriptionLabel) {
_descriptionLabel = [[UILabel alloc] init];
_descriptionLabel.translatesAutoresizingMaskIntoConstraints = NO;
[self.contentView addSubview:_descriptionLabel];
// 顶端
NSLayoutConstraint *titleTop = [NSLayoutConstraint constraintWithItem:_descriptionLabel attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.bigImageView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:5];
[self.contentView addConstraint:titleTop];
// 左边
NSLayoutConstraint *titleLeft = [NSLayoutConstraint constraintWithItem:_descriptionLabel attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeLeft multiplier:1.0 constant:20];
[self.contentView addConstraint:titleLeft];
// 右边
NSLayoutConstraint *titleRight = [NSLayoutConstraint constraintWithItem:_descriptionLabel attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeRight multiplier:1.0 constant:-20];
[self.contentView addConstraint:titleRight];
// 高度
NSLayoutConstraint *titleBottom = [NSLayoutConstraint constraintWithItem:_descriptionLabel attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:-10];
[self.contentView addConstraint:titleBottom];
}
return _descriptionLabel;
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
......
//
// PicTextModel.h
// redstar
//
// Created by admin on 15/12/14.
// Copyright © 2015年 ZWF. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface PicTextModel : NSObject
@property (nonatomic, copy) NSString *descriptionText;
@property (nonatomic, copy) NSString *fileContent;
@property (nonatomic, copy) NSString *fileName;
@property (nonatomic, copy) NSString *fileUrl;
@property (nonatomic, copy) NSString *index;
@property (nonatomic, copy) NSString *lastModified;
@property (nonatomic, copy) NSString *uuid;
@end
//
// PicTextModel.m
// redstar
//
// Created by admin on 15/12/14.
// Copyright © 2015年 ZWF. All rights reserved.
//
#import "PicTextModel.h"
@implementation PicTextModel
- (void)setValue:(id)value forUndefinedKey:(NSString *)key {
if([key isEqualToString:@"description"])
self.descriptionText = value;
}
@end
//
// PictureDetailModel.h
// redstar
//
// Created by admin on 15/12/14.
// Copyright © 2015年 ZWF. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface PictureDetailModel : NSObject
@property (nonatomic, strong) NSArray *attachments;
@property (nonatomic, copy) NSString *content;
@property (nonatomic, copy) NSString *create_id;
@property (nonatomic, copy) NSString *create_operName;
@property (nonatomic, copy) NSString *create_time;
@property (nonatomic, copy) NSString *enterprise;
@property (nonatomic, assign) int hotspot;
@property (nonatomic, copy) NSString *lastModify_id;
@property (nonatomic, copy) NSString *lastModify_operName;
@property (nonatomic, copy) NSString *lastModify_time;
@property (nonatomic, assign) int likeCount;
@property (nonatomic, assign) BOOL myLike;
@property (nonatomic, copy) NSString *state;
@property (nonatomic, copy) NSString *storePath;
@property (nonatomic, copy) NSString *store_code;
@property (nonatomic, copy) NSString *store_name;
@property (nonatomic, copy) NSString *store_uuid;
@property (nonatomic, copy) NSString *submitTime;
@property (nonatomic, copy) NSString *submit_code;
@property (nonatomic, copy) NSString *submit_name;
@property (nonatomic, copy) NSString *submit_uuid;
@property (nonatomic, copy) NSString *title;
@property (nonatomic, copy) NSString *uuid;
@property (nonatomic, copy) NSString *version;
@end
//
// PictureDetailModel.m
// redstar
//
// Created by admin on 15/12/14.
// Copyright © 2015年 ZWF. All rights reserved.
//
#import "PictureDetailModel.h"
@implementation PictureDetailModel
@end
......@@ -9,5 +9,5 @@
#import <UIKit/UIKit.h>
@interface PictureStoryViewController : UIViewController
@property (nonatomic, copy) NSString *uuid;
@end
......@@ -7,7 +7,8 @@
//
#import "PictureStoryViewController.h"
#import "PictureDetailModel.h"
#import "PicTextModel.h"
#import "PictureDetailTableCell.h"
#import "PictureTextTableCell.h"
#import "PictureCommentTableCell.h"
......@@ -17,6 +18,8 @@
#import <MBProgressHUD.h>
#import "CommentModel.h"
#import <UIImageView+WebCache.h>
#define kPictureDetailTableCell @"PictureDetailTableViewCell"
#define kPictureTextTableCell @"PictureTextTableViewCell"
#define kPictureCommentTableCell @"pictureCommentTableViewCell"
......@@ -27,6 +30,13 @@
@property (nonatomic, strong) UIView *backGroundView;
@property (nonatomic, strong) CommentView *commentView;
@property (nonatomic, strong) PictureDetailModel *pictureDetail;
@property (nonatomic, strong) NSMutableArray *picTextArray;
@property (nonatomic, strong) NSMutableArray *allCommentArray;
@property (nonatomic, copy) NSString *pictureUuid;
@end
@implementation PictureStoryViewController
......@@ -40,15 +50,14 @@
- (void)viewDidLoad {
[super viewDidLoad];
self.view.backgroundColor = [UIColor whiteColor];
self.picTextArray = [NSMutableArray array];
self.view.backgroundColor = [UIColor whiteColor];
self.automaticallyAdjustsScrollViewInsets = NO;
self.edgesForExtendedLayout = UIRectEdgeNone;
[self setupNav];
self.tableView.delegate = self;
self.tableView.dataSource = self;
_clickNumber = 0;
[self requestPicturePraiseDetail];
}
......@@ -58,11 +67,26 @@
{
NSString *user_uuid = [[NSUserDefaults standardUserDefaults] objectForKey:@"user_uuid"];
NSString *url = [NSString stringWithFormat:@"%@%@%@?userUuid=%@", kRedStarURL, kPicturePraiseDetailURL, @"uuid", user_uuid];
NSString *url = [NSString stringWithFormat:@"%@%@%@?userUuid=%@", kRedStarURL, kPicturePraiseDetailURL, self.uuid, user_uuid];
[MBProgressHUD showHUDAddedTo:self.view animated:YES];
HttpClient *http = [[HttpClient alloc] initWithUrl:url];
__block PictureStoryViewController *weakSelf = self;
[http getPicturePraiseDetailWithCompletion:^(id response, NSError *error) {
NSLog(@"图说口碑详情 res ===%@, error = %@", response, error);
NSDictionary *dataDict = response[@"data"];
PictureDetailModel *picDetail = [[PictureDetailModel alloc] init];
[picDetail setValuesForKeysWithDictionary:dataDict];
_pictureDetail = picDetail;
_pictureUuid = picDetail.uuid;
for (NSDictionary *picTextDict in picDetail.attachments) {
PicTextModel *picText = [[PicTextModel alloc] init];
[picText setValuesForKeysWithDictionary:picTextDict];
[_picTextArray addObject:picText];
}
weakSelf.tableView.delegate = self;
weakSelf.tableView.dataSource = self;
[MBProgressHUD hideHUDForView:self.view animated:YES];
}];
......@@ -95,12 +119,6 @@
- (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];
......@@ -121,7 +139,7 @@
if (sender.selected) {
// 点赞
NSString *url = [NSString stringWithFormat:@"%@%@%@?time=%@&operId=%@&operName=%@", kRedStarURL, kPicturePraiseLikeURL, @"uuid", dateString, operId, operName];
NSString *url = [NSString stringWithFormat:@"%@%@%@?time=%@&operId=%@&operName=%@", kRedStarURL, kPicturePraiseLikeURL, self.uuid, dateString, operId, operName];
url = [url stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding];
HttpClient *httpClient = [[HttpClient alloc] initWithUrl:url];
......@@ -138,7 +156,7 @@
} else {
// 取消点赞
NSString *url = [NSString stringWithFormat:@"%@%@%@?time=%@&operId=%@&operName=%@", kRedStarURL, kPicturePraiseCancelLikeURL, @"uuid", dateString, operId, operName];
NSString *url = [NSString stringWithFormat:@"%@%@%@?time=%@&operId=%@&operName=%@", kRedStarURL, kPicturePraiseCancelLikeURL, self.uuid, dateString, operId, operName];
url = [url stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding];
HttpClient *httpClient = [[HttpClient alloc] initWithUrl:url];
......@@ -226,7 +244,7 @@
if (section == 0) {
return 1;
} else if (section == 1) {
return 2;
return _picTextArray.count;
} else {
return 2;
}
......@@ -241,14 +259,15 @@
if (!cell) {
cell = [[PictureDetailTableCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:kPictureDetailTableCell];
}
// 标题
NSString *titleLabelText = [NSString stringWithFormat:@"标题:回访短信延迟问题咨询"];
NSString *titleLabelText = [NSString stringWithFormat:@"标题:%@", _pictureDetail.title];
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天,也避免由此引起的顾客抱怨。"];
NSString *contentLabelText = [NSString stringWithFormat:@"内容:%@" , _pictureDetail.content];
NSMutableAttributedString *contentLabelAttr = [[NSMutableAttributedString alloc] initWithString:contentLabelText];
NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc]init];
[paragraphStyle setLineSpacing:5];
......@@ -258,7 +277,14 @@
[cell.contentLabel setAttributedText:contentLabelAttr];
if (_pictureDetail.myLike) {
cell.thumbBtn.selected = YES;
} else {
cell.thumbBtn.selected = NO;
}
[cell.thumbBtn addTarget:self action:@selector(addZan:) forControlEvents:UIControlEventTouchUpInside];
[cell.thumbBtn setTitle:[NSString stringWithFormat:@"%d", _pictureDetail.likeCount] forState:UIControlStateNormal];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
return cell;
......@@ -267,7 +293,11 @@
if (!cell) {
cell = [[PictureTextTableCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:kPictureTextTableCell];
}
PicTextModel *picText = _picTextArray[indexPath.row];
NSURL *imageUrl = [NSURL URLWithString:[NSString stringWithFormat:@"%@%@", kRedStarURL ,picText.fileUrl]];
[cell.bigImageView sd_setImageWithURL:imageUrl placeholderImage:[UIImage imageNamed:@"default_pic"]];
cell.descriptionLabel.text = [NSString stringWithFormat:@"%@", picText.descriptionText];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
return cell;
} else {
......@@ -410,50 +440,50 @@
#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) {
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":_pictureUuid,
@"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];
//
......@@ -478,8 +508,8 @@
// [MBProgressHUD hideHUDForView:self.view animated:YES];
//
// }];
// }
// }
}
}
}
......@@ -489,9 +519,12 @@
if (!_tableView) {
_tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStyleGrouped];
_tableView.translatesAutoresizingMaskIntoConstraints = NO;
_tableView.rowHeight = UITableViewAutomaticDimension;
_tableView.estimatedRowHeight = 200.0;
_tableView.estimatedRowHeight =100.0;
_tableView.showsVerticalScrollIndicator = NO;
_tableView.showsHorizontalScrollIndicator = NO;
_tableView.tableHeaderView=[[UIView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, CGFLOAT_MIN)];
_tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
[_tableView registerClass:[PictureDetailTableCell class] forCellReuseIdentifier:kPictureDetailTableCell];
[_tableView registerClass:[PictureTextTableCell class] forCellReuseIdentifier:kPictureTextTableCell];
[_tableView registerClass:[PictureCommentTableCell class] forCellReuseIdentifier:kPictureCommentTableCell];
......
......@@ -8,6 +8,7 @@
#import <UIKit/UIKit.h>
#import "ZanButton.h"
#import "PictureListModel.h"
@interface PictureTableCell : UITableViewCell
......@@ -20,4 +21,6 @@
@property (nonatomic, strong) ZanButton *thumbBtn;
@property (nonatomic, strong) ZanButton *commentBtn;
@property (nonatomic, strong) PictureListModel *pictureList;
@end
......@@ -7,32 +7,50 @@
//
#import "PictureTableCell.h"
#import <UIImageView+WebCache.h>
@interface PictureTableCell ()
@property (nonatomic, strong) UILabel *hotLabel;
@end
@implementation PictureTableCell
#pragma mark - System Methods
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
[self setup];
}
return self;
}
#pragma mark - Private Methods
- (void)setup
- (void)setPictureList:(PictureListModel *)pictureList
{
self.titleImageView.image = [UIImage imageNamed:@"default_pic"];
self.titleLabel.textColor = kPictureCellTitleColor;
self.hotLabel.font = [UIFont boldSystemFontOfSize:12.0];
self.detailsLabel.textColor = kPictureCellDetailsColor;
self.dateLabel.textColor = kPictureCellDateColor;
self.thumbBtn.titleLabel.font = [UIFont systemFontOfSize:16.0];
self.commentBtn.titleLabel.font = [UIFont systemFontOfSize:16.0];
_pictureList = pictureList;
if (pictureList.attachments.count != 0) {
NSDictionary *dict = pictureList.attachments[0];
NSURL *imageUrl = [NSURL URLWithString:[NSString stringWithFormat:@"%@%@", kRedStarURL ,dict[@"fileUrl"]]];
[self.titleImageView sd_setImageWithURL:imageUrl placeholderImage:[UIImage imageNamed:@"default_pic"]];
} else {
self.titleImageView.image = [UIImage imageNamed:@"default_pic"];
}
self.titleLabel.text = [NSString stringWithFormat:@"%@", pictureList.title];
self.detailsLabel.text = [NSString stringWithFormat:@"%@", pictureList.content];
if (pictureList.submitTime == nil || pictureList.submitTime == NULL || [pictureList.submitTime isEqual:[NSNull null]]) {
self.dateLabel.text = [NSString stringWithFormat:@"发布时间: "];
} else {
self.dateLabel.text = [NSString stringWithFormat:@"发布时间: %@",pictureList.submitTime];
}
if (pictureList.hotspot) {
self.hotLabel.hidden = NO;
} else {
self.hotLabel.hidden = YES;
}
if (pictureList.myLike) {
self.thumbBtn.selected = YES;
} else {
self.thumbBtn.selected = NO;
}
[self.thumbBtn setTitle:[NSString stringWithFormat:@"%d", pictureList.likeCount] forState:UIControlStateNormal];
[self.commentBtn setTitle:@"18" forState:UIControlStateNormal];
}
#pragma mark - Lazy loading
......@@ -62,6 +80,8 @@
{
if (!_titleLabel) {
_titleLabel = [[UILabel alloc] init];
_titleLabel.textColor = kPictureCellTitleColor;
_titleLabel.font = [UIFont systemFontOfSize:17.0];
_titleLabel.translatesAutoresizingMaskIntoConstraints = NO;
[self.contentView addSubview:_titleLabel];
......@@ -87,6 +107,7 @@
_hotLabel.translatesAutoresizingMaskIntoConstraints = NO;
_hotLabel.backgroundColor = kHotBackGroundColor;
_hotLabel.textColor = [UIColor whiteColor];
_hotLabel.font = [UIFont boldSystemFontOfSize:12.0];
_hotLabel.text = @"HOT";
_hotLabel.textAlignment = NSTextAlignmentCenter;
_hotLabel.layer.cornerRadius = 3;
......@@ -115,6 +136,8 @@
_detailsLabel.font = [UIFont systemFontOfSize:15.0];
_detailsLabel.translatesAutoresizingMaskIntoConstraints = NO;
_detailsLabel.numberOfLines = 0;
_detailsLabel.textColor = kPictureCellDetailsColor;
[self.contentView addSubview:_detailsLabel];
NSLayoutConstraint *titleImageTop = [NSLayoutConstraint constraintWithItem:_detailsLabel attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.titleLabel attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0];
......@@ -138,9 +161,11 @@
_dateLabel = [[UILabel alloc] init];
_dateLabel.translatesAutoresizingMaskIntoConstraints = NO;
_dateLabel.font = [UIFont systemFontOfSize:14.0];
_dateLabel.textColor = kPictureCellDateColor;
[self.contentView addSubview:_dateLabel];
NSLayoutConstraint *titleImageTop = [NSLayoutConstraint constraintWithItem:_dateLabel attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.titleImageView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0];
NSLayoutConstraint *titleImageTop = [NSLayoutConstraint constraintWithItem:_dateLabel attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.titleImageView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:5];
[self.contentView addConstraint:titleImageTop];
NSLayoutConstraint *titleImageLeft = [NSLayoutConstraint constraintWithItem:_dateLabel attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeLeft multiplier:1.0 constant:15];
......@@ -149,10 +174,10 @@
NSLayoutConstraint *titleRight = [NSLayoutConstraint constraintWithItem:_dateLabel attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.thumbBtn attribute:NSLayoutAttributeLeft multiplier:1.0 constant:0];
[self.contentView addConstraint:titleRight];
NSLayoutConstraint *titleImageHeight = [NSLayoutConstraint constraintWithItem:_dateLabel attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:45];
NSLayoutConstraint *titleImageHeight = [NSLayoutConstraint constraintWithItem:_dateLabel attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:35];
[self.contentView addConstraint:titleImageHeight];
NSLayoutConstraint *titleImageBottom = [NSLayoutConstraint constraintWithItem:_dateLabel attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0];
NSLayoutConstraint *titleImageBottom = [NSLayoutConstraint constraintWithItem:_dateLabel attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:-5];
[self.contentView addConstraint:titleImageBottom];
}
return _dateLabel;
......@@ -163,8 +188,10 @@
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 setTitleColor:kNavigationBarColor forState:UIControlStateNormal];
_thumbBtn.titleLabel.font = [UIFont systemFontOfSize:16.0];
[self.contentView addSubview:_thumbBtn];
NSLayoutConstraint *titleImageTop = [NSLayoutConstraint constraintWithItem:_thumbBtn attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.titleImageView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:12];
......@@ -189,6 +216,7 @@
[_commentBtn setImage:[UIImage imageNamed:@"comment"] forState:UIControlStateNormal];
_commentBtn.translatesAutoresizingMaskIntoConstraints = NO;
[_commentBtn setTitleColor:kNavigationBarColor forState:UIControlStateNormal];
_commentBtn.titleLabel.font = [UIFont systemFontOfSize:16.0];
[self.contentView addSubview:_commentBtn];
NSLayoutConstraint *titleImageTop = [NSLayoutConstraint constraintWithItem:_commentBtn attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.titleImageView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:12];
......
//
// PictureListModel.h
// redstar
//
// Created by admin on 15/12/14.
// Copyright © 2015年 ZWF. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface PictureListModel : NSObject
@property (nonatomic, strong) NSArray *attachments;
@property (nonatomic, copy) NSString *content;
@property (nonatomic, copy) NSString *create_id;
@property (nonatomic, copy) NSString *create_operName;
@property (nonatomic, copy) NSString *create_time;
@property (nonatomic, copy) NSString *enterprise;
@property (nonatomic, assign) int hotspot;
@property (nonatomic, copy) NSString *lastModify_id;
@property (nonatomic, copy) NSString *lastModify_operName;
@property (nonatomic, copy) NSString *lastModify_time;
@property (nonatomic, assign) int likeCount;
@property (nonatomic, assign) BOOL myLike;
@property (nonatomic, copy) NSString *state;
@property (nonatomic, copy) NSString *storePath;
@property (nonatomic, copy) NSString *store_code;
@property (nonatomic, copy) NSString *store_name;
@property (nonatomic, copy) NSString *store_uuid;
@property (nonatomic, copy) NSString *submitTime;
@property (nonatomic, copy) NSString *submit_code;
@property (nonatomic, copy) NSString *submit_name;
@property (nonatomic, copy) NSString *submit_uuid;
@property (nonatomic, copy) NSString *title;
@property (nonatomic, copy) NSString *uuid;
@property (nonatomic, copy) NSString *version;
@end
//
// PictureListModel.m
// redstar
//
// Created by admin on 15/12/14.
// Copyright © 2015年 ZWF. All rights reserved.
//
#import "PictureListModel.h"
@implementation PictureListModel
@end
......@@ -22,6 +22,7 @@
#import <MBProgressHUD.h>
#import <MJRefresh.h>
#import "PictureListModel.h"
#define kPictureTableViewCell @"pictureTabelViewCell"
......@@ -47,24 +48,27 @@
@property (nonatomic, assign) NSInteger stateRow;
@property (nonatomic, assign) NSInteger timeRow;
@property (nonatomic, assign) NSMutableArray *allPraiseListArray;
@property (nonatomic, strong) NSMutableArray *allPraiseListArray;
@property (nonatomic, assign) int page;
@end
@implementation PictureViewController
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
[self requestPicturePraise];
}
- (void)viewDidLoad
{
[super viewDidLoad];
[self setupNav];
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;
self.extendedLayoutIncludesOpaqueBars = NO;
......@@ -73,8 +77,6 @@
}
[self requestPicturePraise];
_page = 0;
}
......@@ -119,6 +121,8 @@
- (void)requestPicturePraise
{
self.allPraiseListArray = [NSMutableArray array];
// 请求地址
NSString *urlStr = [NSString stringWithFormat:@"%@%@", kRedStarURL, kQueryPicturePraiseURL];
NSString *user_uuid = [[NSUserDefaults standardUserDefaults] objectForKey:@"user_uuid"];
......@@ -133,20 +137,31 @@
HttpClient *httpClient = [[HttpClient alloc] initWithUrl:urlStr];
[MBProgressHUD showHUDAddedTo:self.view animated:YES];
__block PictureViewController *weakSelf = self;
// 请求问题列表
[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];
// }
NSDictionary *dataDict = response[@"data"];
NSArray *dataArray = dataDict[@"records"];
NSMutableArray *tempArray = [NSMutableArray array];
for (NSDictionary *dict in dataArray) {
PictureListModel *picList = [[PictureListModel alloc] init];
[picList setValuesForKeysWithDictionary:dict];
[tempArray addObject:picList];
}
_allPraiseListArray = tempArray;
if (_allPraiseListArray.count == 0) {
weakSelf.noDataView.backgroundColor = [UIColor whiteColor];
} else {
weakSelf.menuView.backgroundColor = kInspectSectionBackGroundColor;
weakSelf.tableView.footer = [MJRefreshBackNormalFooter footerWithRefreshingBlock:^{
[self requestMoreList];
}];
[weakSelf.tableView reloadData];
}
[MBProgressHUD hideHUDForView:self.view animated:YES];
}];
......@@ -302,7 +317,8 @@
_screenView.timeTableView.timeDeleagte = self;
_screenView.backgroundColor = [UIColor whiteColor];
}
[_screenView.resetBtn addTarget:self action:@selector(resetClick:) forControlEvents:UIControlEventTouchUpInside];
[_screenView.submitBtn addTarget:self action:@selector(submitClick:) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:_bgView];
[self.view insertSubview:_screenView aboveSubview:_bgView];
......@@ -439,11 +455,18 @@
[parameters setObject:array forKey:@"queryOrders"];
}
NSLog(@"parameters = %@",parameters);
NSLog(@"parameters rrrrrrrr = %@",parameters);
// 请求问题列表
[httpClient getQuestionListWithParameters:parameters completion:^(id response, NSError *error) {
NSLog(@"图说口碑 列表recods = %@", response);
NSDictionary *dataDict = (NSDictionary *)response[@"data"];
NSDictionary *recordsDict = (NSDictionary *)dataDict[@"records"];
NSLog(@"图说口碑 筛选排序 resp = %@ error = %@", response ,error);
NSMutableArray *tempArray = [NSMutableArray array];
for (NSDictionary *pictureDict in recordsDict) {
PictureListModel *picture = [[PictureListModel alloc] init];
[picture setValuesForKeysWithDictionary:pictureDict];
[tempArray addObject:picture];
}
_allPraiseListArray = tempArray;
if (_allPraiseListArray.count == 0) {
......@@ -452,7 +475,6 @@
_tableView = nil;
}
weakSelf.noDataView.backgroundColor = [UIColor whiteColor];
[MBProgressHUD hideHUDForView:weakSelf.view animated:YES];
[weakSelf closeGreenView];
} else {
if (_noDataView) {
......@@ -462,9 +484,9 @@
weakSelf.tableView.delegate = weakSelf;
weakSelf.tableView.dataSource = weakSelf;
[weakSelf.tableView reloadData];
[MBProgressHUD hideHUDForView:weakSelf.view animated:YES];
[weakSelf closeGreenView];
}
[MBProgressHUD hideHUDForView:weakSelf.view animated:YES];
self.menuView.backgroundColor = kInspectSectionBackGroundColor;
}];
......@@ -521,12 +543,10 @@
}
NSDictionary *parameters = @{@"user":user_uuid,
@"scope":@"all",
@"pageNumber":@(0),
@"pageSize":@(20),
@"pageSize":@(10),
@"queryOrders":queryOrders
};
// 发起请求
HttpClient *httpClient = [[HttpClient alloc] initWithUrl:urlStr];
[MBProgressHUD showHUDAddedTo:self.view animated:YES];
......@@ -534,8 +554,36 @@
// 请求问题列表
[httpClient queryPicturePraiseWithParameters:parameters completion:^(id response, NSError *error) {
NSLog(@"图说口碑 按点赞数 resp = %@ error = %@", response ,error);
NSDictionary *dataDict = (NSDictionary *)response[@"data"];
NSDictionary *recordsDict = (NSDictionary *)dataDict[@"records"];
NSLog(@"图说口碑 按点赞数排序 resp = %@ error = %@", response ,error);
NSMutableArray *tempArray = [NSMutableArray array];
for (NSDictionary *pictureDict in recordsDict) {
PictureListModel *picture = [[PictureListModel alloc] init];
[picture setValuesForKeysWithDictionary:pictureDict];
[tempArray addObject:picture];
}
_allPraiseListArray = tempArray;
if (_allPraiseListArray.count == 0) {
if (_tableView) {
[_tableView removeFromSuperview];
_tableView = nil;
}
self.noDataView.backgroundColor = [UIColor whiteColor];
} else {
if (_noDataView) {
[_noDataView removeFromSuperview];
_noDataView = nil;
}
self.tableView.delegate = self;
self.tableView.dataSource = self;
[self.tableView reloadData];
}
self.menuView.backgroundColor = kInspectSectionBackGroundColor;
[MBProgressHUD hideHUDForView:self.view animated:YES];
}];
......@@ -547,7 +595,7 @@
#pragma mark - UITableView Delegate/DataSource
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return 2;
return self.allPraiseListArray.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
......@@ -556,11 +604,8 @@
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];
cell.pictureList = _allPraiseListArray[indexPath.row];
return cell;
}
......@@ -578,7 +623,9 @@
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
PictureListModel *picList = _allPraiseListArray[indexPath.row];
PictureStoryViewController *storyVC = [[PictureStoryViewController alloc] init];
storyVC.uuid = picList.uuid;
[self.navigationController pushViewController:storyVC animated:YES];
}
......@@ -615,7 +662,9 @@
_tableView.translatesAutoresizingMaskIntoConstraints = NO;
_tableView.showsVerticalScrollIndicator = NO;
_tableView.showsHorizontalScrollIndicator = NO;
_tableView.tableFooterView = [[UIView alloc] init];
_tableView.delegate = self;
_tableView.dataSource = self;
// _tableView.tableFooterView = [[UIView alloc] init];
_tableView.rowHeight = UITableViewAutomaticDimension;
_tableView.estimatedRowHeight = 150.0;
[_tableView registerClass:[PictureTableCell class] forCellReuseIdentifier:kPictureTableViewCell];
......
......@@ -139,7 +139,7 @@
} else {
[weakSelf setupTableView];
self.tableView.footer = [MJRefreshAutoNormalFooter footerWithRefreshingBlock:^{
self.tableView.footer = [MJRefreshBackNormalFooter footerWithRefreshingBlock:^{
[self requestMoreList];
}];
[self.tableView reloadData];
......
......@@ -136,6 +136,8 @@
for (NSDictionary *dict in dataArray) {
TaskListModel *taskList = [[TaskListModel alloc] init];
[taskList setValuesForKeysWithDictionary:dict];
NSLog(@"taskList state = %@", taskList.state);
[taskArray addObject:taskList];
}
[_taskListDataArray addObjectsFromArray:taskArray];
......@@ -210,20 +212,18 @@
{
NSString *url = [NSString stringWithFormat:@"%@%@", kRedStarURL, kInspectListURL];
NSLog(@"uuurl = %@", url);
HttpClient *httpCilent = [[HttpClient alloc] initWithUrl:url];
NSDictionary *parameters = @{
@"userUuid":[[NSUserDefaults standardUserDefaults] objectForKey:@"user_uuid"],
@"queryOrders":@[@{@"field":@"lastModifyInfo"}],
//@"queryOrders":@[@{@"field":@"lastModifyInfo"}],
@"pageNumber":@(0),
@"pageSize":@(10)
};
NSLog(@"parameters = %@", parameters);
[MBProgressHUD showHUDAddedTo:self.view animated:YES];
[httpCilent getInspectListWithParameters:parameters completion:^(id response, NSError *error) {
NSLog(@"巡检列表%@", response);
NSLog(@"inspect List ---11-- 巡检列表%@", response);
NSDictionary *dataDict = response[@"data"];
NSArray *dataArray = dataDict[@"records"];
......@@ -231,6 +231,7 @@
for (NSDictionary *dict in dataArray) {
TaskListModel *taskList = [[TaskListModel alloc] init];
[taskList setValuesForKeysWithDictionary:dict];
NSLog(@"taskList state = %@", taskList.state);
[tempArray addObject:taskList];
}
_taskListDataArray = [NSMutableArray arrayWithArray:tempArray];
......@@ -242,7 +243,7 @@
} else {
self.tableView.delegate = self;
self.tableView.dataSource = self;
self.tableView.footer = [MJRefreshAutoNormalFooter footerWithRefreshingBlock:^{
self.tableView.footer = [MJRefreshBackNormalFooter footerWithRefreshingBlock:^{
[self requestMoreList];
}];
self.menuView.backgroundColor = kInspectSectionBackGroundColor;
......
......@@ -159,7 +159,7 @@
self.tableView.delegate = self;
self.tableView.dataSource = self;
self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
self.tableView.tableHeaderView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, CGFLOAT_MIN)];
[MBProgressHUD hideHUDForView:self.view animated:YES];
}];
......@@ -323,7 +323,7 @@
[self.view addSubview:_tableView];
NSLayoutConstraint *tableTop = [NSLayoutConstraint constraintWithItem:_tableView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeTop multiplier:1.0 constant:-35];
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];
......
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