123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112 |
- //
- // EleDetailVC.m
- // JSJPCoach
- //
- // Created by EchoShacolee on 2018/1/29.
- // Copyright © 2018年 Danson. All rights reserved.
- //
- #import "EleDetailVC.h"
- #import "EleMinRecordListVC.h"
- #import "ElePictureVC.h"
- #import "SportPathVC.h"
- @interface EleDetailVC ()<UIScrollViewDelegate>
- @property (strong, nonatomic) UISegmentedControl *seg;
- @property (strong, nonatomic) UIScrollView *mainScrView;
- @property (strong,nonatomic)NSDictionary *dataDic;
- @end
- @implementation EleDetailVC
- - (void)viewDidLoad {
- [super viewDidLoad];
-
- self.navigationItem.title = [NSString stringWithFormat:@"电子教学日志详细"];
- self.view.backgroundColor = backGroundColor;
- [self configNavBar];
-
- [self getData];
-
- }
- - (void)didReceiveMemoryWarning {
- [super didReceiveMemoryWarning];
- // Dispose of any resources that can be recreated.
- }
- -(void)myInit{
- _seg = [[UISegmentedControl alloc]initWithItems:@[@"分钟学时",@"培训照片",@"轨迹回放"]];
- _seg.frame = CGRectMake(0, kNavOffSet, kSize.width, 40);
- _seg.selectedSegmentIndex = 0;
- [_seg addTarget:self action:@selector(changeTableview) forControlEvents:UIControlEventValueChanged];
- [self.view addSubview:_seg];
-
- _mainScrView = [[UIScrollView alloc]initWithFrame:CGRectMake(0, CGRectGetMaxY(_seg.frame), kSize.width, kSize.height-CGRectGetMaxY(_seg.frame))];
- _mainScrView.contentSize = CGSizeMake(kSize.width*3, 0);
- _mainScrView.pagingEnabled = YES;
- _mainScrView.showsHorizontalScrollIndicator = NO;
- _mainScrView.bounces = NO;
- _mainScrView.delegate = self;
- [self.view addSubview:_mainScrView];
-
- EleMinRecordListVC *minVC = [[EleMinRecordListVC alloc]init];
- minVC.dataArr = self.dataDic[@"list"];
- minVC.view.frame = CGRectMake(0, 0, kSize.width, _mainScrView.height);
- [self addChildViewController:minVC];
- [_mainScrView addSubview:minVC.view];
-
- ElePictureVC *pVC = [[ElePictureVC alloc]init];
- pVC.dataArr = self.dataDic[@"stuPics"];
- pVC.view.frame = CGRectMake(kSize.width, 0, kSize.width, _mainScrView.height);
- [self addChildViewController:pVC];
- [_mainScrView addSubview:pVC.view];
-
- SportPathVC *spVC = [[SportPathVC alloc]init];
- spVC.gpsListArr = self.dataDic[@"gpsList"];
- spVC.dzwlStr = self.dataDic[@"region"][@"RI_POLYGON"];
- // spVC
- spVC.view.frame = CGRectMake(kSize.width*2, 0, kSize.width, _mainScrView.height);
- [self addChildViewController:spVC];
- [_mainScrView addSubview:spVC.view];
- }
- -(void)changeTableview{
- [_mainScrView setContentOffset:CGPointMake(kSize.width*_seg.selectedSegmentIndex, 0) animated:NO];
- }
- -(void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView{
-
- _seg.selectedSegmentIndex = scrollView.contentOffset.x/kSize.width;
- }
- #pragma mark 数据请求
- - (void)getData
- {
- [LoadingView showHUD];
- NSMutableArray *arr = [NSMutableArray array];
- [arr addPro:@"id" Value:self.eLogId];//教学日志id
- [arr addPro:@"dqbh" Value:defUser.userDict[@"cityId"]];
- NSString* method = @"trainClassRecordView";
- [jiaPeiManager requestAnythingWithURL:method array:arr data:nil completion:^(NSDictionary * root) {
- RemoveHUD();
-
- if (!root) {
- ShowMsg(@"数据异常");
- return;
- }
- if ([root[@"code"] isEqualToString:@"1"]) {
- ShowMsg(root[@"body"]);
- return;
- }
-
- self.dataDic = root[@"body"];
-
- [self myInit];
- }];
- }
- @end
|