RQPlaceDetailNoteViewController.m 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. //
  2. // RQPlaceDetailNoteViewController.m
  3. // JiaPei
  4. //
  5. // Created by 张嵘 on 2023/4/17.
  6. //
  7. #import "RQPlaceDetailNoteViewController.h"
  8. @interface RQPlaceDetailNoteViewController ()
  9. /// viewModel
  10. @property (nonatomic, readonly, strong) RQPlaceDetailNoteViewModel *viewModel;
  11. @end
  12. @implementation RQPlaceDetailNoteViewController
  13. @dynamic viewModel;
  14. - (void)viewDidLoad {
  15. [super viewDidLoad];
  16. @weakify(self)
  17. self.tableView.backgroundColor = UIColor.whiteColor;
  18. [[[RQNotificationCenter rac_addObserverForName:RQUserNotificationAlipayOrWechatSuccess object:nil] takeUntil:self.rac_willDeallocSignal] subscribeNext:^(NSNotification * note) {
  19. @strongify(self)
  20. PayResp *resp = (PayResp *)note.object;
  21. NSLog(@"----微信支付成功:%@",resp.returnKey);
  22. [RQ_COMMON_MANAGER updateVipList];
  23. [self.tableView reloadData];
  24. }];
  25. }
  26. #pragma mark - OverrideMethods
  27. /// 配置tableView的区域
  28. - (UIEdgeInsets)contentInset {
  29. return UIEdgeInsetsMake(10, 0, RQ_APPLICATION_SAFEAREA_BOTTOM_HEIGHT + 54.f + (RQ_APPLICATION_NAV_BAR_HEIGHT + QMUIHelper.statusBarHeightConstant), 0);
  30. }
  31. - (UITableViewCell *)tableView:(UITableView *)tableView dequeueReusableCellWithIdentifier:(NSString *)identifier forIndexPath:(NSIndexPath *)indexPath {
  32. RQCommonGroupViewModel *groupViewModel = self.viewModel.dataSource[indexPath.section];
  33. RQCommonItemViewModel *itemViewModel = groupViewModel.itemViewModels[indexPath.row];
  34. return [NSClassFromString(itemViewModel.itemClassName) cellWithTableView:tableView];
  35. }
  36. - (void)configureCell:(RQCommonCell *)cell atIndexPath:(NSIndexPath *)indexPath withObject:(id)object {
  37. [cell bindViewModel:object];
  38. }
  39. #pragma mark - UITableViewDelegate & UITableViewDataSource
  40. - (void)scrollViewDidScroll:(UIScrollView *)scrollView {
  41. !self.scrollCallback ?: self.scrollCallback(scrollView);
  42. }
  43. #pragma mark - JXPagerViewListViewDelegate
  44. - (UIView *)listView {
  45. return self.view;
  46. }
  47. - (UIScrollView *)listScrollView {
  48. return self.tableView;
  49. }
  50. - (void)listViewDidScrollCallback:(void (^)(UIScrollView *))callback {
  51. self.scrollCallback = callback;
  52. }
  53. @end