123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181 |
- //
- // YOUPAIBBMsgVC.m
- // VQU
- //
- // Created by Elaine on 2021/10/21.
- // Copyright © 2021 MS. All rights reserved.
- //
- #import "YOUPAIBBMsgVC.h"
- #import "ZCNavMenuView.h"
- #import "YOUPAIBBMessageVC.h"
- #import "JXCategoryView.h"
- #import "JXPagerView.h"
- #import "LZAlertWindow.h"
- #import "UIViewController+TFPresent.h"
- #define LZCategoryViewHeight 54.0f
- #define LZCategoryViewItemWidth 64.0f
- @interface YOUPAIBBMsgVC ()<UIScrollViewDelegate,ZCNavMenuViewDelegate,JXCategoryViewDelegate,JXPagerViewDelegate,JXCategoryListContainerViewDelegate>
- @property(nonatomic,strong)ZCNavMenuView* youpaipnavView;
- @property(nonatomic,strong)UIScrollView* youpaipscrollView;
- @property(nonatomic,strong)UIView* youpaipscrollBkgView;
- @property(nonatomic,strong)YOUPAIBBMessageVC *youpaipmsgVC;
- @property (nonatomic, weak) JXCategoryListContainerView *youpaippagerView;
- @property (nonatomic, strong) JXCategoryTitleView *youpaipcategoryView;
- @property (nonatomic, strong) UIView *youpaipcategoryBgV;
- /* titlearr */
- @property (strong, nonatomic) NSArray *youpaiptitlesArr;
- /* 打招呼 */
- @property (strong, nonatomic) UIButton *youpaipsayHiBtn;
- @end
- @implementation YOUPAIBBMsgVC
- -(void)viewWillAppear:(BOOL)animated{
- [super viewWillAppear:animated];
- [self.navigationController setNavigationBarHidden:YES animated:animated];
- [self youpaifinitConfig];
- }
- -(void)viewWillDisappear:(BOOL)animated{
- [super viewWillDisappear:animated];
- [self.navigationController setNavigationBarHidden:NO animated:animated];
- }
- - (UIStatusBarStyle)preferredStatusBarStyle{
- return UIStatusBarStyleDefault;
- }
- - (void)viewDidLoad {
- [super viewDidLoad];
- [self.view setBackgroundColor:LCWhiteColor];
- // self.youpaiptitlesArr = @[@"消息",@"通话"];
- self.youpaiptitlesArr = @[@"消息"];
- UIView *youpaipcategoryBgV = [[UIView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, KScreenWidth, LZCategoryViewHeight + StatusBarHeight)];
- youpaipcategoryBgV.backgroundColor = [UIColor whiteColor];
- [self.view addSubview:youpaipcategoryBgV];
- self.youpaipcategoryBgV = youpaipcategoryBgV;
-
- JXCategoryTitleView *youpaipcategoryView = [[JXCategoryTitleView alloc] initWithFrame:CGRectMake(0.0f, StatusBarHeight, KScreenWidth - 16 * 2.0f - 24, LZCategoryViewHeight)];
- youpaipcategoryView.backgroundColor = [UIColor whiteColor];
- youpaipcategoryView.titles = self.youpaiptitlesArr;
- youpaipcategoryView.delegate = self;
- youpaipcategoryView.titleSelectedColor = LZ273145Color;
- youpaipcategoryView.titleColor = LZ475A7DColor;
- youpaipcategoryView.titleColorGradientEnabled = YES;
- youpaipcategoryView.titleFont = LCFont(18.0f);
- youpaipcategoryView.titleSelectedFont = LCBoldFont(18.0f);
- youpaipcategoryView.cellWidth = JXCategoryViewAutomaticDimension;
- youpaipcategoryView.cellSpacing = 20.0f;
- youpaipcategoryView.averageCellSpacingEnabled = NO;
-
- [youpaipcategoryBgV addSubview:youpaipcategoryView];
- self.youpaipcategoryView = youpaipcategoryView;
-
- UIButton* youpaipsayHiBtn = [[UIButton alloc]initWithFrame:CGRectMake(KScreenWidth - 16 - 24,(LZCategoryViewHeight - 44) / 2.0f + StatusBarHeight,24,44)];
- [youpaipsayHiBtn setImage:[UIImage imageNamed:@"vqu_images_nav_more_black"] forState:(UIControlStateNormal)];
- self.youpaipsayHiBtn = youpaipsayHiBtn;
- [youpaipsayHiBtn addTarget:self action:@selector(youpaifsayHiBtnClick) forControlEvents:(UIControlEventTouchUpInside)];
- [youpaipcategoryBgV addSubview:youpaipsayHiBtn];
-
- JXCategoryIndicatorLineView *lineView = [[JXCategoryIndicatorLineView alloc] init];
- lineView.verticalMargin = 10.0f;
- lineView.indicatorHeight = 3.0f;
- lineView.indicatorWidth = 10.0f;
- lineView.indicatorColor = LZ7C69FEColor;
- youpaipcategoryView.indicators = @[lineView];
-
-
- JXCategoryListContainerView *pagerView = [[JXCategoryListContainerView alloc] initWithType:JXCategoryListContainerType_CollectionView delegate:self];
- pagerView.listCellBackgroundColor = [UIColor whiteColor];
- pagerView.frame = CGRectMake(0.0f, youpaipcategoryBgV.mj_h, KScreenWidth, KScreenHeight - youpaipcategoryBgV.mj_h - TabbarHeight);
- [self.view addSubview:pagerView];
- self.youpaippagerView = pagerView;
-
- self.youpaipcategoryView.listContainer = self.youpaippagerView;
- }
- - (void)youpaifinitConfig{ //系统配置信息
- [LCHttpHelper requestWithURLString:AppConfig parameters:nil needToken:YES type:(HttpRequestTypePost) success:^(id responseObject) {
- NSDictionary* dict = (NSDictionary*)responseObject;
- NSInteger code = [[dict objectForKey:@"code"] integerValue];
- if (code==0) {//成功
- NSString* sysId = [[[dict objectForKey:@"data"]objectForKey:@"config"] objectForKey:@"sysId"];
- NSString* servId = [[[dict objectForKey:@"data"]objectForKey:@"config"] objectForKey:@"servId"];
- NSString* appurl = [[[dict objectForKey:@"data"]objectForKey:@"config"] objectForKey:@"appurl"];
- NSArray* serviceIdArr = [[[dict objectForKey:@"data"]objectForKey:@"config"] objectForKey:@"serviceId"];
- // NSString *audit_status = [NSString stringWithFormat:@"%@",[[[dict objectForKey:@"data"]objectForKey:@"config"] objectForKey:@"audit_status"]];
- NSString *rankH5Url = [[dict objectForKey:@"data"]objectForKey:@"rank_url_full"];
- NSInteger free = [[[[dict objectForKey:@"data"]objectForKey:@"config"] objectForKey:@"free"] integerValue];
- [LCSaveData saveAppUrl:appurl];
- [LCSaveData saveSysId:sysId];
- [LCSaveData saveServerId:servId];
- [LCSaveData saveServiceIdArr:serviceIdArr];
- [LCSaveData saveRankH5Url:rankH5Url];
- [LCSaveData saveIMPrice:free];
- }
- } failure:^(NSError *error) {
-
- }];
- }
- #pragma mark-一键已读
- -(void)youpaifsayHiBtnClick{
- LZAlertAction *cancelAction = [LZAlertAction actionWithTitle:@"取消" handler:^(LZAlertAction *action) {
-
- }];
- cancelAction.cornerRadius = 24.0f;
- cancelAction.bgColor = HexColorFromRGB(0x9F9DA5);
-
-
- LZAlertAction *confimAction = [LZAlertAction actionWithTitle:@"确定" handler:^(LZAlertAction *action) {
- //一键已读
- [[NIMSDK sharedSDK].conversationManager markAllMessagesRead];
-
- }];
-
- confimAction.cornerRadius = 24.0f;
- confimAction.bgColor = [UIColor colorWithPatternImage:[LCTools ColorImage:CGSizeMake((KScreenWidth - 105.0f) / 2.0f, 48.0f) FromColors:@[LZBFB6FFColor,LZ7C69FEColor] ByGradientType:GradientLeftToRight]];
-
- LZAlertWindow *alert = [LZAlertWindow alertWithTitle:@"一键已读" content:@"消息红点气泡会消失,但消息不丢失,也不会显示“已读”。" action:@[cancelAction,confimAction]];
- [self TFPresentVC:alert completion:^{}];
-
- }
- - (void)youpaifsystemClick{
- NIMSession *session = [NIMSession session:[LCSaveData getSysId] type:NIMSessionTypeP2P];
- if (session) {
- @weakify(self);
- [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];
- }];
- }
- }
- - (void)youpaifnavBtnClick:(NSInteger)index{
- self.youpaipscrollView.contentOffset = CGPointMake(KScreenWidth*index, 0);
- }
- -(YOUPAIBBMessageVC *)youpaipmsgVC
- {
- if (!_youpaipmsgVC)
- {
- _youpaipmsgVC = [[YOUPAIBBMessageVC alloc]init];
- }
- return _youpaipmsgVC;
- }
- // 返回列表的数量
- - (NSInteger)numberOfListsInlistContainerView:(JXCategoryListContainerView *)listContainerView {
- return self.youpaiptitlesArr.count;
- }
- // 根据下标 index 返回对应遵守并实现 `JXCategoryListContentViewDelegate` 协议的列表实例
- - (id<JXCategoryListContentViewDelegate>)listContainerView:(JXCategoryListContainerView *)listContainerView initListForIndex:(NSInteger)index {
- if (index == 0) {
-
- return self.youpaipmsgVC;
- }else{
- return nil;
- }
- }
- @end
|