YOUPAILZUserShowVC.m 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638
  1. //
  2. // YOUPAILZUserShowVC.m
  3. // VQU
  4. //
  5. // Created by CY on 2021/7/10.
  6. // Copyright © 2021 leo. All rights reserved.
  7. //
  8. #import "YOUPAILZUserShowVC.h"
  9. #import "JXCategoryView.h"
  10. #import "YOUPAIJXCategoryTitleBackgroundView.h"
  11. #import "JXPagerListRefreshView.h"
  12. #import "YOUPAILZPersonalVideoVC.h"
  13. #import "YOUPAIZYUserZiLiaoVC.h"
  14. #import "YOUPAILCUserShowModel.h"
  15. #import "YOUPAILZUserShowHeaderView.h"
  16. #import "MSYMineinfoEditVC.h"
  17. #import "YOUPAILCReportVC.h"
  18. #import "YOUPAILCIMSessionVC.h"
  19. #import "LZAlertWindow.h"
  20. #import "YOUPAIHRRechargePayWindow.h"
  21. #import "UIViewController+TFPresent.h"
  22. #import "YOUPAILPGuardHerVC.h"
  23. #import "YOUPAILPGuardBordeVC.h"
  24. #import "YOUPAIBBVideoRequestVC.h"
  25. @interface YOUPAILZUserShowVC () <JXCategoryViewDelegate,JXPagerViewDelegate,JXPagerMainTableViewGestureDelegate,LPGuardHerDelegate>
  26. @property (nonatomic, strong) YOUPAILZUserShowHeaderView *youpaipheaderView;
  27. @property (nonatomic, strong) JXPagerListRefreshView *youpaippagerView;
  28. @property (nonatomic, strong) JXCategoryTitleView *youpaipcategoryView;
  29. @property (nonatomic, strong) UIView *youpaipcategoryBgV;
  30. @property (nonatomic, strong) YOUPAILCUserShowModel* youpaipshowModel;
  31. @property (nonatomic, weak) UILabel *youpaipavatarCountL;
  32. @property(nonatomic,assign)CGFloat youpaiptoolHeight;//底部tool的高度
  33. /* 视频 */
  34. @property (strong, nonatomic) UIButton *videoBtn;
  35. /* 私信 */
  36. @property (strong, nonatomic) UIButton *siXinBtn;
  37. @property (strong, nonatomic) UIButton *heartbeatBtn;
  38. @end
  39. @implementation YOUPAILZUserShowVC
  40. - (void)viewWillAppear:(BOOL)animated{
  41. [super viewWillAppear:animated];
  42. self.navigationController.navigationBar.translucent = YES;
  43. UIImage *img = [UIImage imageWithColor:[LCBkgColor colorWithAlphaComponent:0.0f] size:CGSizeMake(KScreenWidth, NavBarHeight)];
  44. [self.navigationController.navigationBar setBackgroundImage:img forBarMetrics:(UIBarMetricsDefault)];
  45. [self.navigationController.navigationBar setBackgroundColor:[LCBkgColor colorWithAlphaComponent:0.0f]];
  46. if (@available(iOS 15.0, *)) {
  47. [self.navigationController.navigationBar.scrollEdgeAppearance setBackgroundColor:[LCBkgColor colorWithAlphaComponent:0.0f]];
  48. [self.navigationController.navigationBar.scrollEdgeAppearance setBackgroundImage:img];
  49. [self.navigationController.navigationBar.standardAppearance setBackgroundColor:[LCBkgColor colorWithAlphaComponent:0.0f]];
  50. [self.navigationController.navigationBar.standardAppearance setBackgroundImage:img];
  51. }
  52. }
  53. - (void)viewWillDisappear:(BOOL)animated{
  54. [super viewWillDisappear:animated];
  55. UIImage *img = [UIImage imageWithColor:LCWhiteColor size:CGSizeMake(KScreenWidth, NavBarHeight)];
  56. [self.navigationController.navigationBar setBackgroundImage:img forBarMetrics:UIBarMetricsDefault];
  57. [self.navigationController.navigationBar setBackgroundColor:LCWhiteColor];
  58. if (@available(iOS 15.0, *)) {
  59. [self.navigationController.navigationBar.scrollEdgeAppearance setBackgroundColor:LCWhiteColor];
  60. [self.navigationController.navigationBar.scrollEdgeAppearance setBackgroundImage:img];
  61. [self.navigationController.navigationBar.standardAppearance setBackgroundColor:LCWhiteColor];
  62. [self.navigationController.navigationBar.standardAppearance setBackgroundImage:img];
  63. }
  64. self.navigationController.navigationBar.translucent = NO;
  65. }
  66. - (void)viewDidDisappear:(BOOL)animated{
  67. [super viewDidDisappear:animated];
  68. // [self.youpaipheaderView youpaifstopPlay];
  69. }
  70. - (void)viewDidLoad {
  71. [super viewDidLoad];
  72. [UMengRecordTool umengEventCountWithId:EnterPersonalCenter];
  73. self.youpaiptoolHeight = 74+SafeHeight;
  74. [self youpaifinitData];
  75. }
  76. -(void)youpaifsetBottomView{
  77. UIView *bottomView = [[UIView alloc]init];
  78. [self.view addSubview:bottomView];
  79. [bottomView mas_makeConstraints:^(MASConstraintMaker *make) {
  80. make.left.mas_equalTo(0);
  81. make.right.mas_equalTo(0);
  82. make.height.mas_equalTo(self.youpaiptoolHeight);
  83. make.bottom.mas_equalTo(0);
  84. }];
  85. // [self.view bringSubviewToFront:bottomView];
  86. bottomView.backgroundColor = LCWhiteColor;
  87. UIView *bgView = [UIView new];
  88. [bottomView addSubview:bgView];
  89. [bgView mas_makeConstraints:^(MASConstraintMaker *make) {
  90. make.left.mas_equalTo(0);
  91. make.right.mas_equalTo(0);
  92. make.height.mas_equalTo(self.youpaiptoolHeight);
  93. make.top.mas_equalTo(0);
  94. }];
  95. //视频
  96. UIButton *videoBtn = [UIButton new];
  97. self.videoBtn = videoBtn;
  98. [bgView addSubview:videoBtn];
  99. [videoBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  100. make.left.mas_equalTo(14);
  101. make.top.mas_equalTo(0);
  102. make.size.mas_equalTo(CGSizeMake(74, 74));
  103. }];
  104. [videoBtn setBackgroundImage:[UIImage imageNamed:@"vqu_images_P_user_Video"] forState:UIControlStateNormal];
  105. //私信
  106. UIButton *siXinBtn = [UIButton new];
  107. self.siXinBtn = siXinBtn;
  108. [bgView addSubview:siXinBtn];
  109. [siXinBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  110. make.left.mas_equalTo(videoBtn.mas_right).offset(0);
  111. make.top.mas_equalTo(0);
  112. make.size.mas_equalTo(CGSizeMake(74, 74));
  113. }];
  114. [siXinBtn setBackgroundImage:[UIImage imageNamed:@"vqu_images_P_user_SiXin"] forState:UIControlStateNormal];
  115. //心动
  116. UIButton *heartbeatBtn = [UIButton new];
  117. self.heartbeatBtn = heartbeatBtn;
  118. [bgView addSubview:heartbeatBtn];
  119. [heartbeatBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  120. make.left.mas_equalTo(siXinBtn.mas_right).offset(1);
  121. make.top.mas_equalTo(0);
  122. make.right.offset(-20);
  123. make.height.offset(74);
  124. }];
  125. [heartbeatBtn addTarget:self action:@selector(heartbeatBtnClick:) forControlEvents:UIControlEventTouchUpInside];
  126. YOUPAILCUserModel *user = [LCSaveModel getUserModel];
  127. if (user.youpaipuserinfo.youpaipgender == 1) {
  128. [heartbeatBtn setBackgroundImage:[UIImage imageNamed:@"vqu_images_P_user_heartBeat"] forState:UIControlStateNormal];
  129. }else{
  130. [heartbeatBtn setBackgroundImage:[UIImage imageNamed:@"vqu_images_P_user_heartBeat_1"] forState:UIControlStateNormal];
  131. }
  132. if(self.youpaipshowModel.youpaipis_beckon){
  133. self.heartbeatBtn.hidden = YES;
  134. [self.siXinBtn mas_updateConstraints:^(MASConstraintMaker *make) {
  135. make.width.mas_equalTo(ScaleSize(258));
  136. }];
  137. [self.siXinBtn setBackgroundImage:[UIImage imageNamed:@"vqu_images_P_user_SiXin_big"] forState:UIControlStateNormal];
  138. }else{
  139. self.heartbeatBtn.hidden = NO;
  140. }
  141. //按钮事件
  142. [siXinBtn addTarget:self action:@selector(youpaifsiXinBtnClick) forControlEvents:UIControlEventTouchUpInside];
  143. [videoBtn addTarget:self action:@selector(youpaifvideoBtnClick) forControlEvents:UIControlEventTouchUpInside];
  144. //
  145. // }
  146. }
  147. -(void)heartbeatBtnClick:(UIButton*)sender{
  148. sender.hidden = YES;
  149. if (![LCTools isGirlsRealNameAuthentication]) {
  150. return;
  151. }
  152. if(self.youpaipshowModel.youpaipis_beckon){//心动 true 已心动过,false 未心动过
  153. @weakify(self);
  154. //
  155. NIMSession *session = [NIMSession session:self.youpaipshowModel.youpaipuserid type:NIMSessionTypeP2P];
  156. if (session) {
  157. [ZCHUDHelper show];
  158. [[[NIMSDK sharedSDK] userManager] fetchUserInfos:@[session.sessionId] completion:^(NSArray<NIMUser *> * _Nullable users, NSError * _Nullable error) {
  159. @strongify(self);
  160. [ZCHUDHelper dismiss];
  161. YOUPAILCIMSessionVC *vc = [[YOUPAILCIMSessionVC alloc] initWithSession:session];
  162. [self.navigationController pushViewController:vc animated:YES];
  163. }];
  164. }
  165. }else{
  166. [UMengRecordTool umengEventCountWithId:ClickToChatPersonal];//友盟个人中心点击搭讪
  167. NSMutableDictionary *mutdict = [NSMutableDictionary new];
  168. NSString *str = [NSString stringWithFormat:@"[%@]",self.youpaipshowModel.youpaipuserid];
  169. [mutdict setObject:str forKey:@"user_ids"];
  170. [LCHttpHelper requestWithURLString:HomeBeckonSend parameters:mutdict needToken:YES type:(HttpRequestTypePost) success:^(id responseObject) {
  171. NSDictionary* dict = (NSDictionary*)responseObject;
  172. NSDictionary* dict1 = dict[@"data"];
  173. NSInteger code = [[dict objectForKey:@"code"] integerValue];
  174. if (code==0) {//成功
  175. if (dict1[@"boole"]) {
  176. self.youpaipshowModel.youpaipis_beckon = YES;
  177. if(self.youpaipshowModel.youpaipis_beckon){
  178. self.heartbeatBtn.hidden = YES;
  179. [self.siXinBtn mas_updateConstraints:^(MASConstraintMaker *make) {
  180. make.width.mas_equalTo(ScaleSize(258));
  181. }];
  182. [self.siXinBtn setBackgroundImage:[UIImage imageNamed:@"vqu_images_P_user_SiXin_big"] forState:UIControlStateNormal];
  183. }else{
  184. self.heartbeatBtn.hidden = NO;
  185. }
  186. }
  187. }else{
  188. [ZCHUDHelper showTitle:[dict objectForKey:@"message"]];
  189. }
  190. } failure:^(NSError *error) {
  191. }];
  192. }
  193. [self.siXinBtn mas_updateConstraints:^(MASConstraintMaker *make) {
  194. make.width.mas_equalTo(ScaleSize(258));
  195. }];
  196. [self.siXinBtn setBackgroundImage:[UIImage imageNamed:@"vqu_images_P_user_SiXin_big"] forState:UIControlStateNormal];
  197. }
  198. - (void)youpaifinitUI{
  199. YOUPAILZUserShowHeaderView *headerView = [[YOUPAILZUserShowHeaderView alloc] initWithModel:self.youpaipshowModel];
  200. headerView.backgroundColor = [UIColor whiteColor];
  201. self.youpaipheaderView = headerView;
  202. @weakify(self)
  203. //点击守护
  204. [headerView setYoupaipdidClickSh:^{
  205. @strongify(self)
  206. [self youpaifsetSelectShouHu];
  207. }];
  208. //跳转守护界面
  209. [headerView setJumToGuardVCClick:^{
  210. @strongify(self)
  211. [self JumToGuardVCClick];
  212. }];
  213. UIView *categoryBgV = [[UIView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, KScreenWidth, 1.0f)];
  214. categoryBgV.backgroundColor = [UIColor clearColor];
  215. self.youpaipcategoryBgV = categoryBgV;
  216. YOUPAIJXCategoryTitleBackgroundView *categoryView = [[YOUPAIJXCategoryTitleBackgroundView alloc] initWithFrame:CGRectMake((categoryBgV.mj_w - 164.0f) / 2.0f, (categoryBgV.mj_h - 27.0f) / 2.0f, 164.0f, 1.0f)];
  217. categoryView.backgroundColor = [UIColor clearColor];
  218. // categoryView.titles = self.titles;
  219. categoryView.delegate = self;
  220. categoryView.titleSelectedColor = [UIColor whiteColor];
  221. // categoryView.titleColor = HexColorFromRGB(0x9F9DA5);
  222. categoryView.titleColorGradientEnabled = YES;
  223. categoryView.titleFont = LCFont(14.0f);
  224. categoryView.titleSelectedFont = LCFont(14.0f);
  225. categoryView.cellWidth = 82.0f;
  226. categoryView.cellSpacing = 0.0f;
  227. categoryView.averageCellSpacingEnabled = NO;
  228. categoryView.normalBackgroundColor = [UIColor clearColor];
  229. // categoryView.selectedBackgroundColor = HexColorFromRGB(0x2A2935);
  230. categoryView.cellWidthIncrement = 0;
  231. categoryView.normalBorderColor = [UIColor clearColor];
  232. categoryView.selectedBorderColor = [UIColor clearColor];
  233. categoryView.borderLineWidth = 0;
  234. categoryView.backgroundCornerRadius = 0.0f;
  235. categoryView.backgroundWidth = JXCategoryViewAutomaticDimension;
  236. categoryView.backgroundHeight = 26.0f;
  237. categoryView.userInteractionEnabled = NO;
  238. // categoryView.layer.cornerRadius = 13.5f;
  239. // categoryView.clipsToBounds = YES;
  240. // categoryView.layer.borderColor = HexColorFromRGB(0x2A2935).CGColor;
  241. // categoryView.layer.borderWidth = 1.0f;
  242. [categoryBgV addSubview:categoryView];
  243. self.youpaipcategoryView = categoryView;
  244. //如果不想要下拉刷新的效果,改用JXPagerView类即可
  245. JXPagerListRefreshView *pagerView = [[JXPagerListRefreshView alloc] initWithDelegate:self listContainerType:JXPagerListContainerType_CollectionView];
  246. pagerView.pinSectionHeaderVerticalOffset = NavBarHeight;
  247. pagerView.frame = self.view.bounds;
  248. if (![self.youpaipuserId isEqual:[LCSaveModel getUserModel].youpaipuserinfo.youpaipuser_id]) {
  249. pagerView.mj_h -= self.youpaiptoolHeight;
  250. }
  251. pagerView.mainTableView.gestureDelegate = self;
  252. [self.view addSubview:pagerView];
  253. self.youpaippagerView = pagerView;
  254. categoryView.listContainer = (id<JXCategoryViewListContainer>)self.youpaippagerView.listContainerView;
  255. self.navigationItem.rightBarButtonItem = [UIBarButtonItem itemWithTarget:self action:@selector(youpaifmoreClick) image:[UIImage imageNamed:@"vqu_images_more2"]];
  256. self.navigationItem.leftBarButtonItem = [UIBarButtonItem itemWithTarget:self action:@selector(youpaifback) image:[UIImage imageNamed:@"vqu_images_IM_session_Back"]];
  257. UIView *headerMaskView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth, NavBarHeight)];
  258. [headerMaskView.layer addSublayer:[LCTools getGradientLayerWithSize:CGSizeMake(KScreenWidth, NavBarHeight) twoColors:@[[[UIColor blackColor] colorWithAlphaComponent:0.41f],[[UIColor blackColor] colorWithAlphaComponent:0.0f]] gradientType:GradientTopToBottom]];
  259. [self.view addSubview:headerMaskView];
  260. [headerMaskView mas_makeConstraints:^(MASConstraintMaker *make) {
  261. make.left.top.offset(0.0f);
  262. make.size.mas_offset(CGSizeMake(KScreenWidth, NavBarHeight));
  263. }];
  264. if (![self.youpaipuserId isEqual:[LCSaveModel getUserModel].youpaipuserinfo.youpaipuser_id]) {
  265. [self youpaifsetBottomView];
  266. }
  267. }
  268. -(void)youpaifback{
  269. [self.navigationController popViewControllerAnimated:YES];
  270. }
  271. -(void)youpaifsetSelectShouHu{
  272. YOUPAILPGuardHerVC *VC= [[YOUPAILPGuardHerVC alloc]init];
  273. VC.youpaipdelegate = self;
  274. VC.youpaipuser_id = self.youpaipshowModel.youpaipuserid;
  275. VC.vWidth = KScreenWidth-54;
  276. VC.vHeight = ((KScreenWidth-54)*165)/321.0+261.5;
  277. VC.youpaipinfoModel = self.youpaipshowModel.youpaipguard;
  278. VC.isTouchDismiss = YES;
  279. if(VC.youpaipinfoModel!=nil)
  280. [self TFPresentVC:VC completion:^{
  281. }];
  282. }
  283. //守护成功
  284. -(void)youpaifaddGuardSuccess
  285. {
  286. [self youpaifinitData];
  287. }
  288. -(void)JumToGuardVCClick{
  289. YOUPAILPGuardBordeVC* userDynamic = [[YOUPAILPGuardBordeVC alloc]init];
  290. userDynamic.youpaipuser_id = self.youpaipshowModel.youpaipuserid;
  291. [self.navigationController pushViewController:userDynamic animated:YES];
  292. }
  293. #pragma mark-更多
  294. - (void)youpaifmoreClick{
  295. if ([self.youpaipuserId isEqual:[LCSaveModel getUserModel].youpaipuserinfo.youpaipuser_id]) {
  296. @weakify(self);
  297. ZCAlertAction *action = [ZCAlertAction actionWithTitle:@"编辑" andblock:^{//举报
  298. @strongify(self);
  299. MSYMineinfoEditVC * editvc = [MSYMineinfoEditVC new];
  300. [self.navigationController pushViewController:editvc animated:true];
  301. }];
  302. ZCAlertSheetView* alertSheet = [[ZCAlertSheetView alloc]initWithTitle:nil andShowCancelButton:YES andAction:@[action]];
  303. alertSheet.alertWindow.hidden = NO;
  304. [alertSheet show];
  305. }else{
  306. @weakify(self);
  307. ZCAlertAction *action = [ZCAlertAction actionWithTitle:@"举报" andblock:^{//举报
  308. @strongify(self);
  309. YOUPAILCReportVC* report = [[YOUPAILCReportVC alloc]init];
  310. report.youpaipreport_uid = self.youpaipshowModel.youpaipuserid;
  311. report.youpaiptype = 3;
  312. [self.navigationController pushViewController:report animated:YES];
  313. }];
  314. ZCAlertAction *action1 = [ZCAlertAction actionWithTitle:@"拉黑" andblock:^{//举报
  315. UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"提示" message:@"拉黑后,你将不再收到对方的消息,并且你们互相看不到对方的动态更新。可以在“设置-黑名单”中解除。" preferredStyle:UIAlertControllerStyleAlert];
  316. UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action){
  317. }];
  318. UIAlertAction *okAction = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action){
  319. @strongify(self);
  320. [LCCommonHttp blackUserId:self.youpaipuserId];
  321. }];
  322. [alertController addAction:cancelAction];
  323. [alertController addAction:okAction];
  324. [self presentViewController:alertController animated:YES completion:nil];
  325. }];
  326. ZCAlertSheetView* alertSheet = [[ZCAlertSheetView alloc]initWithTitle:nil andShowCancelButton:YES andAction:@[action,action1]];
  327. //modify by leo --fix bug ios13 20191009
  328. //alertSheet.alertWindow.rootViewController = self;
  329. alertSheet.alertWindow.hidden = NO;
  330. [alertSheet show];
  331. }
  332. }
  333. #pragma mark - JXPagerViewDelegate
  334. - (UIView *)tableHeaderViewInPagerView:(JXPagerView *)pagerView {
  335. return self.youpaipheaderView;
  336. }
  337. - (NSUInteger)tableHeaderViewHeightInPagerView:(JXPagerView *)pagerView {
  338. return self.youpaipheaderView.mj_h;
  339. }
  340. - (NSUInteger)heightForPinSectionHeaderInPagerView:(JXPagerView *)pagerView {
  341. return self.youpaipcategoryBgV.mj_h;
  342. }
  343. - (UIView *)viewForPinSectionHeaderInPagerView:(JXPagerView *)pagerView {
  344. return self.youpaipcategoryBgV;
  345. }
  346. - (NSInteger)numberOfListsInPagerView:(JXPagerView *)pagerView {
  347. return 1;
  348. }
  349. - (void)mainTableViewDidScroll:(UIScrollView *)scrollView{
  350. CGFloat alpha = scrollView.contentOffset.y / 414;
  351. UIImage *img = [UIImage imageWithColor:[LCWhiteColor colorWithAlphaComponent:alpha] size:CGSizeMake(KScreenWidth, NavBarHeight)];
  352. [self.navigationController.navigationBar setBackgroundImage:img forBarMetrics:(UIBarMetricsDefault)];
  353. if (@available(iOS 15.0, *)) {
  354. [self.navigationController.navigationBar.scrollEdgeAppearance setBackgroundImage:img];
  355. [self.navigationController.navigationBar.standardAppearance setBackgroundImage:img];
  356. }
  357. if (alpha >= 1) {
  358. UIImage *img = [UIImage imageWithColor:[LCWhiteColor colorWithAlphaComponent:alpha] size:CGSizeMake(KScreenWidth, NavBarHeight)];
  359. [self.navigationController.navigationBar setBackgroundImage:img forBarMetrics:(UIBarMetricsDefault)];
  360. if (@available(iOS 15.0, *)) {
  361. [self.navigationController.navigationBar.scrollEdgeAppearance setBackgroundImage:img];
  362. [self.navigationController.navigationBar.standardAppearance setBackgroundImage:img];
  363. }
  364. self.navigationItem.leftBarButtonItem = [UIBarButtonItem itemWithTarget:self action:@selector(youpaifback) image:[UIImage imageNamed:@"vqu_images_navigation_back_black"]];
  365. self.navigationItem.rightBarButtonItem = [UIBarButtonItem itemWithTarget:self action:@selector(youpaifmoreClick) image:[UIImage imageNamed:@"vqu_images_more_black"]];
  366. }else if (alpha<1){
  367. self.navigationItem.leftBarButtonItem = [UIBarButtonItem itemWithTarget:self action:@selector(youpaifback) image:[UIImage imageNamed:@"vqu_images_IM_session_Back"]];
  368. self.navigationController.navigationBar.tintColor = [UIColor whiteColor];
  369. self.navigationItem.rightBarButtonItem = [UIBarButtonItem itemWithTarget:self action:@selector(youpaifmoreClick) image:[UIImage imageNamed:@"vqu_images_more2"]];
  370. }
  371. }
  372. - (id<JXPagerViewListViewDelegate>)pagerView:(JXPagerView *)pagerView initListAtIndex:(NSInteger)index{
  373. YOUPAIZYUserZiLiaoVC *vc = [[YOUPAIZYUserZiLiaoVC alloc] init];
  374. vc.youpaipuserId = self.youpaipuserId;
  375. return vc;
  376. }
  377. - (void)youpaifinitData{
  378. [LCHttpHelper requestWithURLString:GetUserInfo parameters:@{@"user_id":self.youpaipuserId} needToken:YES type:(HttpRequestTypePost) success:^(id responseObject) {
  379. NSDictionary* dict = (NSDictionary*)responseObject;
  380. NSInteger code = [[dict objectForKey:@"code"] integerValue];
  381. if (code==0) {//成功
  382. self.youpaipshowModel = [YOUPAILCUserShowModel mj_objectWithKeyValues:[dict objectForKey:@"data"]];
  383. [self youpaifinitUI];
  384. }
  385. } failure:^(NSError *error) {
  386. }];
  387. }
  388. - (NSArray<NSString *> *)titles{
  389. return @[@"资料",@"视频"];
  390. }
  391. #pragma mark-bottomView的按钮事件(私信,视频,关注)
  392. //女神
  393. -(void)youpaifguanZhuBtnClick:(UIButton*)sender{//关注
  394. sender.selected = !sender.selected;
  395. [self youpaifsetNvShenGuanzhu];
  396. }
  397. -(void)youpaifsiXinBtnClick{//私信
  398. [self goChatPage];
  399. }
  400. - (void)goChatPage{
  401. if (![LCTools isGirlsRealNameAuthentication]) {
  402. return;
  403. }
  404. @weakify(self);
  405. // [LCHttpHelper requestWithURLString:IsChat parameters:@{@"user_id":self.youpaipshowModel.youpaipuserid} needToken:YES type:(HttpRequestTypePost) success:^(id responseObject) {
  406. // NSDictionary* dict = (NSDictionary*)responseObject;
  407. // NSInteger code = [[dict objectForKey:@"code"] integerValue];
  408. // if (code==0) {//成功
  409. // NSInteger is_chat = [[[dict objectForKey:@"data"] objectForKey:@"is_chat"] integerValue];
  410. // NSString *msg = [[dict objectForKey:@"data"] objectForKey:@"msg"];
  411. // @strongify(self);
  412. // if (is_chat == 0) { /// 0不可以 1可以私信
  413. // LZAlertAction *cancelAction = [LZAlertAction actionWithTitle:@"再想想" handler:^(LZAlertAction *action) {
  414. //
  415. // }];
  416. // cancelAction.cornerRadius = 5.0f;
  417. // cancelAction.color = LZ273145Color;
  418. // cancelAction.bgColor = LZF5F4F7Color;
  419. // LZAlertAction *confimAction = [LZAlertAction actionWithTitle:@"去充值" handler:^(LZAlertAction *action) {
  420. // @strongify(self);
  421. // YOUPAIHRRechargePayWindow *payWindow = [YOUPAIHRRechargePayWindow new];
  422. // payWindow.isTouchDismiss = NO;
  423. // [self.navigationController TFPresentVC:payWindow completion:^{
  424. //
  425. // }];
  426. // }];
  427. // confimAction.cornerRadius = 5.0f;
  428. // confimAction.color = [UIColor whiteColor];
  429. // confimAction.bgColor = [UIColor colorWithPatternImage:[LCTools ColorImage:CGSizeMake((KScreenWidth - 105.0f) / 2.0f, 48.0f) FromColors:@[LZBFB6FFColor,LZ7C69FEColor] ByGradientType:GradientLeftToRight]];
  430. // LZAlertWindow *alert = [LZAlertWindow alertWithTitle:@"提示" content:msg action:@[cancelAction,confimAction]];
  431. // alert.contentTextAlignment = NSTextAlignmentCenter;
  432. // [self TFPresentVC:alert completion:^{}];
  433. // }else{
  434. [UMengRecordTool umengEventCountWithId:InitiatePrivateChat];
  435. NIMSession *session = [NIMSession session:self.youpaipshowModel.youpaipuserid type:NIMSessionTypeP2P];
  436. if (session) {
  437. [ZCHUDHelper show];
  438. [[[NIMSDK sharedSDK] userManager] fetchUserInfos:@[session.sessionId] completion:^(NSArray<NIMUser *> * _Nullable users, NSError * _Nullable error) {
  439. @strongify(self);
  440. [ZCHUDHelper dismiss];
  441. YOUPAILCIMSessionVC *vc = [[YOUPAILCIMSessionVC alloc] initWithSession:session];
  442. [self.navigationController pushViewController:vc animated:YES];
  443. }];
  444. }
  445. // }
  446. // }
  447. // } failure:^(NSError *error) {
  448. // }];
  449. }
  450. -(void)youpaifvideoBtnClick{//视频
  451. if (self.youpaipshowModel.youpaipskill_list.count == 0) {
  452. [ZCHUDHelper showTitle:@"暂时无法视频通话"];
  453. return;
  454. }
  455. if ([YOUPAILZChatRoomManager shareManager].chatroomWindow != nil && [YOUPAILZChatRoomManager shareManager].chatroomWindow.hidden == NO) {
  456. [ZCHUDHelper showTitle:@"你正在房间中,暂不可拨打视频"];
  457. return;
  458. }
  459. [UMengRecordTool umengEventCountWithId:StartVideoPersonal];
  460. [UCAuthorityManager cameraAuthority:^{
  461. if ([LCSaveData getWhiteVersion]) {//1
  462. [LCHttpHelper requestWithURLString:UserShowPage parameters:@{@"user_id":self.youpaipuserId} needToken:YES type:(HttpRequestTypePost) success:^(id responseObject) {
  463. NSDictionary* dict = (NSDictionary*)responseObject;
  464. NSInteger code = [[dict objectForKey:@"code"] integerValue];
  465. if (code==0) {//成功
  466. NSDictionary *data = [dict objectForKey:@"data"];
  467. YOUPAILCUserShowInfo *info = [YOUPAILCUserShowInfo mj_objectWithKeyValues:[data objectForKey:@"info"]];
  468. YOUPAIBBVideoRequestVC* chatRequest = [[YOUPAIBBVideoRequestVC alloc]init];
  469. YOUPAILCVideoChatModel *videoModel = [[YOUPAILCVideoChatModel alloc] init];
  470. videoModel.youpaiproom_id = [NSString stringWithFormat:@"C%@",[LCTools randomNumberWithLength:6]];
  471. videoModel.youpaipauditState = 1;
  472. videoModel.youpaipfrom_uid = [LCSaveModel getUserModel].youpaipuserinfo.youpaipuser_id;
  473. videoModel.youpaipfrom_nickname = [LCSaveModel getUserModel].youpaipuserinfo.youpaipnickname;
  474. videoModel.youpaipfrom_avatar = [LCSaveModel getUserModel].youpaipuserinfo.youpaipavatar;
  475. videoModel.youpaipto_uid = self.youpaipuserId;
  476. videoModel.youpaipto_nickname = info.youpaipnickname;
  477. videoModel.youpaipto_avatar = info.youpaipavatar;
  478. chatRequest.youpaipvideoModel = videoModel;
  479. ZCBaseNavigationVC *nav = [[ZCBaseNavigationVC alloc]initWithRootViewController:chatRequest];
  480. //modify by leo fix bug ios13
  481. nav.modalPresentationStyle =0;
  482. [self.navigationController presentViewController:nav animated:YES completion:^{
  483. }];
  484. }
  485. } failure:^(NSError *error) {
  486. }];
  487. }else{//0
  488. [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) {
  489. NSDictionary* dict = (NSDictionary*)responseObject;
  490. NSInteger code = [[dict objectForKey:@"code"] integerValue];
  491. if (code==0) {//成功
  492. YOUPAILCVideoChatModel* videoModel = [YOUPAILCVideoChatModel mj_objectWithKeyValues:[dict objectForKey:@"data"]];
  493. [[YOUPAILZChatRoomManager shareManager] youpaifcloseChatRoom];
  494. [[NSNotificationCenter defaultCenter] postNotificationName:@"MeCallVideo" object:nil userInfo:nil];
  495. dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.0f * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
  496. YOUPAILCVideoRequestVC* chatRequest = [[YOUPAILCVideoRequestVC alloc]init];
  497. chatRequest.youpaipvideoModel = videoModel;
  498. //modify by leo fix bug ios13
  499. ZCBaseNavigationVC *nav = [[ZCBaseNavigationVC alloc]initWithRootViewController:chatRequest];
  500. chatRequest.definesPresentationContext = YES;
  501. nav.modalPresentationStyle = UIModalPresentationOverCurrentContext&UIModalPresentationOverFullScreen;
  502. chatRequest.view.backgroundColor=HexColorFromRGBA(0x000000, 0.55);
  503. [self.navigationController presentViewController:nav animated:YES completion:^{
  504. // chatRequest.view.backgroundColor=HexColorFromRGBA(0x000000, 0.55);
  505. }];
  506. });
  507. }
  508. } failure:^(NSError *error) {
  509. }];
  510. }
  511. } denied:^{
  512. dispatch_async(dispatch_get_main_queue(), ^{
  513. UIAlertController *systemAlert = [UIAlertController alertControllerWithTitle:@"请在iphone的“设置-隐私-相机”选项中,允许APP访问您的相机。" message:nil preferredStyle:UIAlertControllerStyleAlert];
  514. UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"现在去设置" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action){
  515. if ([[UIDevice currentDevice].systemVersion floatValue] < 10.0)
  516. {
  517. [[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]];
  518. }
  519. else
  520. {
  521. // 去系统设置页面
  522. if (@available(iOS 10.0, *)) {
  523. [[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString] options:@{} completionHandler:nil];
  524. } else {
  525. // Fallback on earlier versions
  526. }
  527. }
  528. }];
  529. UIAlertAction *action = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:nil];
  530. [systemAlert addAction:cancelAction];
  531. [systemAlert addAction:action];
  532. [self presentViewController: systemAlert animated: YES completion: nil];
  533. });
  534. }];
  535. }
  536. //==其他//
  537. -(void)youpaifotherSiXinBtnClick{//私信
  538. [self goChatPage];
  539. }
  540. //设置女神关注
  541. -(void)youpaifsetNvShenGuanzhu{
  542. [LCCommonHttp followUserId:self.youpaipshowModel.youpaipuserid];
  543. }
  544. @end