EleDetailVC.m 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. //
  2. // EleDetailVC.m
  3. // JSJPCoach
  4. //
  5. // Created by EchoShacolee on 2018/1/29.
  6. // Copyright © 2018年 Danson. All rights reserved.
  7. //
  8. #import "EleDetailVC.h"
  9. #import "EleMinRecordListVC.h"
  10. #import "ElePictureVC.h"
  11. #import "SportPathVC.h"
  12. @interface EleDetailVC ()<UIScrollViewDelegate>
  13. @property (strong, nonatomic) UISegmentedControl *seg;
  14. @property (strong, nonatomic) UIScrollView *mainScrView;
  15. @property (strong,nonatomic)NSDictionary *dataDic;
  16. @end
  17. @implementation EleDetailVC
  18. - (void)viewDidLoad {
  19. [super viewDidLoad];
  20. self.navigationItem.title = [NSString stringWithFormat:@"电子教学日志详细"];
  21. self.view.backgroundColor = backGroundColor;
  22. [self configNavBar];
  23. [self getData];
  24. }
  25. - (void)didReceiveMemoryWarning {
  26. [super didReceiveMemoryWarning];
  27. // Dispose of any resources that can be recreated.
  28. }
  29. -(void)myInit{
  30. _seg = [[UISegmentedControl alloc]initWithItems:@[@"分钟学时",@"培训照片",@"轨迹回放"]];
  31. _seg.frame = CGRectMake(0, kNavOffSet, kSize.width, 40);
  32. _seg.selectedSegmentIndex = 0;
  33. [_seg addTarget:self action:@selector(changeTableview) forControlEvents:UIControlEventValueChanged];
  34. [self.view addSubview:_seg];
  35. _mainScrView = [[UIScrollView alloc]initWithFrame:CGRectMake(0, CGRectGetMaxY(_seg.frame), kSize.width, kSize.height-CGRectGetMaxY(_seg.frame))];
  36. _mainScrView.contentSize = CGSizeMake(kSize.width*3, 0);
  37. _mainScrView.pagingEnabled = YES;
  38. _mainScrView.showsHorizontalScrollIndicator = NO;
  39. _mainScrView.bounces = NO;
  40. _mainScrView.delegate = self;
  41. [self.view addSubview:_mainScrView];
  42. EleMinRecordListVC *minVC = [[EleMinRecordListVC alloc]init];
  43. minVC.dataArr = self.dataDic[@"list"];
  44. minVC.view.frame = CGRectMake(0, 0, kSize.width, _mainScrView.height);
  45. [self addChildViewController:minVC];
  46. [_mainScrView addSubview:minVC.view];
  47. ElePictureVC *pVC = [[ElePictureVC alloc]init];
  48. pVC.dataArr = self.dataDic[@"stuPics"];
  49. pVC.view.frame = CGRectMake(kSize.width, 0, kSize.width, _mainScrView.height);
  50. [self addChildViewController:pVC];
  51. [_mainScrView addSubview:pVC.view];
  52. SportPathVC *spVC = [[SportPathVC alloc]init];
  53. spVC.gpsListArr = self.dataDic[@"gpsList"];
  54. spVC.dzwlStr = self.dataDic[@"region"][@"RI_POLYGON"];
  55. // spVC
  56. spVC.view.frame = CGRectMake(kSize.width*2, 0, kSize.width, _mainScrView.height);
  57. [self addChildViewController:spVC];
  58. [_mainScrView addSubview:spVC.view];
  59. }
  60. -(void)changeTableview{
  61. [_mainScrView setContentOffset:CGPointMake(kSize.width*_seg.selectedSegmentIndex, 0) animated:NO];
  62. }
  63. -(void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView{
  64. _seg.selectedSegmentIndex = scrollView.contentOffset.x/kSize.width;
  65. }
  66. #pragma mark 数据请求
  67. - (void)getData
  68. {
  69. [LoadingView showHUD];
  70. NSMutableArray *arr = [NSMutableArray array];
  71. [arr addPro:@"id" Value:self.eLogId];//教学日志id
  72. [arr addPro:@"dqbh" Value:defUser.userDict[@"cityId"]];
  73. NSString* method = @"trainClassRecordView";
  74. [jiaPeiManager requestAnythingWithURL:method array:arr data:nil completion:^(NSDictionary * root) {
  75. RemoveHUD();
  76. if (!root) {
  77. ShowMsg(@"数据异常");
  78. return;
  79. }
  80. if ([root[@"code"] isEqualToString:@"1"]) {
  81. ShowMsg(root[@"body"]);
  82. return;
  83. }
  84. self.dataDic = root[@"body"];
  85. [self myInit];
  86. }];
  87. }
  88. @end