| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287 |
- //
- // PrivateSpaceViewController.m
- // 千模
- //
- // Created by MUMEI on 2018/5/18.
- // Copyright © 2018年 MUMEI. All rights reserved.
- //
- #import "PrivateSpaceViewController.h"
- #import "OneImageCell.h"
- #import "TwoImageCell.h"
- #import "FourImageCell.h"
- #import "OnlyTextCell.h"
- #import "PushStateCell.h"
- #import "personalImage.h"
- #import "PrivateModel.h"
- #import "ImageViewController.h"
- #import "PublishViewController.h"
- #import "DetailOnlyTextViewController.h"
- #import "DetailOneImageViewController.h"
- @interface PrivateSpaceViewController ()<OneImageDelegate,TwoImageDelegate,FourImageDelegate,pushOrderDelegate>
- @property (weak, nonatomic) IBOutlet UIImageView *zixunImage;
- @property (weak, nonatomic) IBOutlet UIImageView *shipinImage;
- @property (weak, nonatomic) IBOutlet UITableView *tableView;
- @property (weak, nonatomic) IBOutlet personalImage *backView;
- @property (strong, nonatomic) NSString *nickName;
- @property (strong, nonatomic) NSString *star;
- @property (strong, nonatomic) NSString *fCount;//粉丝数
- @property (strong, nonatomic) NSString *is_A;//是否在线
- @property (strong, nonatomic) NSString *is_V;//是否支持视频
- @property (strong, nonatomic) NSString *hei;//身高
- @property (strong, nonatomic) NSString *wei;//体重
- @property (strong, nonatomic) NSString *bust;//胸围
- @property (strong, nonatomic) NSString *wai;//腰围
- @property (strong, nonatomic) NSString *hip;//臀围
- @property (strong, nonatomic) NSString *vPrice;//视频价格
- @property (strong, nonatomic) NSString *lName;//个性签名
- @property (strong, nonatomic) NSString *hphoto;
- @property (strong, nonatomic) NSMutableArray *photoArray;
- @property (assign, nonatomic) NSInteger photoCount;
- //@property (nonatomic,strong) ActorModel *model;
- @property (strong, nonatomic) NSMutableArray *privateArray;
- @property (weak, nonatomic) IBOutlet NSLayoutConstraint *bottomHeight;
- @property (weak, nonatomic) IBOutlet NSLayoutConstraint *topHeight;
- @property (weak, nonatomic) IBOutlet NSLayoutConstraint *bottomHeight2;
- @end
- @implementation PrivateSpaceViewController
- {
- ActorModel *actModel;
- personalImage * backImage;
- int index;
- }
- - (NSMutableArray *)privateArray {
- if (!_privateArray) {
- _privateArray = [NSMutableArray arrayWithCapacity:0];
- }
- return _privateArray;
- }
- - (void)viewDidLoad {
- [super viewDidLoad];
- // [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(hideNavigationBar) name:@"hideNavigationBar" object:nil];
-
- self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
- if ([UIScreen spt_currentScreenMode]== LESScreenModeIPhoneX) {
- _topHeight.constant = -24;
- _bottomHeight.constant = 34;
- }
- backImage = [[personalImage alloc]initWithFrame:CGRectMake(0, 0, ScreenWidth, ScreenWidth+68)];
-
- self.tableView.tableHeaderView = backImage;
- self.tableView.tableFooterView = [[UIView alloc] initWithFrame:CGRectZero];
- [self.tableView setSeparatorInset:UIEdgeInsetsZero];
- self.tableView.mj_header = [MJRefreshNormalHeader headerWithRefreshingTarget:self refreshingAction:@selector(refreshList)];
- self.tableView.mj_footer = [MJRefreshAutoNormalFooter footerWithRefreshingTarget:self refreshingAction:@selector(loadMoreData)];
- _tableView.showsVerticalScrollIndicator = NO;
- }
- -(void)hideNavigationBar{
- self.navigationController.navigationBar.hidden = YES;
- }
- - (void)viewWillAppear:(BOOL)animated {
-
- [super viewWillAppear:animated];
- [self changeLoginState:@"1"];
- [self getPrivateModel];
- [self refreshList];
- self.navigationController.navigationBar.hidden = YES;
- }
- - (void)viewWillDisappear:(BOOL)animated{
- self.navigationController.navigationBar.hidden = NO;
- }
- - (void)changeLoginState:(NSString *)state{
-
- NSString *str = [NSString stringWithFormat:@"%@modelInfo?action=doPutOnline&modelpk=%@&online=%@",imageURl,[ModelUser user].modelpk,state];
- [[AHHttpManager sharedManager]POST:str parameters:nil success:^(id responseObject) {
- NSLog(@"%@",responseObject);
- if ([[responseObject objectForKey:@"msg"]isEqualToString:@"success"]) {
-
- }else{
-
- }
- } failure:^(NSError *error) {
- NSLog(@"error = %@",error);
- }];
- }
- -(void)refreshList{
-
- index = 1;
- [self.privateArray removeAllObjects];
- [self getPrivate:[NSString stringWithFormat:@"%d",index]];
- }
- - (void)loadMoreData{
-
- index++;
- [self getPrivate:[NSString stringWithFormat:@"%d",index]];
- }
- - (void)getPrivate:(NSString*)Index{
-
- NSDictionary *dic = [[NSDictionary alloc] initWithObjectsAndKeys:[ModelUser user].modelpk,@"ModelPK",[ModelUser user].pk,@"memberpk",Index,@"index",@"10",@"size", nil];
-
- [YanCNetWorkManager requestPostWithURLStr:Url_doGetPrivate(PublicUrl) parameters:dic finish:^(id dataDic) {
- [MBProgressHUD hideHUDForView:self.view animated:YES];
- NSString *issuccess = dataDic[@"msg"];
-
- if ([issuccess isEqualToString:@"success"]) {
-
- self.hphoto = [dataDic objectForKey:@"hphoto"];
- NSArray *data = dataDic[@"data"];
- NSArray * array = [PrivateModel arrayOfModelsFromDictionaries:data];
- [self.privateArray addObjectsFromArray:array];
-
- NSString *number = dataDic[@"count"];
- NSInteger num = [number integerValue];
-
- [self.tableView.mj_header endRefreshing];
- if (num == self.privateArray.count || num == 0) {
- [self.tableView.mj_footer endRefreshingWithNoMoreData];
- }else{
- [self.tableView.mj_footer endRefreshing];
- }
- [self.tableView reloadData];
-
- } else {
- [MBProgressHUD showInfo:@"请求失败!"];
- }
- } enError:^(NSError *error) {
- [MBProgressHUD hideHUDForView:self.view animated:YES];
- }];
- }
- - (void)getPrivateModel{
-
- NSString *str = [NSString stringWithFormat:@"%@model?action=getmodeluserinfo&modelpk=%@",imageURl,[ModelUser user].modelpk];
- [[AHHttpManager sharedManager]POST:str parameters:nil success:^(id responseObject) {
- NSLog(@"%@",responseObject);
- if ([[responseObject objectForKey:@"msg"]isEqualToString:@"success"]) {
- actModel = [[ActorModel alloc]initWithDictionary:[responseObject objectForKey:@"data"] error:nil];
- [backImage reloadModel:actModel];
- }else{
- [MBProgressHUD showTextHUD:@"超时" inView:self.view hideAfterDelay:1];
- }
- } failure:^(NSError *error) {
- NSLog(@"error = %@",error);
- [MBProgressHUD showTextHUD:@"超时" inView:self.view hideAfterDelay:1];
- }];
- }
- #pragma mark - deleDate
- -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
-
- return self.privateArray.count+1;
- }
- -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
- {
- if (indexPath.row==0) {
- PushStateCell *cell = [tableView dequeueReusableCellWithIdentifier:@"PushStateCell"];
- if(!cell){
- cell = [[[UINib nibWithNibName:@"PushStateCell" bundle:nil]instantiateWithOwner:self options:nil]lastObject];
- cell.delegate = self;
- cell.selectionStyle = UITableViewCellSelectionStyleNone;
- }
- return cell;
- }else{
- PrivateModel *model = [self.privateArray objectAtIndex:indexPath.row-1];
- if (model.iteminfo.count==0) {
- OnlyTextCell * cell = [tableView dequeueReusableCellWithIdentifier:@"OnlyTextCell"];
- if (!cell) {
- cell = [[[UINib nibWithNibName:@"OnlyTextCell" bundle:nil]instantiateWithOwner:self options:nil]lastObject];
- }
- cell.model = model;
- return cell;
-
- }else if (model.iteminfo.count==1) {
- OneImageCell * cell = [tableView dequeueReusableCellWithIdentifier:@"OneImageCell"];
- if (!cell) {
- cell = [[[UINib nibWithNibName:@"OneImageCell" bundle:nil]instantiateWithOwner:self options:nil]lastObject];
- }
- cell.model = model;
- cell.delegate = self;
- return cell;
-
- }else if(model.iteminfo.count==2){
- TwoImageCell * cell = [tableView dequeueReusableCellWithIdentifier:@"TwoImageCell"];
- if (!cell) {
- cell = [[[UINib nibWithNibName:@"TwoImageCell" bundle:nil]instantiateWithOwner:self options:nil]lastObject];
- }
- cell.model = model;
- cell.delegate = self;
- return cell;
-
- }else{
- FourImageCell * cell = [tableView dequeueReusableCellWithIdentifier:@"FourImageCell"];
- if (!cell) {
- cell = [[[UINib nibWithNibName:@"FourImageCell" bundle:nil]instantiateWithOwner:self options:nil]lastObject];
- }
- cell.model = model;
- cell.delegate = self;
- return cell;
- }
- }
- }
- -(void)clickImage:(PrivateModel *)model andNum:(int)num{
-
- ImageViewController *ImgVc = [[ImageViewController alloc]init];
- ImgVc.model = model;
- ImgVc.i = num;
- ImgVc.hidesBottomBarWhenPushed = YES;
- [self.navigationController pushViewController:ImgVc animated:YES];
- }
- -(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
-
- return 0.00001;
- }
- -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
-
- return 110;
- }
- - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
-
- [tableView deselectRowAtIndexPath:indexPath animated:NO];
- if (indexPath.row!=0) {
- PrivateModel *model = [self.privateArray objectAtIndex:indexPath.row-1];
- DetailOnlyTextViewController *dVc = [[DetailOnlyTextViewController alloc]init];
- dVc.model = model;
- dVc.iconImage = self.hphoto;
- dVc.name = actModel.name;
- [self.navigationController pushViewController:dVc animated:YES];
- }
- }
- - (void)clickImage{
-
- PublishViewController *pVc = [[PublishViewController alloc]init];
- [self.navigationController pushViewController:pVc animated:YES];
- }
- - (void)didReceiveMemoryWarning {
- [super didReceiveMemoryWarning];
- // Dispose of any resources that can be recreated.
- }
- @end
|