小说绘上架版本

This commit is contained in:
xtfei2011
2021-02-07 11:24:08 +08:00
commit ee5c1c8b12
1762 changed files with 115892 additions and 0 deletions
@@ -0,0 +1,17 @@
//
// TFAboutViewController.h
// WXReader
//
// Created by 谢腾飞 on 2020/12/3.
// Copyright © 2020 xtfei_2011@126.com. All rights reserved.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface TFAboutViewController : TFBasicViewController
@end
NS_ASSUME_NONNULL_END
@@ -0,0 +1,146 @@
//
// TFAboutViewController.m
// WXReader
//
// Created by 谢腾飞 on 2020/12/3.
// Copyright © 2020 xtfei_2011@126.com. All rights reserved.
//
#import "TFAboutViewController.h"
#import "WXYZ_AboutModel.h"
#import "TFAboutTableViewCell.h"
#import "TFWebViewController.h"
@interface TFAboutViewController ()<UITableViewDelegate, UITableViewDataSource>
@property (nonatomic ,strong) WXYZ_AboutModel *aboutModel;
@property (nonatomic ,strong) UILabel *companyLabel;
@end
@implementation TFAboutViewController
- (void)viewDidLoad
{
[super viewDidLoad];
[self setNavigationBarTitle:TFLocalizedString(@"联系客服")];
self.view.backgroundColor = kGrayViewColor;
[self createSubviews];
[self netRequest];
}
- (void)createSubviews
{
self.mainTableView.delegate = self;
self.mainTableView.dataSource = self;
[self.view addSubview:self.mainTableView];
[self.mainTableView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(0);
make.top.mas_equalTo(PUB_NAVBAR_HEIGHT);
make.width.mas_equalTo(self.view.mas_width);
make.height.mas_equalTo(self.view.mas_height).with.offset(- PUB_NAVBAR_HEIGHT);
}];
[self.mainTableView setTableHeaderView:[self headerView]];
self.companyLabel = [[UILabel alloc] init];
self.companyLabel.textAlignment = NSTextAlignmentCenter;
self.companyLabel.textColor = [UIColor grayColor];
self.companyLabel.numberOfLines = 0;
self.companyLabel.font = kFont10;
[self.mainTableView addSubview:self.companyLabel];
[self.companyLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(0);
make.width.mas_equalTo(SCREEN_WIDTH);
make.height.mas_equalTo(30);
make.bottom.mas_equalTo(SCREEN_HEIGHT - PUB_NAVBAR_HEIGHT - (is_iPhoneX?15.0f:0.0f));
}];
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return self.aboutModel.about.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
TFAboutTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"TFAboutTableViewCell"];
if (!cell) {
cell = [[TFAboutTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"TFAboutTableViewCell"];
}
cell.contactInfoModel = [self.aboutModel.about objectAtIndex:indexPath.row];
cell.hiddenEndLine = (indexPath.row == self.aboutModel.about.count - 1);
cell.selectionStyle = UITableViewCellSelectionStyleNone;
return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
WXYZ_ContactInfoModel *t_model = [self.aboutModel.about objectAtIndex:indexPath.row];
if ([t_model.action isEqualToString:@"url"]) {
TFWebViewController *vc = [[TFWebViewController alloc] init];
vc.navTitle = t_model.title?:@"";
vc.URLString = t_model.content?:@"";
[self.navigationController pushViewController:vc animated:YES];
} else if ([t_model.action isEqualToString:@"telphone"]) {
NSURL *phoneURL = [NSURL URLWithString:[NSString stringWithFormat:@"tel:%@",t_model.content]];
[[UIApplication sharedApplication] openURL:phoneURL options:@{} completionHandler:nil];
} else {
UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
pasteboard.string = t_model.content?:@"";
[TFPromptManager showPromptViewWithStatus:TFPromptStatusSuccess promptTitle:TFLocalizedString(@"已复制到粘贴板")];
}
}
- (UIView *)headerView
{
UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 180)];
view.backgroundColor = kWhiteColor;
UIImageView *iconImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:[[[[NSBundle mainBundle] infoDictionary] valueForKeyPath:@"CFBundleIcons.CFBundlePrimaryIcon.CFBundleIconFiles"] lastObject]]];
iconImageView.layer.cornerRadius = 12.0;
iconImageView.layer.masksToBounds = YES;
[view addSubview:iconImageView];
[iconImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.mas_equalTo(view.mas_centerX);
make.bottom.mas_equalTo(view.mas_centerY).with.offset(10);
make.width.height.mas_equalTo(60);
}];
UILabel *appNameLabel = [[UILabel alloc] init];
appNameLabel.text = App_Name;
appNameLabel.textAlignment = NSTextAlignmentCenter;
appNameLabel.textColor = kBlackColor;
appNameLabel.font = kMainFont;
[view addSubview:appNameLabel];
[appNameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.mas_equalTo(iconImageView.mas_centerX);
make.top.mas_equalTo(iconImageView.mas_bottom).with.offset(10);
make.width.mas_equalTo(SCREEN_WIDTH);
make.height.mas_equalTo(20);
}];
return view;
}
- (void)netRequest
{
WS(weakSelf)
[TFNetworkTools POST:About_Soft parameters:nil model:WXYZ_AboutModel.class success:^(BOOL isSuccess, WXYZ_AboutModel * _Nullable t_model, TFNetworkRequestModel * _Nonnull requestModel) {
if (isSuccess) {
weakSelf.aboutModel = t_model;
weakSelf.companyLabel.text = t_model.company;
}
[weakSelf.mainTableView reloadData];
} failure:nil];
}
@end
@@ -0,0 +1,32 @@
//
// WXYZ_AboutModel.h
// WXReader
//
// Created by Andrew on 2018/10/15.
// Copyright © 2018 Andrew. All rights reserved.
//
#import <Foundation/Foundation.h>
@class WXYZ_ContactInfoModel;
NS_ASSUME_NONNULL_BEGIN
@interface WXYZ_AboutModel : NSObject
@property (nonatomic, strong) NSArray <WXYZ_ContactInfoModel *> *about;
@property (nonatomic, copy) NSString *company; // 公司
@end
@interface WXYZ_ContactInfoModel : NSObject
@property (nonatomic, copy) NSString *title;
@property (nonatomic, copy) NSString *content;
@property (nonatomic, copy) NSString *action;
@end
NS_ASSUME_NONNULL_END
@@ -0,0 +1,25 @@
//
// WXYZ_AboutModel.m
// WXReader
//
// Created by Andrew on 2018/10/15.
// Copyright © 2018 Andrew. All rights reserved.
//
#import "WXYZ_AboutModel.h"
@implementation WXYZ_AboutModel
+ (NSDictionary<NSString *,id> *)modelContainerPropertyGenericClass{
return @{
@"about" : [WXYZ_ContactInfoModel class]
};
}
@end
@implementation WXYZ_ContactInfoModel
@end
@@ -0,0 +1,20 @@
//
// TFAboutTableViewCell.h
// WXReader
//
// Created by 谢腾飞 on 2020/12/3.
// Copyright © 2020 xtfei_2011@126.com. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "WXYZ_AboutModel.h"
NS_ASSUME_NONNULL_BEGIN
@interface TFAboutTableViewCell : TFBasicTableViewCell
@property (nonatomic, strong) WXYZ_ContactInfoModel *contactInfoModel;
@end
NS_ASSUME_NONNULL_END
@@ -0,0 +1,78 @@
//
// TFAboutTableViewCell.m
// WXReader
//
// Created by 谢腾飞 on 2020/12/3.
// Copyright © 2020 xtfei_2011@126.com. All rights reserved.
//
#import "TFAboutTableViewCell.h"
@interface TFAboutTableViewCell ()
{
UILabel *titleLabel;
UILabel *detailTitleLabel;
UIImageView *connerImage;
}
@end
@implementation TFAboutTableViewCell
- (void)createSubviews
{
[super createSubviews];
titleLabel = [[UILabel alloc] init];
titleLabel.textAlignment = NSTextAlignmentLeft;
titleLabel.textColor = kBlackColor;
titleLabel.font = kMainFont;
[self.contentView addSubview:titleLabel];
[titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(kMargin);
make.centerY.mas_equalTo(self.contentView.mas_centerY);
make.width.mas_equalTo(120);
make.height.mas_equalTo(kLabelHeight);
}];
connerImage = [[UIImageView alloc] init];
connerImage.image = [UIImage imageNamed:@"public_more"];
connerImage.hidden = NO;
[self.contentView addSubview:connerImage];
[connerImage mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.mas_equalTo(self.contentView.mas_right).with.offset(- kMargin);
make.centerY.mas_equalTo(self.contentView.mas_centerY);
make.width.height.mas_equalTo(10);
}];
detailTitleLabel = [[UILabel alloc] init];
detailTitleLabel.textAlignment = NSTextAlignmentRight;
detailTitleLabel.textColor = kGrayTextColor;
detailTitleLabel.font = kFont12;
[self.contentView addSubview:detailTitleLabel];
[detailTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.equalTo(connerImage);
make.centerY.mas_equalTo(self.contentView.mas_centerY);
make.left.equalTo(titleLabel.mas_right).offset(kHalfMargin);
make.height.mas_equalTo(kLabelHeight);
}];
}
- (void)setContactInfoModel:(WXYZ_ContactInfoModel *)contactInfoModel
{
_contactInfoModel = contactInfoModel;
titleLabel.text = contactInfoModel.title?:@"";
[titleLabel mas_updateConstraints:^(MASConstraintMaker *make) {
make.width.mas_equalTo([TFViewHelper getDynamicWidthWithLabel:titleLabel]);
}];
if (![contactInfoModel.action isEqualToString:@"url"]) {
detailTitleLabel.text = contactInfoModel.content?:@"";
connerImage.hidden = YES;
} else {
detailTitleLabel.text = @"";
connerImage.hidden = NO;
}
}
@end