123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242 |
- //
- // SourceListVC.m
- // smartRhino
- //
- // Created by niuzhen on 2020/4/29.
- // Copyright © 2020 tederen. All rights reserved.
- //
- #import "SourceListVC.h"
- #import "ChatMsgListCell.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 "NoteBookShareVC.h"
- #import "ChatMsgListVC.h"
- #import "TopicGroupManageModel.h"
- #import "MyTDTopicGroupManageVC.h"
- #import "WorkNumberModel.h"
- #import "MyTDTopicBookVC.h"
- #import "AddLookUpUserSecondVC.h"
- #import "BookWCDetailVC.h"
- #import "BookListenVC.h"
- @interface SourceListVC ()<UITableViewDelegate,UITableViewDataSource,NoteBookShareVCDelegate>
- @property (strong, nonatomic) UITableView *tableView;
- @property (strong, nonatomic) NSMutableArray *dataArray;
- @property (strong, nonatomic) NoteBookShareVC *noteBookShareVC;
- @property (strong, nonatomic) FlowAttachmentsModel *sendModel;
- @property (assign, nonatomic) BOOL isReturn;
- @property (strong,nonatomic) UILabel *noDataL;
- @property (assign, nonatomic) NSInteger currentPage;
- @property (assign, nonatomic) NSInteger totalPage;
- @end
- @implementation SourceListVC
- - (void)viewWillAppear:(BOOL)animated
- {
- [super viewWillAppear:animated];
- [self headRefresh];
- }
- - (void)viewDidLoad {
- [super viewDidLoad];
- [self setTableRefresh];
- self.tableView.delegate = self;
- self.tableView.dataSource = self;
- self.tableView.backgroundColor = [UIColor whiteColor];
- [self.view addSubview:self.tableView];
- [self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.edges.mas_offset(UIEdgeInsetsZero);
- }];
- [self addSubNoDataL];
- [[UtilsTools getWindow] addSubview:self.noteBookShareVC.view];
- [[UtilsTools getWindow] bringSubviewToFront:self.noteBookShareVC.view];
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(recviveChaoSongRen:) name:NOTIFI_ChaoSongRen object:nil];
- }
- #pragma mark -loay
- - (UITableView *)tableView
- {
- if (!_tableView) {
- _tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain];
- _tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
- }
- return _tableView;
- }
- -(NSMutableArray *)selectGIdArray{
- if(!_selectGIdArray){
- _selectGIdArray = [NSMutableArray array];
- }
- return _selectGIdArray;
- }
- -(NSMutableArray *)dataArray{
- if(!_dataArray){
- _dataArray = [NSMutableArray array];
- }
- return _dataArray;
- }
- - (void)setTableRefresh
- {
- WS(weakSelf);
- self.tableView.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
- [weakSelf headRefresh];
- }];
- self.tableView.mj_footer = [MJRefreshAutoNormalFooter footerWithRefreshingBlock:^{
- [weakSelf footerRefresh];
- }];
- }
- - (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)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.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.centerX.mas_equalTo(self.view);
- make.centerY.mas_equalTo(self.view).offset(-80);
- }];
- 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)];
- NSMutableParagraphStyle *paraStyle = [[NSMutableParagraphStyle alloc]init];
- paraStyle.alignment = NSTextAlignmentCenter;
- [astr addAttribute:NSParagraphStyleAttributeName value:paraStyle range:NSMakeRange(0, str.length)];
- self.noDataL.attributedText = astr;
- }
- }
- #pragma mark - 添加成员
- - (void)AddGroupUser
- {
- if (self.GroupNoUser) {
- AddLookUpUserSecondVC *vc = [[AddLookUpUserSecondVC alloc] init];
- vc.titleStr = @"选人";
- vc.isDefalutPage = 1;
- USERDEFAULTSSET([NSMutableArray array], MAILSELECT);
- [self.navigationController pushViewController:vc animated:YES];
- }
- }
- - (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])
- }];
- }
- }
- #pragma mark - UITableViewDelegate
- - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
- return 1;
- }
- - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
- return self.dataArray.count;
- }
- - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
- return UITableViewAutomaticDimension;
- }
- - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
- WS(weakSelf);
-
- 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];
- if (model.FolderType == CollectModel_NewTopic) {
- [cell.fileBtn setTitle:model.FolderName forState:UIControlStateNormal];
- [cell.fileBtn setAction:^{
- [weakSelf enterFileWithModel:model];
- }];
- cell.ClickUserBlock = ^{
- [weakSelf showUserInfo:model.UserId];
- };
- }else{
- [cell.fileBtn setTitle:model.GroupName 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];
- UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithActionBlock:^(id _Nonnull sender) {
- ReadListVC * vc = [ReadListVC initReadListVC];
- vc.type = CollectModel_NewTopic;
- vc.indexId = model.Id;
- vc.ReadTotal = model.ReadCount;
- [self.navigationController pushViewController:vc animated:YES];
- }];
- [cell.cellReadNumL addGestureRecognizer:tap];
- cell.cellReadNumL.userInteractionEnabled = YES;
- [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];
- if (model.FolderType == CollectModel_NewTopic) {
- [cell.fileBtn setTitle:model.FolderName forState:UIControlStateNormal];
- [cell.fileBtn setAction:^{
- [weakSelf enterFileWithModel:model];
- }];
- cell.ClickUserBlock = ^{
- [weakSelf showUserInfo:model.UserId];
- };
- }else{
- [cell.fileBtn setTitle:model.GroupName forState:UIControlStateNormal];
- [cell.fileBtn setAction:^{
- [weakSelf enterFileWithModel:model];
- }];
- cell.ClickUserBlock = ^{
- [weakSelf showUserInfo:model.UserId];
- };
- }
- 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];
- UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithActionBlock:^(id _Nonnull sender) {
- ReadListVC * vc = [ReadListVC initReadListVC];
- vc.type = CollectModel_NewTopic;
- vc.indexId = model.Id;
- vc.ReadTotal = model.ReadCount;
- [self.navigationController pushViewController:vc animated:YES];
- }];
- [cell.cellReadNumL addGestureRecognizer:tap];
- cell.cellReadNumL.userInteractionEnabled = YES;
- [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];
- if (model.FolderType == CollectModel_NewTopic) {
- [cell.fileBtn setTitle:model.FolderName forState:UIControlStateNormal];
- [cell.fileBtn setAction:^{
- [weakSelf enterFileWithModel:model];
- }];
- cell.ClickUserBlock = ^{
- [weakSelf showUserInfo:model.UserId];
- };
- }else{
- [cell.fileBtn setTitle:model.GroupName forState:UIControlStateNormal];
- [cell.fileBtn setAction:^{
- [weakSelf enterFileWithModel:model];
- }];
- cell.ClickUserBlock = ^{
- [weakSelf showUserInfo:model.UserId];
- };
- }
- 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];
- UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithActionBlock:^(id _Nonnull sender) {
- ReadListVC * vc = [ReadListVC initReadListVC];
- vc.type = CollectModel_NewTopic;
- vc.indexId = model.Id;
- vc.ReadTotal = model.ReadCount;
- [self.navigationController pushViewController:vc animated:YES];
- }];
- [cell.cellReadNumL addGestureRecognizer:tap];
- cell.cellReadNumL.userInteractionEnabled = YES;
- [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)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
- [tableView deselectRowAtIndexPath:indexPath animated:YES];
- WS(weakSelf);
- TopicListItemModel * model = [self.dataArray objectAtIndex:indexPath.row];
- if (model) {
- MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
- vc.type = model.FolderType;
- 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 = model.FolderType;
- if (model.FolderType == CollectModel_NewTopic) {
- vc.FolderId = model.FolderId;
- vc.FolderName = model.FolderName;
- }else{
- vc.FolderId = model.GroupId;
- vc.FolderName = model.GroupName;
- }
- 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) {
-
- }];
- }
- - (void)enterFileWithModel:(TopicListItemModel *)model
- {
- if (model.FolderType == CollectModel_NewTopic) {
- 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];
- }
- }else{
- TDGroupInfoListVC * vc = [TDGroupInfoListVC initTDGroupInfoListVC];
- vc.titleStr = model.GroupName;
- vc.GroupId = model.GroupId;
- vc.type = 2;
- 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":@(model.FolderType),///
- @"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:UITableViewRowAnimationAutomatic];
- }
- });
- } failure:^(NSError * _Nonnull error) {
- btn.enabled = YES;
- }];
- }
- - (void)CommentPush:(TopicListItemModel *)model
- {
- WS(weakSelf);
- MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
- vc.type = model.FolderType;
- 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 = model.FolderType;
- 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;
- }
- }
- - (NSAttributedString *)setTextWithStr:(NSString *)str
- {
- if (str.length == 0) {
- return [[NSAttributedString alloc] initWithString:@""];
- }
- return [[NSAttributedString alloc] initWithString:str];
- }
- - (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;
- }
- @end
|