// // ShareReportViewController.m // Ifish // // Created by imac on 16/9/7. // Copyright © 2016年 lianxiang. All rights reserved. // #import "ShareReportViewController.h" #import "Reprt4ViewCell.h" #import "ShareReportCell.h" #import "LookReportViewCell.h" #import "Report2ViewCell.h" #import "Report3ViewCell.h" #import "Reprt4ViewCell.h" #import "PingfenModel.h" #import "UIImageView+WebCache.h" #import "Report5ViewCell.h" #import "LXShareImageVIew.h" #import #define CEL0TAG 222000222 @interface ShareReportViewController () @end @implementation ShareReportViewController - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view. self.tableView.dataSource = self; // for (Reprt4ViewCell *cell in self.tableView.subviews) { // [cell.faSongBtn setTitle:@"分享给朋友" forState:UIControlStateNormal]; // [cell.faSongBtn addTarget:self action:@selector(sharedAction) forControlEvents:UIControlEventTouchUpInside]; // // } [self.tableView registerClass:[ShareReportCell class] forCellReuseIdentifier:@"ShareReportCell"]; } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{ return 8; } -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ if (indexPath.row ==0) { LookReportViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"LookReportViewCell"]; if (!cell) { cell = [[[NSBundle mainBundle]loadNibNamed:@"LookReportViewCell" owner:self options:nil]lastObject]; } // UIImage *image=[Utils shopsGetImgeWithCameraId:self.listModel.cameraId]; // // if (image) { // cell.lastCameraImg.image = image; // }else{ // // cell.lastCameraImg.image =LXImageWithImageName(@"ic_header.png"); // } NSString *imhUrl = [NSString stringWithFormat:@"%@%@",kGetKanHuUrl,self.baGaoMod.shareImg]; [cell.lastCameraImg sd_setImageWithURL:[NSURL URLWithString:imhUrl] placeholderImage:[UIImage imageNamed:@"ic_header.png"]]; cell.selectionStyle = UITableViewCellSelectionStyleNone; [cell cellSetBackViewCorner]; cell.tag = 222000222; return cell; }else if (indexPath.row >=1 && indexPath.row <=4){ Report2ViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Report2ViewCell"]; if (!cell) { cell = [[[NSBundle mainBundle]loadNibNamed:@"Report2ViewCell" owner:self options:nil]lastObject]; } cell.selectionStyle = UITableViewCellSelectionStyleNone; if (indexPath.row ==1) { cell.fenLabel.hidden = YES; cell.titleCateLabel.text = @"看护时刻:"; cell.descLabel.text = self.baGaoMod.timestamp; }else{ cell.titleCateLabel.text = self.titleDataArr[indexPath.row -2]; PingfenModel *pfModel = self.pinFenArr[indexPath.row -2]; cell.descLabel.text = pfModel.pingFenDesc; cell.fenLabel.text =[NSString stringWithFormat:@"+%@",pfModel.pingFenNumber]; } return cell; }else if (indexPath.row == 5){ Report3ViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Report3ViewCell"]; if (!cell) { cell = [[[NSBundle mainBundle]loadNibNamed:@"Report3ViewCell" owner:self options:nil]lastObject]; } cell.JianYiLabel.text = self.suggesttrue; cell.selectionStyle = UITableViewCellSelectionStyleNone; return cell; }else if (indexPath.row == 6){ Report5ViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Report5ViewCell"]; if (!cell) { cell = [[[NSBundle mainBundle]loadNibNamed:@"Report5ViewCell" owner:self options:nil]lastObject]; } cell.pingFenLabel.text = [NSString stringWithFormat:@"得分:%@分",self.baGaoMod.totalIndex]; cell.pingFenDescreaption.text =[NSString stringWithFormat:@"您的得分,击败了全国%@%的鱼友",self.baGaoMod.baifenbi]; cell.selectionStyle = UITableViewCellSelectionStyleNone; return cell; }else if (indexPath.row == 7){ Reprt4ViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Reprt4ViewCell"]; if (!cell) { cell = [[[NSBundle mainBundle]loadNibNamed:@"Reprt4ViewCell" owner:self options:nil]lastObject]; } cell.selectionStyle = UITableViewCellSelectionStyleNone; [cell.shangJiaImg sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@%@",kGetIconUrl,self.baGaoMod.userImg]] placeholderImage:[UIImage imageNamed:@""]]; cell.shangJiaName.text = self.baGaoMod.shopsName; cell.shangJiadetail.text = self.baGaoMod.shopsName; [cell.faSongBtn setTitle:@"分享给朋友" forState:UIControlStateNormal]; [cell.faSongBtn addTarget:self action:@selector(sharedAction) forControlEvents:UIControlEventTouchUpInside]; [cell cellSetBackViewCorner]; return cell; } return nil; } //分享 -(void)sharedAction{ LXShareImageVIew *shareView=[[LXShareImageVIew alloc] initWithFrame:[UIScreen mainScreen].bounds]; shareView.delegate = self; [shareView shareShow]; } #pragma mark - LXShareImageVIewdelegate -(void)didSelectButWithBtnTag:(NSInteger)btnTag { LookReportViewCell *cell = [self.view viewWithTag:CEL0TAG]; UIImage *shareImg = cell.lastCameraImg.image; if (!shareImg) { return; } [self shareImgWith:shareImg resourceUrl:self.shareUrl addtag:btnTag]; //每日分享看护报告 加金币 [[IfishUserObsever sharedInstance] addGoldWith:SHARELOOKREPORT addType:IFISHADDGOLDTYPE0]; } -(void)shareImgWith:(UIImage *)shareImage resourceUrl:(NSString *)sourceurl addtag:(NSInteger)btnTag{ NSString *shareContent = self.suggesttrue; if (!shareContent) { shareContent = @"爱鱼奇看护报告分享"; } switch (btnTag) { case 0: { //微信 //创建分享消息对象 UMSocialMessageObject *messageObject = [UMSocialMessageObject messageObject]; UMShareWebpageObject *shareObject = [[UMShareWebpageObject alloc] init]; shareObject.title = @"爱鱼奇"; shareObject.webpageUrl =sourceurl; shareObject.thumbImage = shareImage; //分享消息对象设置分享内容对象 messageObject.shareObject = shareObject; [[UMSocialManager defaultManager] shareToPlatform:UMSocialPlatformType_WechatSession messageObject:messageObject currentViewController:self completion:^(id result, NSError *error) { if (error) { NSLog(@"************Share fail with error %@*********",error); }else{ NSLog(@"response data is %@",result); } }]; } break; case 1: { //朋友圈 //微信 UMSocialMessageObject *messageObject = [UMSocialMessageObject messageObject]; UMShareWebpageObject *shareObject = [[UMShareWebpageObject alloc] init]; shareObject.title = @"爱鱼奇"; shareObject.webpageUrl =sourceurl; shareObject.thumbImage = shareImage; //分享消息对象设置分享内容对象 messageObject.shareObject = shareObject; [[UMSocialManager defaultManager] shareToPlatform:UMSocialPlatformType_WechatTimeLine messageObject:messageObject currentViewController:self completion:^(id result, NSError *error) { if (error) { NSLog(@"************Share fail with error %@*********",error); }else{ NSLog(@"response data is %@",result); } }]; } break; case 2: { //QQ UMSocialMessageObject *messageObject = [UMSocialMessageObject messageObject]; UMShareWebpageObject *shareObject = [[UMShareWebpageObject alloc] init]; shareObject.title = @"爱鱼奇"; shareObject.webpageUrl =sourceurl; shareObject.thumbImage = shareImage; //分享消息对象设置分享内容对象 messageObject.shareObject = shareObject; [[UMSocialManager defaultManager] shareToPlatform:UMSocialPlatformType_QQ messageObject:messageObject currentViewController:self completion:^(id result, NSError *error) { if (error) { NSLog(@"************Share fail with error %@*********",error); }else{ NSLog(@"response data is %@",result); } }]; } break; case 3: { UMSocialMessageObject *messageObject = [UMSocialMessageObject messageObject]; UMShareWebpageObject *shareObject = [[UMShareWebpageObject alloc] init]; shareObject.title = @"爱鱼奇"; shareObject.webpageUrl =sourceurl; shareObject.thumbImage = shareImage; NSString *uslStr= [NSString stringWithFormat:@"来自爱鱼奇分享,#🐟%@🐟#",sourceurl]; shareObject.descr =uslStr; //分享消息对象设置分享内容对象 messageObject.shareObject = shareObject; [[UMSocialManager defaultManager] shareToPlatform:UMSocialPlatformType_Sina messageObject:messageObject currentViewController:self completion:^(id result, NSError *error) { if (error) { NSLog(@"************Share fail with error %@*********",error); }else{ NSLog(@"response data is %@",result); } }]; } break; default: break; } } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. } @end