123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161 |
- //
- // IndexViewController.m
- // TheoryNetwork
- //
- // Created by tederen on 2019/9/20.
- // Copyright © 2019 tederen. All rights reserved.
- //
- //#import "DrawerView.h"
- #import "IndexViewController.h"
- #import "SurfaceSearchView.h"
- #import "ChannelModel.h"
- #import "HomeSearchController.h"
- #import "AddChannelController.h"
- #import "HttpManager.h"
- #import "HomeDetailController.h"
- #import "APIPOPOPO.h"
- #import "MyApprovalPageDetail.h"
- #import "MailListDetailVC.h"
- #import "NavigationController.h"
- #import "UIAlertController+TapGesAlertController.h"
- #import "HomeArticleModel.h"
- #import "HomeListWorkCell.h"
- #import "HomeTableViewCell.h"
- #import "SLBannerView.h"
- #import "MyFavoriteVC.h"
- #import "OtherFavoriteVC.h"
- #import "NoteBookVC.h"
- #import "OtherNoteBookVC.h"
- #import "BookStoreHome.h"
- #import "HomeMusicCell.h"
- #import "HomeSchoolCell.h"
- #import "HomeUserPrivilegeCell.h"
- #import "HomeWeiCousreCell.h"
- #import "HomeProblemTopCell.h"
- #import "HomeGoodBookCell.h"
- #import "BookDetailVC.h"
- #import "BookSubArticeCell.h"
- #import "HomeTeacherCell.h"
- #import "BookTeacherListVC.h"
- #import "HKFloatManager.h"
- #import "HomeBigshotCell.h"
- #import "HomeSubModel.h"
- #import "HomeSubItemModel.h"
- #import "HomeRecommendVC.h"
- #import "HomeBigshotVC.h"
- #import "HomeDayGoodBookVC.h"
- #import "HomeDayGoodArticeVC.h"
- #import "HomeSpeakVC.h"
- #import "HomeWeiCousreVC.h"
- #import "HomeMingShiVC.h"
- #import "HomeUserVC.h"
- #import "HomeSchoolVC.h"
- #import "HomeProblemVC.h"
- #import "WorkFlowDetailsController.h"
- #import "IndexSearchVC.h"
- #import "BookListDetailVC.h"
- #import "BookWCDetailVC.h"
- #import "BookListenVC.h"
- #import "BookTeacherDetailVC.h"
- #import "PushModel.h"
- #import "ChatMsgListVC.h"
- #import "ChatTestingVC.h"
- #import "ReplayMeVC.h"
- #import "SWQRCodeViewController.h"
- #import "ChatJoinGroupVC.h"
- #import "TDGroupInfoListVC.h"
- #import "LoginPCVC.h"
- #import "TDQrJoinVC.h"
- @interface IndexViewController () <SLBannerViewDelegate,AddChannelControllerDelegate,EMChatManagerDelegate, EMGroupManagerDelegate, EMConversationsDelegate,SWQRCodeViewControllerDelegate>
- @property (nonatomic, strong) UILabel *titleLabel;
- @property (nonatomic, strong) UIButton *scanBtn;
- @property (nonatomic, strong) UIView *bannerBgV;
- @property (nonatomic, strong) SLBannerView *bannerView;
- @property (nonatomic, strong) SurfaceSearchView *searchView;
- @property (nonatomic, strong) NSMutableArray *bannerImgArr;
- @property (nonatomic, strong) NSMutableArray *tabConfigArray;
- @property (nonatomic, strong) NSMutableArray *bannerModelArray;
- @property (nonatomic, strong) HomeArticleModel *model;
- @property (nonatomic, strong) TDWaitWorkModel *waitModel;
- @property (nonatomic, assign) NSInteger currentPage;
- @property (nonatomic, assign) NSInteger totalPage;
- @property (nonatomic, assign) NSInteger currentChannel;
- @property (nonatomic, assign) NSInteger unReadCount;
- @property (nonatomic, strong) TDButton *addButton;
- @property (nonatomic, strong) TDButton *musicButtton;
- @property (nonatomic, strong) UIView *lineV;
- @property (nonatomic, strong) UIView *rightView;
- @property (nonatomic, strong) NSMutableDictionary *articleDic;
- @property (nonatomic, copy) NSMutableArray *dataSource;
- @property (strong, nonatomic) UIAlertController *alertVC;
- /// 我的频道
- @property (copy, nonatomic) NSMutableArray *myChannel;
- @property (copy, nonatomic) NSString *style;
- @property (strong, nonatomic) NSMutableArray *chatListIMArray;
- @property (strong, nonatomic) NSMutableArray *dataArray;
- @end
- @implementation IndexViewController
- - (void)viewWillAppear:(BOOL)animated
- {
- [super viewWillAppear:animated];
- [[EMClient sharedClient].chatManager addDelegate:self delegateQueue:nil];
- [[EMClient sharedClient].groupManager addDelegate:self delegateQueue:nil];
- [[EMConversationHelper shared] addDelegate:self];
- [self getUnreadCount];
- }
- #pragma mark - LifeCycle
- - (void)viewDidLoad {
- [super viewDidLoad];
- self.fd_prefersNavigationBarHidden = YES;
- [self loadStatusBarColor:[UIColor whiteColor]];
- self.view.backgroundColor = UIColorHex(F2F2F2);
- [self.view addSubview:self.titleLabel];
- [self.view addSubview:self.scanBtn];
- [self.view addSubview:self.searchView];
- [self.searchView setFrame:CGRectMake(0, 0, SCREEN_WIDTH, 52)];
-
- self.bannerView = [[SLBannerView alloc] initWithFrame:CGRectMake(15, 0, SCREEN_WIDTH - 30, 125)];
- self.bannerView.delegate = self;
- self.bannerView.durTimeInterval = 0.2;
- self.bannerView.imgStayTimeInterval = 2.5;
- self.bannerBgV = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 132)];
- self.bannerBgV.backgroundColor = [UIColor clearColor];
- [self.bannerBgV addSubview:self.bannerView];
-
-
- [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.equalTo(self.statusBar.mas_bottom);
- make.left.right.equalTo(self.view);
- make.height.equalTo(@44);
- }];
- [self.scanBtn mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.equalTo(self.statusBar.mas_bottom);
- make.right.mas_equalTo(self.view.mas_right).offset(-10);
- make.size.mas_offset(CGSizeMake(44, 44));
- }];
- [self.searchView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.mas_equalTo(self.titleLabel.mas_bottom);
- make.left.right.equalTo(self.view);
- make.height.mas_offset(52);
- }];
-
- [self getdata];
-
- WEAKSELF
- self.searchView.buttonBlock = ^(){
- // HomeSearchController *homeSearch = [[HomeSearchController alloc] init];
- // [weakSelf.navigationController pushViewController:homeSearch animated:YES];
- IndexSearchVC * vc = [[IndexSearchVC alloc] init];
- vc.hidesBottomBarWhenPushed = YES;
- [weakSelf.navigationController pushViewController:vc animated:YES];
- };
- self.searchView.bookBlock = ^(){
- BookStoreHome *vc = [BookStoreHome initBookStoreHome];
- vc.hidesBottomBarWhenPushed = YES;
- [weakSelf.navigationController pushViewController:vc animated:YES];
- };
- // self.channelScroll.ClickSelectChannelBlock = ^(NSInteger channelId, NSString * _Nonnull StyleCss) {
- // weakSelf.style = StyleCss;
- // weakSelf.currentChannel = channelId;
- // for (ChannelModel * model in weakSelf.myChannel) {
- // model.IsSelect = NO;
- // }
- // for (ChannelModel * model in weakSelf.myChannel) {
- // if (model.ArticleGroupId == channelId) {
- // model.IsSelect = YES;
- // }
- // }
- // dispatch_async(dispatch_get_main_queue(), ^{
- // [weakSelf collectReload];
- // });
- // };
- [self.scanBtn setAction:^{
- SWQRCodeConfig *config = [[SWQRCodeConfig alloc]init];
- config.scannerType = SWScannerTypeBoth;
- SWQRCodeViewController *qrcodeVC = [[SWQRCodeViewController alloc]init];
- qrcodeVC.codeConfig = config;
- qrcodeVC.delegate = weakSelf;
- [weakSelf.navigationController pushViewController:qrcodeVC animated:YES];
- }];
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(tableViewScrollTop) name:HOMESCROLLVIEWTOTOP object:nil];
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(shareReturnAction:) name:SHARERETURNSUCCESS object:nil];
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(JPushToVC:) name:JPUSHSUCCESS object:nil];
- }
- - (void)setCusPageVC
- {
- CGFloat height = SCREEN_HEIGHT - NAVH - 52 - self.tabBarController.tabBar.frame.size.height;
- WS(weakSelf);
- NSMutableArray * data = [NSMutableArray array];
- NSMutableArray * vcArr = [NSMutableArray array];
- for (NSInteger i = 0; i < self.myChannel.count; i ++) {
- ChannelModel * model = self.myChannel[i];
- if ([model.StyleCss isEqualToString:@"Commend"]) {
- [data addObject:model.ArticleGroupName];
- HomeRecommendVC * vc = [[HomeRecommendVC alloc] init];
- vc.height = height;
- vc.style = model.StyleCss;
- [vcArr addObject:vc];
- }
- if ([model.StyleCss isEqualToString:@"Cathedra"]) {
- [data addObject:model.ArticleGroupName];
- HomeBigshotVC * vc = [[HomeBigshotVC alloc] init];
- vc.height = height;
- vc.style = model.StyleCss;
- [vcArr addObject:vc];
- }
- if ([model.StyleCss isEqualToString:@"DayGoodBook"]) {
- [data addObject:model.ArticleGroupName];
- HomeDayGoodBookVC * vc = [[HomeDayGoodBookVC alloc] init];
- vc.height = height;
- vc.style = model.StyleCss;
- [vcArr addObject:vc];
- }
- if ([model.StyleCss isEqualToString:@"DayGoodText"]) {
- [data addObject:model.ArticleGroupName];
- HomeDayGoodArticeVC * vc = [[HomeDayGoodArticeVC alloc] init];
- vc.height = height;
- vc.style = model.StyleCss;
- [vcArr addObject:vc];
- }
- if ([model.StyleCss isEqualToString:@"ChatHearSpeak"]) {
- [data addObject:model.ArticleGroupName];
- HomeSpeakVC * vc = [[HomeSpeakVC alloc] init];
- vc.height = height;
- vc.style = model.StyleCss;
- [vcArr addObject:vc];
- }
- if ([model.StyleCss isEqualToString:@"DayWeBook"]) {
- [data addObject:model.ArticleGroupName];
- HomeWeiCousreVC * vc = [[HomeWeiCousreVC alloc] init];
- vc.height = height;
- vc.style = model.StyleCss;
- [vcArr addObject:vc];
- }
- if ([model.StyleCss isEqualToString:@"StarTeacher"]) {
- [data addObject:model.ArticleGroupName];
- HomeMingShiVC * vc = [[HomeMingShiVC alloc] init];
- vc.height = height;
- vc.style = model.StyleCss;
- [vcArr addObject:vc];
- }
- if ([model.StyleCss isEqualToString:@"VipSupply"]) {
- [data addObject:model.ArticleGroupName];
- HomeUserVC * vc = [[HomeUserVC alloc] init];
- vc.height = height;
- vc.style = model.StyleCss;
- [vcArr addObject:vc];
- }
- if ([model.StyleCss isEqualToString:@"StarSchool"]) {
- [data addObject:model.ArticleGroupName];
- HomeSchoolVC * vc = [[HomeSchoolVC alloc] init];
- vc.height = height;
- vc.style = model.StyleCss;
- [vcArr addObject:vc];
- }
- if ([model.StyleCss isEqualToString:@"DayProblem"]) {///每日技能
- [data addObject:model.ArticleGroupName];
- HomeProblemVC * vc = [[HomeProblemVC alloc] init];
- vc.height = height;
- vc.style = model.StyleCss;
- [vcArr addObject:vc];
- }
- }
- WMZPageParam *param = PageParam()
- .wTitleArrSet(data)
- .wControllersSet(vcArr)
- //固定在所有子控制器底部 需要放在第一个控制器里 例如此例子
- .wFixFirstSet(YES)
- //悬浮开启
- .wTopSuspensionSet(YES)
- //等分
- .wMenuCellPaddingSet(45 - 21.5)
- .wMenuCellMarginSet(15)
- .wTopOffsetSet(52 + NAVH)
- .wFromNaviSet(YES)
- .wMenuAnimalSet(PageTitleMenuNone)
- .wMenuTitleFontSet(15.f)
- .wMenuTitleSelectColorSet(UIColorHex(0x3979D3))
- .wMenuIndicatorYSet(6.f)
- .wMenuIndicatorColorSet(UIColorHex(0x3979D3))
- .wMenuTitleColorSet(UIColorHex(0x666666))
- .wMenuTitleSelectFontSet(15.f)
- .wMenuFixShadowSet(NO)
- .wMenuFixRightDataSet(@" ")
- .wMenuFixWidthSet(88.5)
- //头部
- .wMenuHeadViewSet(^UIView *{
- return self.bannerBgV;
- });
- self.param = param;
- [self updatePageController];
- dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
- dispatch_async(dispatch_get_main_queue(), ^{
- for (UIView * view in weakSelf.view.subviews) {
- if ([view isKindOfClass:[WMZPageScroller class]]) {
- [view setFrame:CGRectMake(0, NAVH + 52, SCREEN_WIDTH, height)];
- }
- if ([view isKindOfClass:[UIScrollView class]]) {
- UIScrollView * sView = (UIScrollView *)view;
- sView.showsVerticalScrollIndicator = NO;
- }
- }
- UIView * view = [weakSelf setRightView];
- [weakSelf.upSc addSubview:view];
- [weakSelf.upSc bringSubviewToFront:view];
- [view setFrame:CGRectMake(SCREEN_WIDTH - 88.5, 0, 88.5, 45)];
- // [weakSelf updateController];
- });
- });
- }
- - (void)getUnreadCount
- {
- WS(weakSelf);
- [[HttpManager sharedHttpManager] GETUrl:Host(API_APP_User_User_Uread_Count) parameters:@{} responseStyle:JOSN success:^(id _Nonnull responseObject) {
- NSDictionary *dic = responseObject;
- WorkNumberModel *numberModel = [[WorkNumberModel alloc] initWithDictionary:dic error:nil];
- weakSelf.unReadCount = numberModel.allNumber;
- dispatch_async(dispatch_get_main_queue(), ^{
- [weakSelf initChatMsgIMData];
- });
- } failure:^(NSError * _Nonnull error) {
- }];
- }
- -(void)initChatMsgIMData{
- self.chatListIMArray = [NSMutableArray array];
- WS(weakSelf);
- SHOWLOADING
- [[HttpManager sharedHttpManager] POSTUrl:Host(Often_Contact_List) parameters:@{@"IndividualGroupId":@(0)} responseStyle:JOSN success:^(id _Nonnull responseObject) {
- NSLog(@"%@",responseObject);
- REMOVESHOW
- if ([responseObject isKindOfClass:[NSArray class]]) {
- for (NSDictionary * dict in responseObject) {
- ChatMsgListImModel * model = [ChatMsgListImModel modelWithDictionary:dict];
- [weakSelf.chatListIMArray addObject:model];
- }
- }
- [weakSelf _loadAllConversationsFromDBWithIsShowHud:NO];
- } failure:^(NSError * _Nonnull error) {
- REMOVESHOW
- NSLog(@"%@",error);
- }];
- }
- - (void)_loadAllConversationsFromDBWithIsShowHud:(BOOL)aIsShowHUD
- {
- __weak typeof(self) weakself = self;
- self.dataArray = [NSMutableArray array];
- dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
- NSArray *conversations = [[EMClient sharedClient].chatManager getAllConversations];
- NSArray *sorted = [conversations sortedArrayUsingComparator:^(EMConversation *obj1, EMConversation *obj2) {
- EMMessage *message1 = [obj1 latestMessage];
- EMMessage *message2 = [obj2 latestMessage];
- if(message1.timestamp > message2.timestamp) {
- return(NSComparisonResult)NSOrderedAscending;
- } else {
- return(NSComparisonResult)NSOrderedDescending;
- }
- }];
- NSArray *models = [EMConversationHelper modelsFromEMConversations:sorted];
- [weakself.dataArray addObjectsFromArray:models];
- [weakself replaceChatData];
- });
- }
- - (void)replaceChatData
- {
- WS(weakSelf);
- [self.chatListIMArray enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
- ChatMsgListImModel * chatModel = (ChatMsgListImModel *)obj;
- [weakSelf.dataArray enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
- EMConversationModel * model = (EMConversationModel *)obj;
- if (chatModel.ImId == [model.emModel.conversationId integerValue]) {
- if (!chatModel.IsDisturb) {
- chatModel.redNum = model.emModel.unreadMessagesCount;
- weakSelf.unReadCount += model.emModel.unreadMessagesCount;
- }
- }
- }];
- }];
- dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
- weakSelf.tabBarController.tabBar.items[2].badgeValue = weakSelf.unReadCount > 0 ? [NSString stringWithFormat:@"%ld",(long)weakSelf.unReadCount] : nil;
- });
- }
- - (void)conversationListDidUpdate:(NSArray *)aConversationList
- {
- [self _loadAllConversationsFromDBWithIsShowHud:NO];
- }
- - (void)messagesDidReceive:(NSArray *)aMessages
- {
- [self performSelector:@selector(getUnreadCount) withObject:nil afterDelay:0.8];
- }
- - (void)tableViewScrollTop
- {
- if (self.dataSource.count > 0) {
- [self.downSc scrollToTop];
- [self.downSc scrollRectToVisible:CGRectMake(0, 0, 1, 1) animated:YES];
- }
- }
- - (void)dealloc
- {
- [[EMClient sharedClient].chatManager removeDelegate:self];
- [[EMClient sharedClient].groupManager removeDelegate:self];
- [[EMConversationHelper shared] removeDelegate:self];
- [[NSNotificationCenter defaultCenter] removeObserver:self];
- }
- #pragma mark - NetRequest - 轮播
- - (void)getdata{
- [self loadChannelModel];
- WS(weakSelf);
- dispatch_semaphore_t sem = dispatch_semaphore_create(0);
- __block NSInteger httpFinishCount = 0;
- dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
- [[HttpManager sharedHttpManager] GETUrl:[NSString stringWithFormat:@"%@%@",BaseUrl,HomeSlideImages_GET] parameters: @{} responseStyle:JOSN success:^(id _Nonnull responseObject) {
- NSArray *arr = responseObject[@"Items"];
- NSLog(@"首页轮播数据%@",arr.firstObject);
- [weakSelf.bannerModelArray removeAllObjects];
- [weakSelf.bannerImgArr removeAllObjects];
- NSMutableArray *array = [NSMutableArray array];
- NSMutableArray *array2 = [NSMutableArray array];
- for (NSInteger i = 0; i < arr.count; i++) {
- NSDictionary *dic = arr[i];
- HomeTopImageModel *imageModel = [[HomeTopImageModel alloc] initWithDictionary:dic error:nil];
- [array2 addObject:imageModel];
- [array addObject:dic[@"ImageUrl"]];
- }
- weakSelf.bannerImgArr = array;
- weakSelf.bannerModelArray = array2;
- weakSelf.bannerView.slImages = array;
- if (++httpFinishCount == 2) {
- dispatch_semaphore_signal(sem);
- }
- } failure:^(NSError * _Nonnull error) {
- // if (++httpFinishCount == 2) {
- // dispatch_semaphore_signal(sem);
- // }
- SHOWERROR([ZYCTool handerResultData:error]);
- }];
- [[HttpManager sharedHttpManager] POSTUrl:[NSString stringWithFormat:@"%@%@",BaseUrl,Article_Pindao_User_Post] parameters:@{} responseStyle:JOSN success:^(id _Nonnull responseObject) {
- NSLog(@"%@",responseObject);
- NSArray *array = responseObject;
- for (NSInteger i = 0 ; i < array.count; i ++) {
- NSDictionary *dic = array[i];
- ChannelModel *model = [ChannelModel modelWithDictionary:dic];
- if (model.ArticleGroupId == 0) {
- model.IsSelect = YES;
- }
- [weakSelf.myChannel addObject:model];
- }
- if (++httpFinishCount == 2) {
- dispatch_semaphore_signal(sem);
- }
- } failure:^(NSError * _Nonnull error) {
- // if (++httpFinishCount == 2) {
- // dispatch_semaphore_signal(sem);
- // }
- SHOWERROR([ZYCTool handerResultData:error]);
- }];
- dispatch_semaphore_wait(sem, DISPATCH_TIME_FOREVER);
- dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
- dispatch_async(dispatch_get_main_queue(), ^{
- [weakSelf setCusPageVC];
- });
- });
- });
- }
- - (void)ReGetHomeListData:(NSInteger)channelId
- {
- WS(weakSelf);
- switch (channelId) {
- case 0:
- {
- [[HttpManager sharedHttpManager] POSTUrl:[NSString stringWithFormat:@"%@%@",BaseUrl,Article_Notice_list_Post] parameters: @{@"page":@(self.currentPage),@"perPage":@10,@"GroupId":@(channelId)} responseStyle:JOSN success:^(id _Nonnull responseObject) {
- NSDictionary *dic = (NSDictionary *)responseObject;
- HomeArticleModel *model = [HomeArticleModel modelWithDictionary:dic];
- weakSelf.totalPage = model.Count;
- [weakSelf.dataSource addObjectsFromArray:model.Items];
- } failure:^(NSError * _Nonnull error) {
-
- }];
- }
- break;
- case 1:
- {
- NSDictionary * paraDict = @{@"Type":@"MyChecking",@"page":@(self.currentPage),@"perPage":@10};
- [[HttpManager sharedHttpManager] GETUrl:Host(WorkFlowAddApproval_Post) parameters:paraDict responseStyle:JOSN success:^(id _Nonnull responseObject) {
- NSDictionary *dic = (NSDictionary *)responseObject;
- HomeArticleModel *model = [HomeArticleModel modelWithDictionary:dic];
- weakSelf.totalPage = model.Count;
- [weakSelf.dataSource addObjectsFromArray:model.Items];
-
- } failure:^(NSError * _Nonnull error) {
- SHOWERROR([ZYCTool handerResultData:error])
- }];
- }
- break;
- default:
- {
- [[HttpManager sharedHttpManager] POSTUrl:Host(API_APP_PAGE_CATHEDRA) parameters:@{@"StyleCss":self.style,@"Page":@(self.currentPage),@"PerPage":@20} responseStyle:JOSN success:^(id _Nonnull responseObject) {
- NSLog(@"%@",responseObject);
- } failure:^(NSError * _Nonnull error) {
-
- }];
- }
- break;
- }
- }
- - (BOOL)hidesBottomBarWhenPushed{
- return NO;
- }
- #pragma mark - UITableViewDataSource && UITableViewDelegate
- - (void)closeBtn_Click {
- [self.alertVC dismissViewControllerAnimated:YES completion:nil];
- }
- - (void)cellDidSelcet:(NSInteger )articleId{
- WEAKSELF
- UIButton *closeBtn = [UIButton buttonWithType:UIButtonTypeCustom];
-
- [closeBtn addTarget:self action:@selector(closeBtn_Click) forControlEvents:UIControlEventTouchUpInside];
- [closeBtn setImage:IMG(@"guanbi") forState:UIControlStateNormal];
- UIAlertController *alertVC = [UIAlertController alertControllerWithTitle:@"对此内容进行操作" message:@"" preferredStyle:UIAlertControllerStyleAlert];
- self.alertVC = alertVC;
- [alertVC.view addSubview:closeBtn];
- [closeBtn mas_makeConstraints:^(MASConstraintMaker *make) {
- make.right.equalTo(alertVC.view).offset(-10);
- make.top.equalTo(@10);
- make.size.mas_equalTo(CGSizeMake(22, 22));
- }];
- UIAlertAction *actionOK = [UIAlertAction actionWithTitle:@"屏蔽TA" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
-
- STRONGSELF
- [strongSelf homeNewsHander:articleId withTypeId:1];
-
- }];
- [actionOK setValue:k9 forKey:@"_titleTextColor"];
- UIAlertAction *actionNO = [UIAlertAction actionWithTitle:@"不感兴趣" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
- STRONGSELF
- [strongSelf homeNewsHander:articleId withTypeId:2];
- }];
- [alertVC addAction:actionOK];
- [alertVC addAction:actionNO];
- [self presentViewController:alertVC animated:YES completion:^{
- [alertVC tapGesAlert];
- }];
- }
- - (void)homeNewsHander:(NSInteger )articleId withTypeId:(NSInteger)blacklistType{
- [[HttpManager sharedHttpManager] POSTUrl:[NSString stringWithFormat:@"%@/%@",BaseUrl,Article_Hander_Post] parameters:@{@"ArticleId":@(articleId),@"BlacklistType":@(blacklistType)} responseStyle:DATA success:^(id _Nonnull responseObject) {
- // [weakSelf headRefresh];
- } failure:^(NSError * _Nonnull error) {
-
- }];
- }
- #pragma mark - channelScroll Block
- - (void)didClickAddButtonChannel{
- AddChannelController *addChannel = [[AddChannelController alloc] init];
- addChannel.modalPresentationStyle = UIModalPresentationFullScreen;
- addChannel.delegate = self;
- [self presentViewController:addChannel animated:YES completion:nil];
- }
- #pragma mark - AddChannelControllerDelegate
- - (void)upadateChannel{
- WS(weakSelf);
- [self loadChannelModel];
- [[HttpManager sharedHttpManager] POSTUrl:[NSString stringWithFormat:@"%@%@",BaseUrl,Article_Pindao_User_Post] parameters:@{} responseStyle:JOSN success:^(id _Nonnull responseObject) {
- NSLog(@"%@",responseObject);
- NSArray *array = responseObject;
- for (NSInteger i = 0 ; i < array.count; i ++) {
- NSDictionary *dic = array[i];
- ChannelModel *model = [ChannelModel modelWithDictionary:dic];
- [weakSelf.myChannel addObject:model];
- }
- dispatch_async(dispatch_get_main_queue(), ^{
- [weakSelf setCusPageVC];
- });
- } failure:^(NSError * _Nonnull error) {
-
- }];
- }
- #pragma mark - SLBannerViewDelegate
- - (void)bannerView:(SLBannerView *)banner didClickImagesAtIndex:(NSInteger)index
- {
- [self getArticleDetail:index];
- }
- - (void)getArticleDetail:(NSInteger)index{
- HomeTopImageModel *model = self.bannerModelArray[index];
- switch (model.MediaType) {
- case CollectModel_StoreBook:
- {
- BookListDetailVC * vc = [BookListDetailVC initBookListDetailVC];
- vc.Id = model.MediaId;
- vc.hidesBottomBarWhenPushed = YES;
- [self.navigationController pushViewController:vc animated:YES];
- }
- break;
- case CollectModel_StoreVideo:
- {
- BookWCDetailVC * vc = [BookWCDetailVC initBookWCDetailVC];
- vc.Id = model.MediaId;
- vc.hidesBottomBarWhenPushed = YES;
- [self.navigationController pushViewController:vc animated:YES];
- }
- break;
- case CollectModel_StoreSound:
- {
- BookListenVC * vc = [BookListenVC initBookListenVC];
- vc.Id = model.MediaId;
- vc.MediaType = MediaMusicType;
- vc.hidesBottomBarWhenPushed = YES;
- [self.navigationController pushViewController:vc animated:YES];
- }
- break;
- case CollectModel_Teacher:
- {
- BookTeacherDetailVC * vc = [BookTeacherDetailVC initBookTeacherDetailVC];
- vc.Id = model.MediaId;
- vc.hidesBottomBarWhenPushed = YES;
- [self.navigationController pushViewController:vc animated:YES];
- }
- break;
- case CollectModel_Organization:
- {
-
- }
- break;
- default:
- {
- MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
- vc.type = model.MediaType;
- vc.Id = model.MediaId;
- [self.navigationController pushViewController:vc animated:YES];
- }
- break;
- }
- }
- #pragma mark - Setter
- - (UILabel *)titleLabel {
- if (!_titleLabel) {
- _titleLabel = [UILabel new];
- _titleLabel.backgroundColor = [UIColor whiteColor];
- _titleLabel.text = @"首页";
- _titleLabel.font = [UIFont systemFontOfSize:16.f];
- _titleLabel.textColor = UIColorHex(1A1A1A);
- _titleLabel.textAlignment = NSTextAlignmentCenter;
- }
- return _titleLabel;
- }
- - (UIButton *)scanBtn {
- if (!_scanBtn) {
- _scanBtn = [UIButton new];
- [_scanBtn setImage:IMG(@"home_scan") forState:UIControlStateNormal];
- }
- return _scanBtn;
- }
- - (SurfaceSearchView *)searchView {
- if (!_searchView) {
- _searchView = [[SurfaceSearchView alloc] init];
- [_searchView setBgViewColor:[UIColor clearColor]];
- // [_searchView setPlaceHolderText:@"输入关键字搜索"];
- [_searchView setMainType];
- }
- return _searchView;
- }
- - (NSMutableArray *)dataSource
- {
- if (!_dataSource) {
- _dataSource = [NSMutableArray array];
- }
- return _dataSource;
- }
- - (NSMutableArray *)tabConfigArray{
- if (!_tabConfigArray) {
- _tabConfigArray = [NSMutableArray array];
- }
- return _tabConfigArray;
- }
- - (NSMutableDictionary *)articleDic{
- if (!_articleDic) {
- _articleDic = [NSMutableDictionary dictionary];
- }
- return _articleDic;
- }
- - (NSMutableArray *)myChannel {
- if (!_myChannel) {
- _myChannel = [NSMutableArray array];
- }
- return _myChannel;
- }
- - (void)loadChannelModel
- {
- [self.myChannel removeAllObjects];
- // ChannelModel * model = [[ChannelModel alloc] init];
- // model.ArticleGroupId = 0;
- // model.ArticleGroupName = @"推荐";
- // model.StyleCss = @"default";
- // model.IsSelect = YES;
- // [self.myChannel addObject:model];
- // ChannelModel * workModel = [[ChannelModel alloc] init];
- // workModel.ArticleGroupId = 1;
- // workModel.ArticleGroupName = @"待办工作";
- // workModel.IsSelect = NO;
- // [self.myChannel addObject:workModel];
- // ChannelModel * sModel = [[ChannelModel alloc] init];
- // sModel.ArticleGroupId = 2;
- // sModel.ArticleGroupName = @"信源听说";
- // sModel.IsSelect = NO;
- // [self.myChannel addObject:sModel];
- // ChannelModel * mModel = [[ChannelModel alloc] init];
- // mModel.ArticleGroupId = 3;
- // mModel.ArticleGroupName = @"名校";
- // mModel.IsSelect = NO;
- // [self.myChannel addObject:mModel];
- // ChannelModel * aModel = [[ChannelModel alloc] init];
- // aModel.ArticleGroupId = 4;
- // aModel.ArticleGroupName = @"会员特供";
- // aModel.IsSelect = NO;
- // [self.myChannel addObject:aModel];
- // ChannelModel * bModel = [[ChannelModel alloc] init];
- // bModel.ArticleGroupId = 5;
- // bModel.ArticleGroupName = @"每日微课";
- // bModel.IsSelect = NO;
- // [self.myChannel addObject:bModel];
- // ChannelModel * cModel = [[ChannelModel alloc] init];
- // cModel.ArticleGroupId = 6;
- // cModel.ArticleGroupName = @"每日技能";
- // cModel.IsSelect = NO;
- // [self.myChannel addObject:cModel];
- // ChannelModel * dModel = [[ChannelModel alloc] init];
- // dModel.ArticleGroupId = 7;
- // dModel.ArticleGroupName = @"每日好书";
- // dModel.IsSelect = NO;
- // [self.myChannel addObject:dModel];
- // ChannelModel * eModel = [[ChannelModel alloc] init];
- // eModel.ArticleGroupId = 8;
- // eModel.ArticleGroupName = @"每日好文";
- // eModel.IsSelect = NO;
- // [self.myChannel addObject:eModel];
- // ChannelModel * fModel = [[ChannelModel alloc] init];
- // fModel.ArticleGroupId = 9;
- // fModel.ArticleGroupName = @"名师";
- // fModel.IsSelect = NO;
- // [self.myChannel addObject:fModel];
- // ChannelModel * gModel = [[ChannelModel alloc] init];
- // gModel.ArticleGroupId = 10;
- // gModel.ArticleGroupName = @"大咖讲座";
- // gModel.IsSelect = NO;
- // [self.myChannel addObject:gModel];
- }
- #pragma mark - 分享成功跳转
- - (void)shareReturnAction:(NSNotification *)noti
- {
- NSDictionary * dic = noti.userInfo;
- CollectModelType type = [[dic objectForKey:@"type"] intValue];
- NSInteger Id = [[dic objectForKey:@"Id"] integerValue];
- NSInteger userId = [[dic objectForKey:@"userId"] integerValue];
- NSString* name = [[dic objectForKey:@"name"] stringByRemovingPercentEncoding];
- // NSString* describe = [[dic objectForKey:@"describe"] stringByRemovingPercentEncoding];
- switch (type) {
- case CollectModel_Aritle:
- {
- MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
- vc.type = CollectModel_Aritle;
- vc.Id = Id;
- vc.hidesBottomBarWhenPushed = YES;
- [self.navigationController pushViewController:vc animated:YES];
- }
- break;
- case CollectModel_work:
- {
- MyApprovalPageDetail * vc = [[MyApprovalPageDetail alloc]init];
- vc.indexId = Id;
- vc.title = name;
- vc.TodoId = Id;
- vc.hidesBottomBarWhenPushed = YES;
- [self.navigationController pushViewController:vc animated:YES];
- }
- break;
- case CollectModel_Toipc:
- {
- MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
- vc.Id = Id;
- vc.type = CollectModel_Toipc;
- vc.hidesBottomBarWhenPushed = YES;
- [self.navigationController pushViewController:vc animated:YES];
- }
- break;
- case CollectModel_NewTopic:
- {
- MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
- vc.Id = Id;
- vc.type = CollectModel_NewTopic;
- vc.hidesBottomBarWhenPushed = YES;
- [self.navigationController pushViewController:vc animated:YES];
- }
- break;
- case CollectModel_Notice:
- {
- MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
- vc.Id = Id;
- vc.type = CollectModel_Notice;
- vc.hidesBottomBarWhenPushed = YES;
- [self.navigationController pushViewController:vc animated:YES];
- }
- break;
- case CollectModel_InterMail:
- {
- MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
- vc.Id = Id;
- vc.type = CollectModel_InterMail;
- vc.hidesBottomBarWhenPushed = YES;
- [self.navigationController pushViewController:vc animated:YES];
- }
- break;
- case CollectModel_NoSignMail:
- {
- MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
- vc.Id = Id;
- vc.type = CollectModel_NoSignMail;
- vc.hidesBottomBarWhenPushed = YES;
- [self.navigationController pushViewController:vc animated:YES];
- }
- break;
- case CollectModel_NoteBook:
- {
- MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
- vc.Id = Id;
- vc.type = CollectModel_NoteBook;
- vc.hidesBottomBarWhenPushed = YES;
- [self.navigationController pushViewController:vc animated:YES];
- }
- break;
- case CollectModel_meetMian:
- {
- MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
- vc.Id = Id;
- vc.type = CollectModel_meetMian;
- vc.hidesBottomBarWhenPushed = YES;
- [self.navigationController pushViewController:vc animated:YES];
- }
- break;
- case CollectModel_meetDetail:
- {
- WorkFlowDetailsController *vc = [[WorkFlowDetailsController alloc] initWithId:Id];
- vc.hidesBottomBarWhenPushed = YES;
- [self.navigationController pushViewController:vc animated:YES];
- }
- break;
- case CollectModel_CollectFile:{
- if (userId == [AppUserModel sharedAppUserModel].Id || userId == 0) {
- MyFavoriteVC *vc = [MyFavoriteVC initMyFavoriteVC];
- vc.listType = Id == 0 ? MyFavoriteListLevelTypeA : MyFavoriteListLevelTypeB;
- vc.ParentId = Id;
- vc.FolderId = Id;
- vc.myTitle = name;
- vc.hidesBottomBarWhenPushed = YES;
- [self.navigationController pushViewController:vc animated:YES];
- }else{
- OtherFavoriteVC *vc = [OtherFavoriteVC initOtherFavoriteVC];
- vc.listType = Id == 0 ? MyFavoriteListLevelTypeA : MyFavoriteListLevelTypeB;
- vc.ParentId = Id;
- vc.FolderId = Id;
- vc.myTitle = name;
- vc.VisitUserId = userId;
- vc.hidesBottomBarWhenPushed = YES;
- [self.navigationController pushViewController:vc animated:YES];
- }
- }break;
- case CollectModel_NoteFile:{
- if (userId == [AppUserModel sharedAppUserModel].Id || userId == 0) {
- NoteBookVC *vc = [NoteBookVC initNoteBookVC];
- vc.listType = Id == 0 ? MyFavoriteListLevelTypeA : MyFavoriteListLevelTypeB;
- vc.ParentId = Id;
- vc.FolderId = Id;
- vc.myTitle = name;
- vc.VisitUserId = 0;
- [self.navigationController pushViewController:vc animated:YES];
- }else{
- OtherNoteBookVC *vc = [OtherNoteBookVC initOtherNoteBookVC];
- vc.listType = Id == 0 ? MyFavoriteListLevelTypeA : MyFavoriteListLevelTypeB;
- vc.ParentId = Id;
- vc.FolderId = Id;
- vc.myTitle = name;
- vc.VisitUserId = userId;
- vc.hidesBottomBarWhenPushed = YES;
- [self.navigationController pushViewController:vc animated:YES];
- }
- }break;
- case CollectModel_TopicBooK:{
- if (userId == [AppUserModel sharedAppUserModel].Id || userId == 0) {
- NoteBookVC *vc = [NoteBookVC initNoteBookVC];
- vc.listType = MyFavoriteListLevelTypeA;
- vc.ParentId = 0;
- vc.FolderId = Id;
- vc.myTitle = name;
- vc.VisitUserId = 0;
- vc.TypeValue = 1;
- [self.navigationController pushViewController:vc animated:YES];
- }else{
- OtherNoteBookVC *vc = [OtherNoteBookVC initOtherNoteBookVC];
- vc.listType = MyFavoriteListLevelTypeA;
- vc.ParentId = 0;
- vc.FolderId = Id;
- vc.myTitle = name;
- vc.VisitUserId = userId;
- vc.TypeValue = 1;
- vc.hidesBottomBarWhenPushed = YES;
- [self.navigationController pushViewController:vc animated:YES];
- }
- }break;
- case CollectModel_TopicSubBooK:{
- if (userId == [AppUserModel sharedAppUserModel].Id || userId == 0) {
- NoteBookVC *vc = [NoteBookVC initNoteBookVC];
- vc.listType = MyFavoriteListLevelTypeB;
- vc.ParentId = Id;
- vc.FolderId = Id;
- vc.myTitle = name;
- vc.VisitUserId = 0;
- vc.TypeValue = 1;
- [self.navigationController pushViewController:vc animated:YES];
- }else{
- OtherNoteBookVC *vc = [OtherNoteBookVC initOtherNoteBookVC];
- vc.listType = MyFavoriteListLevelTypeB;
- vc.ParentId = Id;
- vc.FolderId = Id;
- vc.myTitle = name;
- vc.VisitUserId = userId;
- vc.TypeValue = 1;
- vc.hidesBottomBarWhenPushed = YES;
- [self.navigationController pushViewController:vc animated:YES];
- }
- }break;
- default:
- break;
- }
- }
- - (void)addChannelAction:(UIButton *)sender
- {
- [self didClickAddButtonChannel];
- }
- - (void)musicAction:(UIButton *)sender
- {
- [[HKFloatManager shared] showVideo];
-
- }
- - (TDButton *)addButton {
- if (!_addButton) {
- _addButton = [TDButton buttonWithType:UIButtonTypeCustom];
- [_addButton setImage:IMG(@"home_pdAdd_icon") forState:UIControlStateNormal];
- [_addButton addTarget:self action:@selector(addChannelAction:) forControlEvents:UIControlEventTouchUpInside];
- [_addButton setCurrentButtonHotSize:CGSizeZero];
- }
- return _addButton;
- }
- - (TDButton *)musicButtton {
- if (!_musicButtton) {
- _musicButtton = [TDButton buttonWithType:UIButtonTypeCustom];
- [_musicButtton setImage:IMG(@"home_music_icon") forState:UIControlStateNormal];
- [_musicButtton addTarget:self action:@selector(musicAction:) forControlEvents:UIControlEventTouchUpInside];
- [_musicButtton setCurrentButtonHotSize:CGSizeZero];
- }
- return _musicButtton;
- }
- - (UIView *)lineV
- {
- if (!_lineV) {
- _lineV = [UIView new];
- _lineV.backgroundColor = UIColorHex(0xD8D8D8);
- }
- return _lineV;
- }
- - (UIView *)rightView
- {
- if (!_rightView) {
- _rightView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 88.5, 45)];
- _rightView.backgroundColor = UIColorHex(0xFFFFFF);
- }
- return _rightView;
- }
- - (UIView *)setRightView
- {
- [self.rightView removeAllSubviews];
- [self.rightView addSubview:self.addButton];
- [self.rightView addSubview:self.musicButtton];
- [self.rightView addSubview:self.lineV];
- [self.addButton setFrame:CGRectMake(0, 0, 44, 45)];
- [self.lineV setFrame:CGRectMake(44, 13.5, 0.5, 18)];
- [self.musicButtton setFrame:CGRectMake(44.5, 0, 44, 45)];
- return self.rightView;
- }
- #pragma mark - JPushToVC
- - (void)JPushToVC:(NSNotification *)noti
- {
- PushModel * model = [PushModel modelWithDictionary:noti.userInfo];
- switch (model.mediaType) {
- case CollectModel_Chat:
- {
- ChatMsgListVC * vc = [ChatMsgListVC initChatMsgListVC];
- vc.pModel = model;
- vc.isPush = YES;
- vc.hidesBottomBarWhenPushed = YES;
- [self.navigationController pushViewController:vc animated:NO];
- }
- break;
- case CollectModel_work:
- {
- [self pushWorkVCwithModel:model];
- }
- break;
- case CollectModel_MeShen:
- {
- [self pushWorkVCwithModel:model];
- }
- break;
- case CollectModel_MeChao:
- {
- [self pushWorkVCwithModel:model];
- }
- break;
- case CollectModel_System:
- {
- [self pushWorkVCwithModel:model];
- }
- break;
- case CollectModel_Verify:
- {
- ChatTestingVC * vc = [ChatTestingVC initChatTestingVC];
- vc.hidesBottomBarWhenPushed = YES;
- [self.navigationController pushViewController:vc animated:YES];
- }
- break;
- case CollectModel_ReplayMe:
- {
- ReplayMeVC * vc = [ReplayMeVC initReplayMeVC];
- vc.hidesBottomBarWhenPushed = YES;
- [self.navigationController pushViewController:vc animated:YES];
- }
- break;
- default:
- {
- MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
- vc.Id = model.sourceId;
- vc.type = model.mediaType;
- vc.hidesBottomBarWhenPushed = YES;
- [self.navigationController pushViewController:vc animated:YES];
- }
- break;
- }
- }
- - (void)pushWorkVCwithModel:(PushModel *)model
- {
- MyApprovalPageDetail * vc = [[MyApprovalPageDetail alloc]init];
- vc.pageType = Type_ONEC;
- vc.indexId = model.sourceId;
- [self.navigationController pushViewController:vc animated:YES];
- }
- #pragma mark - ScanResult
- - (void)scanResult:(NSString *)scanStr{
- ScanResultModel *model = [[ScanResultModel alloc]initWithString:scanStr error:nil];
- NSLog(@"%@",model);
- WEAKSELF
- switch (model.key) {
- case 1:// 用户
- {
- [self scanNetWork:model.value urlStrong:SaoYiSao_Post ScanKey:@"Guid" success:^(id responseObject) {
- NSDictionary *dic = responseObject;
- AddressUserModel *model = [[AddressUserModel alloc] initWithDictionary:dic error:nil];
- dispatch_async(dispatch_get_main_queue(), ^{
- MailListDetailVC *vc = [MailListDetailVC initMailListDetailVC];
- vc.indexId = model.Id;
- vc.isAdd = YES;
- [weakSelf.navigationController pushViewController:vc animated:YES];
- });
- } failure:^(NSError *error) {
- SHOWERROR([ZYCTool handerResultData:error]);
- }];
- }
- break;
- case 2:// 群聊
- {
- [self scanToNetWork:model.value urlStrong:SaoYiSao2_Post success:^(id responseObject) {
- ChatJoinGroupVC * vc = [ChatJoinGroupVC initChatJoinGroupVC];
- vc.dict = responseObject;
- [weakSelf.navigationController pushViewController:vc animated:YES];
- } failure:^(NSError *error) {
- SHOWERROR([ZYCTool handerResultData:error]);
- }];
- }
- break;
- case 3://小组
- {
- [self scanToNetWork:model.value urlStrong:SaoYiSao3_Post success:^(id responseObject) {
- if ([responseObject[@"IsUser"] boolValue]) {
- TDGroupInfoListVC * vc = [TDGroupInfoListVC initTDGroupInfoListVC];
- vc.GroupId = [responseObject[@"Id"] integerValue];
- vc.titleStr = responseObject[@"Name"];
- [weakSelf.navigationController pushViewController:vc animated:YES];
- }else{
- dispatch_async(dispatch_get_main_queue(), ^{
- TDQrJoinVC * vc = [TDQrJoinVC initTDQrJoinVC];
- vc.dict = responseObject;
- [weakSelf.navigationController pushViewController:vc animated:YES];
- });
- }
- } failure:^(NSError *error) {
- SHOWERROR([ZYCTool handerResultData:error]);
- }];
- }
- break;
- case 4://扫码登录
- {
- LoginPCVC * vc = [[LoginPCVC alloc] init];
- vc.key = model.value;
- vc.modalPresentationStyle = UIModalPresentationFullScreen;
- [self presentViewController:vc animated:YES completion:^{
-
- }];
- }
- break;
- default:
- break;
- }
- }
- - (void)scanNetWork:(NSString *)scanStr urlStrong:(NSString *)urlstring ScanKey:(NSString*)key success:(void (^) (id responseObject))successful failure:(void (^) (NSError *error))failure{
- SHOWLOADING
- [[HttpManager sharedHttpManager] POSTUrl:[NSString stringWithFormat:@"%@%@",BaseUrl,urlstring] parameters:@{key:scanStr} responseStyle:JOSN success:^(id _Nonnull responseObject) {
- successful(responseObject);
- REMOVESHOW
- } failure:^(NSError * _Nonnull error) {
- REMOVESHOW
- failure(error);
- }];
- }
- - (void)scanToNetWork:(NSString *)scanStr urlStrong:(NSString *)urlstring success:(void (^) (id responseObject))successful failure:(void (^) (NSError *error))failure{
- SHOWLOADING
- NSString * url = [NSString stringWithFormat:@"%@%@",Host(urlstring),scanStr];
- [[HttpManager sharedHttpManager] GETUrl:url parameters:@{} success:^(id _Nonnull responseObject) {
- REMOVESHOW
- successful(responseObject);
- } failure:^(NSError * _Nonnull error) {
- REMOVESHOW
- }];
- }
- @end
|