1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063 |
- //
- // MyTDTopicViewController.m
- // smartRhino
- //
- // Created by tederen on 2019/10/31.
- // Copyright © 2019 tederen. All rights reserved.
- //
- #import "MyTDTopicViewController.h"
- #import "MenuListView.h"
- #import "MyTDTopicGroupManageVC.h"
- #import "SelectModel.h"
- #import "TDGroupInfoListModel.h"
- #import "TDGroupInfoListCell.h"
- #import "TopicListModel.h"
- #import "MyTDGroupView.h"
- #import "MyTDTopicDetailVC.h"
- #import "TopicGroupManageModel.h"
- #import "MyTDTopicSearchVC.h"
- #import "MyTDTopicCreateVC.h"
- #import "NoteBookShareVC.h"
- #import "NoteBookVC.h"
- #import "MyFavoriteVC.h"
- #import "ShowBtn.h"
- #import "MyTDGroupViewController.h"
- #import "MoveViewController.h"
- #import "OtherNoteBookVC.h"
- #import "OtherFavoriteVC.h"
- #import "HomeDetailController.h"
- #import "TDGroupInfoListVC.h"
- #import "WorkFlowDetailsController.h"
- #import "MyApprovalPageDetail.h"
- #import "DownFileViewController.h"
- #import "MailListDetailVC.h"
- @interface MyTDTopicViewController ()<UITableViewDelegate,UITableViewDataSource,NoteBookShareVCDelegate>
- @property (weak, nonatomic) IBOutlet UITableView *tableView;
- @property (weak, nonatomic) IBOutlet UIButton *editBtn;
- @property (strong, nonatomic) ShowBtn *titleBtn;
- @property (strong, nonatomic) MenuListView * menuListView;
- @property (weak, nonatomic) IBOutlet UIView *cusNavBar;
- @property (assign, nonatomic) BOOL menuIsShow;
- @property (strong, nonatomic) NSMutableArray * groupListArray;
- @property (strong, nonatomic) NSMutableArray * dataArray;
- @property (strong, nonatomic) NSMutableArray * selectGIdArray;
- @property (nonatomic, assign) NSUInteger currentPage;
- @property (nonatomic, assign) NSUInteger totalPage;
- @property (nonatomic, assign) NSUInteger totalRecord;
- @property (strong, nonatomic) NoteBookShareVC * noteBookShareVC;
- @property (weak, nonatomic) IBOutlet UIView *noDataView;
- @property (weak, nonatomic) IBOutlet UILabel *noDataL;
- @end
- @implementation MyTDTopicViewController
- +(MyTDTopicViewController *)initMyTDTopicViewController;
- {
- MyTDTopicViewController *controller = [StoryboardManager.shared.myTDTopic instantiateViewControllerWithIdentifier:@"MyTDTopicViewController"];
- return controller;
- }
- - (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
- {
- // TopicListItemModel * model = [self.dataArray objectAtIndex:(indexPath.section - 1)];
- self.noteBookShareVC.view.hidden = !self.noteBookShareVC.view.hidden;
- if ([typeName isEqualToString:@"发给微信好友"]) {
-
- }else if ([typeName isEqualToString:@"发到朋友圈"]){
-
- }else if ([typeName isEqualToString:@"发到微博"]){
-
- }else if ([typeName isEqualToString:@"发给QQ好友"]){
-
- }else if ([typeName isEqualToString:@"发到消息"]){
-
- }else if ([typeName isEqualToString:@"发到小组"]){
- [self returnToGroup];
- }else if ([typeName isEqualToString:@"发到笔记"]){
- [self returnToNote];
- }else if ([typeName isEqualToString:@"发到话题"]){
- [self returnToTopic];
- }else{
-
- }
- }
- - (void)returnToGroup
- {
- MyTDGroupViewController * vc = [[MyTDGroupViewController alloc] init];
- vc.type = CollectModel_Group;
- vc.sendModel = self.sendModel;
- vc.isReturn = YES;
- [self.navigationController pushViewController:vc animated:YES];
- }
- - (void)returnToNote
- {
- MyTDTopicCreateVC * vc = [MyTDTopicCreateVC initMyTDTopicCreateVC];
- vc.type = CollectModel_NoteBook;
- vc.sendModel = self.sendModel;
- vc.isReturn = YES;
- [self.navigationController pushViewController:vc animated:YES];
- }
- - (void)returnToTopic
- {
- MyTDTopicCreateVC * vc = [MyTDTopicCreateVC initMyTDTopicCreateVC];
- vc.type = CollectModel_NewTopic;
- vc.sendModel = self.sendModel;
- vc.isReturn = YES;
- [self.navigationController pushViewController:vc animated:YES];
- }
- - (void)viewWillDisappear:(BOOL)animated
- {
- [super viewWillDisappear:animated];
- self.menuIsShow = NO;
- }
- - (ShowBtn *)titleBtn
- {
- if (!_titleBtn) {
- _titleBtn = [[ShowBtn alloc] init];
- }
- return _titleBtn;
- }
- - (void)viewDidLoad {
- [super viewDidLoad];
- self.fd_prefersNavigationBarHidden = YES;
- self.tableView.delegate = self;
- self.tableView.dataSource = self;
- [self setCusView];
- [self.cusNavBar addSubview:self.titleBtn];
- [self.titleBtn mas_makeConstraints:^(MASConstraintMaker *make) {
- make.center.mas_equalTo(self.cusNavBar);
- }];
- [self autoSizeBtn:@"全部"];
- [self getGroupList];
- [self setTableViewRefresh];
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(headRefresh) name:TOPICDATAUPDATA object:nil];
- }
- - (void)autoSizeBtn:(NSString *)title
- {
- [self.titleBtn setLabelTitle:title];
- [self.titleBtn mas_remakeConstraints:^(MASConstraintMaker *make) {
- make.center.mas_equalTo(self.cusNavBar);
- }];
- [self.cusNavBar layoutIfNeeded];
- }
- - (void)dealloc
- {
- [[NSNotificationCenter defaultCenter] removeObserver:self];
- }
- #pragma mark - UItableView刷新
- - (void)setTableViewRefresh{
- WeakSelf(self)
- self.tableView.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
- [weakself headRefresh];
- }];
- // self.tableView.mj_footer = [MJRefreshBackStateFooter footerWithRefreshingBlock:^{
- // [weakself footerRefresh];
- // }];
-
- [self.tableView.mj_header beginRefreshing];
- }
- - (void)headRefresh{
- self.currentPage = 1;
- self.totalRecord = 0;
- self.totalPage = 1;
- [self.dataArray removeAllObjects];
- [self getData];
- }
- - (void)footerRefresh{
- self.currentPage += 1;
- if (self.totalRecord == self.dataArray.count) {
- self.currentPage --;
- [self.tableView.mj_footer resetNoMoreData];
- return ;
- }
- [self getData];
- }
- - (void)setCusView
- {
- self.menuIsShow = NO;
- WS(weakSelf);
- [self.titleBtn setAction:^{
- if (!weakSelf.menuIsShow) {
- [weakSelf.menuListView show];
- [weakSelf.titleBtn show];
- weakSelf.menuListView.SelectBtnblock = ^(NSArray * _Nonnull array) {
- [weakSelf.titleBtn dismiss];
- [weakSelf.selectGIdArray removeAllObjects];
- NSMutableString * showName = [[NSMutableString alloc] init];
- for (NSArray * subArray in array) {
- for (TopicGroupManageModel * model in subArray) {
- if (model.isSelect) {
- [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];
- }
- }
- if (weakSelf.selectGIdArray.count > 0) {
- dispatch_async(dispatch_get_main_queue(), ^{
- [weakSelf headRefresh];
- });
- }
- };
- weakSelf.menuListView.dismissBlock = ^{
- [weakSelf.titleBtn dismiss];
- };
- weakSelf.menuListView.SelectGroupblock = ^{
- [weakSelf.titleBtn dismiss];
- 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.titleBtn dismiss];
- [weakSelf.menuListView dismiss];
- }
- }];
- [self.editBtn setAction:^{
- weakSelf.menuIsShow = NO;
- [weakSelf.titleBtn dismiss];
- [weakSelf.menuListView dismiss];
- MyTDTopicCreateVC * vc = [MyTDTopicCreateVC initMyTDTopicCreateVC];
- vc.type = CollectModel_NewTopic;
- vc.upDateBlock = ^{
- [weakSelf headRefresh];
- };
- [weakSelf.navigationController pushViewController:vc animated:YES];
- }];
- }
- #pragma mark - 网络请求
- - (void)getGroupList
- {
- [self.groupListArray removeAllObjects];
- WS(weakSelf);
- [[HttpManager sharedHttpManager] POSTUrl:Host(APP_Topic_Group) parameters:@{} responseStyle:JOSN success:^(id _Nonnull responseObject) {
- NSLog(@"%@",responseObject);
- NSArray * array = responseObject;
- TopicGroupManageModel * allModel = [[TopicGroupManageModel alloc] init];
- allModel.Name = @"全部";
- allModel.Id = 0;
- allModel.isSelect = NO;
- [weakSelf.groupListArray addObject:allModel];
- [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] showToView:self.cusNavBar MenuType:MenuMoreSelectType];
- });
- } failure:^(NSError * _Nonnull error) {
-
- }];
- }
- - (void)getData
- {
- BOOL isAll = NO;
- for (NSInteger i = 0; i < self.selectGIdArray.count; i ++) {
- if ([self.selectGIdArray[i] integerValue] == 0) {
- isAll = YES;
- }
- }
- if (isAll) {
- [self.selectGIdArray removeAllObjects];
- }
- WS(weakSelf);
- NSDictionary * paraDict = @{@"ParentId":@(0),
- @"UserId":@([AppUserModel sharedAppUserModel].Id),
- @"Keyword": @"",
- @"Page":@(self.currentPage),
- @"TopicGroupIds": self.selectGIdArray,
- @"PerPage": @(99999999),
- // @"PerPage": @(10),
- @"Sort":@""
- };
- [[HttpManager sharedHttpManager] POSTUrl:Host(APP_Topic_Topic_List_Page) parameters:paraDict responseStyle:JOSN success:^(id _Nonnull responseObject) {
- NSLog(@"%@",responseObject);
- [weakSelf.tableView.mj_header endRefreshing];
- [weakSelf.tableView.mj_footer endRefreshing];
- TopicListModel * model = [TopicListModel modelWithDictionary:responseObject];
- weakSelf.totalRecord = model.Total;
- [weakSelf.dataArray addObjectsFromArray:model.Items];
- if (weakSelf.totalRecord == weakSelf.dataArray.count) {
- [weakSelf.tableView.mj_footer resetNoMoreData];
- }
- dispatch_async(dispatch_get_main_queue(), ^{
- if (weakSelf.dataArray.count > 0) {
- weakSelf.noDataView.hidden = YES;
- weakSelf.tableView.hidden = NO;
- [weakSelf.tableView reloadData];
- }else{
- weakSelf.noDataView.hidden = NO;
- weakSelf.tableView.hidden = YES;
- weakSelf.noDataL.text = @"暂无话题内容";
- }
- });
- } failure:^(NSError * _Nonnull error) {
- [weakSelf.tableView.mj_header endRefreshing];
- [weakSelf.tableView.mj_footer endRefreshing];
- }];
- }
- #pragma mark - UITableViewDelegate
- - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
- {
- return self.dataArray.count + 1;
- }
- - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
- {
- if (section == 0) {
- return 0;
- }
- return 1;
- }
- - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
- {
- WS(weakSelf);
- TopicListItemModel * model = [self.dataArray objectAtIndex:(indexPath.section - 1)];
- 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;
- }
- }
- - (void)enterFileWithModel:(TopicListItemModel *)model
- {
- if (model.UserId == [AppUserModel sharedAppUserModel].Id) {
- NoteBookVC *vc = [NoteBookVC initNoteBookVC];
- vc.listType = MyFavoriteListLevelTypeB;
- vc.FolderId = model.FolderResult.Id;
- vc.ParentId = model.FolderResult.Id;
- vc.myTitle = model.FolderResult.FolderName;
- vc.VisitUserId = model.UserId;
- [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;
- [self.navigationController pushViewController:vc animated:YES];
- }
- }
- - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
- {
- if (section == 0) {
- return 50.f;
- }
- return 0.01f;
- }
- - (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
- {
- if (section == 0) {
- return 0.01f;
- }
- return 8.f;
- }
- - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
- {
- if (section == 0) {
- UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 50)];
- MyTDGroupView * groupView = [[MyTDGroupView alloc] init];
- [view addSubview:groupView];
- view.backgroundColor = UIColorHex(FFFFFF);
- UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(pushSearchVC)];
- [view addGestureRecognizer:tap];
- view.userInteractionEnabled = YES;
- return view;
- }else{
- return [UIView new];
- }
- }
- - (void)showUserInfo:(NSInteger)userId
- {
- MailListDetailVC * vc = [MailListDetailVC initMailListDetailVC];
- vc.indexId = userId;
- [self.navigationController pushViewController:vc animated:YES];
- }
- #pragma mark - 点击文件跳转
- - (void)pushFileWithModel:(TopicListSubModel *)model
- {
- WS(weakSelf);
- switch (model.Type) {
- case CollectModel_Aritle:
- {
- SHOWLOADING
- [[HttpManager sharedHttpManager] GETWithUrl:[NSString stringWithFormat:@"%@%ld",Article_Detail_Get,(long)model.Id] parameters:@{} success:^(id _Nonnull responseObject) {
- REMOVESHOW;
- Item *itemModel = [[Item alloc]initWithDictionary:responseObject error:nil];
- HomeDetailController *homeDetail = [[HomeDetailController alloc] init];
- [homeDetail loadCurrentModel:itemModel];
- [weakSelf.navigationController pushViewController:homeDetail animated:YES];
- } failure:^(NSError * _Nonnull error) {
- SHOWERROR([ZYCTool handerResultData:error]);
- }];
- }
- break;
- case CollectModel_Toipc:
- {
- MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
- vc.type = CollectModel_Toipc;
- vc.Id = model.Id;
- [self.navigationController pushViewController:vc animated:YES];
- }
- break;
- case CollectModel_NewTopic:
- {
- MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
- vc.type = CollectModel_NewTopic;
- vc.Id = model.Id;
- [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;
- [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;
- [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;
- [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;
- [self.navigationController pushViewController:vc animated:YES];
- }else{
- OtherNoteBookVC *vc = [OtherNoteBookVC initOtherNoteBookVC];
- vc.listType = model.Id == 0 ? MyFavoriteListLevelTypeA : MyFavoriteListLevelTypeB;
- vc.ParentId = 0;
- vc.FolderId = model.Id;
- 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;
- [self.navigationController pushViewController:vc animated:YES];
- }
- break;
- case CollectModel_InterMail:
- {
- MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
- vc.type = CollectModel_InterMail;
- vc.Id = model.Id;
- [self.navigationController pushViewController:vc animated:YES];
- }
- break;
- case CollectModel_Group:
- {
- TDGroupInfoListVC * vc = [TDGroupInfoListVC initTDGroupInfoListVC];
- vc.GroupId = model.Id;
- vc.titleStr = model.Title;
- [self.navigationController pushViewController:vc animated:YES];
- }
- break;
- case CollectModel_meetMian:
- {
- MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
- vc.type = CollectModel_meetMian;
- vc.Id = model.Id;
- [self.navigationController pushViewController:vc animated:YES];
- }
- break;
- case CollectModel_meetDetail:
- {
- WorkFlowDetailsController * vc = [[WorkFlowDetailsController alloc] initWithId:model.Id];
- [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;
- [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;
- [self.navigationController pushViewController:vc animated:YES];
- }
- break;
- }
- }
- - (void)pushSearchVC
- {
- MyTDTopicSearchVC * vc = [[MyTDTopicSearchVC alloc] init];
- vc.searchType = TDTopicSearch;
- [self.navigationController pushViewController:vc animated:YES];
- }
- - (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section
- {
- UIView * view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 8)];
- view.backgroundColor = UIColorHex(#F5F6F8);
- return view;
- }
- - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
- {
- WS(weakSelf);
- [tableView deselectRowAtIndexPath:indexPath animated:YES];
- TopicListItemModel * model = [self.dataArray objectAtIndex:(indexPath.section - 1)];
- MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
- vc.type = CollectModel_NewTopic;
- vc.deleteTopicBlock = ^{
- [weakSelf headRefresh];
- };
- vc.Id = model.Id;
- [self.navigationController pushViewController:vc animated:YES];
- }
- #pragma mark - loadData
- - (NSMutableArray *)groupListArray
- {
- if (!_groupListArray) {
- _groupListArray = [NSMutableArray array];
- }
- return _groupListArray;
- }
- - (NSMutableArray *)selectGIdArray
- {
- if (!_selectGIdArray) {
- _selectGIdArray = [NSMutableArray array];
- }
- return _selectGIdArray;
- }
- - (NSMutableArray *)dataArray
- {
- if (!_dataArray) {
- _dataArray = [NSMutableArray array];
- }
- return _dataArray;
- }
- - (void)backAction:(id)sender
- {
- [super backAction:sender];
- self.menuIsShow = NO;
- [self.menuListView dismiss];
- }
- #pragma mark - 点击评论
- - (void)likeAction:(TopicListItemModel *)model withBtn:(UIButton *)btn index:(NSIndexPath *)indexPath
- {
- WS(weakSelf);
- NSDictionary * paraDict = @{@"SourceId":@(model.Id),
- @"TypeValue":@(3),///3 笔记
- @"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(), ^{
- [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.deleteTopicBlock = ^{
- [weakSelf headRefresh];
- };
- vc.Id = model.Id;
- vc.isComment = 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;
- }
- - (NSAttributedString *)setTextWithStr:(NSString *)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
- {
- 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;
- }
- @end
|