// // PBVideoViewController.m // IphoneBIMe // // Created by ZhangJF on 2023/2/7. // Copyright © 2023 ProBIM. All rights reserved. // #import "PBVideoViewController.h" #import "PBWebViewController.h" @interface PBVideoViewController () @property (nonatomic,strong) UITableView *tableView; @property (nonatomic,strong) NSArray *videoArr; @end static NSString *const CellID = @"CellID"; @implementation PBVideoViewController - (void)viewDidLoad { [super viewDidLoad]; self.view.backgroundColor = [UIColor whiteColor]; if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.f) { self.edgesForExtendedLayout = UIRectEdgeNone; } [self setupNav]; [self setupUI]; [self loadVideoList]; } - (void)setupNav { self.title = @"现场监控"; PBBackNavItem *backNav = [PBBackNavItem backNacItem]; backNav.title = @" "; [backNav addTarget:self action:@selector(backItemAction) forControlEvents:UIControlEventTouchUpInside]; UIBarButtonItem *backNavItem = [[UIBarButtonItem alloc] initWithCustomView:backNav]; self.navigationItem.leftBarButtonItem = backNavItem; } - (void)backItemAction { [self.navigationController popViewControllerAnimated:YES]; } - (void)setupUI { self.tableView = [[UITableView alloc] init]; self.tableView.backgroundColor = PBColor(248, 248, 248); self.tableView.dataSource = self; self.tableView.delegate = self; self.tableView.rowHeight = 50.f; self.tableView.tableFooterView = [[UIView alloc] initWithFrame:CGRectZero]; // self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone; [self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:CellID]; [self.view addSubview:self.tableView]; [self.tableView mas_makeConstraints:^(MASConstraintMaker *make) { make.top.left.right.bottom.equalTo(self.view); }]; } - (void)loadVideoList { [YJProgressHUD showProgress:@"" inView:self.view]; [[PBNetworkTools sharedTools] GetVideoWithOrganizeId:@"" andCallBack:^(NSURLSessionDataTask *task, id response, NSError *error) { if (error) { [YJProgressHUD showMessage:@"加载列表失败" inView:self.view]; return; } NSString *str = [[NSString alloc] initWithData:response encoding:NSUTF8StringEncoding]; PBNetworkModel *networkModel = [PBNetworkModel yy_modelWithJSON:str]; if (networkModel.Ret == 1) { [YJProgressHUD hide]; self.videoArr = networkModel.Data; [self.tableView reloadData]; } else { [YJProgressHUD showMessage:@"加载列表失败" inView:self.view]; } }]; } #pragma mark - UITableViewDataSource - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return self.videoArr.count; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellID forIndexPath:indexPath]; cell.backgroundColor = PBColor(248, 248, 248); NSDictionary *dict = self.videoArr[indexPath.row]; cell.textLabel.text = [dict valueForKey:@"carmerName"]; return cell; } #pragma mark - UITableViewDelegate - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { NSDictionary *dict = self.videoArr[indexPath.row]; NSString *url = [dict valueForKey:@"carmerSrc"]; NSString *title = [dict valueForKey:@"carmerName"]; PBWebViewController *vc = [[PBWebViewController alloc] init]; vc.jump_URL = url; vc.jump_Title = title; [self.navigationController pushViewController:vc animated:YES]; // PBPanoramaModel *panoramaModel = self.videoArr[indexPath.row]; // PBPanoramaViewController *panoramaVC = [[PBPanoramaViewController alloc] init]; // panoramaVC.projectModel = self.projectModel; // panoramaVC.panoramaModel = panoramaModel; // [self.navigationController pushViewController:panoramaVC animated:YES]; } /* #pragma mark - Navigation // In a storyboard-based application, you will often want to do a little preparation before navigation - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { // Get the new view controller using [segue destinationViewController]. // Pass the selected object to the new view controller. } */ @end