12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808 |
- //
- // SourceHomeVC.m
- // smartRhino
- //
- // Created by niuzhen on 2020/5/6.
- // Copyright © 2020 tederen. All rights reserved.
- //
- #import "SourceHomeVC.h"
- #import "MyTDGroupView.h"
- #import "GHRefreshCollectionView.h"
- #import "ChatMsgListCell.h"
- #import "ChatMsgCollectionCell.h"
- #import "TDGroupInfoListModel.h"
- #import "TDGroupInfoListCell.h"
- #import "NoteBookVC.h"
- #import "OtherNoteBookVC.h"
- #import "MailListDetailVC.h"
- #import "MyFavoriteVC.h"
- #import "MyTDGroupViewController.h"
- #import "MoveViewController.h"
- #import "OtherFavoriteVC.h"
- #import "TDGroupInfoListVC.h"
- #import "WorkFlowDetailsController.h"
- #import "MyApprovalPageDetail.h"
- #import "DownFileViewController.h"
- #import "ShareListVC.h"
- #import "TDInterLeterHomeViewController.h"
- #import "MyTDTopicViewController.h"
- #import "MailListVC.h"
- #import "WaitWorkVC.h"
- #import "MyTDTopicSearchVC.h"
- #import "NoteBookShareVC.h"
- #import "SourceGroupVC.h"
- #import "ChatMsgListVC.h"
- #import "ShowBtn.h"
- #import "MenuListView.h"
- #import "TopicGroupManageModel.h"
- #import "MyTDTopicGroupManageVC.h"
- #import "WorkNumberModel.h"
- #import "MyTDTopicBookVC.h"
- #import "AddLookUpUserSecondVC.h"
- #import "BookWCDetailVC.h"
- #import "BookListenVC.h"
- @interface SourceHomeVC ()<UITableViewDelegate,UITableViewDataSource,UICollectionViewDelegate,UICollectionViewDataSource,NoteBookShareVCDelegate,UIScrollViewDelegate,EMChatManagerDelegate, EMGroupManagerDelegate, EMConversationsDelegate,AddLookUpUserSecondVCDelegate>
- @property (weak, nonatomic) IBOutlet UITableView *tableView;
- @property (strong, nonatomic) UIView *HeadView;
- @property (strong, nonatomic) MyTDGroupView *SearchView;
- @property (strong, nonatomic) NSMutableArray *dataArray;
- @property (strong, nonatomic) NSMutableArray *collectionDataSource;
- @property (strong, nonatomic) NSMutableArray *selectGIdArray;
- @property (strong, nonatomic) NSMutableArray *groupListArray;
- @property (nonatomic, strong) GHRefreshCollectionView *collectionView;
- @property (strong, nonatomic) NoteBookShareVC *noteBookShareVC;
- @property (strong, nonatomic) FlowAttachmentsModel *sendModel;
- @property (assign, nonatomic) BOOL isReturn;
- @property (strong, nonatomic) ShowBtn *showBtn;
- @property (strong, nonatomic) MenuListView *menuListView;
- @property (assign, nonatomic) BOOL menuIsShow;
- @property (assign, nonatomic) CGFloat setY;
- @property (strong, nonatomic) UIView *sectionView;
- @property (assign, nonatomic) NSInteger currentPage;
- @property (assign, nonatomic) NSInteger totalPage;
- @property (strong, nonatomic) NSMutableArray *chatListIMArray;
- @property (strong, nonatomic) NSMutableArray *ImArray;
- @property (assign, nonatomic) NSInteger unReadCount;
- @property (strong, nonatomic) WorkNumberModel * numModel;
- @property (copy, nonatomic) NSString * listName;
- @property (strong,nonatomic) UILabel * noDataL;
- @property (assign, nonatomic) BOOL GroupNoUser;
- @end
- @implementation SourceHomeVC
- - (void)viewWillDisappear:(BOOL)animated
- {
- [super viewWillDisappear:animated];
- [self.showBtn dismissCom];
- self.menuIsShow = NO;
- [self.menuListView dismiss];
- }
- - (BOOL)hidesBottomBarWhenPushed{
- return NO;
- }
- - (UIView *)HeadView
- {
- if (!_HeadView) {
- _HeadView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 46)];
- _HeadView.backgroundColor = [UIColor whiteColor];
- }
- return _HeadView;
- }
- - (MyTDGroupView *)SearchView
- {
- if (!_SearchView) {
- _SearchView = [[MyTDGroupView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 36)];
- }
- return _SearchView;
- }
- -(NSMutableArray *)collectionDataSource{
- if(!_collectionDataSource){
- _collectionDataSource = [[NSMutableArray alloc] init];
- }
- return _collectionDataSource;
- }
- -(NSMutableArray *)dataArray{
- if(!_dataArray){
- _dataArray = [[NSMutableArray alloc] init];
- }
- return _dataArray;
- }
- -(NSMutableArray *)selectGIdArray{
- if(!_selectGIdArray){
- _selectGIdArray = [[NSMutableArray alloc] init];
- }
- return _selectGIdArray;
- }
- -(NSMutableArray *)groupListArray{
- if(!_groupListArray){
- _groupListArray = [[NSMutableArray alloc] init];
- }
- return _groupListArray;
- }
- - (ShowBtn *)showBtn
- {
- if (!_showBtn) {
- _showBtn = [ShowBtn new];
- }
- return _showBtn;
- }
- - (GHRefreshCollectionView *)collectionView {
- if (!_collectionView) {
- UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
- layout.scrollDirection = UICollectionViewScrollDirectionHorizontal;
- layout.sectionInset = UIEdgeInsetsMake(0, 0, 0, 0);
- _collectionView = [[GHRefreshCollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:layout];
- _collectionView.delegate = self;
- _collectionView.dataSource = self;
- _collectionView.showsHorizontalScrollIndicator = NO;
- [_collectionView registerNib:[UINib nibWithNibName:@"ChatMsgCollectionCell" bundle:nil] forCellWithReuseIdentifier:@"ChatMsgCollectionCell"];
- _collectionView.backgroundColor = [UIColor whiteColor];
- }
- return _collectionView;
- }
- - (void)getUnreadCount
- {
- WS(weakSelf);
- [[HttpManager sharedHttpManager] GETUrl:Host(API_APP_User_User_Uread_Count) parameters:@{} responseStyle:JOSN success:^(id _Nonnull responseObject) {
- NSDictionary *dic = responseObject;
- weakSelf.numModel = [[WorkNumberModel alloc] initWithDictionary:dic error:nil];
- dispatch_async(dispatch_get_main_queue(), ^{
- [weakSelf initChatMsgIMData];
- });
- } failure:^(NSError * _Nonnull error) {
- }];
- }
- -(void)initChatMsgIMData{
- self.chatListIMArray = [NSMutableArray array];
- WS(weakSelf);
- [[HttpManager sharedHttpManager] POSTUrl:Host(Often_Contact_List) parameters:@{@"IndividualGroupId":@(0)} responseStyle:JOSN success:^(id _Nonnull responseObject) {
- NSLog(@"%@",responseObject);
- 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) {
- NSLog(@"%@",error);
- }];
- }
- - (void)_loadAllConversationsFromDBWithIsShowHud:(BOOL)aIsShowHUD
- {
- __weak typeof(self) weakself = self;
- self.ImArray = [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.ImArray addObjectsFromArray:models];
- [weakself replaceChatData];
- });
- }
- - (void)replaceChatData
- {
- WS(weakSelf);
- self.unReadCount = 0;
- [self.chatListIMArray enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
- ChatMsgListImModel * chatModel = (ChatMsgListImModel *)obj;
- [weakSelf.ImArray 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_async(dispatch_get_main_queue(), ^{
- weakSelf.numModel.UReadChatCount = weakSelf.numModel.UReadChatCount + weakSelf.unReadCount;
- NSInteger count = weakSelf.numModel.allNumber + weakSelf.numModel.UReadChatCount;
- weakSelf.tabBarController.tabBar.items[2].badgeValue = count > 0 ? [NSString stringWithFormat:@"%ld",(long)count] : nil;
- [weakSelf initCollectionData:weakSelf.numModel];
- });
- }
- - (void)viewWillAppear:(BOOL)animated
- {
- [super viewWillAppear:animated];
- [self getUnreadCount];
- }
- - (void)conversationListDidUpdate:(NSArray *)aConversationList
- {
- [self _loadAllConversationsFromDBWithIsShowHud:NO];
- }
- - (void)messagesDidReceive:(NSArray *)aMessages
- {
- [self performSelector:@selector(getUnreadCount) withObject:nil afterDelay:0.8];
- }
- - (void)setTableRefresh
- {
- WS(weakSelf);
- self.tableView.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
- [weakSelf headRefresh];
- }];
- self.tableView.mj_footer = [MJRefreshAutoNormalFooter footerWithRefreshingBlock:^{
- [weakSelf footerRefresh];
- }];
- [self.tableView.mj_header beginRefreshing];
- }
- - (void)headRefresh{
- self.currentPage = 1;
- self.totalPage = 1;
- [self.dataArray removeAllObjects];
- [self getData];
- }
- - (void)footerRefresh{
- self.currentPage += 1;
- if (self.totalPage == self.dataArray.count) {
- self.currentPage --;
- [self.tableView.mj_footer endRefreshingWithNoMoreData];
- self.tableView.mj_footer.hidden = YES;
- return;
- }
- [self getData];
- }
- - (void)viewDidLoad {
- [super viewDidLoad];
- [self setTableRefresh];
- [[EMClient sharedClient].chatManager addDelegate:self delegateQueue:nil];
- [[EMClient sharedClient].groupManager addDelegate:self delegateQueue:nil];
- [[EMConversationHelper shared] addDelegate:self];
- self.fd_prefersNavigationBarHidden = YES;
- self.view.backgroundColor = RGB(240, 239, 244);
- self.tableView.delegate = self;
- self.tableView.dataSource = self;
- self.tableView.backgroundColor = [UIColor whiteColor];
- [self.HeadView addSubview:self.SearchView];
- [self.SearchView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.mas_offset(5);
- make.left.right.mas_equalTo(self.HeadView);
- make.height.mas_offset(36);
- }];
- WS(weakSelf);
- [self.SearchView.button setAction:^{
- [weakSelf pushSearchVC];
- }];
- self.tableView.tableHeaderView = self.HeadView;
- [self setShowData];
- [self addSubNoDataL];
- [[UtilsTools getWindow] addSubview:self.noteBookShareVC.view];
- [[UtilsTools getWindow] bringSubviewToFront:self.noteBookShareVC.view];
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(pushSubViewController:) name:DRAWERPUSHVC object:nil];
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(headRefresh) name:DRAFTUPDATESUCCESS object:nil];
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(recviveChaoSongRen:) name:NOTIFI_ChaoSongRen object:nil];
- }
- - (void)getData
- {
- WS(weakSelf);
- NSDictionary * paraDict = @{@"ParentId":@(0),
- @"UserId":@([AppUserModel sharedAppUserModel].Id),
- @"Keyword": @"",
- @"Page":@(self.currentPage),
- @"TopicGroupIds": self.selectGIdArray,
- @"PerPage": @(10),
- @"Sort":@""
- };
- SHOWLOADING
- [[HttpManager sharedHttpManager] POSTUrl:Host(APP_Topic_List_Page) parameters:paraDict responseStyle:JOSN success:^(id _Nonnull responseObject) {
- NSLog(@"%@",responseObject);
- REMOVESHOW
- [weakSelf.tableView.mj_header endRefreshing];
- [weakSelf.tableView.mj_footer endRefreshing];
- TopicListModel * model = [TopicListModel modelWithDictionary:responseObject];
- weakSelf.totalPage = model.Total;
- [weakSelf.dataArray addObjectsFromArray:model.Items];
- dispatch_async(dispatch_get_main_queue(), ^{
- if (weakSelf.dataArray.count == 0) {
- [weakSelf.tableView.mj_footer endRefreshingWithNoMoreData];
- weakSelf.tableView.mj_footer.hidden = YES;
- weakSelf.noDataL.hidden = NO;
- [weakSelf setNoDataMsg:weakSelf.GroupNoUser];
- }else{
- weakSelf.noDataL.hidden = YES;
- }
- // [weakSelf.collectionView reloadData];
- [weakSelf.tableView reloadData];
- });
- } failure:^(NSError * _Nonnull error) {
- REMOVESHOW
- [weakSelf.tableView.mj_header endRefreshing];
- [weakSelf.tableView.mj_footer endRefreshing];
- }];
- }
- - (UILabel *)noDataL
- {
- if (!_noDataL) {
- _noDataL = [UILabel new];
- }
- return _noDataL;
- }
- - (void)addSubNoDataL
- {
- [self.view addSubview:self.noDataL];
- [self.noDataL mas_makeConstraints:^(MASConstraintMaker *make) {
- make.center.mas_equalTo(self.view);
- }];
- self.noDataL.hidden = YES;
- WS(weakSelf);
- UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithActionBlock:^(id _Nonnull sender) {
- [weakSelf AddGroupUser];
- }];
- [self.noDataL addGestureRecognizer:tap];
- [self.noDataL bringSubviewToFront:self.tableView];
- self.noDataL.hidden = YES;
- self.noDataL.userInteractionEnabled = YES;
- }
- - (void)setNoDataMsg:(BOOL)noUser
- {
- if (noUser) {
- NSString * str = @"该分组还没有人,快去 添加 吧";
- NSMutableAttributedString * astr = [[NSMutableAttributedString alloc] initWithString:str];
- [astr addAttribute:NSFontAttributeName value:[UIFont fontWithName:@"PingFang SC" size:16] range:NSMakeRange(0, str.length)];
- [astr addAttribute:NSForegroundColorAttributeName value:UIColorHex(0x666666) range:NSMakeRange(0, str.length)];
- [astr addAttribute:NSForegroundColorAttributeName value:UIColorHex(0x1E7AB9) range:NSMakeRange(11, 2)];
- NSMutableParagraphStyle *paraStyle = [[NSMutableParagraphStyle alloc]init];
- paraStyle.alignment = NSTextAlignmentCenter;
- [astr addAttribute:NSParagraphStyleAttributeName value:paraStyle range:NSMakeRange(0, str.length)];
- self.noDataL.attributedText = astr;
- }else{
- NSString * str = @"暂无话题内容";
- NSMutableAttributedString * astr = [[NSMutableAttributedString alloc] initWithString:str];
- [astr addAttribute:NSFontAttributeName value:[UIFont fontWithName:@"PingFang SC" size:16] range:NSMakeRange(0, str.length)];
- [astr addAttribute:NSForegroundColorAttributeName value:UIColorHex(0x666666) range:NSMakeRange(0, str.length)];
- // [astr addAttribute:NSForegroundColorAttributeName value:UIColorHex(0x1E7AB9) range:NSMakeRange(11, 2)];
- NSMutableParagraphStyle *paraStyle = [[NSMutableParagraphStyle alloc]init];
- paraStyle.alignment = NSTextAlignmentCenter;
- [astr addAttribute:NSParagraphStyleAttributeName value:paraStyle range:NSMakeRange(0, str.length)];
- self.noDataL.attributedText = astr;
- }
- }
- - (void)AddGroupUser
- {
- if (self.GroupNoUser) {
- AddLookUpUserSecondVC *vc = [[AddLookUpUserSecondVC alloc] init];
- vc.titleStr = @"选人";
- vc.isDefalutPage = 1;
- vc.delegate = self;
- USERDEFAULTSSET([NSMutableArray array], MAILSELECT);
- [self.navigationController pushViewController:vc animated:YES];
- }
- }
- #pragma mark - 注册通知 接受抄送人和审批人数据
- - (void)recviveChaoSongRen:(NSNotification *)notification{
- NSMutableArray * addArray = [NSMutableArray array];
- NSMutableArray <SelectModel *>* array = notification.userInfo[@"selectPeople"];
- for (SelectModel * model in array) {
- [addArray addObject:@(model.UserId)];
- }
- if (self.selectGIdArray.count > 0) {
- NSInteger Id = [self.selectGIdArray.firstObject integerValue];
- NSDictionary * paraDict = @{@"UserIds":addArray,
- @"TopicGroupId":@(Id)
- };
- SHOWLOADING
- [[HttpManager sharedHttpManager] POSTUrl:Host(APP_Topic_Add_Group_User) parameters:paraDict responseStyle:DATA success:^(id _Nonnull responseObject) {
- REMOVESHOW
- NSLog(@"添加人员成功");
- } failure:^(NSError * _Nonnull error) {
- REMOVESHOW
- SHOWERROR([ZYCTool handerResultData:error])
- }];
- }
- }
- -(void)initCollectionData:(WorkNumberModel *)numModel{
- [self.collectionDataSource removeAllObjects];
- NSMutableArray * array = [NSMutableArray array];
- for (int i= 0;i < 4; i++) {
- MoreAppInfoModel *model = [[MoreAppInfoModel alloc] init];
- switch (i) {
- case 0:{
- model.title = @"收件箱";
- model.imgName = @"chatmsg_znx_icon";
- model.notImgName = @"chatmsg_tz_hui_icon";
- model.type = ChatMenuZhanXinType;
- model.readNum = numModel.FlowAuditUReadCount + numModel.FlowSendUReadCount + numModel.FlowCcUReadCount + numModel.noticeCount + numModel.missiveCount;
- model.showEditFlag = YES;
- }break;
- case 1:{
- model.title = @"小组";
- model.imgName = @"chatmsg_xiaozu_icon";
- model.notImgName = @"chatmsg_tz_hui_icon";
- model.type = ChatMenuGroupType;
- model.readNum = 0;
- model.showEditFlag = YES;
- }break;
- case 2:{
- model.title = @"待办事项";
- model.imgName = @"chatmsg_dbsx_icon";
- model.notImgName = @"chatmsg_tz_hui_icon";
- model.type = ChatMenuWaitType;
- model.readNum = numModel.WaitHandleUFinishCount;
- model.showEditFlag = YES;
- }break;
- default:{
- model.title = @"私信";
- model.imgName = @"Common_sixin_icon";
- model.notImgName = @"Common_sixin_icon";
- model.type = ChatMenuSiXinType;
- model.readNum = numModel.UReadChatCount;
- model.showEditFlag = YES;
- }break;
- }
- [array addObject:model];
- }
- self.collectionDataSource = array;
- [self.collectionView reloadData];
- }
- #pragma mark - UITableViewDelegate
- - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
- return 2;
- }
- - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
- switch (section) {
- case 0:{
- return 1;
- }break;
- default:{
- return self.dataArray.count;
- }break;
- }
- }
- - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
- switch (indexPath.section) {
- case 0:{
- return 80.f;
- }break;
- default:{
- return UITableViewAutomaticDimension;
- }break;
- }
- }
- - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
- {
- switch (section) {
- case 0:{
- return 0.f;
- }break;
- default:{
- return 36.f;
- }break;
- }
- }
- - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
- {
- WS(weakSelf);
- CGFloat width = (SCREEN_WIDTH - 20) * 0.25;
- UILabel * testL = [UILabel new];
- testL.font = [UIFont systemFontOfSize:15];
- testL.text = @"收件箱";
- UILabel * testBtnL = [UILabel new];
- testBtnL.font = [UIFont systemFontOfSize:15];
- testBtnL.text = @"私信";
- switch (section) {
- case 0:{
- UIView * view = [UIView new];
- return view;
- }break;
- default:{
- self.sectionView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 36)];
- self.sectionView.backgroundColor = UIColorHex(0xF5F5F5);
- UILabel * label = [UILabel new];
- label.font = [UIFont systemFontOfSize:15];
- label.textColor = UIColorHex(0x009AFF);
- label.text = @"话题本";
- [self.sectionView addSubview:label];
- CGFloat w = [testL sizeThatFits:CGSizeMake(SCREEN_WIDTH, 20)].width;
- CGFloat left = (width - w) * 0.5 + 10;
- [label mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_offset(left);
- make.centerY.mas_equalTo(self.sectionView);
- }];
- UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithActionBlock:^(id _Nonnull sender) {
- MyTDTopicBookVC * vc = [MyTDTopicBookVC initMyTDTopicBookVC];
- [weakSelf.navigationController pushViewController:vc animated:YES];
- }];
- label.userInteractionEnabled = YES;
- [label addGestureRecognizer:tap];
- UIButton * btn = [UIButton new];
- [self.sectionView addSubview:btn];
- [btn setImage:IMG(@"ChatMsg_topic_create") forState:UIControlStateNormal];
- CGFloat r = [testBtnL sizeThatFits:CGSizeMake(SCREEN_WIDTH, 20)].width;
- CGFloat right = (width - r) * 0.5 - 0.5;
- [btn mas_makeConstraints:^(MASConstraintMaker *make) {
- make.right.mas_offset(-right);
- make.centerY.mas_equalTo(self.sectionView);
- make.size.mas_offset(CGSizeMake(36, 36));
- }];
- WS(weakSelf);
- [btn setAction:^{
- MyTDTopicCreateVC * vc = [MyTDTopicCreateVC initMyTDTopicCreateVC];
- vc.hidesBottomBarWhenPushed = YES;
- vc.type = CollectModel_NewTopic;
- vc.upDateBlock = ^{
- [weakSelf headRefresh];
- };
- [weakSelf.navigationController pushViewController:vc animated:YES];
- }];
- [self autoSizeBtn:self.listName.length > 0 ? self.listName : @"全部"];
- [self.sectionView addSubview:self.showBtn];
- [self.showBtn mas_makeConstraints:^(MASConstraintMaker *make) {
- make.center.mas_equalTo(self.sectionView);
- }];
- [self.sectionView layoutIfNeeded];
- return self.sectionView;
- }break;
- }
- }
- - (void)autoSizeBtn:(NSString *)title
- {
- [self.showBtn setcomTitle:title];
- }
- - (void)setShowData
- {
- [self getGroupList];
- self.menuIsShow = NO;
- WS(weakSelf);
- [self.showBtn setAction:^{
- if (!weakSelf.menuIsShow) {
- [weakSelf.menuListView show];
- [weakSelf.showBtn showCom];
- weakSelf.menuListView.SelectBtnblock = ^(NSArray * _Nonnull array) {
- [weakSelf.showBtn dismissCom];
- [weakSelf.selectGIdArray removeAllObjects];
- NSMutableString * showName = [[NSMutableString alloc] init];
- for (NSArray * subArray in array) {
- for (TopicGroupManageModel * model in subArray) {
- if (model.isSelect) {
- weakSelf.GroupNoUser = model.IncludeCount == 0 ? YES : NO;
- [showName appendString:model.Name];
- // [showName appendString:@"、"];
- [weakSelf.selectGIdArray addObject:@(model.Id)];
- }
- }
- }
- // if (showName.length > 1) {
- // [showName deleteCharactersInRange:NSMakeRange(showName.length - 1, 1)];
- // if (showName.length >= 10) {
- // NSRange range1 = NSMakeRange(8, showName.length - 8);
- // NSString *resultStr1 = [showName stringByReplacingCharactersInRange:range1 withString:@"..."];
- // [weakSelf autoSizeBtn:resultStr1];
- // }else{
- // [weakSelf autoSizeBtn:showName];
- // }
- // }
- weakSelf.listName = showName;
- // [weakSelf autoSizeBtn:showName];
- if (weakSelf.selectGIdArray.count > 0) {
- [weakSelf headRefresh];
- }
- };
- weakSelf.menuListView.dismissBlock = ^{
- [weakSelf.showBtn dismissCom];
- };
- weakSelf.menuListView.SelectGroupblock = ^{
- [weakSelf.showBtn dismissCom];
- weakSelf.menuIsShow = NO;
- [weakSelf.menuListView dismiss];
- MyTDTopicGroupManageVC * vc = [MyTDTopicGroupManageVC initMyTDTopicGroupManageVC];
- vc.RefreshListBlock = ^{
- [weakSelf getGroupList];
- };
- [weakSelf.navigationController pushViewController:vc animated:YES];
- };
- weakSelf.menuIsShow = YES;
- }else{
- weakSelf.menuIsShow = NO;
- [weakSelf.showBtn dismissCom];
- [weakSelf.menuListView dismiss];
- }
- }];
- }
- - (void)getGroupList
- {
- WS(weakSelf);
- [[HttpManager sharedHttpManager] GETUrl:Host(APP_Topic_Group) parameters:@{} responseStyle:JOSN success:^(id _Nonnull responseObject) {
- NSLog(@"======%@",responseObject);
- [weakSelf.groupListArray removeAllObjects];
- NSArray * array = responseObject;
- [array enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
- NSDictionary * dict = (NSDictionary *)obj;
- TopicGroupManageModel * model = [TopicGroupManageModel modelWithDictionary:dict];
- [weakSelf.groupListArray addObject:model];
- }];
- dispatch_async(dispatch_get_main_queue(), ^{
- weakSelf.menuListView = [MenuListView MenuListViewaddArray:@[weakSelf.groupListArray] height:162 + NAVH MenuType:MenuMoreSelectType];
- });
- } failure:^(NSError * _Nonnull error) {
- }];
- }
- - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
- WS(weakSelf);
- switch (indexPath.section) {
- case 0:
- {
- ChatMsgListCell *cell = [ChatMsgListCell configCell1:tableView indexPath:indexPath];
- [cell.cell1ContentBgView addSubview:self.collectionView];
- self.collectionView.frame = CGRectMake(0, 0, SCREEN_WIDTH, cell.cell1ContentBgView.height);
- 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.collectionView reloadData];
- });
- });
- return cell;
- }
- break;
- default:
- {
- TopicListItemModel * model = [self.dataArray objectAtIndex:indexPath.row];
- if (!model) {
- return [TDGroupInfoListCell configCell1:tableView indexPath:indexPath];
- }
- switch (model.DataType) {
- case TopiclistCellImage:
- {
- TDGroupInfoListCell * cell;
- switch (model.Data.count) {
- case 1:
- {
- cell = [TDGroupInfoListCell configCell1:tableView indexPath:indexPath];
- cell.cellImagV1.hidden = NO;
- cell.cellImagV2.hidden = YES;
- cell.cellImagV3.hidden = YES;
- cell.cellImagV4.hidden = YES;
- cell.cellImagV5.hidden = YES;
- cell.cellImagV6.hidden = YES;
- cell.cellImagV7.hidden = YES;
- cell.cellImagV8.hidden = YES;
- cell.cellImagV9.hidden = YES;
- TopicListSubModel * subModel0 = model.Data[0];
- [cell.cellImagV1 sd_setImageWithURL:[NSURL URLWithString:subModel0.File] placeholderImage:IMG(@"img_placeHolderVertical")];
- }
- break;
- case 2:
- {
- cell = [TDGroupInfoListCell configCell1:tableView indexPath:indexPath];
- cell.cellImagV1.hidden = NO;
- cell.cellImagV2.hidden = NO;
- cell.cellImagV3.hidden = YES;
- cell.cellImagV4.hidden = YES;
- cell.cellImagV5.hidden = YES;
- cell.cellImagV6.hidden = YES;
- cell.cellImagV7.hidden = YES;
- cell.cellImagV8.hidden = YES;
- cell.cellImagV9.hidden = YES;
- TopicListSubModel * subModel0 = model.Data[0];
- [cell.cellImagV1 sd_setImageWithURL:[NSURL URLWithString:subModel0.File] placeholderImage:IMG(@"img_placeHolderVertical")];
- TopicListSubModel * subModel1 = model.Data[1];
- [cell.cellImagV2 sd_setImageWithURL:[NSURL URLWithString:subModel1.File] placeholderImage:IMG(@"img_placeHolderVertical")];
- }
- break;
- case 3:
- {
- cell = [TDGroupInfoListCell configCell2:tableView indexPath:indexPath];
- cell.cellImagV1.hidden = NO;
- cell.cellImagV2.hidden = NO;
- cell.cellImagV3.hidden = NO;
- cell.cellImagV4.hidden = YES;
- cell.cellImagV5.hidden = YES;
- cell.cellImagV6.hidden = YES;
- cell.cellImagV7.hidden = YES;
- cell.cellImagV8.hidden = YES;
- cell.cellImagV9.hidden = YES;
- TopicListSubModel * subModel0 = model.Data[0];
- [cell.cellImagV1 sd_setImageWithURL:[NSURL URLWithString:subModel0.File] placeholderImage:IMG(@"img_placeHolderVertical")];
- TopicListSubModel * subModel1 = model.Data[1];
- [cell.cellImagV2 sd_setImageWithURL:[NSURL URLWithString:subModel1.File] placeholderImage:IMG(@"img_placeHolderVertical")];
- TopicListSubModel * subModel2 = model.Data[2];
- [cell.cellImagV3 sd_setImageWithURL:[NSURL URLWithString:subModel2.File] placeholderImage:IMG(@"img_placeHolderVertical")];
- }
- break;
- case 4:
- {
- cell = [TDGroupInfoListCell configCell3:tableView indexPath:indexPath];
- cell.cellImagV1.hidden = NO;
- cell.cellImagV2.hidden = NO;
- cell.cellImagV3.hidden = NO;
- cell.cellImagV4.hidden = NO;
- cell.cellImagV5.hidden = YES;
- cell.cellImagV6.hidden = YES;
- cell.cellImagV7.hidden = YES;
- cell.cellImagV8.hidden = YES;
- cell.cellImagV9.hidden = YES;
- TopicListSubModel * subModel0 = model.Data[0];
- [cell.cellImagV1 sd_setImageWithURL:[NSURL URLWithString:subModel0.File] placeholderImage:IMG(@"img_placeHolderVertical")];
- TopicListSubModel * subModel1 = model.Data[1];
- [cell.cellImagV2 sd_setImageWithURL:[NSURL URLWithString:subModel1.File] placeholderImage:IMG(@"img_placeHolderVertical")];
- TopicListSubModel * subModel2 = model.Data[2];
- [cell.cellImagV3 sd_setImageWithURL:[NSURL URLWithString:subModel2.File] placeholderImage:IMG(@"img_placeHolderVertical")];
- TopicListSubModel * subModel3 = model.Data[3];
- [cell.cellImagV4 sd_setImageWithURL:[NSURL URLWithString:subModel3.File] placeholderImage:IMG(@"img_placeHolderVertical")];
- }
- break;
- case 5:
- {
- cell = [TDGroupInfoListCell configCell4:tableView indexPath:indexPath];
- cell.cellImagV1.hidden = NO;
- cell.cellImagV2.hidden = NO;
- cell.cellImagV3.hidden = NO;
- cell.cellImagV4.hidden = NO;
- cell.cellImagV5.hidden = NO;
- cell.cellImagV6.hidden = YES;
- cell.cellImagV7.hidden = YES;
- cell.cellImagV8.hidden = YES;
- cell.cellImagV9.hidden = YES;
- TopicListSubModel * subModel0 = model.Data[0];
- [cell.cellImagV1 sd_setImageWithURL:[NSURL URLWithString:subModel0.File] placeholderImage:IMG(@"img_placeHolderVertical")];
- TopicListSubModel * subModel1 = model.Data[1];
- [cell.cellImagV2 sd_setImageWithURL:[NSURL URLWithString:subModel1.File] placeholderImage:IMG(@"img_placeHolderVertical")];
- TopicListSubModel * subModel2 = model.Data[2];
- [cell.cellImagV3 sd_setImageWithURL:[NSURL URLWithString:subModel2.File] placeholderImage:IMG(@"img_placeHolderVertical")];
- TopicListSubModel * subModel3 = model.Data[3];
- [cell.cellImagV4 sd_setImageWithURL:[NSURL URLWithString:subModel3.File] placeholderImage:IMG(@"img_placeHolderVertical")];
- TopicListSubModel * subModel4 = model.Data[4];
- [cell.cellImagV5 sd_setImageWithURL:[NSURL URLWithString:subModel4.File] placeholderImage:IMG(@"img_placeHolderVertical")];
- }
- break;
- case 6:
- {
- cell = [TDGroupInfoListCell configCell4:tableView indexPath:indexPath];
- cell.cellImagV1.hidden = NO;
- cell.cellImagV2.hidden = NO;
- cell.cellImagV3.hidden = NO;
- cell.cellImagV4.hidden = NO;
- cell.cellImagV5.hidden = NO;
- cell.cellImagV6.hidden = NO;
- cell.cellImagV7.hidden = YES;
- cell.cellImagV8.hidden = YES;
- cell.cellImagV9.hidden = YES;
- TopicListSubModel * subModel0 = model.Data[0];
- [cell.cellImagV1 sd_setImageWithURL:[NSURL URLWithString:subModel0.File] placeholderImage:IMG(@"img_placeHolderVertical")];
- TopicListSubModel * subModel1 = model.Data[1];
- [cell.cellImagV2 sd_setImageWithURL:[NSURL URLWithString:subModel1.File] placeholderImage:IMG(@"img_placeHolderVertical")];
- TopicListSubModel * subModel2 = model.Data[2];
- [cell.cellImagV3 sd_setImageWithURL:[NSURL URLWithString:subModel2.File] placeholderImage:IMG(@"img_placeHolderVertical")];
- TopicListSubModel * subModel3 = model.Data[3];
- [cell.cellImagV4 sd_setImageWithURL:[NSURL URLWithString:subModel3.File] placeholderImage:IMG(@"img_placeHolderVertical")];
- TopicListSubModel * subModel4 = model.Data[4];
- [cell.cellImagV5 sd_setImageWithURL:[NSURL URLWithString:subModel4.File] placeholderImage:IMG(@"img_placeHolderVertical")];
- TopicListSubModel * subModel5 = model.Data[5];
- [cell.cellImagV6 sd_setImageWithURL:[NSURL URLWithString:subModel5.File] placeholderImage:IMG(@"img_placeHolderVertical")];
- }
- break;
- case 7:
- {
- cell = [TDGroupInfoListCell configCell5:tableView indexPath:indexPath];
- cell.cellImagV1.hidden = NO;
- cell.cellImagV2.hidden = NO;
- cell.cellImagV3.hidden = NO;
- cell.cellImagV4.hidden = NO;
- cell.cellImagV5.hidden = NO;
- cell.cellImagV6.hidden = NO;
- cell.cellImagV7.hidden = NO;
- cell.cellImagV8.hidden = YES;
- cell.cellImagV9.hidden = YES;
- TopicListSubModel * subModel0 = model.Data[0];
- [cell.cellImagV1 sd_setImageWithURL:[NSURL URLWithString:subModel0.File] placeholderImage:IMG(@"img_placeHolderVertical")];
- TopicListSubModel * subModel1 = model.Data[1];
- [cell.cellImagV2 sd_setImageWithURL:[NSURL URLWithString:subModel1.File] placeholderImage:IMG(@"img_placeHolderVertical")];
- TopicListSubModel * subModel2 = model.Data[2];
- [cell.cellImagV3 sd_setImageWithURL:[NSURL URLWithString:subModel2.File] placeholderImage:IMG(@"img_placeHolderVertical")];
- TopicListSubModel * subModel3 = model.Data[3];
- [cell.cellImagV4 sd_setImageWithURL:[NSURL URLWithString:subModel3.File] placeholderImage:IMG(@"img_placeHolderVertical")];
- TopicListSubModel * subModel4 = model.Data[4];
- [cell.cellImagV5 sd_setImageWithURL:[NSURL URLWithString:subModel4.File] placeholderImage:IMG(@"img_placeHolderVertical")];
- TopicListSubModel * subModel5 = model.Data[5];
- [cell.cellImagV6 sd_setImageWithURL:[NSURL URLWithString:subModel5.File] placeholderImage:IMG(@"img_placeHolderVertical")];
- TopicListSubModel * subModel6 = model.Data[6];
- [cell.cellImagV7 sd_setImageWithURL:[NSURL URLWithString:subModel6.File] placeholderImage:IMG(@"img_placeHolderVertical")];
- }
- break;
- case 8:
- {
- cell = [TDGroupInfoListCell configCell5:tableView indexPath:indexPath];
- cell.cellImagV1.hidden = NO;
- cell.cellImagV2.hidden = NO;
- cell.cellImagV3.hidden = NO;
- cell.cellImagV4.hidden = NO;
- cell.cellImagV5.hidden = NO;
- cell.cellImagV6.hidden = NO;
- cell.cellImagV7.hidden = NO;
- cell.cellImagV8.hidden = NO;
- cell.cellImagV9.hidden = YES;
- TopicListSubModel * subModel0 = model.Data[0];
- [cell.cellImagV1 sd_setImageWithURL:[NSURL URLWithString:subModel0.File] placeholderImage:IMG(@"img_placeHolderVertical")];
- TopicListSubModel * subModel1 = model.Data[1];
- [cell.cellImagV2 sd_setImageWithURL:[NSURL URLWithString:subModel1.File] placeholderImage:IMG(@"img_placeHolderVertical")];
- TopicListSubModel * subModel2 = model.Data[2];
- [cell.cellImagV3 sd_setImageWithURL:[NSURL URLWithString:subModel2.File] placeholderImage:IMG(@"img_placeHolderVertical")];
- TopicListSubModel * subModel3 = model.Data[3];
- [cell.cellImagV4 sd_setImageWithURL:[NSURL URLWithString:subModel3.File] placeholderImage:IMG(@"img_placeHolderVertical")];
- TopicListSubModel * subModel4 = model.Data[4];
- [cell.cellImagV5 sd_setImageWithURL:[NSURL URLWithString:subModel4.File] placeholderImage:IMG(@"img_placeHolderVertical")];
- TopicListSubModel * subModel5 = model.Data[5];
- [cell.cellImagV6 sd_setImageWithURL:[NSURL URLWithString:subModel5.File] placeholderImage:IMG(@"img_placeHolderVertical")];
- TopicListSubModel * subModel6 = model.Data[6];
- [cell.cellImagV7 sd_setImageWithURL:[NSURL URLWithString:subModel6.File] placeholderImage:IMG(@"img_placeHolderVertical")];
- TopicListSubModel * subModel7 = model.Data[7];
- [cell.cellImagV8 sd_setImageWithURL:[NSURL URLWithString:subModel7.File] placeholderImage:IMG(@"img_placeHolderVertical")];
- }
- break;
- default:
- {
- cell = [TDGroupInfoListCell configCell5:tableView indexPath:indexPath];
- cell.cellImagV1.hidden = NO;
- cell.cellImagV2.hidden = NO;
- cell.cellImagV3.hidden = NO;
- cell.cellImagV4.hidden = NO;
- cell.cellImagV5.hidden = NO;
- cell.cellImagV6.hidden = NO;
- cell.cellImagV7.hidden = NO;
- cell.cellImagV8.hidden = NO;
- cell.cellImagV9.hidden = NO;
- TopicListSubModel * subModel0 = model.Data[0];
- [cell.cellImagV1 sd_setImageWithURL:[NSURL URLWithString:subModel0.File] placeholderImage:IMG(@"img_placeHolderVertical")];
- TopicListSubModel * subModel1 = model.Data[1];
- [cell.cellImagV2 sd_setImageWithURL:[NSURL URLWithString:subModel1.File] placeholderImage:IMG(@"img_placeHolderVertical")];
- TopicListSubModel * subModel2 = model.Data[2];
- [cell.cellImagV3 sd_setImageWithURL:[NSURL URLWithString:subModel2.File] placeholderImage:IMG(@"img_placeHolderVertical")];
- TopicListSubModel * subModel3 = model.Data[3];
- [cell.cellImagV4 sd_setImageWithURL:[NSURL URLWithString:subModel3.File] placeholderImage:IMG(@"img_placeHolderVertical")];
- TopicListSubModel * subModel4 = model.Data[4];
- [cell.cellImagV5 sd_setImageWithURL:[NSURL URLWithString:subModel4.File] placeholderImage:IMG(@"img_placeHolderVertical")];
- TopicListSubModel * subModel5 = model.Data[5];
- [cell.cellImagV6 sd_setImageWithURL:[NSURL URLWithString:subModel5.File] placeholderImage:IMG(@"img_placeHolderVertical")];
- TopicListSubModel * subModel6 = model.Data[6];
- [cell.cellImagV7 sd_setImageWithURL:[NSURL URLWithString:subModel6.File] placeholderImage:IMG(@"img_placeHolderVertical")];
- TopicListSubModel * subModel7 = model.Data[7];
- [cell.cellImagV8 sd_setImageWithURL:[NSURL URLWithString:subModel7.File] placeholderImage:IMG(@"img_placeHolderVertical")];
- TopicListSubModel * subModel8 = model.Data[8];
- [cell.cellImagV9 sd_setImageWithURL:[NSURL URLWithString:subModel8.File] placeholderImage:IMG(@"img_placeHolderVertical")];
- }
- break;
- }
-
- [cell.cellIconV sd_setImageWithURL:[NSURL URLWithString:model.AvatarUrl] placeholderImage:kUserDefaultHeadImage];
- [cell.fileBtn setTitle:model.FolderResult.FolderName forState:UIControlStateNormal];
- [cell.fileBtn setAction:^{
- [weakSelf enterFileWithModel:model];
- }];
- cell.ClickUserBlock = ^{
- [weakSelf showUserInfo:model.UserId];
- };
- cell.cellTimeL.text = [model.CreatedDate substringWithRange:NSMakeRange(5, 11)];
- cell.celltitleL.attributedText = [self setTitleWithStr:model.Title];
- cell.cellContentL.attributedText = [self setTextWithStr:model.Content];
- cell.cellNameL.text = model.UserName;
- cell.cellReadNumL.text = [NSString stringWithFormat:@"阅读:%ld",(long)model.ReadCount];
- [cell.cellLikeBtn setAction:^{
- [weakSelf likeAction:model withBtn:cell.cellLikeBtn index:indexPath];
- }];
- if (model.CommentCount > 0) {
- [cell.cellPingBtn setTitle:[NSString stringWithFormat:@"%ld",(long)model.CommentCount] forState:UIControlStateNormal];
- }else{
- [cell.cellPingBtn setTitle:@"评论" forState:UIControlStateNormal];
- }
- if (model.PraiseCount > 0) {
- [cell.cellLikeBtn setTitle:[NSString stringWithFormat:@"%ld",(long)model.PraiseCount] forState:UIControlStateNormal];
- }else{
- [cell.cellLikeBtn setTitle:@"赞" forState:UIControlStateNormal];
- }
- if (model.IsPraise) {
- [cell.cellLikeBtn setTitleColor:UIColorHex(#009AFF) forState:UIControlStateNormal];
- [cell.cellLikeBtn setImage:[UIImage imageNamed:@"收藏_赞_select"] forState:UIControlStateNormal];
- }else{
- [cell.cellLikeBtn setTitleColor:UIColorHex(#999999) forState:UIControlStateNormal];
- [cell.cellLikeBtn setImage:[UIImage imageNamed:@"收藏_赞"] forState:UIControlStateNormal];
- }
- [cell.cellPingBtn setAction:^{
- [weakSelf CommentPush:model];
- }];
- [cell.cellSendBtn setAction:^{
- [weakSelf reSend:model];
- }];
- if (model.Title.length == 0) {
- cell.TitleConstant.constant = 0;
- }else{
- cell.TitleConstant.constant = 10.f;
- }
- if (model.Content.length == 0) {
- cell.subTitleContant.constant = 0.f;
- }else{
- cell.subTitleContant.constant = 7.5f;
- }
- cell.fileContant.constant = 0.f;
- return cell;
- }
- break;
- case TopiclistCellFile:
- {
- TDGroupInfoListCell * cell = [TDGroupInfoListCell configCell6:tableView indexPath:indexPath];
- [cell.cellIconV sd_setImageWithURL:[NSURL URLWithString:model.AvatarUrl] placeholderImage:kUserDefaultHeadImage];
- [cell.fileBtn setTitle:model.FolderResult.FolderName forState:UIControlStateNormal];
- [cell.fileBtn setAction:^{
- [weakSelf enterFileWithModel:model];
- }];
- [cell.ClickFileAction setAction:^{
- [weakSelf pushFileWithModel:model.Data.firstObject];
- }];
- cell.cellNameL.text = model.UserName;
- cell.cellTimeL.text = [model.CreatedDate substringWithRange:NSMakeRange(5, 11)];
- cell.celltitleL.attributedText = [self setTitleWithStr:model.Title];
- cell.cellContentL.attributedText = [self setTextWithStr:model.Content];
- [cell setDataWithCell6:model.Data.firstObject];
- cell.cellReadNumL.text = [NSString stringWithFormat:@"阅读:%ld",(long)model.ReadCount];
- [cell.cellLikeBtn setAction:^{
- [weakSelf likeAction:model withBtn:cell.cellLikeBtn index:indexPath];
- }];
- if (model.CommentCount > 0) {
- [cell.cellPingBtn setTitle:[NSString stringWithFormat:@"%ld",(long)model.CommentCount] forState:UIControlStateNormal];
- }else{
- [cell.cellPingBtn setTitle:@"评论" forState:UIControlStateNormal];
- }
- if (model.PraiseCount > 0) {
- [cell.cellLikeBtn setTitle:[NSString stringWithFormat:@"%ld",(long)model.PraiseCount] forState:UIControlStateNormal];
- }else{
- [cell.cellLikeBtn setTitle:@"赞" forState:UIControlStateNormal];
- }
- if (model.IsPraise) {
- [cell.cellLikeBtn setTitleColor:UIColorHex(#009AFF) forState:UIControlStateNormal];
- [cell.cellLikeBtn setImage:[UIImage imageNamed:@"收藏_赞_select"] forState:UIControlStateNormal];
- }else{
- [cell.cellLikeBtn setTitleColor:UIColorHex(#999999) forState:UIControlStateNormal];
- [cell.cellLikeBtn setImage:[UIImage imageNamed:@"收藏_赞"] forState:UIControlStateNormal];
- }
- [cell.cellPingBtn setAction:^{
- [weakSelf CommentPush:model];
- }];
- [cell.cellSendBtn setAction:^{
- [weakSelf reSend:model];
- }];
- if (model.Title.length == 0) {
- cell.TitleConstant.constant = 0;
- }else{
- cell.TitleConstant.constant = 10.f;
- }
- if (model.Content.length == 0) {
- cell.subTitleContant.constant = 0.f;
- }else{
- cell.subTitleContant.constant = 7.5f;
- }
- cell.ClickUserBlock = ^{
- [weakSelf showUserInfo:model.UserId];
- };
- return cell;
- }
- break;
- default:///TopiclistCellNone
- {
- TDGroupInfoListCell * cell = [TDGroupInfoListCell configCell0:tableView indexPath:indexPath];
- [cell.cellIconV sd_setImageWithURL:[NSURL URLWithString:model.AvatarUrl] placeholderImage:kUserDefaultHeadImage];
- [cell.fileBtn setTitle:model.FolderResult.FolderName forState:UIControlStateNormal];
- [cell.fileBtn setAction:^{
- [weakSelf enterFileWithModel:model];
- }];
- cell.cellNameL.text = model.UserName;
- cell.cellTimeL.text = [model.CreatedDate substringWithRange:NSMakeRange(5, 11)];
- cell.celltitleL.attributedText = [self setTitleWithStr:model.Title];
- cell.cellContentL.attributedText = [self setTextWithStr:model.Content];
- cell.cellReadNumL.text = [NSString stringWithFormat:@"阅读:%ld",(long)model.ReadCount];
- [cell.cellLikeBtn setAction:^{
- [weakSelf likeAction:model withBtn:cell.cellLikeBtn index:indexPath];
- }];
- if (model.CommentCount > 0) {
- [cell.cellPingBtn setTitle:[NSString stringWithFormat:@"%ld",(long)model.CommentCount] forState:UIControlStateNormal];
- }else{
- [cell.cellPingBtn setTitle:@"评论" forState:UIControlStateNormal];
- }
- if (model.PraiseCount > 0) {
- [cell.cellLikeBtn setTitle:[NSString stringWithFormat:@"%ld",(long)model.PraiseCount] forState:UIControlStateNormal];
- }else{
- [cell.cellLikeBtn setTitle:@"赞" forState:UIControlStateNormal];
- }
- if (model.IsPraise) {
- [cell.cellLikeBtn setTitleColor:UIColorHex(#009AFF) forState:UIControlStateNormal];
- [cell.cellLikeBtn setImage:[UIImage imageNamed:@"收藏_赞_select"] forState:UIControlStateNormal];
- }else{
- [cell.cellLikeBtn setTitleColor:UIColorHex(#999999) forState:UIControlStateNormal];
- [cell.cellLikeBtn setImage:[UIImage imageNamed:@"收藏_赞"] forState:UIControlStateNormal];
- }
- [cell.cellPingBtn setAction:^{
- [weakSelf CommentPush:model];
- }];
- [cell.cellSendBtn setAction:^{
- [weakSelf reSend:model];
- }];
- if (model.Title.length == 0) {
- cell.TitleConstant.constant = 0;
- }else{
- cell.TitleConstant.constant = 10.f;
- }
- if (model.Content.length == 0) {
- cell.subTitleContant.constant = 0.f;
- }else{
- cell.subTitleContant.constant = 7.5f;
- }
- cell.ClickUserBlock = ^{
- [weakSelf showUserInfo:model.UserId];
- };
- return cell;
- }
- break;
- }
- }
- break;
- }
- }
- - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
- [tableView deselectRowAtIndexPath:indexPath animated:YES];
- WS(weakSelf);
- if (indexPath.section > 0) {
- TopicListItemModel * model = [self.dataArray objectAtIndex:indexPath.row];
- if (model) {
- MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
- vc.type = CollectModel_NewTopic;
- vc.RefreshTopicBlock = ^{
- [weakSelf headRefresh];
- };
- vc.Id = model.Id;
- [self.navigationController pushViewController:vc animated:YES];
- }
- }
- }
- - (UISwipeActionsConfiguration *)tableView:(UITableView *)tableView trailingSwipeActionsConfigurationForRowAtIndexPath:(NSIndexPath *)indexPath API_AVAILABLE(ios(11.0)) API_UNAVAILABLE(tvos){// delete action
- WS(weakSelf);
- TopicListItemModel * model = [self.dataArray objectAtIndex:indexPath.row];
- if (model.UserId == [AppUserModel sharedAppUserModel].Id) {
- UIContextualAction *action1 = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleDestructive title:@"删除" handler:^(UIContextualAction * _Nonnull action,__kindof UIView * _Nonnull sourceView,void (^ _Nonnull completionHandler)(BOOL)) {
- UIAlertController *alert = [UIAlertController alertControllerWithTitle:nil message:@"确认删除" preferredStyle:(UIAlertControllerStyleAlert)];
- UIAlertAction * sureAction = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDestructive handler:^(UIAlertAction * _Nonnull action) {
- [weakSelf deleteFind:model.Id row:indexPath.row];
- }];
- UIAlertAction * cancelAction = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
- dispatch_async(dispatch_get_main_queue(), ^{
- [weakSelf.tableView reloadData];
- });
- }];
- [alert addAction:sureAction];
- [alert addAction:cancelAction];
- [weakSelf presentViewController:alert animated:YES completion:^{
-
- }];
- completionHandler(YES);
- }];
- action1.backgroundColor = UIColorHex(#F64A33);
- UIContextualAction *action2 = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleDestructive title:@"编辑" handler:^(UIContextualAction * _Nonnull action,__kindof UIView * _Nonnull sourceView,void (^ _Nonnull completionHandler)(BOOL)) {
- [weakSelf eidtorNoteBook:model];
- completionHandler(YES);
- }];
- action2.backgroundColor = UIColorHex(#FF923A);
-
- UISwipeActionsConfiguration *actions = [UISwipeActionsConfiguration configurationWithActions:@[action1,action2]];
- actions.performsFirstActionWithFullSwipe = NO;
- return actions;
- }else{
- UISwipeActionsConfiguration *actions = [UISwipeActionsConfiguration configurationWithActions:@[]];
- actions.performsFirstActionWithFullSwipe = NO;
- return actions;
- }
- }
- - (void)eidtorNoteBook:(TopicListItemModel *)model{
- MyTDTopicCreateVC * vc = [MyTDTopicCreateVC initMyTDTopicCreateVC];
- vc.type = CollectModel_NewTopic;
- vc.FolderId = model.FolderId;
- vc.FolderName = model.FolderName;
- vc.Id = model.Id;
- WS(weakSelf);
- vc.upDateBlock = ^{
- [weakSelf headRefresh];
- };
- vc.isEdit = YES;
- [self.navigationController pushViewController:vc animated:YES];
- }
- - (void)deleteFind:(NSInteger)Id row:(NSInteger)row{
- WEAKSELF
- NSString * url = [NSString stringWithFormat:@"%@%ld",Host(API_APP_Note_Top),Id];
- [[HttpManager sharedHttpManager] DeleteUrl:url parameters:@{} responseStyle:DATA success:^(id _Nonnull responseObject) {
- [weakSelf.dataArray removeObjectAtIndex:row];
- dispatch_async(dispatch_get_main_queue(), ^{
- [weakSelf.tableView reloadData];
- });
- } failure:^(NSError * _Nonnull error) {
-
- }];
- }
- #pragma mark -UICollectionViewDataSource
- /**********************************************************************/
- - (NSInteger)collectionView:(GHRefreshCollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
- return self.collectionDataSource.count;
- }
- - (UICollectionViewCell *)collectionView:(GHRefreshCollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
- {
- MoreAppInfoModel *bean = [self.collectionDataSource objectAtIndex:indexPath.item];
- ChatMsgCollectionCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"ChatMsgCollectionCell" forIndexPath:indexPath];
- cell.cell0IconImg.image = [UIImage imageNamed:bean.imgName];
- cell.cell0TitleLabel.text = bean.title;
- cell.imagH.constant = 25.f;
- cell.imagW.constant = 25.f;
- switch (bean.type) {
- case ChatMenuNoticeType:
- {
- NSString * count = [NSString stringWithFormat:@"%ld",bean.readNum];
- cell.cell0ReadNumLabel.text = count;
- cell.cell0ReadNumLabel.hidden = bean.readNum > 0 ? NO : YES;
- UILabel * label = [UILabel new];
- label.font = [UIFont systemFontOfSize:12];
- label.text = count;
- CGFloat width = [label sizeThatFits:CGSizeMake(SCREEN_WIDTH, 16)].width;
- if ((width + 5) < 16) {
- cell.constant.constant = 16;
- }else{
- cell.constant.constant = width + 8;
- }
- }
- break;
- case ChatMenuZhanXinType:
- {
- NSString * count = [NSString stringWithFormat:@"%ld",bean.readNum];
- cell.cell0ReadNumLabel.text = count;
- cell.cell0ReadNumLabel.hidden = bean.readNum > 0 ? NO : YES;
- UILabel * label = [UILabel new];
- label.font = [UIFont systemFontOfSize:12];
- label.text = count;
- CGFloat width = [label sizeThatFits:CGSizeMake(SCREEN_WIDTH, 16)].width;
- if ((width + 5) < 16) {
- cell.constant.constant = 16;
- }else{
- cell.constant.constant = width + 8;
- }
- }
- break;
- case ChatMenuWaitType:
- {
- NSString * count = [NSString stringWithFormat:@"%ld",bean.readNum];
- cell.cell0ReadNumLabel.text = count;
- cell.cell0ReadNumLabel.hidden = bean.readNum > 0 ? NO : YES;
- UILabel * label = [UILabel new];
- label.font = [UIFont systemFontOfSize:12];
- label.text = count;
- CGFloat width = [label sizeThatFits:CGSizeMake(SCREEN_WIDTH, 16)].width;
- if ((width + 5) < 16) {
- cell.constant.constant = 16;
- }else{
- cell.constant.constant = width + 8;
- }
- }
- break;
- default:
- {
- NSString * count = [NSString stringWithFormat:@"%ld",bean.readNum];
- cell.cell0ReadNumLabel.text = count;
- cell.cell0ReadNumLabel.hidden = bean.readNum > 0 ? NO : YES;
- }
- break;
- }
- cell.cell0MengCengView.hidden = YES;
- return cell;
- }
- /****************************************************/
- #pragma mark --UICollectionViewDelegateFlowLayout
- /****************************************************/
- - (CGSize)collectionView:(GHRefreshCollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath
- {
- CGFloat width = (SCREEN_WIDTH - 20) / self.collectionDataSource.count;
- CGFloat height = 80;
- return CGSizeMake(width, height);
- }
- -(UIEdgeInsets)collectionView:(GHRefreshCollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout insetForSectionAtIndex:(NSInteger)section
- {
- CGFloat W = 10;
- return UIEdgeInsetsMake(0,W,0,W);
- }
- - (CGFloat)collectionView:(GHRefreshCollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout minimumLineSpacingForSectionAtIndex:(NSInteger)section{
- return 0;
- }
- - (CGFloat)collectionView:(GHRefreshCollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout minimumInteritemSpacingForSectionAtIndex:(NSInteger)section{
- return 0;
- }
- - (void)collectionView:(GHRefreshCollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath{
- [collectionView deselectItemAtIndexPath:indexPath animated:YES];
- MoreAppInfoModel * model = [self.collectionDataSource objectAtIndex:indexPath.item];
- switch (model.type) {
- case ChatMenuZhanXinType:{
- TDInterLeterHomeViewController *vc = [TDInterLeterHomeViewController initChatMsgNoticeVC];
- vc.hidesBottomBarWhenPushed = YES;
- vc.interLeterFolderId = 0;
- vc.isHome = YES;
- [self.navigationController pushViewController:vc animated:YES];
- }break;
- case ChatMenuGroupType:{
- SourceGroupVC *vc = [SourceGroupVC initSourceGroupVC];
- vc.hidesBottomBarWhenPushed = YES;
- [self.navigationController pushViewController:vc animated:YES];
- }break;
- case ChatMenuWaitType:{
- WaitWorkVC *vc = [WaitWorkVC initWaitWorkVC];
- vc.hidesBottomBarWhenPushed = YES;
- [self.navigationController pushViewController:vc animated:YES];
- }break;
- case ChatMenuSiXinType:{
- ChatMsgListVC * vc = [ChatMsgListVC initChatMsgListVC];
- vc.hidesBottomBarWhenPushed = YES;
- [self.navigationController pushViewController:vc animated:YES];
- }break;
- default:
- break;
- }
- }
- - (void)enterFileWithModel:(TopicListItemModel *)model
- {
- if (model.UserId == [AppUserModel sharedAppUserModel].Id) {
- if (model.FolderResult.Id == 0) {
- MyTDTopicBookVC * vc = [MyTDTopicBookVC initMyTDTopicBookVC];
- [self.navigationController pushViewController:vc animated:YES];
- }else{
- NoteBookVC *vc = [NoteBookVC initNoteBookVC];
- vc.listType = MyFavoriteListLevelTypeB;
- vc.FolderId = model.FolderResult.Id;
- vc.ParentId = model.FolderResult.Id;
- vc.myTitle = model.FolderResult.FolderName;
- vc.TypeValue = 1;
- vc.isSubVC = YES;
- vc.hidesBottomBarWhenPushed = YES;
- [self.navigationController pushViewController:vc animated:YES];
- }
- }else{
- OtherNoteBookVC *vc = [OtherNoteBookVC initOtherNoteBookVC];
- vc.listType = MyFavoriteListLevelTypeB;
- vc.FolderId = model.FolderResult.Id;
- vc.Author = model.UserName;
- vc.myTitle = model.FolderResult.FolderName;
- vc.VisitUserId = model.UserId;
- vc.TypeValue = 1;
- vc.hidesBottomBarWhenPushed = YES;
- [self.navigationController pushViewController:vc animated:YES];
- }
- }
- - (void)showUserInfo:(NSInteger)userId
- {
- MailListDetailVC * vc = [MailListDetailVC initMailListDetailVC];
- vc.indexId = userId;
- vc.hidesBottomBarWhenPushed = YES;
- [self.navigationController pushViewController:vc animated:YES];
- }
- #pragma mark - 点击评论
- - (void)likeAction:(TopicListItemModel *)model withBtn:(UIButton *)btn index:(NSIndexPath *)indexPath
- {
- WS(weakSelf);
- NSDictionary * paraDict = @{@"SourceId":@(model.Id),
- @"TypeValue":@(-4),///
- @"AnalyzeType":@(1)
- };
- btn.enabled = NO;
- [[HttpManager sharedHttpManager] POSTUrl:Host(API_APP_Analyze_Set) parameters:paraDict responseStyle:DATA success:^(id _Nonnull responseObject) {
- btn.enabled = YES;
- model.IsPraise = !model.IsPraise;
- model.PraiseCount = model.IsPraise ? (model.PraiseCount + 1) : (model.PraiseCount - 1);
- dispatch_async(dispatch_get_main_queue(), ^{
- if (weakSelf.dataArray.count > 0) {
- [weakSelf.tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
- }
- });
- } failure:^(NSError * _Nonnull error) {
- btn.enabled = YES;
- }];
- }
- - (void)CommentPush:(TopicListItemModel *)model
- {
- WS(weakSelf);
- MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
- vc.type = CollectModel_NewTopic;
- vc.RefreshTopicBlock = ^{
- [weakSelf headRefresh];
- };
- vc.Id = model.Id;
- vc.isComment = YES;
- vc.hidesBottomBarWhenPushed = YES;
- [self.navigationController pushViewController:vc animated:YES];
- }
- - (void)reSend:(TopicListItemModel *)model
- {
- FlowAttachmentsModel * topicModel = [[FlowAttachmentsModel alloc] init];
- topicModel.SoureTypeId = CollectModel_NewTopic;
- topicModel.Title = model.Title;
- topicModel.SoureId = model.Id;
- topicModel.Title = model.Title;
- topicModel.Author = model.UserName;
- self.sendModel = topicModel;
- [self.noteBookShareVC initNoteBookShareData];
- self.noteBookShareVC.view.hidden = !self.noteBookShareVC.view.hidden;
- }
- - (NoteBookShareVC *)noteBookShareVC{
- if (_noteBookShareVC == nil) {
- _noteBookShareVC = [NoteBookShareVC initNoteBookShareVC];
- [_noteBookShareVC.view setFrame:CGRectMake(0,0, SCREEN_WIDTH, SCREEN_HEIGHT)];
- [_noteBookShareVC.view setHidden:YES];
- _noteBookShareVC.delegate = self;
- }
- return _noteBookShareVC;
- }
- - (void)userSelectType:(NSString *)typeName WithIndexPath:(NSIndexPath *)indexPath
- {
- self.noteBookShareVC.view.hidden = !self.noteBookShareVC.view.hidden;
- if ([typeName isEqualToString:@"发给微信好友"]) {
- [self returnToWechatSession];
- }else if ([typeName isEqualToString:@"发到朋友圈"]){
- [self returnToWechatTimeLine];
- }else if ([typeName isEqualToString:@"发到微博"]){
- [self returnToSina];
- }else if ([typeName isEqualToString:@"发给QQ好友"]){
- [self returnToQQ];
- }else if ([typeName isEqualToString:@"发到消息"]){
- [self returnToMessage];
- }else if ([typeName isEqualToString:@"发到小组"]){
- [self returnToGroup];
- }else if ([typeName isEqualToString:@"发到笔记"]){
- [self returnToNote];
- }else if ([typeName isEqualToString:@"发到话题"]){
- [self returnToTopic];
- }else{
-
- }
- }
- - (void)shareWebPageToPlatformType:(UMSocialPlatformType)platformType title:(NSString *)title desc:(NSString *)desc url:(NSString *)url
- {
- //创建分享消息对象
- UMSocialMessageObject *messageObject = [UMSocialMessageObject messageObject];
-
- messageObject.title = title;
- //创建网页内容对象
- UMShareWebpageObject *shareObject = [UMShareWebpageObject shareObjectWithTitle:title descr:desc thumImage:IMG(@"logo_60")];
- //设置网页地址
- shareObject.webpageUrl = url;
-
- //分享消息对象设置分享内容对象
- messageObject.shareObject = shareObject;
-
- //调用分享接口
- [[UMSocialManager defaultManager] shareToPlatform:platformType messageObject:messageObject currentViewController:self completion:^(id data, NSError *error) {
- if (error) {
- NSLog(@"************Share fail with error %@*********",error);
- }else{
- NSLog(@"response data is %@",data);
- }
- }];
- }
- - (void)returnToWechatSession
- {
- [self shareWebPageToPlatformType:UMSocialPlatformType_WechatSession title:self.sendModel.Title desc:[NSString stringWithFormat:@"来自-%@",self.sendModel.Author] url:[self returnUrl]];
- }
- - (void)returnToWechatTimeLine
- {
- [self shareWebPageToPlatformType:UMSocialPlatformType_WechatTimeLine title:self.sendModel.Title desc:[NSString stringWithFormat:@"来自-%@",self.sendModel.Author] url:[self returnUrl]];
- }
- - (void)returnToSina
- {
- [self shareWebPageToPlatformType:UMSocialPlatformType_Sina title:self.sendModel.Title desc:[NSString stringWithFormat:@"来自-%@",self.sendModel.Author] url:[self returnUrl]];
- }
- - (void)returnToQQ
- {
- [self shareWebPageToPlatformType:UMSocialPlatformType_QQ title:self.sendModel.Title desc:[NSString stringWithFormat:@"来自-%@",self.sendModel.Author] url:[self returnUrl]];
- }
- - (NSString *)returnUrl
- {
- NSString * url = [NSString stringWithFormat:@"%@%ld",ShareHost(@"mobile/topicDetailsWx?"),(long)self.sendModel.Id];
- return url;
- }
- #pragma mark - 分享功能
- - (void)returnToMessage
- {
- ShareListVC * vc = [ShareListVC initShareListVC];
- vc.sendModel = self.sendModel;
- vc.isReturn = YES;
- vc.hidesBottomBarWhenPushed = YES;
- [self.navigationController pushViewController:vc animated:YES];
- }
- - (void)returnToGroup
- {
- MyTDGroupViewController * vc = [[MyTDGroupViewController alloc] init];
- vc.type = CollectModel_Group;
- vc.sendModel = self.sendModel;
- vc.isReturn = YES;
- vc.hidesBottomBarWhenPushed = YES;
- [self.navigationController pushViewController:vc animated:YES];
- }
- - (void)returnToNote
- {
- MyTDTopicCreateVC * vc = [MyTDTopicCreateVC initMyTDTopicCreateVC];
- vc.type = CollectModel_NoteBook;
- vc.sendModel = self.sendModel;
- vc.isReturn = YES;
- vc.hidesBottomBarWhenPushed = YES;
- [self.navigationController pushViewController:vc animated:YES];
- }
- - (void)returnToTopic
- {
- MyTDTopicCreateVC * vc = [MyTDTopicCreateVC initMyTDTopicCreateVC];
- vc.type = CollectModel_NewTopic;
- vc.sendModel = self.sendModel;
- vc.isReturn = YES;
- vc.hidesBottomBarWhenPushed = YES;
- [self.navigationController pushViewController:vc animated:YES];
- }
- #pragma mark - 点击文件跳转
- - (void)pushFileWithModel:(TopicListSubModel *)model
- {
- WS(weakSelf);
- switch (model.Type) {
- case CollectModel_Aritle:
- {
- MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
- vc.type = CollectModel_Aritle;
- vc.Id = model.Id;
- vc.hidesBottomBarWhenPushed = YES;
- [self.navigationController pushViewController:vc animated:YES];
- }
- break;
- case CollectModel_Toipc:
- {
- MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
- vc.type = CollectModel_Toipc;
- vc.Id = model.Id;
- vc.hidesBottomBarWhenPushed = YES;
- [self.navigationController pushViewController:vc animated:YES];
- }
- break;
- case CollectModel_NewTopic:
- {
- MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
- vc.type = CollectModel_NewTopic;
- vc.Id = model.Id;
- vc.hidesBottomBarWhenPushed = YES;
- [self.navigationController pushViewController:vc animated:YES];
- }
- break;
- case CollectModel_Collect:
- {
- }
- break;
- case CollectModel_NoteBook:
- {
- MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
- vc.type = CollectModel_NoteBook;
- vc.Id = model.Id;
- vc.hidesBottomBarWhenPushed = YES;
- [self.navigationController pushViewController:vc animated:YES];
- }
- break;
- case CollectModel_CollectFile:{
- if (model.SourceUserId == [AppUserModel sharedAppUserModel].Id) {
- MyFavoriteVC *vc = [MyFavoriteVC initMyFavoriteVC];
- vc.listType = model.Id == 0 ? MyFavoriteListLevelTypeA : MyFavoriteListLevelTypeB;
- vc.ParentId = 0;
- vc.FolderId = model.Id;
- vc.myTitle = model.Title;
- vc.hidesBottomBarWhenPushed = YES;
- [self.navigationController pushViewController:vc animated:YES];
- }else{
- OtherFavoriteVC *vc = [OtherFavoriteVC initOtherFavoriteVC];
- vc.listType = model.Id == 0 ? MyFavoriteListLevelTypeA : MyFavoriteListLevelTypeB;
- vc.ParentId = 0;
- vc.FolderId = model.Id;
- vc.myTitle = model.Title;
- vc.VisitUserId = model.SourceUserId;
- vc.hidesBottomBarWhenPushed = YES;
- [self.navigationController pushViewController:vc animated:YES];
- }
- }break;
- case CollectModel_NoteFile:{
- if (model.SourceUserId == [AppUserModel sharedAppUserModel].Id) {
- NoteBookVC *vc = [NoteBookVC initNoteBookVC];
- vc.listType = model.Id == 0 ? MyFavoriteListLevelTypeA : MyFavoriteListLevelTypeB;
- vc.ParentId = 0;
- vc.FolderId = model.Id;
- vc.myTitle = model.Title;
- vc.VisitUserId = 0;
- vc.hidesBottomBarWhenPushed = YES;
- [self.navigationController pushViewController:vc animated:YES];
- }else{
- OtherNoteBookVC *vc = [OtherNoteBookVC initOtherNoteBookVC];
- vc.listType = model.Id == 0 ? MyFavoriteListLevelTypeA : MyFavoriteListLevelTypeB;
- vc.FolderId = model.Id;
- vc.myTitle = model.Title;
- vc.VisitUserId = model.SourceUserId;
- vc.TypeValue = 0;
- vc.hidesBottomBarWhenPushed = YES;
- [self.navigationController pushViewController:vc animated:YES];
- }
- }break;
- case CollectModel_TopicBooK:{
- if (model.SourceUserId == [AppUserModel sharedAppUserModel].Id) {
- NoteBookVC *vc = [NoteBookVC initNoteBookVC];
- vc.listType = MyFavoriteListLevelTypeA ;
- vc.ParentId = 0;
- vc.FolderId = model.Id;
- vc.myTitle = model.Title;
- vc.VisitUserId = 0;
- vc.TypeValue = 1;
- vc.hidesBottomBarWhenPushed = YES;
- [self.navigationController pushViewController:vc animated:YES];
- }else{
- OtherNoteBookVC * vc = [OtherNoteBookVC initOtherNoteBookVC];
- vc.listType = MyFavoriteListLevelTypeA ;
- vc.FolderId = model.Id;
- vc.CollectionDataId = model.Id;
- vc.CollectionType = CollectModel_TopicBooK;
- vc.Author = model.Title;
- vc.TypeValue = 1;
- vc.myTitle = model.Title;
- vc.VisitUserId = model.SourceUserId;
- [self.navigationController pushViewController:vc animated:YES];
- }
- }break;
- case CollectModel_TopicSubBooK:{
- if (model.SourceUserId == [AppUserModel sharedAppUserModel].Id) {
- NoteBookVC *vc = [NoteBookVC initNoteBookVC];
- vc.listType = MyFavoriteListLevelTypeB ;
- vc.FolderId = model.Id;
- vc.myTitle = model.Title;
- vc.VisitUserId = 0;
- vc.TypeValue = 1;
- [self.navigationController pushViewController:vc animated:YES];
- }else{
- OtherNoteBookVC * vc = [OtherNoteBookVC initOtherNoteBookVC];
- vc.listType = MyFavoriteListLevelTypeB ;
- vc.FolderId = model.Id;
- vc.CollectionDataId = model.Id;
- vc.CollectionType = CollectModel_TopicSubBooK;
- vc.Author = model.Title;
- vc.TypeValue = 1;
- vc.myTitle = model.Title;
- vc.VisitUserId = model.SourceUserId;
- [self.navigationController pushViewController:vc animated:YES];
- }
- }break;
- case CollectModel_Notice:
- {
- MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
- vc.type = CollectModel_Notice;
- vc.Id = model.Id;
- vc.hidesBottomBarWhenPushed = YES;
- [self.navigationController pushViewController:vc animated:YES];
- }
- break;
- case CollectModel_InterMail:
- {
- MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
- vc.type = CollectModel_InterMail;
- vc.Id = model.Id;
- vc.hidesBottomBarWhenPushed = YES;
- [self.navigationController pushViewController:vc animated:YES];
- }
- break;
- case CollectModel_Group:
- {
- TDGroupInfoListVC * vc = [TDGroupInfoListVC initTDGroupInfoListVC];
- vc.GroupId = model.Id;
- vc.titleStr = model.Title;
- vc.hidesBottomBarWhenPushed = YES;
- [self.navigationController pushViewController:vc animated:YES];
- }
- break;
- case CollectModel_meetMian:
- {
- MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
- vc.type = CollectModel_meetMian;
- vc.Id = model.Id;
- vc.hidesBottomBarWhenPushed = YES;
- [self.navigationController pushViewController:vc animated:YES];
- }
- break;
- case CollectModel_meetDetail:
- {
- WorkFlowDetailsController * vc = [[WorkFlowDetailsController alloc] initWithId:model.Id];
- vc.hidesBottomBarWhenPushed = YES;
- [self.navigationController pushViewController:vc animated:YES];
- }
- break;
- case CollectModel_work:
- {
- MyApprovalPageDetail * vc = [[MyApprovalPageDetail alloc]init];
- vc.pageType = Type_ONEC;
- vc.indexId = model.Id;
- vc.title = model.Title;
- vc.TodoId = model.Id;
- vc.hidesBottomBarWhenPushed = YES;
- [self.navigationController pushViewController:vc animated:YES];
- }
- break;
- case CollectModel_StoreSound:
- {
- BookListenVC * vc = [BookListenVC initBookListenVC];
- vc.Id = model.Id;
- vc.MediaType = MediaMusicType;
- vc.hidesBottomBarWhenPushed = YES;
- [self.navigationController pushViewController:vc animated:YES];
- }
- break;
- case CollectModel_StoreVideo:
- {
- BookWCDetailVC * vc = [BookWCDetailVC initBookWCDetailVC];
- vc.Id = model.Id;
- vc.hidesBottomBarWhenPushed = YES;
- [self.navigationController pushViewController:vc animated:YES];
- }
- break;
- default:
- {
- DownFileViewController *vc = [[DownFileViewController alloc]init];
- FlowAttachmentsModel * fmodel = [[FlowAttachmentsModel alloc] init];
- fmodel.SoureId = model.Id;
- fmodel.Title = model.Title;
- fmodel.Url = model.File;
- vc.model = fmodel;
- vc.hidesBottomBarWhenPushed = YES;
- [self.navigationController pushViewController:vc animated:YES];
- }
- break;
- }
- }
- - (void)pushSearchVC
- {
- MyTDTopicSearchVC * vc = [[MyTDTopicSearchVC alloc] init];
- vc.searchType = TDTopicSearch;
- vc.hidesBottomBarWhenPushed = YES;
- [self.navigationController pushViewController:vc animated:YES];
- }
- - (NSAttributedString *)setTextWithStr:(NSString *)str
- {
- if (str.length == 0) {
- return [[NSAttributedString alloc] initWithString:@""];
- }
- return [[NSAttributedString alloc] initWithString:str];
- // NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:str];
- // [attributedString addAttribute:NSFontAttributeName value:[UIFont fontWithName:@"PingFang SC" size:16] range:NSMakeRange(0, str.length)];
- // [attributedString addAttribute:NSForegroundColorAttributeName value:UIColorHex(#484848) range:NSMakeRange(0, str.length)];
- // NSMutableParagraphStyle *paraStyle = [[NSMutableParagraphStyle alloc]init];
- // paraStyle.alignment = NSTextAlignmentJustified;//两端对齐
- // [paraStyle setLineSpacing:5];//行间距
- // [attributedString addAttribute:NSParagraphStyleAttributeName value:paraStyle range:NSMakeRange(0, str.length)];
- // [attributedString addAttribute:NSUnderlineStyleAttributeName value:[NSNumber numberWithInteger:NSUnderlineStyleNone] range:NSMakeRange(0, str.length)];
- // return attributedString;
- }
- - (NSAttributedString *)setTitleWithStr:(NSString *)str
- {
- if (str.length == 0) {
- return [[NSAttributedString alloc] initWithString:@""];
- }
- NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:str];
- [attributedString addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:18] range:NSMakeRange(0, str.length)];
- [attributedString addAttribute:NSForegroundColorAttributeName value:UIColorHex(0x0a0a0a) range:NSMakeRange(0, str.length)];
- NSMutableParagraphStyle *paraStyle = [[NSMutableParagraphStyle alloc]init];
- paraStyle.alignment = NSTextAlignmentJustified;//两端对齐
- [paraStyle setLineSpacing:5];//行间距
- [attributedString addAttribute:NSParagraphStyleAttributeName value:paraStyle range:NSMakeRange(0, str.length)];
- [attributedString addAttribute:NSUnderlineStyleAttributeName value:[NSNumber numberWithInteger:NSUnderlineStyleNone] range:NSMakeRange(0, str.length)];
- return attributedString;
- }
- #pragma mark - 接收Drawer通知跳转到对应的子页面
- - (void)pushSubViewController:(NSNotification *)notification
- {
- ///@"站内信", @"通知", @"收藏",@"笔记", @"设置"
- NSInteger index = [[notification.userInfo objectForKey:VCINDEX] integerValue];
- switch (index) {
- case 0:
- {
- [self pushInterLeterVC];
- }
- break;
- case 1:
- {
- [self pushChatMsgNoticeVC];
- }
- break;
- default:
- break;
- }
- }
- #pragma mark - 跳转到站内信、通知页面
- - (void)pushInterLeterVC
- {
- TDInterLeterHomeViewController *vc = [TDInterLeterHomeViewController initChatMsgNoticeVC];
- vc.hidesBottomBarWhenPushed = YES;
- vc.interLeterFolderId = 0;
- vc.isHome = YES;
- [self.navigationController pushViewController:vc animated:YES];
- }
- - (void)pushChatMsgNoticeVC
- {
- ChatMsgListVC *vc = [ChatMsgListVC initChatMsgListVC];
- vc.hidesBottomBarWhenPushed = YES;
- [self.navigationController pushViewController:vc animated:YES];
- }
- - (void)scrollViewDidScroll:(UIScrollView *)scrollView
- {
- self.setY = scrollView.contentOffset.y;
- if (self.setY > 126) {
- [self.menuListView setViewHeight:NAVH + 36];
- }else{
- [self.menuListView setViewHeight:162 - self.setY + NAVH];
- }
- }
- - (void)dealloc
- {
- [[EMClient sharedClient].chatManager removeDelegate:self];
- [[EMClient sharedClient].groupManager removeDelegate:self];
- [[EMConversationHelper shared] removeDelegate:self];
- [[NSNotificationCenter defaultCenter] removeObserver:self];
- }
- //- (void)tableView:(UITableView *)tableView willBeginEditingRowAtIndexPath:(NSIndexPath *)indexPath
- //{
- // NSLog(@"13413141414124134");
- // [self configSwipeButton];
- //}
- //
- //- (void)configSwipeButton
- //{
- // if (IOS13_OR_LATER) {
- // for (UIView *supView in self.tableView.subviews){
- // if ([supView isKindOfClass:NSClassFromString(@"_UITableViewCellSwipeContainerView")]){
- // for (UIView * view in supView.subviews) {
- //// NSLog(@"%@",[view description]);
- // if ([view isKindOfClass:NSClassFromString(@"UISwipeActionPullView")]) {
- // CGRect rect = view.frame;
- // CGPoint center = view.center;
- // if (view.frame.size.height > 80) {
- // rect.size.height = 80;
- // }
- // view.frame = rect;
- // view.center = center;
- // }
- // }
- // }
- // }
- // }else{
- // for (UIView *view in self.tableView.subviews){
- // if ([view isKindOfClass:NSClassFromString(@"UISwipeActionPullView")]) {
- // CGRect rect = view.frame;
- // CGPoint center = view.center;
- // if (view.frame.size.height > 80) {
- // rect.size.height = 80;
- // }
- // view.frame = rect;
- // view.center = center;
- // }
- // }
- // }
- //}
- @end
|