MyTDTopicSearchVC.m 45 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947
  1. //
  2. // MyTDTopicSearchVC.m
  3. // smartRhino
  4. //
  5. // Created by niuzhen on 2019/12/19.
  6. // Copyright © 2019 tederen. All rights reserved.
  7. //
  8. #import "MyTDTopicSearchVC.h"
  9. #import "TDGroupInfoListCell.h"
  10. #import "TopicListModel.h"
  11. #import "MyTDGroupView.h"
  12. #import "MyTDTopicDetailVC.h"
  13. #import "TopicGroupManageModel.h"
  14. #import "MyTDTopicCreateVC.h"
  15. #import "NoteBookVC.h"
  16. #import "NoteBookShareVC.h"
  17. #import "MyTDGroupViewController.h"
  18. #import "MoveViewController.h"
  19. #import "HomeDetailController.h"
  20. #import "TDGroupInfoListVC.h"
  21. #import "WorkFlowDetailsController.h"
  22. #import "MyApprovalPageDetail.h"
  23. #import "DownFileViewController.h"
  24. #import "MyFavoriteVC.h"
  25. #import "OtherNoteBookVC.h"
  26. #import "OtherFavoriteVC.h"
  27. #import "MailListDetailVC.h"
  28. #import "ShareListVC.h"
  29. @interface MyTDTopicSearchVC ()<UITableViewDelegate,UITableViewDataSource,NoteBookShareVCDelegate>
  30. @property (nonatomic, assign) NSUInteger currentPage;
  31. @property (nonatomic, assign) NSUInteger totalPage;
  32. @property (nonatomic, assign) NSUInteger totalRecord;
  33. @property (nonatomic, assign) BOOL isFresh;
  34. @property (strong, nonatomic) NSMutableArray * groupListArray;
  35. @property (strong, nonatomic) NSMutableArray * dataArray;
  36. @property (strong, nonatomic) NoteBookShareVC * noteBookShareVC;
  37. @end
  38. @implementation MyTDTopicSearchVC
  39. - (void)viewDidLoad {
  40. [super viewDidLoad];
  41. self.fd_prefersNavigationBarHidden = YES;
  42. self.view.backgroundColor = RGB(255, 255, 255);
  43. self.tableView.delegate = self;
  44. self.tableView.dataSource = self;
  45. self.historySearchType = HistorySearchType_Topic;
  46. [self.view addSubview:self.noteBookShareVC.view];
  47. [self addObserver:self forKeyPath:@"searchText" options:NSKeyValueObservingOptionNew context:nil];
  48. }
  49. - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary<NSKeyValueChangeKey,id> *)change context:(void *)context
  50. {
  51. id obj = [change objectForKey:@"new"];
  52. NSString * text = @"";
  53. if ([obj isKindOfClass:[NSString class]]) {
  54. text = obj;
  55. }else{
  56. text = [obj stringValue];
  57. }
  58. if (text.length > 0) {
  59. [self headRefresh];
  60. }
  61. }
  62. #pragma mark - UItableView刷新
  63. - (void)setTableViewRefresh{
  64. WeakSelf(self)
  65. self.tableView.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
  66. [weakself headRefresh];
  67. }];
  68. self.tableView.mj_footer = [MJRefreshBackStateFooter footerWithRefreshingBlock:^{
  69. [weakself footerRefresh];
  70. }];
  71. }
  72. - (void)headRefresh{
  73. self.currentPage = 1;
  74. self.totalPage = 0;
  75. [self.dataArray removeAllObjects];
  76. [self getData];
  77. }
  78. - (void)footerRefresh{
  79. self.currentPage += 1;
  80. if (self.totalRecord == self.dataArray.count) {
  81. self.currentPage --;
  82. [self.tableView.mj_footer endRefreshing];
  83. return ;
  84. }
  85. [self getData];
  86. }
  87. - (void)getData
  88. {
  89. NSDictionary * paraDict;
  90. NSString * url;
  91. if (self.searchType == TDTopicSearch) {
  92. paraDict = @{@"ParentId":@(self.floderId),
  93. @"UserId":@([AppUserModel sharedAppUserModel].Id),
  94. @"Keyword": self.searchText,
  95. @"TopicGroupIds": @[],
  96. @"PerPage": @(10),
  97. @"Page": @(self.currentPage),
  98. @"Sort":@""
  99. };
  100. url = Host(APP_Topic_List_Page);
  101. }else{
  102. paraDict = @{@"GroupIds":@[@(self.GroupId)],
  103. @"Page": @(self.currentPage),
  104. @"PerPage": @(10),
  105. @"Sort":@"",
  106. @"UserId":@([AppUserModel sharedAppUserModel].Id),
  107. @"Key":self.searchText
  108. };
  109. url = Host(API_APP_Topic_Page);
  110. }
  111. WS(weakSelf);
  112. SHOWLOADING
  113. [[HttpManager sharedHttpManager] POSTUrl:url parameters:paraDict responseStyle:JOSN success:^(id _Nonnull responseObject) {
  114. NSLog(@"%@",responseObject);
  115. REMOVESHOW
  116. TopicListModel * model = [TopicListModel modelWithDictionary:responseObject];
  117. weakSelf.totalRecord = model.Total;
  118. [weakSelf.tableView.mj_header endRefreshing];
  119. [weakSelf.tableView.mj_footer endRefreshing];
  120. [weakSelf.dataArray addObjectsFromArray:model.Items];
  121. if (weakSelf.totalRecord == weakSelf.dataArray.count) {
  122. [weakSelf.tableView.mj_footer resetNoMoreData];
  123. }
  124. dispatch_async(dispatch_get_main_queue(), ^{
  125. if (weakSelf.dataArray.count > 0) {
  126. weakSelf.collectionView.hidden = YES;
  127. weakSelf.noDataView.hidden = YES;
  128. weakSelf.tableView.hidden = NO;
  129. [weakSelf.tableView reloadData];
  130. }else{
  131. weakSelf.noDataView.hidden = NO;
  132. weakSelf.collectionView.hidden = YES;
  133. weakSelf.tableView.hidden = YES;
  134. weakSelf.noDataL.attributedText = [ZYCTool checkOfString:@"没有话题,我来发表一个" withSearchText:@"发表" bgtextColor:UIColorHex(#BBBBBB) foreTextColor:UIColorHex(#0F88EB) font:[UIFont systemFontOfSize:15]];
  135. UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithActionBlock:^(id _Nonnull sender) {
  136. MyTDTopicCreateVC * vc = [MyTDTopicCreateVC initMyTDTopicCreateVC];
  137. vc.type = weakSelf.searchType == TDTopicSearch ? CollectModel_NewTopic : CollectModel_Toipc;
  138. vc.upDateBlock = ^{
  139. [weakSelf headRefresh];
  140. };
  141. [weakSelf.navigationController pushViewController:vc animated:YES];
  142. }];
  143. [weakSelf.noDataL addGestureRecognizer:tap];
  144. weakSelf.noDataL.userInteractionEnabled = YES;
  145. }
  146. });
  147. } failure:^(NSError * _Nonnull error) {
  148. REMOVESHOW
  149. }];
  150. }
  151. #pragma mark - UITableViewDelegate
  152. - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
  153. {
  154. return self.dataArray.count;
  155. }
  156. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
  157. {
  158. WS(weakSelf);
  159. TopicListItemModel * model = [self.dataArray objectAtIndex:indexPath.row];
  160. switch (model.DataType) {
  161. case TopiclistCellImage:
  162. {
  163. TDGroupInfoListCell * cell;
  164. switch (model.Data.count) {
  165. case 1:
  166. {
  167. cell = [TDGroupInfoListCell configCell1:tableView indexPath:indexPath];
  168. cell.cellImagV1.hidden = NO;
  169. cell.cellImagV2.hidden = YES;
  170. cell.cellImagV3.hidden = YES;
  171. cell.cellImagV4.hidden = YES;
  172. cell.cellImagV5.hidden = YES;
  173. cell.cellImagV6.hidden = YES;
  174. cell.cellImagV7.hidden = YES;
  175. cell.cellImagV8.hidden = YES;
  176. cell.cellImagV9.hidden = YES;
  177. TopicListSubModel * subModel0 = model.Data[0];
  178. [cell.cellImagV1 sd_setImageWithURL:[NSURL URLWithString:subModel0.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  179. }
  180. break;
  181. case 2:
  182. {
  183. cell = [TDGroupInfoListCell configCell1:tableView indexPath:indexPath];
  184. cell.cellImagV1.hidden = NO;
  185. cell.cellImagV2.hidden = NO;
  186. cell.cellImagV3.hidden = YES;
  187. cell.cellImagV4.hidden = YES;
  188. cell.cellImagV5.hidden = YES;
  189. cell.cellImagV6.hidden = YES;
  190. cell.cellImagV7.hidden = YES;
  191. cell.cellImagV8.hidden = YES;
  192. cell.cellImagV9.hidden = YES;
  193. TopicListSubModel * subModel0 = model.Data[0];
  194. [cell.cellImagV1 sd_setImageWithURL:[NSURL URLWithString:subModel0.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  195. TopicListSubModel * subModel1 = model.Data[1];
  196. [cell.cellImagV2 sd_setImageWithURL:[NSURL URLWithString:subModel1.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  197. }
  198. break;
  199. case 3:
  200. {
  201. cell = [TDGroupInfoListCell configCell2:tableView indexPath:indexPath];
  202. cell.cellImagV1.hidden = NO;
  203. cell.cellImagV2.hidden = NO;
  204. cell.cellImagV3.hidden = NO;
  205. cell.cellImagV4.hidden = YES;
  206. cell.cellImagV5.hidden = YES;
  207. cell.cellImagV6.hidden = YES;
  208. cell.cellImagV7.hidden = YES;
  209. cell.cellImagV8.hidden = YES;
  210. cell.cellImagV9.hidden = YES;
  211. TopicListSubModel * subModel0 = model.Data[0];
  212. [cell.cellImagV1 sd_setImageWithURL:[NSURL URLWithString:subModel0.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  213. TopicListSubModel * subModel1 = model.Data[1];
  214. [cell.cellImagV2 sd_setImageWithURL:[NSURL URLWithString:subModel1.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  215. TopicListSubModel * subModel2 = model.Data[2];
  216. [cell.cellImagV3 sd_setImageWithURL:[NSURL URLWithString:subModel2.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  217. }
  218. break;
  219. case 4:
  220. {
  221. cell = [TDGroupInfoListCell configCell3:tableView indexPath:indexPath];
  222. cell.cellImagV1.hidden = NO;
  223. cell.cellImagV2.hidden = NO;
  224. cell.cellImagV3.hidden = NO;
  225. cell.cellImagV4.hidden = NO;
  226. cell.cellImagV5.hidden = YES;
  227. cell.cellImagV6.hidden = YES;
  228. cell.cellImagV7.hidden = YES;
  229. cell.cellImagV8.hidden = YES;
  230. cell.cellImagV9.hidden = YES;
  231. TopicListSubModel * subModel0 = model.Data[0];
  232. [cell.cellImagV1 sd_setImageWithURL:[NSURL URLWithString:subModel0.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  233. TopicListSubModel * subModel1 = model.Data[1];
  234. [cell.cellImagV2 sd_setImageWithURL:[NSURL URLWithString:subModel1.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  235. TopicListSubModel * subModel2 = model.Data[2];
  236. [cell.cellImagV3 sd_setImageWithURL:[NSURL URLWithString:subModel2.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  237. TopicListSubModel * subModel3 = model.Data[3];
  238. [cell.cellImagV4 sd_setImageWithURL:[NSURL URLWithString:subModel3.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  239. }
  240. break;
  241. case 5:
  242. {
  243. cell = [TDGroupInfoListCell configCell4:tableView indexPath:indexPath];
  244. cell.cellImagV1.hidden = NO;
  245. cell.cellImagV2.hidden = NO;
  246. cell.cellImagV3.hidden = NO;
  247. cell.cellImagV4.hidden = NO;
  248. cell.cellImagV5.hidden = NO;
  249. cell.cellImagV6.hidden = YES;
  250. cell.cellImagV7.hidden = YES;
  251. cell.cellImagV8.hidden = YES;
  252. cell.cellImagV9.hidden = YES;
  253. TopicListSubModel * subModel0 = model.Data[0];
  254. [cell.cellImagV1 sd_setImageWithURL:[NSURL URLWithString:subModel0.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  255. TopicListSubModel * subModel1 = model.Data[1];
  256. [cell.cellImagV2 sd_setImageWithURL:[NSURL URLWithString:subModel1.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  257. TopicListSubModel * subModel2 = model.Data[2];
  258. [cell.cellImagV3 sd_setImageWithURL:[NSURL URLWithString:subModel2.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  259. TopicListSubModel * subModel3 = model.Data[3];
  260. [cell.cellImagV4 sd_setImageWithURL:[NSURL URLWithString:subModel3.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  261. TopicListSubModel * subModel4 = model.Data[4];
  262. [cell.cellImagV5 sd_setImageWithURL:[NSURL URLWithString:subModel4.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  263. }
  264. break;
  265. case 6:
  266. {
  267. cell = [TDGroupInfoListCell configCell4:tableView indexPath:indexPath];
  268. cell.cellImagV1.hidden = NO;
  269. cell.cellImagV2.hidden = NO;
  270. cell.cellImagV3.hidden = NO;
  271. cell.cellImagV4.hidden = NO;
  272. cell.cellImagV5.hidden = NO;
  273. cell.cellImagV6.hidden = NO;
  274. cell.cellImagV7.hidden = YES;
  275. cell.cellImagV8.hidden = YES;
  276. cell.cellImagV9.hidden = YES;
  277. TopicListSubModel * subModel0 = model.Data[0];
  278. [cell.cellImagV1 sd_setImageWithURL:[NSURL URLWithString:subModel0.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  279. TopicListSubModel * subModel1 = model.Data[1];
  280. [cell.cellImagV2 sd_setImageWithURL:[NSURL URLWithString:subModel1.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  281. TopicListSubModel * subModel2 = model.Data[2];
  282. [cell.cellImagV3 sd_setImageWithURL:[NSURL URLWithString:subModel2.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  283. TopicListSubModel * subModel3 = model.Data[3];
  284. [cell.cellImagV4 sd_setImageWithURL:[NSURL URLWithString:subModel3.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  285. TopicListSubModel * subModel4 = model.Data[4];
  286. [cell.cellImagV5 sd_setImageWithURL:[NSURL URLWithString:subModel4.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  287. TopicListSubModel * subModel5 = model.Data[5];
  288. [cell.cellImagV6 sd_setImageWithURL:[NSURL URLWithString:subModel5.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  289. }
  290. break;
  291. case 7:
  292. {
  293. cell = [TDGroupInfoListCell configCell5:tableView indexPath:indexPath];
  294. cell.cellImagV1.hidden = NO;
  295. cell.cellImagV2.hidden = NO;
  296. cell.cellImagV3.hidden = NO;
  297. cell.cellImagV4.hidden = NO;
  298. cell.cellImagV5.hidden = NO;
  299. cell.cellImagV6.hidden = NO;
  300. cell.cellImagV7.hidden = NO;
  301. cell.cellImagV8.hidden = YES;
  302. cell.cellImagV9.hidden = YES;
  303. TopicListSubModel * subModel0 = model.Data[0];
  304. [cell.cellImagV1 sd_setImageWithURL:[NSURL URLWithString:subModel0.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  305. TopicListSubModel * subModel1 = model.Data[1];
  306. [cell.cellImagV2 sd_setImageWithURL:[NSURL URLWithString:subModel1.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  307. TopicListSubModel * subModel2 = model.Data[2];
  308. [cell.cellImagV3 sd_setImageWithURL:[NSURL URLWithString:subModel2.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  309. TopicListSubModel * subModel3 = model.Data[3];
  310. [cell.cellImagV4 sd_setImageWithURL:[NSURL URLWithString:subModel3.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  311. TopicListSubModel * subModel4 = model.Data[4];
  312. [cell.cellImagV5 sd_setImageWithURL:[NSURL URLWithString:subModel4.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  313. TopicListSubModel * subModel5 = model.Data[5];
  314. [cell.cellImagV6 sd_setImageWithURL:[NSURL URLWithString:subModel5.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  315. TopicListSubModel * subModel6 = model.Data[6];
  316. [cell.cellImagV7 sd_setImageWithURL:[NSURL URLWithString:subModel6.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  317. }
  318. break;
  319. case 8:
  320. {
  321. cell = [TDGroupInfoListCell configCell5:tableView indexPath:indexPath];
  322. cell.cellImagV1.hidden = NO;
  323. cell.cellImagV2.hidden = NO;
  324. cell.cellImagV3.hidden = NO;
  325. cell.cellImagV4.hidden = NO;
  326. cell.cellImagV5.hidden = NO;
  327. cell.cellImagV6.hidden = NO;
  328. cell.cellImagV7.hidden = NO;
  329. cell.cellImagV8.hidden = NO;
  330. cell.cellImagV9.hidden = YES;
  331. TopicListSubModel * subModel0 = model.Data[0];
  332. [cell.cellImagV1 sd_setImageWithURL:[NSURL URLWithString:subModel0.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  333. TopicListSubModel * subModel1 = model.Data[1];
  334. [cell.cellImagV2 sd_setImageWithURL:[NSURL URLWithString:subModel1.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  335. TopicListSubModel * subModel2 = model.Data[2];
  336. [cell.cellImagV3 sd_setImageWithURL:[NSURL URLWithString:subModel2.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  337. TopicListSubModel * subModel3 = model.Data[3];
  338. [cell.cellImagV4 sd_setImageWithURL:[NSURL URLWithString:subModel3.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  339. TopicListSubModel * subModel4 = model.Data[4];
  340. [cell.cellImagV5 sd_setImageWithURL:[NSURL URLWithString:subModel4.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  341. TopicListSubModel * subModel5 = model.Data[5];
  342. [cell.cellImagV6 sd_setImageWithURL:[NSURL URLWithString:subModel5.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  343. TopicListSubModel * subModel6 = model.Data[6];
  344. [cell.cellImagV7 sd_setImageWithURL:[NSURL URLWithString:subModel6.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  345. TopicListSubModel * subModel7 = model.Data[7];
  346. [cell.cellImagV8 sd_setImageWithURL:[NSURL URLWithString:subModel7.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  347. }
  348. break;
  349. default:
  350. {
  351. cell = [TDGroupInfoListCell configCell5:tableView indexPath:indexPath];
  352. cell.cellImagV1.hidden = NO;
  353. cell.cellImagV2.hidden = NO;
  354. cell.cellImagV3.hidden = NO;
  355. cell.cellImagV4.hidden = NO;
  356. cell.cellImagV5.hidden = NO;
  357. cell.cellImagV6.hidden = NO;
  358. cell.cellImagV7.hidden = NO;
  359. cell.cellImagV8.hidden = NO;
  360. cell.cellImagV9.hidden = NO;
  361. TopicListSubModel * subModel0 = model.Data[0];
  362. [cell.cellImagV1 sd_setImageWithURL:[NSURL URLWithString:subModel0.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  363. TopicListSubModel * subModel1 = model.Data[1];
  364. [cell.cellImagV2 sd_setImageWithURL:[NSURL URLWithString:subModel1.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  365. TopicListSubModel * subModel2 = model.Data[2];
  366. [cell.cellImagV3 sd_setImageWithURL:[NSURL URLWithString:subModel2.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  367. TopicListSubModel * subModel3 = model.Data[3];
  368. [cell.cellImagV4 sd_setImageWithURL:[NSURL URLWithString:subModel3.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  369. TopicListSubModel * subModel4 = model.Data[4];
  370. [cell.cellImagV5 sd_setImageWithURL:[NSURL URLWithString:subModel4.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  371. TopicListSubModel * subModel5 = model.Data[5];
  372. [cell.cellImagV6 sd_setImageWithURL:[NSURL URLWithString:subModel5.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  373. TopicListSubModel * subModel6 = model.Data[6];
  374. [cell.cellImagV7 sd_setImageWithURL:[NSURL URLWithString:subModel6.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  375. TopicListSubModel * subModel7 = model.Data[7];
  376. [cell.cellImagV8 sd_setImageWithURL:[NSURL URLWithString:subModel7.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  377. TopicListSubModel * subModel8 = model.Data[8];
  378. [cell.cellImagV9 sd_setImageWithURL:[NSURL URLWithString:subModel8.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  379. }
  380. break;
  381. }
  382. [cell.cellIconV sd_setImageWithURL:[NSURL URLWithString:model.AvatarUrl] placeholderImage:kUserDefaultHeadImage];
  383. [cell.fileBtn setTitle:model.FolderResult.FolderName forState:UIControlStateNormal];
  384. [cell.fileBtn setAction:^{
  385. [weakSelf enterFileWithModel:model];
  386. }];
  387. cell.cellTimeL.text = [model.CreatedDate substringWithRange:NSMakeRange(5, 11)];
  388. cell.cellNameL.text = model.UserName;
  389. cell.cellReadNumL.text = [NSString stringWithFormat:@"阅读:%ld",(long)model.ReadCount];
  390. cell.celltitleL.attributedText = [ZYCTool checkOfString:model.Title withSearchText:self.searchText];
  391. cell.cellContentL.attributedText = [ZYCTool checkOfString:model.Content withSearchText:self.searchText];
  392. [cell.cellLikeBtn setAction:^{
  393. [weakSelf likeAction:model withBtn:cell.cellLikeBtn index:indexPath];
  394. }];
  395. if (model.CommentCount > 0) {
  396. [cell.cellPingBtn setTitle:[NSString stringWithFormat:@"%ld",(long)model.CommentCount] forState:UIControlStateNormal];
  397. }else{
  398. [cell.cellPingBtn setTitle:@"评论" forState:UIControlStateNormal];
  399. }
  400. if (model.PraiseCount > 0) {
  401. [cell.cellLikeBtn setTitle:[NSString stringWithFormat:@"%ld",(long)model.PraiseCount] forState:UIControlStateNormal];
  402. }else{
  403. [cell.cellLikeBtn setTitle:@"赞" forState:UIControlStateNormal];
  404. }
  405. if (model.IsPraise) {
  406. [cell.cellLikeBtn setTitleColor:UIColorHex(#009AFF) forState:UIControlStateNormal];
  407. [cell.cellLikeBtn setImage:[UIImage imageNamed:@"收藏_赞_select"] forState:UIControlStateNormal];
  408. }else{
  409. [cell.cellLikeBtn setTitleColor:UIColorHex(#999999) forState:UIControlStateNormal];
  410. [cell.cellLikeBtn setImage:[UIImage imageNamed:@"收藏_赞"] forState:UIControlStateNormal];
  411. }
  412. [cell.cellPingBtn setAction:^{
  413. [weakSelf CommentPush:model];
  414. }];
  415. [cell.cellSendBtn setAction:^{
  416. [weakSelf reSend:model];
  417. }];
  418. if (model.Title.length == 0) {
  419. cell.TitleConstant.constant = 0;
  420. }else{
  421. cell.TitleConstant.constant = 10.f;
  422. }
  423. if (model.Content.length == 0) {
  424. cell.subTitleContant.constant = 0.f;
  425. }else{
  426. cell.subTitleContant.constant = 7.5f;
  427. }
  428. cell.fileContant.constant = 0.f;
  429. if (self.searchType == TDTopicSearch) {
  430. cell.fileBtn.hidden = NO;
  431. cell.rightView.hidden = NO;
  432. }else{
  433. cell.fileBtn.hidden = YES;
  434. cell.rightView.hidden = YES;
  435. }
  436. cell.ClickUserBlock = ^{
  437. [weakSelf showUserInfo:model.UserId];
  438. };
  439. return cell;
  440. }
  441. break;
  442. case TopiclistCellFile:
  443. {
  444. TDGroupInfoListCell * cell = [TDGroupInfoListCell configCell6:tableView indexPath:indexPath];
  445. [cell.cellIconV sd_setImageWithURL:[NSURL URLWithString:model.AvatarUrl] placeholderImage:kUserDefaultHeadImage];
  446. [cell.fileBtn setTitle:model.FolderResult.FolderName forState:UIControlStateNormal];
  447. [cell.fileBtn setAction:^{
  448. [weakSelf enterFileWithModel:model];
  449. }];
  450. cell.cellNameL.text = model.UserName;
  451. cell.cellTimeL.text = [model.CreatedDate substringWithRange:NSMakeRange(5, 11)];
  452. cell.celltitleL.attributedText = [ZYCTool checkOfString:model.Title withSearchText:self.searchText];
  453. cell.cellContentL.attributedText = [ZYCTool checkOfString:model.Content withSearchText:self.searchText];
  454. [cell setDataWithCell6:model.Data.firstObject];
  455. cell.cellReadNumL.text = [NSString stringWithFormat:@"阅读:%ld",(long)model.ReadCount];
  456. [cell.ClickFileAction setAction:^{
  457. [weakSelf pushFileWithModel:model.Data.firstObject];
  458. }];
  459. [cell.cellLikeBtn setAction:^{
  460. [weakSelf likeAction:model withBtn:cell.cellLikeBtn index:indexPath];
  461. }];
  462. if (model.CommentCount > 0) {
  463. [cell.cellPingBtn setTitle:[NSString stringWithFormat:@"%ld",(long)model.CommentCount] forState:UIControlStateNormal];
  464. }else{
  465. [cell.cellPingBtn setTitle:@"评论" forState:UIControlStateNormal];
  466. }
  467. if (model.PraiseCount > 0) {
  468. [cell.cellLikeBtn setTitle:[NSString stringWithFormat:@"%ld",(long)model.PraiseCount] forState:UIControlStateNormal];
  469. }else{
  470. [cell.cellLikeBtn setTitle:@"赞" forState:UIControlStateNormal];
  471. }
  472. if (model.IsPraise) {
  473. [cell.cellLikeBtn setTitleColor:UIColorHex(#009AFF) forState:UIControlStateNormal];
  474. [cell.cellLikeBtn setImage:[UIImage imageNamed:@"收藏_赞_select"] forState:UIControlStateNormal];
  475. }else{
  476. [cell.cellLikeBtn setTitleColor:UIColorHex(#999999) forState:UIControlStateNormal];
  477. [cell.cellLikeBtn setImage:[UIImage imageNamed:@"收藏_赞"] forState:UIControlStateNormal];
  478. }
  479. [cell.cellPingBtn setAction:^{
  480. [weakSelf CommentPush:model];
  481. }];
  482. [cell.cellSendBtn setAction:^{
  483. [weakSelf reSend:model];
  484. }];
  485. if (model.Title.length == 0) {
  486. cell.TitleConstant.constant = 0;
  487. }else{
  488. cell.TitleConstant.constant = 10.f;
  489. }
  490. if (model.Content.length == 0) {
  491. cell.subTitleContant.constant = 0.f;
  492. }else{
  493. cell.subTitleContant.constant = 7.5f;
  494. }
  495. cell.fileContant.constant = 0.f;
  496. if (self.searchType == TDTopicSearch) {
  497. cell.fileBtn.hidden = NO;
  498. cell.rightView.hidden = NO;
  499. }else{
  500. cell.fileBtn.hidden = YES;
  501. cell.rightView.hidden = YES;
  502. }
  503. cell.ClickUserBlock = ^{
  504. [weakSelf showUserInfo:model.UserId];
  505. };
  506. return cell;
  507. }
  508. break;
  509. default:///TopiclistCellNone
  510. {
  511. TDGroupInfoListCell * cell = [TDGroupInfoListCell configCell0:tableView indexPath:indexPath];
  512. [cell.cellIconV sd_setImageWithURL:[NSURL URLWithString:model.AvatarUrl] placeholderImage:kUserDefaultHeadImage];
  513. [cell.fileBtn setTitle:model.FolderResult.FolderName forState:UIControlStateNormal];
  514. [cell.fileBtn setAction:^{
  515. [weakSelf enterFileWithModel:model];
  516. }];
  517. cell.cellNameL.text = model.UserName;
  518. cell.cellTimeL.text = [model.CreatedDate substringWithRange:NSMakeRange(5, 11)];
  519. cell.celltitleL.attributedText = [ZYCTool checkOfString:model.Title withSearchText:self.searchText];
  520. cell.cellContentL.attributedText = [ZYCTool checkOfString:model.Content withSearchText:self.searchText];
  521. cell.cellReadNumL.text = [NSString stringWithFormat:@"阅读:%ld",(long)model.ReadCount];
  522. [cell.cellLikeBtn setAction:^{
  523. [weakSelf likeAction:model withBtn:cell.cellLikeBtn index:indexPath];
  524. }];
  525. if (model.CommentCount > 0) {
  526. [cell.cellPingBtn setTitle:[NSString stringWithFormat:@"%ld",(long)model.CommentCount] forState:UIControlStateNormal];
  527. }else{
  528. [cell.cellPingBtn setTitle:@"评论" forState:UIControlStateNormal];
  529. }
  530. if (model.PraiseCount > 0) {
  531. [cell.cellLikeBtn setTitle:[NSString stringWithFormat:@"%ld",(long)model.PraiseCount] forState:UIControlStateNormal];
  532. }else{
  533. [cell.cellLikeBtn setTitle:@"赞" forState:UIControlStateNormal];
  534. }
  535. if (model.IsPraise) {
  536. [cell.cellLikeBtn setTitleColor:UIColorHex(#009AFF) forState:UIControlStateNormal];
  537. [cell.cellLikeBtn setImage:[UIImage imageNamed:@"收藏_赞_select"] forState:UIControlStateNormal];
  538. }else{
  539. [cell.cellLikeBtn setTitleColor:UIColorHex(#999999) forState:UIControlStateNormal];
  540. [cell.cellLikeBtn setImage:[UIImage imageNamed:@"收藏_赞"] forState:UIControlStateNormal];
  541. }
  542. [cell.cellPingBtn setAction:^{
  543. [weakSelf CommentPush:model];
  544. }];
  545. [cell.cellSendBtn setAction:^{
  546. [weakSelf reSend:model];
  547. }];
  548. if (model.Title.length == 0) {
  549. cell.TitleConstant.constant = 0;
  550. }else{
  551. cell.TitleConstant.constant = 10.f;
  552. }
  553. if (model.Content.length == 0) {
  554. cell.subTitleContant.constant = 0.f;
  555. }else{
  556. cell.subTitleContant.constant = 7.5f;
  557. }
  558. cell.fileContant.constant = 0.f;
  559. if (self.searchType == TDTopicSearch) {
  560. cell.fileBtn.hidden = NO;
  561. cell.rightView.hidden = NO;
  562. }else{
  563. cell.fileBtn.hidden = YES;
  564. cell.rightView.hidden = YES;
  565. }
  566. cell.ClickUserBlock = ^{
  567. [weakSelf showUserInfo:model.UserId];
  568. };
  569. return cell;
  570. }
  571. break;
  572. }
  573. }
  574. - (void)showUserInfo:(NSInteger)userId
  575. {
  576. MailListDetailVC * vc = [MailListDetailVC initMailListDetailVC];
  577. vc.indexId = userId;
  578. [self.navigationController pushViewController:vc animated:YES];
  579. }
  580. - (void)enterFileWithModel:(TopicListItemModel *)model
  581. {
  582. NoteBookVC *vc = [NoteBookVC initNoteBookVC];
  583. vc.listType = MyFavoriteListLevelTypeB;
  584. vc.ParentId = model.FolderResult.Id;
  585. vc.FolderId = model.FolderResult.Id;
  586. vc.myTitle = model.FolderResult.FolderName;
  587. vc.VisitUserId = 0;
  588. [self.navigationController pushViewController:vc animated:YES];
  589. }
  590. - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
  591. {
  592. return 0.01f;
  593. }
  594. - (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
  595. {
  596. return 8.f;
  597. }
  598. - (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section
  599. {
  600. UIView * view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 8)];
  601. view.backgroundColor = UIColorHex(#F5F6F8);
  602. return view;
  603. }
  604. - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
  605. {
  606. [tableView deselectRowAtIndexPath:indexPath animated:YES];
  607. TopicListItemModel * model = [self.dataArray objectAtIndex:indexPath.row];
  608. MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
  609. vc.type = self.searchType == TDTopicSearch ? CollectModel_NewTopic : CollectModel_Toipc;
  610. vc.Id = model.Id;
  611. [self.navigationController pushViewController:vc animated:YES];
  612. }
  613. #pragma mark - loadData
  614. - (NSMutableArray *)groupListArray
  615. {
  616. if (!_groupListArray) {
  617. _groupListArray = [NSMutableArray array];
  618. }
  619. return _groupListArray;
  620. }
  621. - (NSMutableArray *)dataArray
  622. {
  623. if (!_dataArray) {
  624. _dataArray = [NSMutableArray array];
  625. }
  626. return _dataArray;
  627. }
  628. #pragma mark - 点击文件跳转
  629. - (void)pushFileWithModel:(TopicListSubModel *)model
  630. {
  631. WS(weakSelf);
  632. switch (model.Type) {
  633. case CollectModel_Aritle:
  634. {
  635. SHOWLOADING
  636. [[HttpManager sharedHttpManager] GETWithUrl:[NSString stringWithFormat:@"%@%ld",Article_Detail_Get,(long)model.Id] parameters:@{} success:^(id _Nonnull responseObject) {
  637. REMOVESHOW;
  638. Item *itemModel = [[Item alloc]initWithDictionary:responseObject error:nil];
  639. // HomeDetailController *homeDetail = [[HomeDetailController alloc] init];
  640. // [homeDetail loadCurrentModel:itemModel];
  641. // [weakSelf.navigationController pushViewController:homeDetail animated:YES];
  642. MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
  643. vc.type = CollectModel_Aritle;
  644. vc.Id = itemModel.Id;
  645. [weakSelf.navigationController pushViewController:vc animated:YES];
  646. } failure:^(NSError * _Nonnull error) {
  647. SHOWERROR([ZYCTool handerResultData:error]);
  648. }];
  649. }
  650. break;
  651. case CollectModel_Toipc:
  652. {
  653. MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
  654. vc.type = CollectModel_Toipc;
  655. vc.Id = model.Id;
  656. [self.navigationController pushViewController:vc animated:YES];
  657. }
  658. break;
  659. case CollectModel_NewTopic:
  660. {
  661. MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
  662. vc.type = CollectModel_NewTopic;
  663. vc.Id = model.Id;
  664. [self.navigationController pushViewController:vc animated:YES];
  665. }
  666. break;
  667. case CollectModel_Collect:
  668. {
  669. }
  670. break;
  671. case CollectModel_NoteBook:
  672. {
  673. MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
  674. vc.type = CollectModel_NoteBook;
  675. vc.Id = model.Id;
  676. [self.navigationController pushViewController:vc animated:YES];
  677. }
  678. break;
  679. case CollectModel_CollectFile:{
  680. if (model.SourceUserId == [AppUserModel sharedAppUserModel].Id) {
  681. MyFavoriteVC *vc = [MyFavoriteVC initMyFavoriteVC];
  682. vc.listType = model.Id == 0 ? MyFavoriteListLevelTypeA : MyFavoriteListLevelTypeB;
  683. vc.ParentId = 0;
  684. vc.FolderId = model.Id;
  685. vc.myTitle = model.Title;
  686. [self.navigationController pushViewController:vc animated:YES];
  687. }else{
  688. OtherFavoriteVC *vc = [OtherFavoriteVC initOtherFavoriteVC];
  689. vc.listType = model.Id == 0 ? MyFavoriteListLevelTypeA : MyFavoriteListLevelTypeB;
  690. vc.ParentId = 0;
  691. vc.FolderId = model.Id;
  692. vc.myTitle = model.Title;
  693. vc.VisitUserId = model.SourceUserId;
  694. [self.navigationController pushViewController:vc animated:YES];
  695. }
  696. }break;
  697. case CollectModel_NoteFile:{
  698. if (model.SourceUserId == [AppUserModel sharedAppUserModel].Id) {
  699. NoteBookVC *vc = [NoteBookVC initNoteBookVC];
  700. vc.listType = model.Id == 0 ? MyFavoriteListLevelTypeA : MyFavoriteListLevelTypeB;
  701. vc.ParentId = 0;
  702. vc.FolderId = model.Id;
  703. vc.myTitle = model.Title;
  704. vc.VisitUserId = 0;
  705. [self.navigationController pushViewController:vc animated:YES];
  706. }else{
  707. OtherNoteBookVC *vc = [OtherNoteBookVC initOtherNoteBookVC];
  708. vc.listType = model.Id == 0 ? MyFavoriteListLevelTypeA : MyFavoriteListLevelTypeB;
  709. vc.ParentId = 0;
  710. vc.FolderId = model.Id;
  711. vc.myTitle = model.Title;
  712. vc.TypeValue = 1;
  713. vc.VisitUserId = model.SourceUserId;
  714. [self.navigationController pushViewController:vc animated:YES];
  715. }
  716. }break;
  717. case CollectModel_Notice:
  718. {
  719. MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
  720. vc.type = CollectModel_Notice;
  721. vc.Id = model.Id;
  722. [self.navigationController pushViewController:vc animated:YES];
  723. }
  724. break;
  725. case CollectModel_InterMail:
  726. {
  727. MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
  728. vc.type = CollectModel_InterMail;
  729. vc.Id = model.Id;
  730. [self.navigationController pushViewController:vc animated:YES];
  731. }
  732. break;
  733. case CollectModel_Group:
  734. {
  735. TDGroupInfoListVC * vc = [TDGroupInfoListVC initTDGroupInfoListVC];
  736. vc.GroupId = model.Id;
  737. vc.titleStr = model.Title;
  738. [self.navigationController pushViewController:vc animated:YES];
  739. }
  740. break;
  741. case CollectModel_meetMian:
  742. {
  743. MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
  744. vc.type = CollectModel_meetMian;
  745. vc.Id = model.Id;
  746. [self.navigationController pushViewController:vc animated:YES];
  747. }
  748. break;
  749. case CollectModel_meetDetail:
  750. {
  751. WorkFlowDetailsController * vc = [[WorkFlowDetailsController alloc] initWithId:model.Id];
  752. [self.navigationController pushViewController:vc animated:YES];
  753. }
  754. break;
  755. case CollectModel_work:
  756. {
  757. MyApprovalPageDetail * vc = [[MyApprovalPageDetail alloc]init];
  758. vc.pageType = Type_ONEC;
  759. vc.indexId = model.Id;
  760. vc.title = model.Title;
  761. vc.TodoId = model.Id;
  762. [self.navigationController pushViewController:vc animated:YES];
  763. }
  764. break;
  765. default:
  766. {
  767. DownFileViewController *vc = [[DownFileViewController alloc]init];
  768. FlowAttachmentsModel * fmodel = [[FlowAttachmentsModel alloc] init];
  769. fmodel.SoureId = model.Id;
  770. fmodel.Title = model.Title;
  771. fmodel.Url = model.File;
  772. vc.model = fmodel;
  773. [self.navigationController pushViewController:vc animated:YES];
  774. }
  775. break;
  776. }
  777. }
  778. #pragma mark - 点击评论
  779. - (void)likeAction:(TopicListItemModel *)model withBtn:(UIButton *)btn index:(NSIndexPath *)indexPath
  780. {
  781. WS(weakSelf);
  782. NSDictionary * paraDict = @{@"SourceId":@(model.Id),
  783. @"TypeValue":@(self.searchType == 0 ? -4 : 2),///3 笔记
  784. @"AnalyzeType":@(1)
  785. };
  786. btn.enabled = NO;
  787. [[HttpManager sharedHttpManager] POSTUrl:Host(API_APP_Analyze_Set) parameters:paraDict responseStyle:DATA success:^(id _Nonnull responseObject) {
  788. btn.enabled = YES;
  789. model.IsPraise = !model.IsPraise;
  790. model.PraiseCount = model.IsPraise ? (model.PraiseCount + 1) : (model.PraiseCount - 1);
  791. dispatch_async(dispatch_get_main_queue(), ^{
  792. [weakSelf.tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
  793. });
  794. } failure:^(NSError * _Nonnull error) {
  795. btn.enabled = YES;
  796. }];
  797. }
  798. - (void)CommentPush:(TopicListItemModel *)model
  799. {
  800. WS(weakSelf);
  801. MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
  802. vc.type = self.searchType == TDTopicSearch ? CollectModel_NewTopic : CollectModel_Toipc;
  803. vc.RefreshTopicBlock = ^{
  804. [weakSelf headRefresh];
  805. };
  806. vc.Id = model.Id;
  807. vc.isComment = YES;
  808. [self.navigationController pushViewController:vc animated:YES];
  809. }
  810. /// 转发正文
  811. - (void)shareHander:(NSIndexPath *)indexPath{
  812. [self.noteBookShareVC initNoteBookShareData];
  813. self.noteBookShareVC.indexpath = indexPath;
  814. self.noteBookShareVC.view.hidden = !self.noteBookShareVC.view.hidden;
  815. }
  816. - (NoteBookShareVC *)noteBookShareVC{
  817. if (_noteBookShareVC == nil) {
  818. _noteBookShareVC = [NoteBookShareVC initNoteBookShareVC];
  819. [_noteBookShareVC.view setFrame:CGRectMake(0,0, SCREEN_WIDTH, SCREEN_HEIGHT)];
  820. [_noteBookShareVC.view setHidden:YES];
  821. _noteBookShareVC.delegate = self;
  822. }
  823. return _noteBookShareVC;
  824. }
  825. - (void)userSelectType:(NSString *)typeName WithIndexPath:(NSIndexPath *)indexPath
  826. {
  827. self.noteBookShareVC.view.hidden = !self.noteBookShareVC.view.hidden;
  828. if ([typeName isEqualToString:@"发给微信好友"]) {
  829. [self returnToWechatSession];
  830. }else if ([typeName isEqualToString:@"发到朋友圈"]){
  831. [self returnToWechatTimeLine];
  832. }else if ([typeName isEqualToString:@"发到微博"]){
  833. [self returnToSina];
  834. }else if ([typeName isEqualToString:@"发给QQ好友"]){
  835. [self returnToQQ];
  836. }else if ([typeName isEqualToString:@"发到消息"]){
  837. [self returnToMessage];
  838. }else if ([typeName isEqualToString:@"发到小组"]){
  839. [self returnToGroup];
  840. }else if ([typeName isEqualToString:@"发到笔记"]){
  841. [self returnToNote];
  842. }else if ([typeName isEqualToString:@"发到话题"]){
  843. [self returnToTopic];
  844. }else{
  845. }
  846. }
  847. - (void)shareWebPageToPlatformType:(UMSocialPlatformType)platformType title:(NSString *)title desc:(NSString *)desc url:(NSString *)url
  848. {
  849. //创建分享消息对象
  850. UMSocialMessageObject *messageObject = [UMSocialMessageObject messageObject];
  851. messageObject.title = title;
  852. //创建网页内容对象
  853. UMShareWebpageObject *shareObject = [UMShareWebpageObject shareObjectWithTitle:title descr:desc thumImage:IMG(@"话题")];
  854. //设置网页地址
  855. shareObject.webpageUrl = url;
  856. //分享消息对象设置分享内容对象
  857. messageObject.shareObject = shareObject;
  858. //调用分享接口
  859. [[UMSocialManager defaultManager] shareToPlatform:platformType messageObject:messageObject currentViewController:self completion:^(id data, NSError *error) {
  860. if (error) {
  861. NSLog(@"************Share fail with error %@*********",error);
  862. }else{
  863. NSLog(@"response data is %@",data);
  864. }
  865. }];
  866. }
  867. - (void)returnToWechatSession
  868. {
  869. [self shareWebPageToPlatformType:UMSocialPlatformType_WechatSession title:self.sendModel.Title desc:[NSString stringWithFormat:@"来自-%@",self.sendModel.Author] url:[self returnUrl]];
  870. }
  871. - (void)returnToWechatTimeLine
  872. {
  873. [self shareWebPageToPlatformType:UMSocialPlatformType_WechatTimeLine title:self.sendModel.Title desc:[NSString stringWithFormat:@"来自-%@",self.sendModel.Author] url:[self returnUrl]];
  874. }
  875. - (void)returnToSina
  876. {
  877. [self shareWebPageToPlatformType:UMSocialPlatformType_Sina title:self.sendModel.Title desc:[NSString stringWithFormat:@"来自-%@",self.sendModel.Author] url:[self returnUrl]];
  878. }
  879. - (void)returnToQQ
  880. {
  881. [self shareWebPageToPlatformType:UMSocialPlatformType_QQ title:self.sendModel.Title desc:[NSString stringWithFormat:@"来自-%@",self.sendModel.Author] url:[self returnUrl]];
  882. }
  883. - (NSString *)returnUrl
  884. {
  885. NSString * url = [NSString stringWithFormat:@"%@%ld",Host(@"/admin/mobile/noteDetailsWx?"),(long)self.sendModel.Id];
  886. return url;
  887. }
  888. - (void)returnToMessage
  889. {
  890. ShareListVC * vc = [ShareListVC initShareListVC];
  891. vc.sendModel = self.sendModel;
  892. vc.isReturn = YES;
  893. [self.navigationController pushViewController:vc animated:YES];
  894. }
  895. - (void)returnToGroup
  896. {
  897. MyTDGroupViewController * vc = [[MyTDGroupViewController alloc] init];
  898. vc.type = CollectModel_Group;
  899. vc.sendModel = self.sendModel;
  900. vc.isReturn = YES;
  901. [self.navigationController pushViewController:vc animated:YES];
  902. }
  903. - (void)returnToNote
  904. {
  905. MyTDTopicCreateVC * vc = [MyTDTopicCreateVC initMyTDTopicCreateVC];
  906. vc.type = CollectModel_NoteBook;
  907. vc.sendModel = self.sendModel;
  908. vc.isReturn = YES;
  909. [self.navigationController pushViewController:vc animated:YES];
  910. }
  911. - (void)returnToTopic
  912. {
  913. MyTDTopicCreateVC * vc = [MyTDTopicCreateVC initMyTDTopicCreateVC];
  914. vc.type = CollectModel_NewTopic;
  915. vc.sendModel = self.sendModel;
  916. vc.isReturn = YES;
  917. [self.navigationController pushViewController:vc animated:YES];
  918. }
  919. - (void)reSend:(TopicListItemModel *)model
  920. {
  921. FlowAttachmentsModel * topicModel = [[FlowAttachmentsModel alloc] init];
  922. topicModel.SoureTypeId = self.searchType == TDTopicSearch ? CollectModel_NewTopic : CollectModel_Toipc;
  923. topicModel.Title = model.Title;
  924. topicModel.SoureId = model.Id;
  925. topicModel.Title = model.Title;
  926. topicModel.Author = model.UserName;
  927. self.sendModel = topicModel;
  928. [self.noteBookShareVC initNoteBookShareData];
  929. self.noteBookShareVC.view.hidden = !self.noteBookShareVC.view.hidden;
  930. }
  931. @end