678 lines
25 KiB
Objective-C
678 lines
25 KiB
Objective-C
//
|
||
// ShouYeViewController.m
|
||
// ProductApp
|
||
//
|
||
// Created by 工作 on 2024/9/20.
|
||
//
|
||
|
||
#import "ShouYeViewController.h"
|
||
#import "ShouYeZNXZTableViewCell.h"
|
||
#import "ShouYeXieZuoTableViewCell.h"
|
||
#import "ShouYeBannerTableViewCell.h"
|
||
#import "ShouYeToolsTableViewCell.h"
|
||
#import "ShouYeZuoWenTableViewCell.h"
|
||
#import "ShouYeShenFenViewController.h"
|
||
#import "ShouYeLingYuViewController.h"
|
||
#import "ShouYeLSZWPGTableViewCell.h"
|
||
#import "ShouYeLSKTPGTableViewCell.h"
|
||
#import "ShouYeZCPPTTableViewCell.h"
|
||
#import "ShouYeZCXZTableViewCell.h"
|
||
#import "ShouYeLiShiJiLuViewController.h"
|
||
#import "PublicNetWorkManager.h"
|
||
#import "NetWorkManager.h"
|
||
#import "FanWenDetailViewController.h"
|
||
#import "UpdataAlterView.h"
|
||
|
||
#import "ShouYeLSPLPGTableViewCell.h"
|
||
|
||
@interface ShouYeViewController ()<UITableViewDelegate,UITableViewDataSource>
|
||
///
|
||
@property (nonatomic , strong) UIButton *btnianji;
|
||
///
|
||
@property (nonatomic , strong) UITableView *tableView ;
|
||
|
||
///
|
||
@property (nonatomic , strong) NSArray *arrTools;
|
||
///
|
||
@property (nonatomic , strong) NSArray *arrFanWen;
|
||
|
||
@end
|
||
|
||
@implementation ShouYeViewController
|
||
-(UIStatusBarStyle)preferredStatusBarStyle {
|
||
return UIStatusBarStyleDefault;
|
||
}
|
||
-(void)viewWillAppear:(BOOL)animated
|
||
{
|
||
[super viewWillAppear:animated];
|
||
if(self.tableView)
|
||
{
|
||
[self.tableView reloadData];
|
||
}
|
||
[self updateBtShow];
|
||
// if(self.arrTools.count==0 || [[[NSUserDefaults standardUserDefaults] objectForKey:HomeToosRef] intValue] == 1)
|
||
// {
|
||
// [self getTools];
|
||
// }
|
||
if([UserInfoModel shareModel].isupdataJiaoyu)
|
||
{
|
||
[UserInfoModel shareModel].isupdataJiaoyu = NO;
|
||
[self getFanWen];
|
||
}
|
||
|
||
[self tanLoginChuan];
|
||
}
|
||
- (void)viewDidLoad {
|
||
[super viewDidLoad];
|
||
[self.navigationController setNavigationBarHidden:YES animated:NO];
|
||
[self showNaviGationView:YES];
|
||
[self.navigationView setTitle:@"" titleColor:RGBCOLOR(60, 60, 60)];
|
||
[self.navigationView setBackgroundColor:[UIColor clearColor]];
|
||
[self drawTopView];
|
||
|
||
UITableView *tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStyleGrouped];
|
||
[tableView setSeparatorStyle:UITableViewCellSeparatorStyleNone];
|
||
[tableView setBackgroundColor:[UIColor clearColor]];
|
||
[tableView setDelegate:self];
|
||
[tableView setDataSource:self];
|
||
[tableView setShowsVerticalScrollIndicator:NO];
|
||
[self.view addSubview:tableView];
|
||
[tableView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
make.bottom.equalTo(self.view);
|
||
make.left.offset(16);
|
||
make.right.equalTo(self.view).offset(-16);
|
||
make.top.offset(NavHeight+15);
|
||
}];
|
||
_tableView = tableView;
|
||
tableView.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
|
||
[self getTools];
|
||
[self getFanWen];
|
||
}];
|
||
|
||
[self getUserData];
|
||
[self getTools];
|
||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
||
NSDictionary *dic = [[UserInfoModel shareModel].config objectForKey:@"client.version.upgrade"];
|
||
[self showUpDataAltre:dic];
|
||
});
|
||
}
|
||
|
||
-(void)drawTopView
|
||
{
|
||
[self.view setBackgroundColor:RGBCOLOR(242, 242, 242)];
|
||
UIImageView *imgvback = [[UIImageView alloc] init];
|
||
[imgvback setImage:[UIImage imageNamed:@"home_back"]];
|
||
[self.view addSubview:imgvback];
|
||
[imgvback mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
make.left.right.top.equalTo(self.view);
|
||
}];
|
||
[self.view sendSubviewToBack:imgvback];
|
||
|
||
UIButton *btnianji = [[UIButton alloc] init];
|
||
[btnianji setTitle:@"学生-五年级" forState:UIControlStateNormal];
|
||
[btnianji setTitleColor:RGBCOLOR(26, 26, 26) forState:UIControlStateNormal];
|
||
[btnianji.titleLabel setFont:[UIFont systemFontOfSize:16]];
|
||
[btnianji setImage:[UIImage imageNamed:@"home_三角"] forState:UIControlStateNormal];
|
||
[self.navigationView addSubview:btnianji];
|
||
[btnianji mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
make.left.offset(16);
|
||
make.bottom.equalTo(self.navigationView).offset(-2);
|
||
make.height.offset(40);
|
||
}];
|
||
[btnianji setIconInRightWithSpacing:6];
|
||
[btnianji setTag:0];
|
||
[btnianji addTarget:self action:@selector(topAction:) forControlEvents:UIControlEventTouchUpInside];
|
||
_btnianji = btnianji;
|
||
|
||
UIButton *btlishi = [[UIButton alloc] init];
|
||
[btlishi setImage:[UIImage imageNamed:@"home_lishi"] forState:UIControlStateNormal];
|
||
[self.navigationView addSubview:btlishi];
|
||
[btlishi mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
make.right.equalTo(self.navigationView).offset(-16);
|
||
make.centerY.equalTo(btnianji);
|
||
make.width.height.offset(40);
|
||
}];
|
||
[btlishi setTag:1];
|
||
[btlishi addTarget:self action:@selector(topAction:) forControlEvents:UIControlEventTouchUpInside];
|
||
}
|
||
|
||
-(void)topAction:(UIButton *)sender
|
||
{
|
||
if(sender.tag==1)
|
||
{///历史记录
|
||
ShouYeLiShiJiLuViewController *vc = [ShouYeLiShiJiLuViewController new];
|
||
[self.navigationController pushViewController:vc animated:YES];
|
||
[UserInfoModel shijianShangBao:0 key:@"client.jump.to.write.history" value:@"首页" extra:@""];
|
||
}
|
||
else
|
||
{///身份选择
|
||
///未选择过身份或者是职场
|
||
if([UserInfoModel shareModel].identityType.intValue == 3 || [UserInfoModel shareModel].user_stage==nil)
|
||
{
|
||
ShouYeLingYuViewController *vc = [ShouYeLingYuViewController new];
|
||
[self.navigationController pushViewController:vc animated:YES];
|
||
}
|
||
else
|
||
{
|
||
ShouYeShenFenViewController *vc = [ShouYeShenFenViewController new];
|
||
[self.navigationController pushViewController:vc animated:YES];
|
||
}
|
||
}
|
||
}
|
||
///更新
|
||
-(void)showUpDataAltre:(NSDictionary *)dic
|
||
{
|
||
NSString *strfw = [[dic objectForKey:@"version"] stringByReplacingOccurrencesOfString:@"." withString:@""];
|
||
NSString *strbd = [[Tools applicationVersion] stringByReplacingOccurrencesOfString:@"." withString:@""];
|
||
if(strfw.intValue>strbd.intValue)
|
||
{
|
||
BOOL isforce = [[dic objectForKey:@"force"] boolValue];
|
||
[UpdataAlterView showName:[Tools isStringnil:[dic objectForKey:@"description"]] strversion:[NSString stringWithFormat:@"V%@",[dic objectForKey:@"version"]] isforce:isforce];
|
||
}
|
||
}
|
||
#pragma mark - UITableView
|
||
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
|
||
{
|
||
if([UserInfoModel shareModel].identityType.intValue==3)return 4;
|
||
if([UserInfoModel shareModel].identityType.intValue==2)return 6;
|
||
return 5;
|
||
}
|
||
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
|
||
{
|
||
if([UserInfoModel shareModel].identityType.intValue==2)
|
||
{
|
||
if(section==5)
|
||
{///高分作文
|
||
return self.arrFanWen.count;
|
||
}
|
||
}
|
||
else
|
||
{
|
||
if(section==4)
|
||
{///高分作文
|
||
return self.arrFanWen.count;
|
||
}
|
||
}
|
||
return 1;
|
||
}
|
||
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
|
||
{
|
||
///0学生 1家长 2老师 3职场
|
||
int type = [UserInfoModel shareModel].identityType.intValue;
|
||
if(type==0||type==1)
|
||
{
|
||
if(indexPath.section==0)
|
||
{
|
||
static NSString *strcell = @"ShouYeZNXZTableViewCell";
|
||
ShouYeZNXZTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:strcell];
|
||
if(!cell)
|
||
{
|
||
cell = [[ShouYeZNXZTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:strcell];
|
||
[cell setSelectionStyle:UITableViewCellSelectionStyleNone];
|
||
[cell setBackgroundColor:[UIColor clearColor]];
|
||
}
|
||
|
||
return cell;
|
||
}
|
||
else if(indexPath.section==1)
|
||
{
|
||
static NSString *strcell = @"ShouYeXieZuoTableViewCell";
|
||
ShouYeXieZuoTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:strcell];
|
||
if(!cell)
|
||
{
|
||
cell = [[ShouYeXieZuoTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:strcell];
|
||
[cell setSelectionStyle:UITableViewCellSelectionStyleNone];
|
||
[cell setBackgroundColor:[UIColor clearColor]];
|
||
}
|
||
|
||
return cell;
|
||
}
|
||
else if(indexPath.section==2)
|
||
{
|
||
static NSString *strcell = @"ShouYeBannerTableViewCell";
|
||
ShouYeBannerTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:strcell];
|
||
if(!cell)
|
||
{
|
||
cell = [[ShouYeBannerTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:strcell];
|
||
[cell setSelectionStyle:UITableViewCellSelectionStyleNone];
|
||
[cell setBackgroundColor:[UIColor clearColor]];
|
||
}
|
||
|
||
return cell;
|
||
}
|
||
else if(indexPath.section==3)
|
||
{
|
||
static NSString *strcell = @"ShouYeToolsTableViewCell";
|
||
ShouYeToolsTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:strcell];
|
||
if(!cell)
|
||
{
|
||
cell = [[ShouYeToolsTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:strcell];
|
||
[cell setSelectionStyle:UITableViewCellSelectionStyleNone];
|
||
[cell setBackgroundColor:[UIColor clearColor]];
|
||
}
|
||
cell.arrdata = self.arrTools;
|
||
|
||
return cell;
|
||
}
|
||
}
|
||
else if (type==2)
|
||
{
|
||
if(indexPath.section==0)
|
||
{
|
||
static NSString *strcell = @"ShouYeLSZWPGTableViewCell";
|
||
ShouYeLSZWPGTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:strcell];
|
||
if(!cell)
|
||
{
|
||
cell = [[ShouYeLSZWPGTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:strcell];
|
||
[cell setSelectionStyle:UITableViewCellSelectionStyleNone];
|
||
[cell setBackgroundColor:[UIColor clearColor]];
|
||
}
|
||
|
||
return cell;
|
||
}
|
||
else if(indexPath.section==1)
|
||
{
|
||
static NSString *strcell = @"ShouYeLSPLPGTableViewCell";
|
||
ShouYeLSPLPGTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:strcell];
|
||
if(!cell)
|
||
{
|
||
cell = [[ShouYeLSPLPGTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:strcell];
|
||
[cell setSelectionStyle:UITableViewCellSelectionStyleNone];
|
||
[cell setBackgroundColor:[UIColor clearColor]];
|
||
}
|
||
|
||
return cell;
|
||
}
|
||
else if(indexPath.section==2)
|
||
{
|
||
static NSString *strcell = @"ShouYeLSKTPGTableViewCell";
|
||
ShouYeLSKTPGTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:strcell];
|
||
if(!cell)
|
||
{
|
||
cell = [[ShouYeLSKTPGTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:strcell];
|
||
[cell setSelectionStyle:UITableViewCellSelectionStyleNone];
|
||
[cell setBackgroundColor:[UIColor clearColor]];
|
||
}
|
||
|
||
return cell;
|
||
}
|
||
else if(indexPath.section==3)
|
||
{
|
||
static NSString *strcell = @"ShouYeBannerTableViewCell";
|
||
ShouYeBannerTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:strcell];
|
||
if(!cell)
|
||
{
|
||
cell = [[ShouYeBannerTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:strcell];
|
||
[cell setSelectionStyle:UITableViewCellSelectionStyleNone];
|
||
[cell setBackgroundColor:[UIColor clearColor]];
|
||
}
|
||
|
||
return cell;
|
||
}
|
||
else if(indexPath.section==4)
|
||
{
|
||
static NSString *strcell = @"ShouYeToolsTableViewCell";
|
||
ShouYeToolsTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:strcell];
|
||
if(!cell)
|
||
{
|
||
cell = [[ShouYeToolsTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:strcell];
|
||
[cell setSelectionStyle:UITableViewCellSelectionStyleNone];
|
||
[cell setBackgroundColor:[UIColor clearColor]];
|
||
}
|
||
cell.arrdata = self.arrTools;
|
||
return cell;
|
||
}
|
||
}
|
||
else
|
||
{
|
||
if(indexPath.section==0)
|
||
{
|
||
static NSString *strcell = @"ShouYeZCPPTTableViewCell";
|
||
ShouYeZCPPTTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:strcell];
|
||
if(!cell)
|
||
{
|
||
cell = [[ShouYeZCPPTTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:strcell];
|
||
[cell setSelectionStyle:UITableViewCellSelectionStyleNone];
|
||
[cell setBackgroundColor:[UIColor clearColor]];
|
||
}
|
||
|
||
return cell;
|
||
}
|
||
else if(indexPath.section==1)
|
||
{
|
||
static NSString *strcell = @"ShouYeZCXZTableViewCell";
|
||
ShouYeZCXZTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:strcell];
|
||
if(!cell)
|
||
{
|
||
cell = [[ShouYeZCXZTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:strcell];
|
||
[cell setSelectionStyle:UITableViewCellSelectionStyleNone];
|
||
[cell setBackgroundColor:[UIColor clearColor]];
|
||
}
|
||
|
||
return cell;
|
||
}
|
||
else if(indexPath.section==2)
|
||
{
|
||
static NSString *strcell = @"ShouYeBannerTableViewCell";
|
||
ShouYeBannerTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:strcell];
|
||
if(!cell)
|
||
{
|
||
cell = [[ShouYeBannerTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:strcell];
|
||
[cell setSelectionStyle:UITableViewCellSelectionStyleNone];
|
||
[cell setBackgroundColor:[UIColor clearColor]];
|
||
}
|
||
|
||
return cell;
|
||
}
|
||
else if(indexPath.section==3)
|
||
{
|
||
static NSString *strcell = @"ShouYeToolsTableViewCell";
|
||
ShouYeToolsTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:strcell];
|
||
if(!cell)
|
||
{
|
||
cell = [[ShouYeToolsTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:strcell];
|
||
[cell setSelectionStyle:UITableViewCellSelectionStyleNone];
|
||
[cell setBackgroundColor:[UIColor clearColor]];
|
||
}
|
||
cell.arrdata = self.arrTools;
|
||
return cell;
|
||
}
|
||
}
|
||
|
||
static NSString *strcell = @"ShouYeZuoWenTableViewCell";
|
||
ShouYeZuoWenTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:strcell];
|
||
if(!cell)
|
||
{
|
||
cell = [[ShouYeZuoWenTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:strcell];
|
||
[cell setSelectionStyle:UITableViewCellSelectionStyleNone];
|
||
[cell setBackgroundColor:[UIColor clearColor]];
|
||
}
|
||
if(indexPath.row==self.arrFanWen.count-1)
|
||
{
|
||
cell.islast = YES;
|
||
}
|
||
else
|
||
{
|
||
cell.islast = NO;
|
||
}
|
||
cell.model = self.arrFanWen[indexPath.row];
|
||
return cell;
|
||
}
|
||
-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
|
||
{
|
||
if(([UserInfoModel shareModel].identityType.intValue==2 && section==5)||([UserInfoModel shareModel].identityType.intValue!=2 && section==4))
|
||
{///高分作文
|
||
return 45;
|
||
}
|
||
return 0.01;
|
||
}
|
||
-(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
|
||
{
|
||
if(([UserInfoModel shareModel].identityType.intValue==2 && section==5)||([UserInfoModel shareModel].identityType.intValue!=2 && section==4))
|
||
{///高分作文
|
||
return 10;
|
||
}
|
||
return 15;
|
||
}
|
||
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
|
||
{
|
||
int type = [UserInfoModel shareModel].identityType.intValue;
|
||
if(type==0||type==1)
|
||
{
|
||
if(indexPath.section==0)
|
||
{
|
||
return 140;
|
||
}
|
||
else if(indexPath.section==1)
|
||
{
|
||
return 160;
|
||
}
|
||
else if(indexPath.section==2)
|
||
{
|
||
return 92;
|
||
}
|
||
else if(indexPath.section==3)
|
||
{
|
||
/// 没得工具52 有 +86一行 第一行是76;
|
||
float fheight = 52;
|
||
NSInteger iline = self.arrTools.count/4;
|
||
if(self.arrTools.count%4!=0)iline+=1;
|
||
if(iline>0)
|
||
{
|
||
fheight+=86*iline-10;
|
||
}
|
||
return fheight;
|
||
}
|
||
}
|
||
else if (type==2)
|
||
{
|
||
if(indexPath.section==0)
|
||
{
|
||
return 140;
|
||
}
|
||
else if(indexPath.section==1)
|
||
{
|
||
return 80;
|
||
}
|
||
else if(indexPath.section==2)
|
||
{
|
||
return 80;
|
||
}
|
||
else if(indexPath.section==3)
|
||
{
|
||
return 92;
|
||
}
|
||
else if(indexPath.section==4)
|
||
{
|
||
/// 没得工具52 有 +86一行 第一行是76;
|
||
float fheight = 52;
|
||
NSInteger iline = self.arrTools.count/4;
|
||
if(self.arrTools.count%4!=0)iline+=1;
|
||
if(iline>0)
|
||
{
|
||
fheight+=86*iline-10;
|
||
}
|
||
return fheight;
|
||
}
|
||
}
|
||
else
|
||
{
|
||
if(indexPath.section==0)
|
||
{
|
||
return 140;
|
||
}
|
||
else if(indexPath.section==1)
|
||
{
|
||
return 76;
|
||
}
|
||
else if(indexPath.section==2)
|
||
{
|
||
return 92;
|
||
}
|
||
else if(indexPath.section==3)
|
||
{
|
||
/// 没得工具52 有 +86一行 第一行是76;
|
||
float fheight = 52;
|
||
NSInteger iline = self.arrTools.count/4;
|
||
if(self.arrTools.count%4!=0)iline+=1;
|
||
if(iline>0)
|
||
{
|
||
fheight+=86*iline-10;
|
||
}
|
||
return fheight;
|
||
}
|
||
}
|
||
return 72;
|
||
}
|
||
-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
|
||
{
|
||
if(([UserInfoModel shareModel].identityType.intValue==2 && section==5)||([UserInfoModel shareModel].identityType.intValue!=2 && section==4))
|
||
{///高分作文
|
||
UIView *viewback = [[UIView alloc] initWithFrame:CGRectMake(0, 0, UISCREEN_WIDTH-32, 45)];
|
||
[viewback setBackgroundColor:[UIColor whiteColor]];
|
||
UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect: viewback.bounds byRoundingCorners:UIRectCornerTopLeft | UIRectCornerTopRight cornerRadii:CGSizeMake(8,8)];
|
||
CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
|
||
maskLayer.frame = viewback.bounds;
|
||
maskLayer.path = maskPath.CGPath;
|
||
viewback.layer.mask = maskLayer;
|
||
|
||
UILabel *lbname = [[UILabel alloc] init];
|
||
[lbname setText:@"高分作文"];
|
||
[lbname setTextColor:RGBCOLOR(26, 26, 26)];
|
||
[lbname setTextAlignment:NSTextAlignmentLeft];
|
||
[lbname setFont:[UIFont boldSystemFontOfSize:16]];
|
||
[viewback addSubview:lbname];
|
||
[lbname mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
make.left.offset(14);
|
||
make.top.offset(18);
|
||
}];
|
||
|
||
UIButton *btmore = [[UIButton alloc] init];
|
||
[btmore setTitle:@"查看更多" forState:UIControlStateNormal];
|
||
[btmore setTitleColor:RGBCOLOR(153, 153, 153) forState:UIControlStateNormal];
|
||
[btmore.titleLabel setFont:[UIFont systemFontOfSize:12]];
|
||
[btmore setImage:[UIImage imageNamed:@"next"] forState:UIControlStateNormal];
|
||
[viewback addSubview:btmore];
|
||
[btmore mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
make.centerY.equalTo(lbname);
|
||
make.right.equalTo(viewback).offset(-10);
|
||
make.height.offset(30);
|
||
make.width.offset(80);
|
||
}];
|
||
[btmore setIconInRightWithSpacing:2];
|
||
[btmore addTarget:self action:@selector(morezwAction) forControlEvents:UIControlEventTouchUpInside];
|
||
|
||
return viewback;
|
||
}
|
||
return [UIView new];
|
||
}
|
||
-(UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section
|
||
{
|
||
if(([UserInfoModel shareModel].identityType.intValue==2 && section==5)||([UserInfoModel shareModel].identityType.intValue!=2 && section==4))
|
||
{///高分作文
|
||
UIView *viewback = [[UIView alloc] initWithFrame:CGRectMake(0, 0, UISCREEN_WIDTH-32, 10)];
|
||
[viewback setBackgroundColor:[UIColor whiteColor]];
|
||
UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect: viewback.bounds byRoundingCorners:UIRectCornerBottomLeft | UIRectCornerBottomRight cornerRadii:CGSizeMake(8,8)];
|
||
CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
|
||
maskLayer.frame = viewback.bounds;
|
||
maskLayer.path = maskPath.CGPath;
|
||
viewback.layer.mask = maskLayer;
|
||
return viewback;
|
||
}
|
||
return [UIView new];
|
||
}
|
||
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
|
||
{
|
||
if(([UserInfoModel shareModel].identityType.intValue==2 && indexPath.section==5)||([UserInfoModel shareModel].identityType.intValue!=2 && indexPath.section==4))
|
||
{
|
||
ExampleTextGreatModelDataItems *model = self.arrFanWen[indexPath.row];
|
||
FanWenDetailViewController *vc = [FanWenDetailViewController new];
|
||
vc.modelDetail = model;
|
||
[self.navigationController pushViewController:vc animated:YES];
|
||
|
||
[UserInfoModel shijianShangBao:0 key:@"client.jump.to.excellent_composition.info" value:@"首页" extra:@""];
|
||
|
||
}
|
||
}
|
||
///高分作文查看更多
|
||
-(void)morezwAction
|
||
{
|
||
[[NSNotificationCenter defaultCenter] postNotificationName:@"carnumberChangeNotifi" object:@"1"];
|
||
|
||
[UserInfoModel shijianShangBao:0 key:@"client.view.more.excellent_composition" value:@"首页" extra:@""];
|
||
}
|
||
///用户信息
|
||
-(void)getUserData
|
||
{
|
||
[PublicNetWorkManager requestUserData:self.view Callback:^(BOOL state, UserModel *responseObject, NSString * _Nullable describle) {
|
||
if(state)
|
||
{
|
||
[UserInfoModel setIdentityType:responseObject.data.identityType];
|
||
[UserInfoModel shareModel].isAllLevel = responseObject.data.isAllLevel;
|
||
[UserInfoModel shareModel].user_stage = responseObject.data.user_stage;
|
||
[UserInfoModel setTemp:responseObject.data.temp];
|
||
[UserInfoModel setUserid:responseObject.data.user_id];
|
||
[UserInfoModel shareModel].vip = responseObject.data.vip;
|
||
[self updateBtShow];
|
||
[self getFanWen];
|
||
}
|
||
}];
|
||
}
|
||
///常用工具
|
||
-(void)getTools
|
||
{
|
||
[NetWorkManager requestToolsListData:self.view page:1 size:@"1000" type_id:@"" tool_name:@"" is_recommend:@"0" Callback:^(BOOL state, ToolsListModel *responseObject, NSString * _Nullable describle) {
|
||
[self.tableView.mj_header endRefreshing];
|
||
if(state)
|
||
{
|
||
self.arrTools = responseObject.data.items;
|
||
[self.tableView reloadData];
|
||
}
|
||
}];
|
||
}
|
||
-(void)pushCollectInit
|
||
{
|
||
[NetWorkManager requestToolsFavInitData:self.view Callback:^(BOOL state, id _Nullable responseObject, NSString * _Nullable describle) {
|
||
if(state)
|
||
{
|
||
[NetWorkManager requestToolsFavData:self.view page:1 size:@"100" Callback:^(BOOL state, ToolsListModel *responseObject, NSString * _Nullable describle) {
|
||
[self.tableView.mj_header endRefreshing];
|
||
if(state)
|
||
{
|
||
self.arrTools = responseObject.data.items;
|
||
[self.tableView reloadData];
|
||
}
|
||
}];
|
||
}
|
||
}];
|
||
}
|
||
|
||
-(void)getFanWen
|
||
{
|
||
if([UserInfoModel shareModel].identityType.intValue==3)return;
|
||
NSString *strrole_id = [UserInfoModel shareModel].user_stage.ID;
|
||
if([UserInfoModel shareModel].identityType.intValue == 2 && [UserInfoModel shareModel].isAllLevel.intValue == 1)
|
||
{
|
||
strrole_id = [UserInfoModel shareModel].user_stage.pid;
|
||
}
|
||
|
||
[NetWorkManager requestExampleTextGreatData:self.view page:1 size:@"5" role_id:strrole_id Callback:^(BOOL state, ExampleTextGreatModel *responseObject, NSString * _Nullable describle) {
|
||
if(state)
|
||
{
|
||
self.arrFanWen = responseObject.data.items;
|
||
[self.tableView reloadData];
|
||
}
|
||
}];
|
||
}
|
||
|
||
|
||
-(void)updateBtShow
|
||
{
|
||
if([UserInfoModel shareModel].identityType.intValue==3)
|
||
{
|
||
[self.btnianji setTitle:[NSString stringWithFormat:@"%@",[UserInfoModel getidentityTypeString]] forState:UIControlStateNormal];
|
||
}
|
||
else
|
||
{
|
||
if([UserInfoModel shareModel].user_stage==nil)
|
||
{
|
||
[self.btnianji setTitle:@"请选择" forState:UIControlStateNormal];
|
||
}
|
||
else
|
||
{
|
||
if([UserInfoModel shareModel].isAllLevel.intValue==1)
|
||
{
|
||
[self.btnianji setTitle:[NSString stringWithFormat:@"%@-%@",[UserInfoModel getidentityTypeString],[UserInfoModel shareModel].user_stage.parent_name] forState:UIControlStateNormal];
|
||
}
|
||
else
|
||
{
|
||
[self.btnianji setTitle:[NSString stringWithFormat:@"%@-%@",[UserInfoModel getidentityTypeString],[UserInfoModel shareModel].user_stage.name] forState:UIControlStateNormal];
|
||
}
|
||
}
|
||
}
|
||
[self.btnianji setIconInRightWithSpacing:6];
|
||
}
|
||
|
||
|
||
@end
|