XYVoiceMatchOrderListViewController.m 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. //
  2. // XYVoiceMatchOrderListViewController.m
  3. // Starbuds
  4. //
  5. // Created by 翟玉磊 on 2020/11/20.
  6. // Copyright © 2020 翟玉磊. All rights reserved.
  7. //
  8. #import "XYVoiceMatchOrderListViewController.h"
  9. #import "XYVoiceMatchOrderListViewModel.h"
  10. #import "XYVoiceMatchOrderCellModel.h"
  11. #import "XYVoiceMatchOrderListTableViewCell.h"
  12. #import "XYVoiceMatchOrderDetailsViewController.h"
  13. @interface XYVoiceMatchOrderListViewController ()
  14. @property (nonatomic, strong) XYVoiceMatchOrderListViewModel *viewModel;
  15. @end
  16. @implementation XYVoiceMatchOrderListViewController
  17. - (void)viewDidLoad {
  18. [super viewDidLoad];
  19. // Do any additional setup after loading the view.
  20. }
  21. #pragma mark — Override
  22. - (void)bindViewModel {
  23. self.viewModel = XYVoiceMatchOrderListViewModel.new;
  24. self.viewModel.orderStatus = self.orderStatus;
  25. }
  26. - (UIEdgeInsets)contentInset {
  27. return UIEdgeInsetsMake(0, 0, NAVGATION_HEIGHT + 48.0f, 0);
  28. }
  29. - (void)tableViewDidTriggerHeaderRefresh {
  30. self.viewModel.pullDown = YES;
  31. [self.viewModel loadData:^(id _Nullable responseModel) {
  32. [self tableViewDidFinishTriggerHeader:YES reload:YES];
  33. [self.tableView zyl_configEmptyViewWithType:ZYLEmptyDataViewTypeDefault emptyInfo:@"" errorInfo:@"" offsetTop:250.0f hasData:self.viewModel.dataSource.count>0 hasError:NO reloadBlock:nil];
  34. } failure:^(ZYLNetworkError * _Nullable error) {
  35. [self tableViewDidFinishTriggerHeader:YES reload:NO];
  36. [self.tableView zyl_configEmptyViewWithType:ZYLEmptyDataViewTypeDefault emptyInfo:@"" errorInfo:error.domain offsetTop:250.0f hasData:self.viewModel.dataSource.count>0 hasError:error!=nil reloadBlock:nil];
  37. }];
  38. }
  39. - (void)tableViewDidTriggerFooterRefresh {
  40. [super tableViewDidTriggerFooterRefresh];
  41. }
  42. - (UITableViewCell *)tableView:(UITableView *)tableView dequeueReusableCellWithIdentifier:(NSString *)identifier forIndexPath:(NSIndexPath *)indexPath {
  43. return [XYVoiceMatchOrderListTableViewCell cellWithTableView:tableView];
  44. }
  45. - (void)configureCell:(XYVoiceMatchOrderListTableViewCell *)cell atIndexPath:(NSIndexPath *)indexPath withObject:(id)object {
  46. [cell configureModel:object];
  47. }
  48. - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
  49. return 182.0f;
  50. }
  51. - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
  52. [tableView deselectRowAtIndexPath:indexPath animated:YES];
  53. XYVoiceMatchOrderCellModel *model = self.viewModel.dataSource[indexPath.row];
  54. XYVoiceMatchOrderDetailsViewController *controller = XYVoiceMatchOrderDetailsViewController.new;
  55. controller.orderId = [model.hisId copy];
  56. [self.navigationController pushViewController:controller animated:YES];
  57. }
  58. #pragma mark — JXCategoryListContentViewDelegate
  59. /**
  60. 如果列表是VC,就返回VC.view
  61. 如果列表是View,就返回View自己
  62. @return 返回列表视图
  63. */
  64. - (UIView *)listView {
  65. return self.view;
  66. }
  67. @end