From 21d3023a9b7b6aff68c1170e345951396b1c6cfd Mon Sep 17 00:00:00 2001
From: 单军华
Date: Tue, 31 Jul 2018 13:35:21 +0800
Subject: [PATCH] no message
---
screendisplay/screendisplay/Classes/检测/Controller/DetailDataViewController.m | 268 +++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 268 insertions(+), 0 deletions(-)
diff --git "a/screendisplay/screendisplay/Classes/\346\243\200\346\265\213/Controller/DetailDataViewController.m" "b/screendisplay/screendisplay/Classes/\346\243\200\346\265\213/Controller/DetailDataViewController.m"
new file mode 100644
index 0000000..bec9dd6
--- /dev/null
+++ "b/screendisplay/screendisplay/Classes/\346\243\200\346\265\213/Controller/DetailDataViewController.m"
@@ -0,0 +1,268 @@
+//
+// DetailDataViewController.m
+// screendisplay
+//
+// Created by ��������� on 2018/7/5.
+// Copyright �� 2018��� ���������. All rights reserved.
+//
+
+#import "DetailDataViewController.h"
+#import "DetailService.h"
+#import "CommonReqModel.h"
+#import "DetailItemCell.h"
+#import "DynamicViewController.h"
+
+@interface DetailDataViewController ()<UITableViewDelegate,UITableViewDataSource>
+{
+ NSTimer * myTimer; // ������������������
+}
+
+@property(nonatomic,strong) UITableView * tableView;
+
+/** <#digest#> */
+@property (nonatomic, strong) DetailService *detailService;
+
+@end
+
+@implementation DetailDataViewController
+
+#pragma mark - getter
+
+- (DetailService *)detailService
+{
+ if(_detailService == nil)
+ {
+ _detailService = [[DetailService alloc] init];
+ }
+ return _detailService;
+}
+
+- (UITableView *)tableView
+{
+ if (!_tableView)
+ {
+ _tableView = [[UITableView alloc] init];
+
+
+ _tableView.delegate = self;
+ _tableView.dataSource = self;
+ _tableView.frame = CGRectMake((SCREEN_WIDTH-AdaptedWidth(340))/2, NavBar_Height+AdaptedHeight(13), AdaptedWidth(350), AdaptedHeight(570));
+ _tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
+ _tableView.backgroundColor = [UIColor clearColor];
+ [self.view addSubview:_tableView];
+
+ UIImageView * viewBackground = [[UIImageView alloc] initWithFrame:CGRectMake((SCREEN_WIDTH-AdaptedWidth(355))/2, NavBar_Height+AdaptedHeight(13), AdaptedWidth(355), AdaptedHeight(574))];
+ viewBackground.image = [UIImage imageNamed:@"detail_back"];
+ _tableView.backgroundView = viewBackground;
+
+// [_tableView mas_makeConstraints:^(MASConstraintMaker *make) {
+// make.edges.mas_equalTo(UIEdgeInsetsMake((SCREEN_WIDTH-AdaptedWidth(355))/2 , AdaptedHeight(13), AdaptedHeight(13),(SCREEN_WIDTH-AdaptedWidth(355))/2));
+// }];
+
+ _tableView.tableFooterView = [UIView new];
+ }
+ return _tableView;
+}
+
+#pragma mark - UITableViewDataSource UITableViewDelegate
+- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
+{
+ return 1;
+}
+
+- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
+{
+ return self.detailService.detailViewModels.count;
+}
+
+- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
+{
+ return AdaptedHeight(42.0);
+}
+
+- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
+{
+ DetailItemCell *topicCell = [DetailItemCell topicCellWithTableView:tableView];
+ topicCell.detailViewModel = self.detailService.detailViewModels[indexPath.row];
+ return topicCell;
+}
+
+
+-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
+{
+ NSInteger index = [indexPath row];
+
+ // 0 ������ 1 ������������ 2 ������������ 3 ������������ 4 ������
+ if([self.deviceModel.state intValue] == 4)
+ {
+ [Global alertMessageEx:@"���������������������������������������������!" title:@"������������" okTtitle:nil cancelTitle:@"������" delegate:self];
+ }
+ else
+ {
+ DynamicViewController * page = [[DynamicViewController alloc] init];
+ page.detailModel = [self.detailService.detailViewModels objectAtIndex:index];
+ [self.navigationController pushViewController:page animated:YES];
+ }
+
+ NSLog(@"click didSelectRowAtIndexPath");
+}
+
+- (void)viewDidLoad {
+ [super viewDidLoad];
+ // Do any additional setup after loading the view.
+
+ [self initView];
+
+ [self getDetailList];
+
+ //���1���������������function���������
+ myTimer = [NSTimer scheduledTimerWithTimeInterval:10.0 target:self selector:@selector(updateDynamicData) userInfo:nil repeats:YES];
+
+}
+
+-(void)viewWillAppear:(BOOL)animated
+{
+ [super viewWillAppear:YES];
+
+ self.navigationController.navigationBarHidden = YES;
+
+ if (myTimer == nil)
+ myTimer = [NSTimer scheduledTimerWithTimeInterval:10.0 target:self selector:@selector(updateDynamicData) userInfo:nil repeats:YES];
+ else
+ //���������������
+ [myTimer setFireDate:[NSDate distantPast]];
+}
+
+-(void)viewDidDisappear:(BOOL)animated
+{
+ [super viewDidDisappear:YES];
+
+ //���������������
+ if(myTimer)
+ [myTimer setFireDate:[NSDate distantFuture]];
+}
+
+-(void) initView
+{
+ // ������������������
+ //self.fd_interactivePopDisabled = YES;
+
+ self.view.backgroundColor = kUIColorFromRGB(0x0b2f76);
+
+
+}
+
+
+
+- (void)didReceiveMemoryWarning {
+ [super didReceiveMemoryWarning];
+ // Dispose of any resources that can be recreated.
+}
+
+
+#pragma mark custom function
+-(void)updateDynamicData
+{
+ [self getDetailList];
+}
+
+-(void)getDetailList
+{
+ NSMutableDictionary *param = [[NSMutableDictionary alloc] init];
+ [param setObject:self.deviceModel.deviceVersionId forKey:@"deviceVersionId"];
+ [param setObject:self.deviceModel.mac forKey:@"mac"];
+ [param setObject:self.deviceModel.id forKey:@"deviceId"];
+
+ TWWeak(self);
+ [self.detailService getDetailListWithParameters:param completion:^(NSString *desc, int code) {
+ if(code == 1)
+ {
+ weakself.tableView.hidden = NO;
+ [weakself.tableView reloadData];
+ }
+ else
+ {
+ [Global alertMessageEx:desc title:@"������������" okTtitle:nil cancelTitle:@"OK" delegate:self];
+ }
+ }];
+}
+
+/*
+#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.
+}
+*/
+
+#pragma mark - LMJNavUIBaseViewControllerDataSource
+
+- (UIStatusBarStyle)navUIBaseViewControllerPreferStatusBarStyle:(LMJNavUIBaseViewController *)navUIBaseViewController
+{
+ return UIStatusBarStyleDefault;
+}
+
+/**������������*/
+- (NSMutableAttributedString*)lmjNavigationBarTitle:(LMJNavigationBar *)navigationBar
+{
+ return [self changeTitle:@"������������" changeColor:[UIColor whiteColor]];
+}
+
+//������������
+//- (UIImage *)lmjNavigationBarBackgroundImage:(LMJNavigationBar *)navigationBar
+//{
+// return [UIImage imageNamed:@"map_top_bar_bk"];
+//}
+
+/** ��������� */
+- (UIColor *)lmjNavigationBackgroundColor:(LMJNavigationBar *)navigationBar
+{
+ return kUIColorFromRGB(0x0b2f76);
+}
+
+/** ������������������������ */
+- (BOOL)lmjNavigationIsHideBottomLine:(LMJNavigationBar *)navigationBar
+{
+ return YES;
+}
+
+/** ������������������������ */
+- (UIImage *)lmjNavigationBarLeftButtonImage:(UIButton *)leftButton navigationBar:(LMJNavigationBar *)navigationBar
+{
+ return [UIImage imageNamed:@"map_back"];
+}
+/** ������������������������ */
+- (UIImage *)lmjNavigationBarRightButtonImage:(UIButton *)rightButton navigationBar:(LMJNavigationBar *)navigationBar
+{
+ //return [UIImage imageNamed:@"map_back"];
+
+ // [rightButton setTitle:@"������������" forState: UIControlStateNormal];
+ // [rightButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
+ // [rightButton setTitleColor:[UIColor lightGrayColor] forState:UIControlStateHighlighted];
+ // rightButton.titleLabel.font = [UIFont systemFontOfSize:15];
+ //
+ // rightButton.lmj_width = 80;
+
+ return nil;
+}
+
+#pragma mark - LMJNavUIBaseViewControllerDelegate
+/** ������������������������ */
+-(void)leftButtonEvent:(UIButton *)sender navigationBar:(LMJNavigationBar *)navigationBar
+{
+ [self.navigationController popViewControllerAnimated:YES];
+ //[self dismissViewControllerAnimated:YES completion:nil];
+}
+
+
+/** ������������������������ */
+-(void)rightButtonEvent:(UIButton *)sender navigationBar:(LMJNavigationBar *)navigationBar
+{
+
+}
+
+
+
+@end
--
Gitblit v1.8.0