小说绘上架版本
This commit is contained in:
+18
@@ -0,0 +1,18 @@
|
||||
//
|
||||
// TFFeedBackRecordViewController.h
|
||||
// TFReader
|
||||
//
|
||||
// Created by 谢腾飞 on 2020/12/23.
|
||||
// Copyright © 2020 xtfei_2011@126.com. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "TFBasicViewController.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface TFFeedBackRecordViewController : TFBasicViewController
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
+133
@@ -0,0 +1,133 @@
|
||||
//
|
||||
// TFFeedBackRecordViewController.m
|
||||
// TFReader
|
||||
//
|
||||
// Created by 谢腾飞 on 2020/12/23.
|
||||
// Copyright © 2020 xtfei_2011@126.com. All rights reserved.
|
||||
//
|
||||
|
||||
#import "TFFeedBackRecordViewController.h"
|
||||
#import "TFFeedBackRecordViewCell.h"
|
||||
#import "TFFeedBackRecordModel.h"
|
||||
|
||||
@interface TFFeedBackRecordViewController ()<UITableViewDelegate, UITableViewDataSource>
|
||||
|
||||
@end
|
||||
|
||||
@implementation TFFeedBackRecordViewController
|
||||
|
||||
- (void)viewDidLoad
|
||||
{
|
||||
[super viewDidLoad];
|
||||
|
||||
[self initialize];
|
||||
[self createSubviews];
|
||||
}
|
||||
|
||||
- (void)initialize
|
||||
{
|
||||
[self setNavigationBarTitle:TFLocalizedString(@"我的反馈")];
|
||||
}
|
||||
|
||||
- (void)createSubviews
|
||||
{
|
||||
self.view.backgroundColor = kGrayViewColor;
|
||||
|
||||
self.mainTableViewGroup.delegate = self;
|
||||
self.mainTableViewGroup.dataSource = self;
|
||||
[self.view addSubview:self.mainTableViewGroup];
|
||||
|
||||
[self.mainTableViewGroup mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(0);
|
||||
make.top.mas_equalTo(PUB_NAVBAR_HEIGHT);
|
||||
make.width.mas_equalTo(SCREEN_WIDTH);
|
||||
make.height.mas_equalTo(SCREEN_HEIGHT - PUB_NAVBAR_HEIGHT);
|
||||
}];
|
||||
|
||||
WS(weakSelf)
|
||||
self.mainTableViewGroup.mj_header = [TFRefreshHeader headerWithRefreshingBlock:^{
|
||||
weakSelf.currentPageNumber = 1;
|
||||
[weakSelf netRequest];
|
||||
}];
|
||||
[self.mainTableViewGroup.mj_header beginRefreshing];
|
||||
|
||||
self.mainTableViewGroup.mj_footer = [TFRefreshFooter footerWithRefreshingBlock:^{
|
||||
weakSelf.currentPageNumber ++;
|
||||
[weakSelf netRequest];
|
||||
}];
|
||||
|
||||
[self setEmptyOnView:self.mainTableViewGroup title:TFLocalizedString(@"您还没有任何反馈") tapBlock:^{
|
||||
}];
|
||||
}
|
||||
|
||||
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
|
||||
{
|
||||
return self.dataSourceArray.count;
|
||||
}
|
||||
|
||||
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
|
||||
{
|
||||
static NSString *cellName = @"TFFeedBackRecordViewCell";
|
||||
TFFeedBackRecordViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellName];
|
||||
if (!cell) {
|
||||
cell = [[TFFeedBackRecordViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellName];
|
||||
}
|
||||
cell.contentModel = [self.dataSourceArray objectOrNilAtIndex:indexPath.section];
|
||||
cell.selectionStyle = UITableViewCellSelectionStyleNone;
|
||||
return cell;
|
||||
}
|
||||
|
||||
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
|
||||
{
|
||||
return kHalfMargin;
|
||||
}
|
||||
|
||||
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
|
||||
{
|
||||
UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, kHalfMargin)];
|
||||
view.backgroundColor = kGrayViewColor;
|
||||
return view;
|
||||
}
|
||||
|
||||
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
|
||||
{
|
||||
return CGFLOAT_MIN;
|
||||
}
|
||||
|
||||
- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section
|
||||
{
|
||||
UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, PUB_TABBAR_OFFSET == 0 ? 10 : PUB_TABBAR_OFFSET)];
|
||||
view.backgroundColor = kGrayViewColor;
|
||||
return view;
|
||||
}
|
||||
|
||||
- (void)netRequest
|
||||
{
|
||||
WS(weakSelf)
|
||||
[TFNetworkTools POST:Feed_Back_List parameters:nil model:TFFeedBackRecordModel.class success:^(BOOL isSuccess, TFFeedBackRecordModel *_Nullable t_model, TFNetworkRequestModel *requestModel) {
|
||||
|
||||
[weakSelf.mainTableViewGroup endRefreshing];
|
||||
|
||||
if (isSuccess) {
|
||||
if (weakSelf.currentPageNumber == 1) {
|
||||
weakSelf.dataSourceArray = [NSMutableArray arrayWithArray:t_model.list];
|
||||
} else {
|
||||
[weakSelf.dataSourceArray addObjectsFromArray:t_model.list];
|
||||
}
|
||||
|
||||
[weakSelf.mainTableViewGroup reloadData];
|
||||
if (t_model.total_page <= t_model.current_page) {
|
||||
[weakSelf.mainTableViewGroup hideRefreshFooter];
|
||||
}
|
||||
}
|
||||
[weakSelf.mainTableViewGroup xtfei_endLoading];
|
||||
} failure:nil];
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
//
|
||||
// TFFeedBackViewController.h
|
||||
// TFReader
|
||||
//
|
||||
// Created by 谢腾飞 on 2020/12/22.
|
||||
// Copyright © 2020 xtfei_2011@126.com. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "TFBasicViewController.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface TFFeedBackViewController : TFBasicViewController
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
+153
@@ -0,0 +1,153 @@
|
||||
//
|
||||
// TFFeedBackViewController.m
|
||||
// TFReader
|
||||
//
|
||||
// Created by 谢腾飞 on 2020/12/22.
|
||||
// Copyright © 2020 xtfei_2011@126.com. All rights reserved.
|
||||
//
|
||||
|
||||
#import "TFFeedBackViewController.h"
|
||||
#import "WXYZ_FeedbackSubViewController.h"
|
||||
#import "TFFeedBackRecordViewController.h"
|
||||
#import "TFFeedBackHeaderView.h"
|
||||
#import "TFFeedBackViewCellCell.h"
|
||||
#import "TFFeedBackModel.h"
|
||||
|
||||
@interface TFFeedBackViewController ()<UITableViewDataSource, UITableViewDelegate>
|
||||
|
||||
@property (nonatomic ,strong) TFFeedBackModel *feedbackModel;
|
||||
@property (nonatomic ,assign) NSUInteger selectIndex; // 当前选择位置
|
||||
|
||||
@end
|
||||
|
||||
@implementation TFFeedBackViewController
|
||||
|
||||
- (void)viewDidLoad
|
||||
{
|
||||
[super viewDidLoad];
|
||||
|
||||
[self initialize];
|
||||
[self createSubviews];
|
||||
[self netRequest];
|
||||
}
|
||||
|
||||
- (void)initialize
|
||||
{
|
||||
[self setNavigationBarTitle:TFLocalizedString(@"首页帮助反馈")];
|
||||
self.selectIndex = 99999;
|
||||
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(deletePhoto:) name:TF_DELETE_PHOTO object:nil];
|
||||
}
|
||||
|
||||
- (void)createSubviews
|
||||
{
|
||||
self.mainTableViewGroup.delegate = self;
|
||||
self.mainTableViewGroup.dataSource = self;
|
||||
[self.view addSubview:self.mainTableViewGroup];
|
||||
|
||||
WS(weakSelf)
|
||||
TFFeedBackHeaderView *headerView = [[TFFeedBackHeaderView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 80)];
|
||||
headerView.leftButtonClick = ^{
|
||||
[weakSelf.navigationController pushViewController:[[TFFeedBackRecordViewController alloc] init] animated:YES];
|
||||
};
|
||||
headerView.rightButtonClick = ^{
|
||||
[weakSelf.navigationController pushViewController:[[WXYZ_FeedbackSubViewController alloc] init] animated:YES];
|
||||
};
|
||||
[self.mainTableViewGroup setTableHeaderView:headerView];
|
||||
|
||||
[self.mainTableViewGroup mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(0);
|
||||
make.top.mas_equalTo(PUB_NAVBAR_HEIGHT);
|
||||
make.width.mas_equalTo(SCREEN_WIDTH);
|
||||
make.height.mas_equalTo(SCREEN_HEIGHT - PUB_NAVBAR_HEIGHT);
|
||||
}];
|
||||
}
|
||||
|
||||
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
|
||||
{
|
||||
return self.feedbackModel.help_list.count;
|
||||
}
|
||||
|
||||
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
|
||||
{
|
||||
return [self.feedbackModel.help_list objectAtIndex:section].list.count;
|
||||
}
|
||||
|
||||
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
|
||||
{
|
||||
TFHelpListModel *sectionModel = [self.feedbackModel.help_list objectAtIndex:indexPath.section];
|
||||
TFQuestionListModel *indexModel = [sectionModel.list objectOrNilAtIndex:indexPath.row];
|
||||
|
||||
static NSString *cellName = @"TFFeedBackViewCellCell";
|
||||
TFFeedBackViewCellCell *cell = [tableView dequeueReusableCellWithIdentifier:cellName];
|
||||
if (!cell) {
|
||||
cell = [[TFFeedBackViewCellCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellName];
|
||||
}
|
||||
cell.questionModel = indexModel;
|
||||
cell.selectionStyle = UITableViewCellSelectionStyleNone;
|
||||
return cell;
|
||||
}
|
||||
|
||||
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
|
||||
{
|
||||
return 40;
|
||||
}
|
||||
|
||||
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
|
||||
{
|
||||
UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 40)];
|
||||
view.backgroundColor = kGrayViewColor;
|
||||
|
||||
UILabel *titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(kHalfMargin, 0, SCREEN_WIDTH - 2 * kHalfMargin, 40)];
|
||||
titleLabel.text = [self.feedbackModel.help_list objectAtIndex:section].name ? : @"";
|
||||
titleLabel.textColor = kGrayTextColor;
|
||||
titleLabel.font = kFont15;
|
||||
[view addSubview:titleLabel];
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
|
||||
{
|
||||
if (section == self.feedbackModel.help_list.count - 1) {
|
||||
return PUB_TABBAR_OFFSET == 0 ? 10 : PUB_TABBAR_OFFSET;
|
||||
}
|
||||
return CGFLOAT_MIN;
|
||||
}
|
||||
|
||||
- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section
|
||||
{
|
||||
UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, kHalfMargin)];
|
||||
view.backgroundColor = [UIColor clearColor];
|
||||
return view;
|
||||
}
|
||||
|
||||
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
|
||||
{
|
||||
TFFeedBackViewCellCell *cell = [self.mainTableViewGroup cellForRowAtIndexPath:indexPath];
|
||||
[self.mainTableViewGroup beginUpdates];
|
||||
if (cell.detailCellShowing) {
|
||||
[cell hiddenDetail];
|
||||
} else {
|
||||
[cell showDetail];
|
||||
}
|
||||
[self.mainTableViewGroup endUpdates];
|
||||
}
|
||||
|
||||
- (void)netRequest
|
||||
{
|
||||
WS(weakSelf)
|
||||
[TFNetworkTools POST:Answer_List parameters:nil model:TFFeedBackModel.class success:^(BOOL isSuccess, TFFeedBackModel *_Nullable t_model, TFNetworkRequestModel *requestModel) {
|
||||
if (isSuccess) {
|
||||
weakSelf.feedbackModel = t_model;
|
||||
[weakSelf.mainTableViewGroup reloadData];
|
||||
}
|
||||
} failure:nil];
|
||||
}
|
||||
|
||||
- (void)deletePhoto:(NSNotification *)noti
|
||||
{
|
||||
[TFNetworkTools POST:Delete_Upload_Image parameters:@{@"image":[TFUtilsHelper formatStringWithObject:noti.object]} model:nil success:nil failure:nil];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,36 @@
|
||||
//
|
||||
// TFFeedBackModel.h
|
||||
// TFReader
|
||||
//
|
||||
// Created by 谢腾飞 on 2020/12/22.
|
||||
// Copyright © 2020 xtfei_2011@126.com. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
@class TFHelpListModel, TFQuestionListModel;
|
||||
|
||||
@interface TFFeedBackModel : NSObject
|
||||
|
||||
@property (nonatomic ,strong) NSArray <TFHelpListModel *>*help_list;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@interface TFHelpListModel : NSObject
|
||||
|
||||
@property (nonatomic ,copy) NSString *name; // 标题
|
||||
@property (nonatomic ,strong) NSArray <TFQuestionListModel *>*list; // 问题列表
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@interface TFQuestionListModel : NSObject
|
||||
|
||||
@property (nonatomic ,copy) NSString *title;
|
||||
@property (nonatomic ,copy) NSString *answer;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,33 @@
|
||||
//
|
||||
// TFFeedBackModel.m
|
||||
// TFReader
|
||||
//
|
||||
// Created by 谢腾飞 on 2020/12/22.
|
||||
// Copyright © 2020 xtfei_2011@126.com. All rights reserved.
|
||||
//
|
||||
|
||||
#import "TFFeedBackModel.h"
|
||||
|
||||
@implementation TFFeedBackModel
|
||||
|
||||
+ (NSDictionary<NSString *,id> *)modelContainerPropertyGenericClass
|
||||
{
|
||||
return @{@"help_list" : [TFHelpListModel class]};
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@implementation TFHelpListModel
|
||||
|
||||
+ (NSDictionary<NSString *,id> *)modelContainerPropertyGenericClass
|
||||
{
|
||||
return @{@"list" : [TFQuestionListModel class]};
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@implementation TFQuestionListModel
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,32 @@
|
||||
//
|
||||
// TFFeedBackRecordModel.h
|
||||
// TFReader
|
||||
//
|
||||
// Created by 谢腾飞 on 2020/12/23.
|
||||
// Copyright © 2020 xtfei_2011@126.com. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@class TFFeedbackContentModel, TFPagingModel;
|
||||
|
||||
@interface TFFeedBackRecordModel : TFPagingModel
|
||||
|
||||
@property (nonatomic ,strong) NSArray <TFFeedbackContentModel *>*list;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
|
||||
@interface TFFeedbackContentModel : NSObject
|
||||
|
||||
@property (nonatomic ,copy) NSString *content; // 用户反馈内容
|
||||
@property (nonatomic ,strong) NSArray <NSString *>* images; // 图片组
|
||||
@property (nonatomic ,copy) NSString *reply; // 管理员回复内容
|
||||
@property (nonatomic ,copy) NSString *created_at; // 反馈时间
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,23 @@
|
||||
//
|
||||
// TFFeedBackRecordModel.m
|
||||
// TFReader
|
||||
//
|
||||
// Created by 谢腾飞 on 2020/12/23.
|
||||
// Copyright © 2020 xtfei_2011@126.com. All rights reserved.
|
||||
//
|
||||
|
||||
#import "TFFeedBackRecordModel.h"
|
||||
|
||||
@implementation TFFeedBackRecordModel
|
||||
|
||||
+ (NSDictionary<NSString *,id> *)modelContainerPropertyGenericClass
|
||||
{
|
||||
return @{@"list" : [TFFeedbackContentModel class]};
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@implementation TFFeedbackContentModel
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,20 @@
|
||||
//
|
||||
// TFFeedBackHeaderView.h
|
||||
// TFReader
|
||||
//
|
||||
// Created by 谢腾飞 on 2020/12/22.
|
||||
// Copyright © 2020 xtfei_2011@126.com. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface TFFeedBackHeaderView : UIView
|
||||
|
||||
@property (nonatomic, copy) void(^leftButtonClick)(void);
|
||||
@property (nonatomic, copy) void(^rightButtonClick)(void);
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,83 @@
|
||||
//
|
||||
// TFFeedBackHeaderView.m
|
||||
// TFReader
|
||||
//
|
||||
// Created by 谢腾飞 on 2020/12/22.
|
||||
// Copyright © 2020 xtfei_2011@126.com. All rights reserved.
|
||||
//
|
||||
|
||||
#import "TFFeedBackHeaderView.h"
|
||||
|
||||
@implementation TFFeedBackHeaderView
|
||||
|
||||
- (instancetype)initWithFrame:(CGRect)frame
|
||||
{
|
||||
if (self = [super initWithFrame:frame]) {
|
||||
[self createSubviews];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)createSubviews
|
||||
{
|
||||
TFButton *leftButton = [[TFButton alloc] initWithFrame:CGRectZero buttonTitle:TFLocalizedString(@"首页我的反馈") buttonSubTitle:@"" buttonImageName:@"feedback_talk" buttonIndicator:TFButtonIndicatorTitleRight showMaskView:NO];
|
||||
leftButton.graphicDistance = 1;
|
||||
leftButton.buttonImageScale = 0.4;
|
||||
leftButton.buttonTitleFont = kBoldFont15;
|
||||
leftButton.tag = 1;
|
||||
[leftButton addTarget:self action:@selector(menuClick:) forControlEvents:UIControlEventTouchUpInside];
|
||||
[self addSubview:leftButton];
|
||||
|
||||
[leftButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(self.mas_left);
|
||||
make.top.mas_equalTo(self.mas_top);
|
||||
make.height.mas_equalTo(self.mas_height);
|
||||
make.width.mas_equalTo(self.mas_width).multipliedBy(0.5);
|
||||
}];
|
||||
|
||||
UIView *line = [[UIView alloc] init];
|
||||
line.backgroundColor = kGrayViewColor;
|
||||
[self addSubview:line];
|
||||
|
||||
[line mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(leftButton.mas_right);
|
||||
make.centerY.mas_equalTo(leftButton.mas_centerY);
|
||||
make.width.mas_equalTo(2);
|
||||
make.height.mas_equalTo(self.mas_height).with.multipliedBy(0.5);
|
||||
}];
|
||||
|
||||
TFButton *rightButton = [[TFButton alloc] initWithFrame:CGRectZero buttonTitle:TFLocalizedString(@"反馈意见") buttonSubTitle:@"" buttonImageName:@"feedback_list" buttonIndicator:TFButtonIndicatorTitleRight showMaskView:NO];
|
||||
rightButton.graphicDistance = 1;
|
||||
rightButton.buttonImageScale = 0.4;
|
||||
rightButton.buttonTitleFont = kBoldFont15;
|
||||
rightButton.tag = 2;
|
||||
[rightButton addTarget:self action:@selector(menuClick:) forControlEvents:UIControlEventTouchUpInside];
|
||||
[self addSubview:rightButton];
|
||||
|
||||
[rightButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.right.mas_equalTo(self.mas_right);
|
||||
make.top.mas_equalTo(self.mas_top);
|
||||
make.height.mas_equalTo(self.mas_height);
|
||||
make.width.mas_equalTo(self.mas_width).multipliedBy(0.5);
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)menuClick:(UIButton *)sender
|
||||
{
|
||||
if (!TFUserInfoManager.isLogin) {
|
||||
[TFLoginOptionsViewController presentLoginView:nil];
|
||||
return;
|
||||
}
|
||||
|
||||
if (sender.tag == 1) {
|
||||
if (self.leftButtonClick) {
|
||||
self.leftButtonClick();
|
||||
}
|
||||
} else if (sender.tag == 2) {
|
||||
if (self.rightButtonClick) {
|
||||
self.rightButtonClick();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
//
|
||||
// TFFeedBackRecordViewCell.h
|
||||
// TFReader
|
||||
//
|
||||
// Created by 谢腾飞 on 2020/12/23.
|
||||
// Copyright © 2020 xtfei_2011@126.com. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "TFFeedBackRecordModel.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface TFFeedBackRecordViewCell : TFBasicTableViewCell
|
||||
|
||||
@property (nonatomic ,strong) TFFeedbackContentModel *contentModel;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
+152
@@ -0,0 +1,152 @@
|
||||
//
|
||||
// TFFeedBackRecordViewCell.m
|
||||
// TFReader
|
||||
//
|
||||
// Created by 谢腾飞 on 2020/12/23.
|
||||
// Copyright © 2020 xtfei_2011@126.com. All rights reserved.
|
||||
//
|
||||
|
||||
#import "TFFeedBackRecordViewCell.h"
|
||||
#import "TFPhotoBrowser.h"
|
||||
|
||||
@interface TFFeedBackRecordViewCell ()
|
||||
{
|
||||
UILabel *dateLabel;
|
||||
UILabel *questionLabel;
|
||||
UIView *questionImageBack;
|
||||
UILabel *replyLabel;
|
||||
|
||||
NSArray *questionImageArray;
|
||||
|
||||
UIView *line;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation TFFeedBackRecordViewCell
|
||||
|
||||
- (void)createSubviews
|
||||
{
|
||||
[super createSubviews];
|
||||
|
||||
dateLabel = [[UILabel alloc] init];
|
||||
dateLabel.textColor = kGrayTextColor;
|
||||
dateLabel.textAlignment = NSTextAlignmentLeft;
|
||||
dateLabel.font = kFont11;
|
||||
[self.contentView addSubview:dateLabel];
|
||||
|
||||
[dateLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(self.contentView.mas_left).with.offset(kHalfMargin);
|
||||
make.top.mas_equalTo(self.contentView.mas_top).with.offset(kHalfMargin);
|
||||
make.width.mas_equalTo(self.contentView.mas_width).with.offset(- kMargin);
|
||||
make.height.mas_equalTo(20);
|
||||
}];
|
||||
|
||||
questionLabel = [[UILabel alloc] init];
|
||||
questionLabel.textColor = kBlackColor;
|
||||
questionLabel.textAlignment = NSTextAlignmentLeft;
|
||||
questionLabel.font = kMainFont;
|
||||
questionLabel.numberOfLines = 0;
|
||||
[self.contentView addSubview:questionLabel];
|
||||
[questionLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(dateLabel.mas_left);
|
||||
make.width.mas_equalTo(dateLabel.mas_width);
|
||||
make.top.mas_equalTo(dateLabel.mas_bottom);
|
||||
}];
|
||||
|
||||
questionImageBack = [[UIView alloc] init];
|
||||
questionImageBack.backgroundColor = kWhiteColor;
|
||||
[self.contentView addSubview:questionImageBack];
|
||||
|
||||
[questionImageBack mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(dateLabel.mas_left);
|
||||
make.top.mas_equalTo(questionLabel.mas_bottom).with.offset(kHalfMargin);
|
||||
make.right.mas_equalTo(dateLabel.mas_right);
|
||||
make.height.mas_equalTo(CGFLOAT_MIN);
|
||||
}];
|
||||
|
||||
line = [[UIView alloc] init];
|
||||
line.backgroundColor = kGrayLineColor;
|
||||
line.hidden = YES;
|
||||
[self.contentView addSubview:line];
|
||||
|
||||
[line mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(kMargin);
|
||||
make.top.mas_equalTo(questionImageBack.mas_bottom).with.offset(kHalfMargin);
|
||||
make.width.mas_equalTo(SCREEN_WIDTH - kMargin);
|
||||
make.height.mas_equalTo(kCellLineHeight);
|
||||
}];
|
||||
|
||||
replyLabel = [[UILabel alloc] init];
|
||||
replyLabel.textColor = kGrayTextColor;
|
||||
replyLabel.textAlignment = NSTextAlignmentLeft;
|
||||
replyLabel.font = kMainFont;
|
||||
replyLabel.numberOfLines = 10;
|
||||
[self.contentView addSubview:replyLabel];
|
||||
|
||||
[replyLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(dateLabel.mas_left);
|
||||
make.top.mas_equalTo(questionImageBack.mas_bottom).with.offset(kMargin);
|
||||
make.right.mas_equalTo(dateLabel.mas_right);
|
||||
make.height.mas_equalTo(CGFLOAT_MIN);
|
||||
make.bottom.mas_equalTo(self.contentView.mas_bottom).with.offset(- kHalfMargin).priorityLow();
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)setContentModel:(TFFeedbackContentModel *)contentModel
|
||||
{
|
||||
_contentModel = contentModel;
|
||||
|
||||
dateLabel.text = contentModel.created_at?:@"";
|
||||
|
||||
questionLabel.text = [TFLocalizedString(@"问题:\n\n") stringByAppendingString:contentModel.content?:@""];
|
||||
|
||||
if (questionImageArray.count != contentModel.images.count) {
|
||||
NSInteger buttonNum = contentModel.images.count;//每行多少按钮
|
||||
CGFloat button_W = 60;//按钮宽
|
||||
CGFloat button_H = 60;//按钮高
|
||||
CGFloat space_X = 10;//按钮间距
|
||||
for (NSInteger i = 0; i < buttonNum; i++) {
|
||||
NSInteger loc = i % buttonNum;//列号
|
||||
|
||||
CGFloat button_X = (space_X + button_W) * loc;
|
||||
CGFloat button_Y = 0;
|
||||
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
button.frame = CGRectMake(button_X, button_Y, button_W, button_H);
|
||||
button.tag = i;
|
||||
button.adjustsImageWhenHighlighted = NO;
|
||||
[button setImageWithURL:[NSURL URLWithString:[contentModel.images objectOrNilAtIndex:i]] forState:UIControlStateNormal options:YYWebImageOptionSetImageWithFadeAnimation];
|
||||
[button addTarget:self action:@selector(watchPhoto:) forControlEvents:UIControlEventTouchUpInside];
|
||||
[questionImageBack addSubview:button];
|
||||
}
|
||||
[questionImageBack mas_updateConstraints:^(MASConstraintMaker *make) {
|
||||
make.height.mas_equalTo(70);
|
||||
}];
|
||||
}
|
||||
|
||||
if (contentModel.reply.length > 0) {
|
||||
line.hidden = NO;
|
||||
replyLabel.text = [TFLocalizedString(@"回复:\n\n") stringByAppendingString:contentModel.reply?:@""];
|
||||
[replyLabel mas_updateConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.mas_equalTo(questionImageBack.mas_bottom).with.offset(kMargin);
|
||||
make.height.mas_equalTo([TFViewHelper getDynamicHeightWithLabelFont:replyLabel.font labelWidth:(SCREEN_WIDTH - kMargin) labelText:replyLabel.text] - kHalfMargin);
|
||||
}];
|
||||
} else {
|
||||
line.hidden = YES;
|
||||
[replyLabel mas_updateConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.mas_equalTo(questionImageBack.mas_bottom).with.offset(CGFLOAT_MIN);
|
||||
make.height.mas_equalTo(CGFLOAT_MIN);
|
||||
}];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)watchPhoto:(UIButton *)sender
|
||||
{
|
||||
TFPhotoBrowser *browser = [TFPhotoBrowser new];
|
||||
browser.dataSource = self.contentModel.images.mutableCopy;
|
||||
browser.downLoadNeeded = YES;
|
||||
browser.currentPhotoIndex = sender.tag;
|
||||
[[TFViewHelper getCurrentViewController] presentViewController:browser animated:YES completion:nil];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,25 @@
|
||||
//
|
||||
// TFFeedBackViewCellCell.h
|
||||
// TFReader
|
||||
//
|
||||
// Created by 谢腾飞 on 2020/12/22.
|
||||
// Copyright © 2020 xtfei_2011@126.com. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "TFFeedBackModel.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface TFFeedBackViewCellCell : TFBasicTableViewCell
|
||||
|
||||
@property (nonatomic ,strong) TFQuestionListModel *questionModel;
|
||||
@property (nonatomic ,assign) BOOL detailCellShowing;
|
||||
|
||||
- (void)showDetail;
|
||||
|
||||
- (void)hiddenDetail;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,90 @@
|
||||
//
|
||||
// TFFeedBackViewCellCell.m
|
||||
// TFReader
|
||||
//
|
||||
// Created by 谢腾飞 on 2020/12/22.
|
||||
// Copyright © 2020 xtfei_2011@126.com. All rights reserved.
|
||||
//
|
||||
|
||||
#import "TFFeedBackViewCellCell.h"
|
||||
|
||||
@interface TFFeedBackViewCellCell ()
|
||||
{
|
||||
UILabel *questionTitleLabel;
|
||||
UILabel *questionDetailLabel;
|
||||
}
|
||||
@end
|
||||
|
||||
@implementation TFFeedBackViewCellCell
|
||||
|
||||
- (void)createSubviews
|
||||
{
|
||||
[super createSubviews];
|
||||
|
||||
questionTitleLabel = [[UILabel alloc] init];
|
||||
questionTitleLabel.backgroundColor = kWhiteColor;
|
||||
questionTitleLabel.textColor = kBlackColor;
|
||||
questionTitleLabel.font = kMainFont;
|
||||
questionTitleLabel.numberOfLines = 0;
|
||||
questionTitleLabel.userInteractionEnabled = YES;
|
||||
[self.contentView addSubview:questionTitleLabel];
|
||||
|
||||
[questionTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(self.contentView.mas_left).with.offset(kHalfMargin);
|
||||
make.top.mas_equalTo(self.contentView.mas_top);
|
||||
make.right.mas_equalTo(self.contentView.mas_right).with.offset(- kHalfMargin);
|
||||
make.height.mas_equalTo(40);
|
||||
}];
|
||||
|
||||
questionDetailLabel = [[UILabel alloc] init];
|
||||
questionDetailLabel.textColor = kGrayTextColor;
|
||||
questionDetailLabel.font = kMainFont;
|
||||
questionDetailLabel.numberOfLines = 0;
|
||||
[self.contentView addSubview:questionDetailLabel];
|
||||
|
||||
[questionDetailLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(questionTitleLabel.mas_left).with.offset(kHalfMargin);
|
||||
make.top.mas_equalTo(questionTitleLabel.mas_bottom);
|
||||
make.right.mas_equalTo(questionTitleLabel.mas_right).with.offset(- kHalfMargin);
|
||||
make.height.mas_equalTo(CGFLOAT_MIN);
|
||||
make.bottom.mas_equalTo(self.contentView.mas_bottom).priorityLow();
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)setQuestionModel:(TFQuestionListModel *)questionModel
|
||||
{
|
||||
_questionModel = questionModel;
|
||||
|
||||
questionTitleLabel.text = [NSString stringWithFormat:@"Q:%@", questionModel.title]?:@"";
|
||||
[questionTitleLabel mas_updateConstraints:^(MASConstraintMaker *make) {
|
||||
make.height.mas_equalTo([TFViewHelper getDynamicHeightWithLabelFont:kMainFont labelWidth:(SCREEN_WIDTH - kMargin) labelText:questionTitleLabel.text]);
|
||||
}];
|
||||
|
||||
questionDetailLabel.text = [NSString stringWithFormat:@"A:%@", questionModel.answer]?:@"";
|
||||
}
|
||||
|
||||
- (void)showDetail
|
||||
{
|
||||
self.detailCellShowing = YES;
|
||||
|
||||
[UIView animateWithDuration:kAnimatedDurationFast animations:^{
|
||||
[self->questionDetailLabel mas_updateConstraints:^(MASConstraintMaker *make) {
|
||||
make.height.mas_equalTo([TFViewHelper getDynamicHeightWithLabel:self->questionDetailLabel] - kHalfMargin);
|
||||
}];
|
||||
[self->questionDetailLabel.superview layoutIfNeeded];//强制绘制
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)hiddenDetail
|
||||
{
|
||||
self.detailCellShowing = NO;
|
||||
|
||||
[UIView animateWithDuration:kAnimatedDurationFast animations:^{
|
||||
[self->questionDetailLabel mas_updateConstraints:^(MASConstraintMaker *make) {
|
||||
make.height.mas_equalTo(CGFLOAT_MIN);
|
||||
}];
|
||||
[self->questionDetailLabel.superview layoutIfNeeded];//强制绘制
|
||||
}];
|
||||
}
|
||||
|
||||
@end
|
||||
Reference in New Issue
Block a user