YOUPAIBBMsgVC.m 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. //
  2. // YOUPAIBBMsgVC.m
  3. // VQU
  4. //
  5. // Created by Elaine on 2021/10/21.
  6. // Copyright © 2021 MS. All rights reserved.
  7. //
  8. #import "YOUPAIBBMsgVC.h"
  9. #import "ZCNavMenuView.h"
  10. #import "YOUPAIBBMessageVC.h"
  11. #import "JXCategoryView.h"
  12. #import "JXPagerView.h"
  13. #import "LZAlertWindow.h"
  14. #import "UIViewController+TFPresent.h"
  15. #define LZCategoryViewHeight 54.0f
  16. #define LZCategoryViewItemWidth 64.0f
  17. @interface YOUPAIBBMsgVC ()<UIScrollViewDelegate,ZCNavMenuViewDelegate,JXCategoryViewDelegate,JXPagerViewDelegate,JXCategoryListContainerViewDelegate>
  18. @property(nonatomic,strong)ZCNavMenuView* youpaipnavView;
  19. @property(nonatomic,strong)UIScrollView* youpaipscrollView;
  20. @property(nonatomic,strong)UIView* youpaipscrollBkgView;
  21. @property(nonatomic,strong)YOUPAIBBMessageVC *youpaipmsgVC;
  22. @property (nonatomic, weak) JXCategoryListContainerView *youpaippagerView;
  23. @property (nonatomic, strong) JXCategoryTitleView *youpaipcategoryView;
  24. @property (nonatomic, strong) UIView *youpaipcategoryBgV;
  25. /* titlearr */
  26. @property (strong, nonatomic) NSArray *youpaiptitlesArr;
  27. /* 打招呼 */
  28. @property (strong, nonatomic) UIButton *youpaipsayHiBtn;
  29. @end
  30. @implementation YOUPAIBBMsgVC
  31. -(void)viewWillAppear:(BOOL)animated{
  32. [super viewWillAppear:animated];
  33. [self.navigationController setNavigationBarHidden:YES animated:animated];
  34. [self youpaifinitConfig];
  35. }
  36. -(void)viewWillDisappear:(BOOL)animated{
  37. [super viewWillDisappear:animated];
  38. [self.navigationController setNavigationBarHidden:NO animated:animated];
  39. }
  40. - (UIStatusBarStyle)preferredStatusBarStyle{
  41. return UIStatusBarStyleDefault;
  42. }
  43. - (void)viewDidLoad {
  44. [super viewDidLoad];
  45. [self.view setBackgroundColor:LCWhiteColor];
  46. // self.youpaiptitlesArr = @[@"消息",@"通话"];
  47. self.youpaiptitlesArr = @[@"消息"];
  48. UIView *youpaipcategoryBgV = [[UIView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, KScreenWidth, LZCategoryViewHeight + StatusBarHeight)];
  49. youpaipcategoryBgV.backgroundColor = [UIColor whiteColor];
  50. [self.view addSubview:youpaipcategoryBgV];
  51. self.youpaipcategoryBgV = youpaipcategoryBgV;
  52. JXCategoryTitleView *youpaipcategoryView = [[JXCategoryTitleView alloc] initWithFrame:CGRectMake(0.0f, StatusBarHeight, KScreenWidth - 16 * 2.0f - 24, LZCategoryViewHeight)];
  53. youpaipcategoryView.backgroundColor = [UIColor whiteColor];
  54. youpaipcategoryView.titles = self.youpaiptitlesArr;
  55. youpaipcategoryView.delegate = self;
  56. youpaipcategoryView.titleSelectedColor = LZ273145Color;
  57. youpaipcategoryView.titleColor = LZ475A7DColor;
  58. youpaipcategoryView.titleColorGradientEnabled = YES;
  59. youpaipcategoryView.titleFont = LCFont(18.0f);
  60. youpaipcategoryView.titleSelectedFont = LCBoldFont(18.0f);
  61. youpaipcategoryView.cellWidth = JXCategoryViewAutomaticDimension;
  62. youpaipcategoryView.cellSpacing = 20.0f;
  63. youpaipcategoryView.averageCellSpacingEnabled = NO;
  64. [youpaipcategoryBgV addSubview:youpaipcategoryView];
  65. self.youpaipcategoryView = youpaipcategoryView;
  66. UIButton* youpaipsayHiBtn = [[UIButton alloc]initWithFrame:CGRectMake(KScreenWidth - 16 - 24,(LZCategoryViewHeight - 44) / 2.0f + StatusBarHeight,24,44)];
  67. [youpaipsayHiBtn setImage:[UIImage imageNamed:@"vqu_images_nav_more_black"] forState:(UIControlStateNormal)];
  68. self.youpaipsayHiBtn = youpaipsayHiBtn;
  69. [youpaipsayHiBtn addTarget:self action:@selector(youpaifsayHiBtnClick) forControlEvents:(UIControlEventTouchUpInside)];
  70. [youpaipcategoryBgV addSubview:youpaipsayHiBtn];
  71. JXCategoryIndicatorLineView *lineView = [[JXCategoryIndicatorLineView alloc] init];
  72. lineView.verticalMargin = 10.0f;
  73. lineView.indicatorHeight = 3.0f;
  74. lineView.indicatorWidth = 10.0f;
  75. lineView.indicatorColor = LZ7C69FEColor;
  76. youpaipcategoryView.indicators = @[lineView];
  77. JXCategoryListContainerView *pagerView = [[JXCategoryListContainerView alloc] initWithType:JXCategoryListContainerType_CollectionView delegate:self];
  78. pagerView.listCellBackgroundColor = [UIColor whiteColor];
  79. pagerView.frame = CGRectMake(0.0f, youpaipcategoryBgV.mj_h, KScreenWidth, KScreenHeight - youpaipcategoryBgV.mj_h - TabbarHeight);
  80. [self.view addSubview:pagerView];
  81. self.youpaippagerView = pagerView;
  82. self.youpaipcategoryView.listContainer = self.youpaippagerView;
  83. }
  84. - (void)youpaifinitConfig{ //系统配置信息
  85. [LCHttpHelper requestWithURLString:AppConfig parameters:nil needToken:YES type:(HttpRequestTypePost) success:^(id responseObject) {
  86. NSDictionary* dict = (NSDictionary*)responseObject;
  87. NSInteger code = [[dict objectForKey:@"code"] integerValue];
  88. if (code==0) {//成功
  89. NSString* sysId = [[[dict objectForKey:@"data"]objectForKey:@"config"] objectForKey:@"sysId"];
  90. NSString* servId = [[[dict objectForKey:@"data"]objectForKey:@"config"] objectForKey:@"servId"];
  91. NSString* appurl = [[[dict objectForKey:@"data"]objectForKey:@"config"] objectForKey:@"appurl"];
  92. NSArray* serviceIdArr = [[[dict objectForKey:@"data"]objectForKey:@"config"] objectForKey:@"serviceId"];
  93. // NSString *audit_status = [NSString stringWithFormat:@"%@",[[[dict objectForKey:@"data"]objectForKey:@"config"] objectForKey:@"audit_status"]];
  94. NSString *rankH5Url = [[dict objectForKey:@"data"]objectForKey:@"rank_url_full"];
  95. NSInteger free = [[[[dict objectForKey:@"data"]objectForKey:@"config"] objectForKey:@"free"] integerValue];
  96. [LCSaveData saveAppUrl:appurl];
  97. [LCSaveData saveSysId:sysId];
  98. [LCSaveData saveServerId:servId];
  99. [LCSaveData saveServiceIdArr:serviceIdArr];
  100. [LCSaveData saveRankH5Url:rankH5Url];
  101. [LCSaveData saveIMPrice:free];
  102. }
  103. } failure:^(NSError *error) {
  104. }];
  105. }
  106. #pragma mark-一键已读
  107. -(void)youpaifsayHiBtnClick{
  108. LZAlertAction *cancelAction = [LZAlertAction actionWithTitle:@"取消" handler:^(LZAlertAction *action) {
  109. }];
  110. cancelAction.cornerRadius = 24.0f;
  111. cancelAction.bgColor = HexColorFromRGB(0x9F9DA5);
  112. LZAlertAction *confimAction = [LZAlertAction actionWithTitle:@"确定" handler:^(LZAlertAction *action) {
  113. //一键已读
  114. [[NIMSDK sharedSDK].conversationManager markAllMessagesRead];
  115. }];
  116. confimAction.cornerRadius = 24.0f;
  117. confimAction.bgColor = [UIColor colorWithPatternImage:[LCTools ColorImage:CGSizeMake((KScreenWidth - 105.0f) / 2.0f, 48.0f) FromColors:@[LZBFB6FFColor,LZ7C69FEColor] ByGradientType:GradientLeftToRight]];
  118. LZAlertWindow *alert = [LZAlertWindow alertWithTitle:@"一键已读" content:@"消息红点气泡会消失,但消息不丢失,也不会显示“已读”。" action:@[cancelAction,confimAction]];
  119. [self TFPresentVC:alert completion:^{}];
  120. }
  121. - (void)youpaifsystemClick{
  122. NIMSession *session = [NIMSession session:[LCSaveData getSysId] type:NIMSessionTypeP2P];
  123. if (session) {
  124. @weakify(self);
  125. [ZCHUDHelper show];
  126. [[[NIMSDK sharedSDK] userManager] fetchUserInfos:@[session.sessionId] completion:^(NSArray<NIMUser *> * _Nullable users, NSError * _Nullable error) {
  127. @strongify(self);
  128. [ZCHUDHelper dismiss];
  129. YOUPAILCIMSessionVC *vc = [[YOUPAILCIMSessionVC alloc] initWithSession:session];
  130. [self.navigationController pushViewController:vc animated:YES];
  131. }];
  132. }
  133. }
  134. - (void)youpaifnavBtnClick:(NSInteger)index{
  135. self.youpaipscrollView.contentOffset = CGPointMake(KScreenWidth*index, 0);
  136. }
  137. -(YOUPAIBBMessageVC *)youpaipmsgVC
  138. {
  139. if (!_youpaipmsgVC)
  140. {
  141. _youpaipmsgVC = [[YOUPAIBBMessageVC alloc]init];
  142. }
  143. return _youpaipmsgVC;
  144. }
  145. // 返回列表的数量
  146. - (NSInteger)numberOfListsInlistContainerView:(JXCategoryListContainerView *)listContainerView {
  147. return self.youpaiptitlesArr.count;
  148. }
  149. // 根据下标 index 返回对应遵守并实现 `JXCategoryListContentViewDelegate` 协议的列表实例
  150. - (id<JXCategoryListContentViewDelegate>)listContainerView:(JXCategoryListContainerView *)listContainerView initListForIndex:(NSInteger)index {
  151. if (index == 0) {
  152. return self.youpaipmsgVC;
  153. }else{
  154. return nil;
  155. }
  156. }
  157. @end