123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638 |
- //
- // YOUPAILZUserShowVC.m
- // VQU
- //
- // Created by CY on 2021/7/10.
- // Copyright © 2021 leo. All rights reserved.
- //
- #import "YOUPAILZUserShowVC.h"
- #import "JXCategoryView.h"
- #import "YOUPAIJXCategoryTitleBackgroundView.h"
- #import "JXPagerListRefreshView.h"
- #import "YOUPAILZPersonalVideoVC.h"
- #import "YOUPAIZYUserZiLiaoVC.h"
- #import "YOUPAILCUserShowModel.h"
- #import "YOUPAILZUserShowHeaderView.h"
- #import "MSYMineinfoEditVC.h"
- #import "YOUPAILCReportVC.h"
- #import "YOUPAILCIMSessionVC.h"
- #import "LZAlertWindow.h"
- #import "YOUPAIHRRechargePayWindow.h"
- #import "UIViewController+TFPresent.h"
- #import "YOUPAILPGuardHerVC.h"
- #import "YOUPAILPGuardBordeVC.h"
- #import "YOUPAIBBVideoRequestVC.h"
- @interface YOUPAILZUserShowVC () <JXCategoryViewDelegate,JXPagerViewDelegate,JXPagerMainTableViewGestureDelegate,LPGuardHerDelegate>
- @property (nonatomic, strong) YOUPAILZUserShowHeaderView *youpaipheaderView;
- @property (nonatomic, strong) JXPagerListRefreshView *youpaippagerView;
- @property (nonatomic, strong) JXCategoryTitleView *youpaipcategoryView;
- @property (nonatomic, strong) UIView *youpaipcategoryBgV;
- @property (nonatomic, strong) YOUPAILCUserShowModel* youpaipshowModel;
- @property (nonatomic, weak) UILabel *youpaipavatarCountL;
- @property(nonatomic,assign)CGFloat youpaiptoolHeight;//底部tool的高度
- /* 视频 */
- @property (strong, nonatomic) UIButton *videoBtn;
- /* 私信 */
- @property (strong, nonatomic) UIButton *siXinBtn;
- @property (strong, nonatomic) UIButton *heartbeatBtn;
- @end
- @implementation YOUPAILZUserShowVC
- - (void)viewWillAppear:(BOOL)animated{
- [super viewWillAppear:animated];
- self.navigationController.navigationBar.translucent = YES;
- UIImage *img = [UIImage imageWithColor:[LCBkgColor colorWithAlphaComponent:0.0f] size:CGSizeMake(KScreenWidth, NavBarHeight)];
- [self.navigationController.navigationBar setBackgroundImage:img forBarMetrics:(UIBarMetricsDefault)];
- [self.navigationController.navigationBar setBackgroundColor:[LCBkgColor colorWithAlphaComponent:0.0f]];
- if (@available(iOS 15.0, *)) {
- [self.navigationController.navigationBar.scrollEdgeAppearance setBackgroundColor:[LCBkgColor colorWithAlphaComponent:0.0f]];
- [self.navigationController.navigationBar.scrollEdgeAppearance setBackgroundImage:img];
- [self.navigationController.navigationBar.standardAppearance setBackgroundColor:[LCBkgColor colorWithAlphaComponent:0.0f]];
- [self.navigationController.navigationBar.standardAppearance setBackgroundImage:img];
- }
- }
- - (void)viewWillDisappear:(BOOL)animated{
- [super viewWillDisappear:animated];
- UIImage *img = [UIImage imageWithColor:LCWhiteColor size:CGSizeMake(KScreenWidth, NavBarHeight)];
- [self.navigationController.navigationBar setBackgroundImage:img forBarMetrics:UIBarMetricsDefault];
- [self.navigationController.navigationBar setBackgroundColor:LCWhiteColor];
- if (@available(iOS 15.0, *)) {
- [self.navigationController.navigationBar.scrollEdgeAppearance setBackgroundColor:LCWhiteColor];
- [self.navigationController.navigationBar.scrollEdgeAppearance setBackgroundImage:img];
- [self.navigationController.navigationBar.standardAppearance setBackgroundColor:LCWhiteColor];
- [self.navigationController.navigationBar.standardAppearance setBackgroundImage:img];
- }
-
- self.navigationController.navigationBar.translucent = NO;
-
- }
- - (void)viewDidDisappear:(BOOL)animated{
- [super viewDidDisappear:animated];
- // [self.youpaipheaderView youpaifstopPlay];
-
- }
- - (void)viewDidLoad {
- [super viewDidLoad];
- [UMengRecordTool umengEventCountWithId:EnterPersonalCenter];
- self.youpaiptoolHeight = 74+SafeHeight;
- [self youpaifinitData];
-
- }
- -(void)youpaifsetBottomView{
-
- UIView *bottomView = [[UIView alloc]init];
- [self.view addSubview:bottomView];
- [bottomView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(0);
- make.right.mas_equalTo(0);
- make.height.mas_equalTo(self.youpaiptoolHeight);
- make.bottom.mas_equalTo(0);
- }];
- // [self.view bringSubviewToFront:bottomView];
- bottomView.backgroundColor = LCWhiteColor;
-
- UIView *bgView = [UIView new];
- [bottomView addSubview:bgView];
- [bgView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(0);
- make.right.mas_equalTo(0);
- make.height.mas_equalTo(self.youpaiptoolHeight);
- make.top.mas_equalTo(0);
- }];
-
- //视频
- UIButton *videoBtn = [UIButton new];
- self.videoBtn = videoBtn;
- [bgView addSubview:videoBtn];
- [videoBtn mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(14);
- make.top.mas_equalTo(0);
- make.size.mas_equalTo(CGSizeMake(74, 74));
- }];
-
- [videoBtn setBackgroundImage:[UIImage imageNamed:@"vqu_images_P_user_Video"] forState:UIControlStateNormal];
-
- //私信
- UIButton *siXinBtn = [UIButton new];
- self.siXinBtn = siXinBtn;
- [bgView addSubview:siXinBtn];
- [siXinBtn mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(videoBtn.mas_right).offset(0);
- make.top.mas_equalTo(0);
- make.size.mas_equalTo(CGSizeMake(74, 74));
- }];
-
- [siXinBtn setBackgroundImage:[UIImage imageNamed:@"vqu_images_P_user_SiXin"] forState:UIControlStateNormal];
- //心动
- UIButton *heartbeatBtn = [UIButton new];
- self.heartbeatBtn = heartbeatBtn;
- [bgView addSubview:heartbeatBtn];
- [heartbeatBtn mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(siXinBtn.mas_right).offset(1);
- make.top.mas_equalTo(0);
- make.right.offset(-20);
- make.height.offset(74);
- }];
-
-
- [heartbeatBtn addTarget:self action:@selector(heartbeatBtnClick:) forControlEvents:UIControlEventTouchUpInside];
- YOUPAILCUserModel *user = [LCSaveModel getUserModel];
- if (user.youpaipuserinfo.youpaipgender == 1) {
- [heartbeatBtn setBackgroundImage:[UIImage imageNamed:@"vqu_images_P_user_heartBeat"] forState:UIControlStateNormal];
-
- }else{
- [heartbeatBtn setBackgroundImage:[UIImage imageNamed:@"vqu_images_P_user_heartBeat_1"] forState:UIControlStateNormal];
- }
- if(self.youpaipshowModel.youpaipis_beckon){
- self.heartbeatBtn.hidden = YES;
- [self.siXinBtn mas_updateConstraints:^(MASConstraintMaker *make) {
- make.width.mas_equalTo(ScaleSize(258));
- }];
- [self.siXinBtn setBackgroundImage:[UIImage imageNamed:@"vqu_images_P_user_SiXin_big"] forState:UIControlStateNormal];
- }else{
- self.heartbeatBtn.hidden = NO;
- }
- //按钮事件
-
- [siXinBtn addTarget:self action:@selector(youpaifsiXinBtnClick) forControlEvents:UIControlEventTouchUpInside];
- [videoBtn addTarget:self action:@selector(youpaifvideoBtnClick) forControlEvents:UIControlEventTouchUpInside];
- //
- // }
-
-
- }
- -(void)heartbeatBtnClick:(UIButton*)sender{
- sender.hidden = YES;
- if (![LCTools isGirlsRealNameAuthentication]) {
- return;
- }
- if(self.youpaipshowModel.youpaipis_beckon){//心动 true 已心动过,false 未心动过
-
- @weakify(self);
- //
-
- NIMSession *session = [NIMSession session:self.youpaipshowModel.youpaipuserid type:NIMSessionTypeP2P];
- if (session) {
- [ZCHUDHelper show];
- [[[NIMSDK sharedSDK] userManager] fetchUserInfos:@[session.sessionId] completion:^(NSArray<NIMUser *> * _Nullable users, NSError * _Nullable error) {
- @strongify(self);
- [ZCHUDHelper dismiss];
- YOUPAILCIMSessionVC *vc = [[YOUPAILCIMSessionVC alloc] initWithSession:session];
- [self.navigationController pushViewController:vc animated:YES];
- }];
- }
- }else{
- [UMengRecordTool umengEventCountWithId:ClickToChatPersonal];//友盟个人中心点击搭讪
- NSMutableDictionary *mutdict = [NSMutableDictionary new];
- NSString *str = [NSString stringWithFormat:@"[%@]",self.youpaipshowModel.youpaipuserid];
- [mutdict setObject:str forKey:@"user_ids"];
-
- [LCHttpHelper requestWithURLString:HomeBeckonSend parameters:mutdict needToken:YES type:(HttpRequestTypePost) success:^(id responseObject) {
- NSDictionary* dict = (NSDictionary*)responseObject;
- NSDictionary* dict1 = dict[@"data"];
- NSInteger code = [[dict objectForKey:@"code"] integerValue];
- if (code==0) {//成功
- if (dict1[@"boole"]) {
- self.youpaipshowModel.youpaipis_beckon = YES;
- if(self.youpaipshowModel.youpaipis_beckon){
- self.heartbeatBtn.hidden = YES;
- [self.siXinBtn mas_updateConstraints:^(MASConstraintMaker *make) {
- make.width.mas_equalTo(ScaleSize(258));
- }];
- [self.siXinBtn setBackgroundImage:[UIImage imageNamed:@"vqu_images_P_user_SiXin_big"] forState:UIControlStateNormal];
- }else{
- self.heartbeatBtn.hidden = NO;
- }
- }
-
- }else{
- [ZCHUDHelper showTitle:[dict objectForKey:@"message"]];
- }
- } failure:^(NSError *error) {
-
- }];
- }
-
-
- [self.siXinBtn mas_updateConstraints:^(MASConstraintMaker *make) {
- make.width.mas_equalTo(ScaleSize(258));
- }];
- [self.siXinBtn setBackgroundImage:[UIImage imageNamed:@"vqu_images_P_user_SiXin_big"] forState:UIControlStateNormal];
-
-
- }
- - (void)youpaifinitUI{
- YOUPAILZUserShowHeaderView *headerView = [[YOUPAILZUserShowHeaderView alloc] initWithModel:self.youpaipshowModel];
-
- headerView.backgroundColor = [UIColor whiteColor];
- self.youpaipheaderView = headerView;
- @weakify(self)
- //点击守护
- [headerView setYoupaipdidClickSh:^{
- @strongify(self)
- [self youpaifsetSelectShouHu];
- }];
- //跳转守护界面
- [headerView setJumToGuardVCClick:^{
- @strongify(self)
- [self JumToGuardVCClick];
- }];
- UIView *categoryBgV = [[UIView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, KScreenWidth, 1.0f)];
- categoryBgV.backgroundColor = [UIColor clearColor];
- self.youpaipcategoryBgV = categoryBgV;
-
- YOUPAIJXCategoryTitleBackgroundView *categoryView = [[YOUPAIJXCategoryTitleBackgroundView alloc] initWithFrame:CGRectMake((categoryBgV.mj_w - 164.0f) / 2.0f, (categoryBgV.mj_h - 27.0f) / 2.0f, 164.0f, 1.0f)];
- categoryView.backgroundColor = [UIColor clearColor];
- // categoryView.titles = self.titles;
- categoryView.delegate = self;
- categoryView.titleSelectedColor = [UIColor whiteColor];
- // categoryView.titleColor = HexColorFromRGB(0x9F9DA5);
- categoryView.titleColorGradientEnabled = YES;
- categoryView.titleFont = LCFont(14.0f);
- categoryView.titleSelectedFont = LCFont(14.0f);
- categoryView.cellWidth = 82.0f;
- categoryView.cellSpacing = 0.0f;
- categoryView.averageCellSpacingEnabled = NO;
- categoryView.normalBackgroundColor = [UIColor clearColor];
- // categoryView.selectedBackgroundColor = HexColorFromRGB(0x2A2935);
- categoryView.cellWidthIncrement = 0;
- categoryView.normalBorderColor = [UIColor clearColor];
- categoryView.selectedBorderColor = [UIColor clearColor];
- categoryView.borderLineWidth = 0;
- categoryView.backgroundCornerRadius = 0.0f;
- categoryView.backgroundWidth = JXCategoryViewAutomaticDimension;
- categoryView.backgroundHeight = 26.0f;
- categoryView.userInteractionEnabled = NO;
- // categoryView.layer.cornerRadius = 13.5f;
- // categoryView.clipsToBounds = YES;
- // categoryView.layer.borderColor = HexColorFromRGB(0x2A2935).CGColor;
- // categoryView.layer.borderWidth = 1.0f;
- [categoryBgV addSubview:categoryView];
- self.youpaipcategoryView = categoryView;
-
- //如果不想要下拉刷新的效果,改用JXPagerView类即可
- JXPagerListRefreshView *pagerView = [[JXPagerListRefreshView alloc] initWithDelegate:self listContainerType:JXPagerListContainerType_CollectionView];
- pagerView.pinSectionHeaderVerticalOffset = NavBarHeight;
- pagerView.frame = self.view.bounds;
- if (![self.youpaipuserId isEqual:[LCSaveModel getUserModel].youpaipuserinfo.youpaipuser_id]) {
- pagerView.mj_h -= self.youpaiptoolHeight;
- }
-
- pagerView.mainTableView.gestureDelegate = self;
- [self.view addSubview:pagerView];
- self.youpaippagerView = pagerView;
- categoryView.listContainer = (id<JXCategoryViewListContainer>)self.youpaippagerView.listContainerView;
-
-
-
- self.navigationItem.rightBarButtonItem = [UIBarButtonItem itemWithTarget:self action:@selector(youpaifmoreClick) image:[UIImage imageNamed:@"vqu_images_more2"]];
- self.navigationItem.leftBarButtonItem = [UIBarButtonItem itemWithTarget:self action:@selector(youpaifback) image:[UIImage imageNamed:@"vqu_images_IM_session_Back"]];
- UIView *headerMaskView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth, NavBarHeight)];
- [headerMaskView.layer addSublayer:[LCTools getGradientLayerWithSize:CGSizeMake(KScreenWidth, NavBarHeight) twoColors:@[[[UIColor blackColor] colorWithAlphaComponent:0.41f],[[UIColor blackColor] colorWithAlphaComponent:0.0f]] gradientType:GradientTopToBottom]];
- [self.view addSubview:headerMaskView];
- [headerMaskView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.top.offset(0.0f);
- make.size.mas_offset(CGSizeMake(KScreenWidth, NavBarHeight));
- }];
- if (![self.youpaipuserId isEqual:[LCSaveModel getUserModel].youpaipuserinfo.youpaipuser_id]) {
- [self youpaifsetBottomView];
- }
-
- }
- -(void)youpaifback{
- [self.navigationController popViewControllerAnimated:YES];
- }
- -(void)youpaifsetSelectShouHu{
- YOUPAILPGuardHerVC *VC= [[YOUPAILPGuardHerVC alloc]init];
- VC.youpaipdelegate = self;
- VC.youpaipuser_id = self.youpaipshowModel.youpaipuserid;
- VC.vWidth = KScreenWidth-54;
- VC.vHeight = ((KScreenWidth-54)*165)/321.0+261.5;
- VC.youpaipinfoModel = self.youpaipshowModel.youpaipguard;
- VC.isTouchDismiss = YES;
- if(VC.youpaipinfoModel!=nil)
- [self TFPresentVC:VC completion:^{
-
- }];
- }
- //守护成功
- -(void)youpaifaddGuardSuccess
- {
- [self youpaifinitData];
- }
- -(void)JumToGuardVCClick{
- YOUPAILPGuardBordeVC* userDynamic = [[YOUPAILPGuardBordeVC alloc]init];
- userDynamic.youpaipuser_id = self.youpaipshowModel.youpaipuserid;
- [self.navigationController pushViewController:userDynamic animated:YES];
-
- }
- #pragma mark-更多
- - (void)youpaifmoreClick{
-
- if ([self.youpaipuserId isEqual:[LCSaveModel getUserModel].youpaipuserinfo.youpaipuser_id]) {
- @weakify(self);
- ZCAlertAction *action = [ZCAlertAction actionWithTitle:@"编辑" andblock:^{//举报
- @strongify(self);
- MSYMineinfoEditVC * editvc = [MSYMineinfoEditVC new];
- [self.navigationController pushViewController:editvc animated:true];
- }];
- ZCAlertSheetView* alertSheet = [[ZCAlertSheetView alloc]initWithTitle:nil andShowCancelButton:YES andAction:@[action]];
- alertSheet.alertWindow.hidden = NO;
- [alertSheet show];
-
- }else{
- @weakify(self);
- ZCAlertAction *action = [ZCAlertAction actionWithTitle:@"举报" andblock:^{//举报
- @strongify(self);
- YOUPAILCReportVC* report = [[YOUPAILCReportVC alloc]init];
- report.youpaipreport_uid = self.youpaipshowModel.youpaipuserid;
- report.youpaiptype = 3;
- [self.navigationController pushViewController:report animated:YES];
- }];
-
- ZCAlertAction *action1 = [ZCAlertAction actionWithTitle:@"拉黑" andblock:^{//举报
- UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"提示" message:@"拉黑后,你将不再收到对方的消息,并且你们互相看不到对方的动态更新。可以在“设置-黑名单”中解除。" preferredStyle:UIAlertControllerStyleAlert];
- UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action){
-
- }];
- UIAlertAction *okAction = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action){
- @strongify(self);
- [LCCommonHttp blackUserId:self.youpaipuserId];
-
- }];
- [alertController addAction:cancelAction];
- [alertController addAction:okAction];
- [self presentViewController:alertController animated:YES completion:nil];
- }];
- ZCAlertSheetView* alertSheet = [[ZCAlertSheetView alloc]initWithTitle:nil andShowCancelButton:YES andAction:@[action,action1]];
- //modify by leo --fix bug ios13 20191009
- //alertSheet.alertWindow.rootViewController = self;
- alertSheet.alertWindow.hidden = NO;
- [alertSheet show];
- }
-
-
-
- }
- #pragma mark - JXPagerViewDelegate
- - (UIView *)tableHeaderViewInPagerView:(JXPagerView *)pagerView {
- return self.youpaipheaderView;
- }
- - (NSUInteger)tableHeaderViewHeightInPagerView:(JXPagerView *)pagerView {
- return self.youpaipheaderView.mj_h;
- }
- - (NSUInteger)heightForPinSectionHeaderInPagerView:(JXPagerView *)pagerView {
- return self.youpaipcategoryBgV.mj_h;
- }
- - (UIView *)viewForPinSectionHeaderInPagerView:(JXPagerView *)pagerView {
- return self.youpaipcategoryBgV;
- }
- - (NSInteger)numberOfListsInPagerView:(JXPagerView *)pagerView {
- return 1;
- }
- - (void)mainTableViewDidScroll:(UIScrollView *)scrollView{
- CGFloat alpha = scrollView.contentOffset.y / 414;
- UIImage *img = [UIImage imageWithColor:[LCWhiteColor colorWithAlphaComponent:alpha] size:CGSizeMake(KScreenWidth, NavBarHeight)];
- [self.navigationController.navigationBar setBackgroundImage:img forBarMetrics:(UIBarMetricsDefault)];
- if (@available(iOS 15.0, *)) {
- [self.navigationController.navigationBar.scrollEdgeAppearance setBackgroundImage:img];
- [self.navigationController.navigationBar.standardAppearance setBackgroundImage:img];
- }
- if (alpha >= 1) {
- UIImage *img = [UIImage imageWithColor:[LCWhiteColor colorWithAlphaComponent:alpha] size:CGSizeMake(KScreenWidth, NavBarHeight)];
- [self.navigationController.navigationBar setBackgroundImage:img forBarMetrics:(UIBarMetricsDefault)];
- if (@available(iOS 15.0, *)) {
- [self.navigationController.navigationBar.scrollEdgeAppearance setBackgroundImage:img];
- [self.navigationController.navigationBar.standardAppearance setBackgroundImage:img];
- }
- self.navigationItem.leftBarButtonItem = [UIBarButtonItem itemWithTarget:self action:@selector(youpaifback) image:[UIImage imageNamed:@"vqu_images_navigation_back_black"]];
- self.navigationItem.rightBarButtonItem = [UIBarButtonItem itemWithTarget:self action:@selector(youpaifmoreClick) image:[UIImage imageNamed:@"vqu_images_more_black"]];
- }else if (alpha<1){
- self.navigationItem.leftBarButtonItem = [UIBarButtonItem itemWithTarget:self action:@selector(youpaifback) image:[UIImage imageNamed:@"vqu_images_IM_session_Back"]];
- self.navigationController.navigationBar.tintColor = [UIColor whiteColor];
- self.navigationItem.rightBarButtonItem = [UIBarButtonItem itemWithTarget:self action:@selector(youpaifmoreClick) image:[UIImage imageNamed:@"vqu_images_more2"]];
- }
- }
- - (id<JXPagerViewListViewDelegate>)pagerView:(JXPagerView *)pagerView initListAtIndex:(NSInteger)index{
- YOUPAIZYUserZiLiaoVC *vc = [[YOUPAIZYUserZiLiaoVC alloc] init];
- vc.youpaipuserId = self.youpaipuserId;
-
- return vc;
- }
- - (void)youpaifinitData{
- [LCHttpHelper requestWithURLString:GetUserInfo parameters:@{@"user_id":self.youpaipuserId} needToken:YES type:(HttpRequestTypePost) success:^(id responseObject) {
- NSDictionary* dict = (NSDictionary*)responseObject;
- NSInteger code = [[dict objectForKey:@"code"] integerValue];
- if (code==0) {//成功
- self.youpaipshowModel = [YOUPAILCUserShowModel mj_objectWithKeyValues:[dict objectForKey:@"data"]];
- [self youpaifinitUI];
- }
- } failure:^(NSError *error) {
-
- }];
- }
- - (NSArray<NSString *> *)titles{
- return @[@"资料",@"视频"];
- }
- #pragma mark-bottomView的按钮事件(私信,视频,关注)
- //女神
- -(void)youpaifguanZhuBtnClick:(UIButton*)sender{//关注
-
- sender.selected = !sender.selected;
- [self youpaifsetNvShenGuanzhu];
-
-
-
- }
- -(void)youpaifsiXinBtnClick{//私信
- [self goChatPage];
- }
- - (void)goChatPage{
-
- if (![LCTools isGirlsRealNameAuthentication]) {
- return;
- }
- @weakify(self);
- // [LCHttpHelper requestWithURLString:IsChat parameters:@{@"user_id":self.youpaipshowModel.youpaipuserid} needToken:YES type:(HttpRequestTypePost) success:^(id responseObject) {
- // NSDictionary* dict = (NSDictionary*)responseObject;
- // NSInteger code = [[dict objectForKey:@"code"] integerValue];
- // if (code==0) {//成功
- // NSInteger is_chat = [[[dict objectForKey:@"data"] objectForKey:@"is_chat"] integerValue];
- // NSString *msg = [[dict objectForKey:@"data"] objectForKey:@"msg"];
- // @strongify(self);
- // if (is_chat == 0) { /// 0不可以 1可以私信
- // LZAlertAction *cancelAction = [LZAlertAction actionWithTitle:@"再想想" handler:^(LZAlertAction *action) {
- //
- // }];
- // cancelAction.cornerRadius = 5.0f;
- // cancelAction.color = LZ273145Color;
- // cancelAction.bgColor = LZF5F4F7Color;
- // LZAlertAction *confimAction = [LZAlertAction actionWithTitle:@"去充值" handler:^(LZAlertAction *action) {
- // @strongify(self);
- // YOUPAIHRRechargePayWindow *payWindow = [YOUPAIHRRechargePayWindow new];
- // payWindow.isTouchDismiss = NO;
- // [self.navigationController TFPresentVC:payWindow completion:^{
- //
- // }];
- // }];
- // confimAction.cornerRadius = 5.0f;
- // confimAction.color = [UIColor whiteColor];
- // confimAction.bgColor = [UIColor colorWithPatternImage:[LCTools ColorImage:CGSizeMake((KScreenWidth - 105.0f) / 2.0f, 48.0f) FromColors:@[LZBFB6FFColor,LZ7C69FEColor] ByGradientType:GradientLeftToRight]];
- // LZAlertWindow *alert = [LZAlertWindow alertWithTitle:@"提示" content:msg action:@[cancelAction,confimAction]];
- // alert.contentTextAlignment = NSTextAlignmentCenter;
- // [self TFPresentVC:alert completion:^{}];
- // }else{
- [UMengRecordTool umengEventCountWithId:InitiatePrivateChat];
- NIMSession *session = [NIMSession session:self.youpaipshowModel.youpaipuserid type:NIMSessionTypeP2P];
- if (session) {
- [ZCHUDHelper show];
- [[[NIMSDK sharedSDK] userManager] fetchUserInfos:@[session.sessionId] completion:^(NSArray<NIMUser *> * _Nullable users, NSError * _Nullable error) {
- @strongify(self);
- [ZCHUDHelper dismiss];
- YOUPAILCIMSessionVC *vc = [[YOUPAILCIMSessionVC alloc] initWithSession:session];
-
- [self.navigationController pushViewController:vc animated:YES];
- }];
- }
- // }
- // }
- // } failure:^(NSError *error) {
- // }];
- }
- -(void)youpaifvideoBtnClick{//视频
- if (self.youpaipshowModel.youpaipskill_list.count == 0) {
- [ZCHUDHelper showTitle:@"暂时无法视频通话"];
- return;
- }
- if ([YOUPAILZChatRoomManager shareManager].chatroomWindow != nil && [YOUPAILZChatRoomManager shareManager].chatroomWindow.hidden == NO) {
- [ZCHUDHelper showTitle:@"你正在房间中,暂不可拨打视频"];
- return;
- }
-
- [UMengRecordTool umengEventCountWithId:StartVideoPersonal];
- [UCAuthorityManager cameraAuthority:^{
- if ([LCSaveData getWhiteVersion]) {//1
- [LCHttpHelper requestWithURLString:UserShowPage parameters:@{@"user_id":self.youpaipuserId} needToken:YES type:(HttpRequestTypePost) success:^(id responseObject) {
- NSDictionary* dict = (NSDictionary*)responseObject;
-
- NSInteger code = [[dict objectForKey:@"code"] integerValue];
- if (code==0) {//成功
- NSDictionary *data = [dict objectForKey:@"data"];
- YOUPAILCUserShowInfo *info = [YOUPAILCUserShowInfo mj_objectWithKeyValues:[data objectForKey:@"info"]];
-
- YOUPAIBBVideoRequestVC* chatRequest = [[YOUPAIBBVideoRequestVC alloc]init];
- YOUPAILCVideoChatModel *videoModel = [[YOUPAILCVideoChatModel alloc] init];
- videoModel.youpaiproom_id = [NSString stringWithFormat:@"C%@",[LCTools randomNumberWithLength:6]];
- videoModel.youpaipauditState = 1;
- videoModel.youpaipfrom_uid = [LCSaveModel getUserModel].youpaipuserinfo.youpaipuser_id;
- videoModel.youpaipfrom_nickname = [LCSaveModel getUserModel].youpaipuserinfo.youpaipnickname;
- videoModel.youpaipfrom_avatar = [LCSaveModel getUserModel].youpaipuserinfo.youpaipavatar;
-
- videoModel.youpaipto_uid = self.youpaipuserId;
- videoModel.youpaipto_nickname = info.youpaipnickname;
- videoModel.youpaipto_avatar = info.youpaipavatar;
- chatRequest.youpaipvideoModel = videoModel;
- ZCBaseNavigationVC *nav = [[ZCBaseNavigationVC alloc]initWithRootViewController:chatRequest];
- //modify by leo fix bug ios13
- nav.modalPresentationStyle =0;
- [self.navigationController presentViewController:nav animated:YES completion:^{
- }];
-
- }
- } failure:^(NSError *error) {
-
- }];
- }else{//0
- [LCHttpHelper requestWithURLString:CallChatType parameters:@{@"to_uid":self.youpaipshowModel.youpaipuserid,@"skill_id":@(self.youpaipshowModel.youpaipskill_list[0].youpaipskill_id),@"type":@"0"} needToken:YES type:(HttpRequestTypePost) success:^(id responseObject) {
- NSDictionary* dict = (NSDictionary*)responseObject;
- NSInteger code = [[dict objectForKey:@"code"] integerValue];
- if (code==0) {//成功
- YOUPAILCVideoChatModel* videoModel = [YOUPAILCVideoChatModel mj_objectWithKeyValues:[dict objectForKey:@"data"]];
- [[YOUPAILZChatRoomManager shareManager] youpaifcloseChatRoom];
- [[NSNotificationCenter defaultCenter] postNotificationName:@"MeCallVideo" object:nil userInfo:nil];
- dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.0f * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
-
- YOUPAILCVideoRequestVC* chatRequest = [[YOUPAILCVideoRequestVC alloc]init];
- chatRequest.youpaipvideoModel = videoModel;
- //modify by leo fix bug ios13
- ZCBaseNavigationVC *nav = [[ZCBaseNavigationVC alloc]initWithRootViewController:chatRequest];
- chatRequest.definesPresentationContext = YES;
- nav.modalPresentationStyle = UIModalPresentationOverCurrentContext&UIModalPresentationOverFullScreen;
- chatRequest.view.backgroundColor=HexColorFromRGBA(0x000000, 0.55);
- [self.navigationController presentViewController:nav animated:YES completion:^{
- // chatRequest.view.backgroundColor=HexColorFromRGBA(0x000000, 0.55);
- }];
- });
- }
- } failure:^(NSError *error) {
-
-
- }];
- }
-
-
-
-
-
-
-
-
- } denied:^{
-
- dispatch_async(dispatch_get_main_queue(), ^{
- UIAlertController *systemAlert = [UIAlertController alertControllerWithTitle:@"请在iphone的“设置-隐私-相机”选项中,允许APP访问您的相机。" message:nil preferredStyle:UIAlertControllerStyleAlert];
- UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"现在去设置" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action){
- if ([[UIDevice currentDevice].systemVersion floatValue] < 10.0)
- {
- [[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]];
-
- }
- else
- {
- // 去系统设置页面
- if (@available(iOS 10.0, *)) {
- [[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString] options:@{} completionHandler:nil];
- } else {
- // Fallback on earlier versions
- }
- }
- }];
- UIAlertAction *action = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:nil];
- [systemAlert addAction:cancelAction];
- [systemAlert addAction:action];
- [self presentViewController: systemAlert animated: YES completion: nil];
- });
-
- }];
- }
- //==其他//
- -(void)youpaifotherSiXinBtnClick{//私信
- [self goChatPage];
- }
- //设置女神关注
- -(void)youpaifsetNvShenGuanzhu{
- [LCCommonHttp followUserId:self.youpaipshowModel.youpaipuserid];
-
- }
- @end
|