历史流量记录改版
This commit is contained in:
parent
b871a24c4e
commit
672e8cf92f
Binary file not shown.
|
|
@ -0,0 +1,21 @@
|
||||||
|
{
|
||||||
|
"images" : [
|
||||||
|
{
|
||||||
|
"idiom" : "universal",
|
||||||
|
"scale" : "1x"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"idiom" : "universal",
|
||||||
|
"scale" : "2x"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"idiom" : "universal",
|
||||||
|
"filename" : "history_bg_new@3x.png",
|
||||||
|
"scale" : "3x"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"info" : {
|
||||||
|
"version" : 1,
|
||||||
|
"author" : "xcode"
|
||||||
|
}
|
||||||
|
}
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 290 KiB |
|
|
@ -70,7 +70,7 @@
|
||||||
</dict>
|
</dict>
|
||||||
</array>
|
</array>
|
||||||
<key>CFBundleVersion</key>
|
<key>CFBundleVersion</key>
|
||||||
<string>10.0.5</string>
|
<string>10.0.8</string>
|
||||||
<key>ITSAppUsesNonExemptEncryption</key>
|
<key>ITSAppUsesNonExemptEncryption</key>
|
||||||
<false/>
|
<false/>
|
||||||
<key>LSApplicationCategoryType</key>
|
<key>LSApplicationCategoryType</key>
|
||||||
|
|
|
||||||
|
|
@ -11,4 +11,5 @@
|
||||||
@interface IfishChatView : UIView
|
@interface IfishChatView : UIView
|
||||||
@property(nonatomic,strong)NSArray*datas;
|
@property(nonatomic,strong)NSArray*datas;
|
||||||
-(void)reloadHeater;//刷新流量状态
|
-(void)reloadHeater;//刷新流量状态
|
||||||
|
-(void)loadDatasWithArray:(NSArray *)dataArray;
|
||||||
@end
|
@end
|
||||||
|
|
|
||||||
|
|
@ -10,11 +10,12 @@
|
||||||
#import "IfishHistroyVo.h"
|
#import "IfishHistroyVo.h"
|
||||||
|
|
||||||
#define Normal_heaterPh 499 //只有499才是正常流量
|
#define Normal_heaterPh 499 //只有499才是正常流量
|
||||||
#define Rect_Width kSizeFrom750(568)
|
#define Rect_Width kSizeFrom750(599)
|
||||||
#define Origin_Left kSizeFrom750(72)
|
#define Origin_Left kSizeFrom750(59)
|
||||||
#define Rect_Height kSizeFrom750(185)
|
#define Rect_Height kSizeFrom750(420)
|
||||||
|
#define Zero_Y kSizeFrom750(526)
|
||||||
@interface IfishChatView()
|
@interface IfishChatView()
|
||||||
@property(nonatomic,strong)NSMutableArray*line1;
|
@property(nonatomic,strong)NSMutableArray*line1;//水温
|
||||||
@property(nonatomic,strong)UIView *lablesView;
|
@property(nonatomic,strong)UIView *lablesView;
|
||||||
@property(nonatomic,strong)UILabel*numLable;
|
@property(nonatomic,strong)UILabel*numLable;
|
||||||
Strong NSMutableArray * heaterPhArray;//流量走势
|
Strong NSMutableArray * heaterPhArray;//流量走势
|
||||||
|
|
@ -39,73 +40,76 @@ Strong NSMutableArray * heaterPhArray;//流量走势
|
||||||
[_line1 removeAllObjects];
|
[_line1 removeAllObjects];
|
||||||
if (_datas.count) {
|
if (_datas.count) {
|
||||||
|
|
||||||
|
|
||||||
// CGFloat gapW= 357*scale*0.1;
|
|
||||||
for (int i=0; i<self.datas.count; i++) {
|
for (int i=0; i<self.datas.count; i++) {
|
||||||
IfishHistroyVo*vo=self.datas[i];
|
IfishHistroyVo*vo=self.datas[i];
|
||||||
CGFloat x=Origin_Left +([vo.heaterGatheringTime floatValue]/24)*Rect_Width;
|
CGFloat x=Origin_Left +([vo.heaterGatheringTime floatValue]/24.f)*Rect_Width;
|
||||||
if(vo.heaterWaterTemperature.integerValue>350){
|
if(vo.heaterWaterTemperature.integerValue>350){
|
||||||
vo.heaterWaterTemperature=@"350";
|
vo.heaterWaterTemperature=@"350";
|
||||||
}else if(vo.heaterWaterTemperature.integerValue<250){
|
}else if(vo.heaterWaterTemperature.integerValue<250){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
CGFloat y=Rect_Height*(1-((vo.heaterWaterTemperature.integerValue*0.1-25)/10))+kSizeFrom750(43);//*-1*+158;
|
CGFloat y=Rect_Height*(1-((vo.heaterWaterTemperature.integerValue*0.1-25)/10))+kSizeFrom750(105);//
|
||||||
CGPoint p1=CGPointMake(x, y);
|
CGPoint p1=CGPointMake(x, y);
|
||||||
// NSLog(@"%f-------%f--%f-",y,vo.heaterWaterTemperature.integerValue*0.1,x);
|
|
||||||
[_line1 addObject:NSStringFromCGPoint(p1)];
|
[_line1 addObject:NSStringFromCGPoint(p1)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return _line1;
|
return _line1;
|
||||||
}
|
}
|
||||||
-(void)setDatas:(NSArray *)datas{
|
-(void)loadDatasWithArray:(NSArray *)dataArray{
|
||||||
NSSortDescriptor *ageSD = [NSSortDescriptor sortDescriptorWithKey:@"heaterGatheringTime_int" ascending:YES];
|
NSSortDescriptor *ageSD = [NSSortDescriptor sortDescriptorWithKey:@"heaterGatheringTime_int" ascending:YES];
|
||||||
datas = [datas sortedArrayUsingDescriptors:@[ageSD]];
|
dataArray = [dataArray sortedArrayUsingDescriptors:@[ageSD]];
|
||||||
_datas=datas;
|
_datas=dataArray;
|
||||||
[self layoutIfNeeded];
|
[self layoutIfNeeded];
|
||||||
}
|
}
|
||||||
-(NSMutableArray *)heaterPhArray{
|
//-(NSMutableArray *)heaterPhArray{
|
||||||
if (!_heaterPhArray) {
|
// if (!_heaterPhArray) {
|
||||||
_heaterPhArray = InitObject(NSMutableArray);
|
// _heaterPhArray = InitObject(NSMutableArray);
|
||||||
//添加流量
|
// //添加流量
|
||||||
for (int i=0; i<23; i++) {
|
// for (int i=0; i<23; i++) {
|
||||||
CGFloat x=(i*(Rect_Width/24)+Origin_Left);
|
// CGFloat x=(i*(Rect_Width/24)+Origin_Left);
|
||||||
CGFloat y=kSizeFrom750(236);
|
// CGFloat y=kSizeFrom750(315);
|
||||||
UIView *lineView = [[UIView alloc] initWithFrame:RECT(x, y, Rect_Width/24, 1)];
|
// UIView *lineView = [[UIView alloc] initWithFrame:RECT(x, y, Rect_Width/24.f, 1)];
|
||||||
lineView.tag = i+100;
|
// lineView.tag = i+100;
|
||||||
[self addSubview:lineView];
|
// [self addSubview:lineView];
|
||||||
[_heaterPhArray addObject:lineView];
|
// [_heaterPhArray addObject:lineView];
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
return _heaterPhArray;
|
// return _heaterPhArray;
|
||||||
}
|
//}
|
||||||
//刷新流量状态
|
////刷新流量状态
|
||||||
-(void)reloadHeater{
|
//-(void)reloadHeater{
|
||||||
for (UIView *view in self.heaterPhArray) {
|
// for (UIView *view in self.heaterPhArray) {
|
||||||
[view.layer removeAllAnimations];
|
// [view.layer removeAllAnimations];
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
for (int i=0; i<self.datas.count-1; i++) {
|
// for (int i=0; i<self.datas.count-1; i++) {
|
||||||
IfishHistroyVo*vo=self.datas[i];
|
// IfishHistroyVo*vo=self.datas[i];
|
||||||
IfishHistroyVo*nextVo=self.datas[i+1];
|
// IfishHistroyVo*nextVo=self.datas[i+1];
|
||||||
//如果有时间段的数据拿不到,则直接使用虚线
|
// //如果有时间段的数据拿不到,则直接使用虚线
|
||||||
if ([nextVo.heaterGatheringTime integerValue]-[vo.heaterGatheringTime integerValue]>1) {
|
// if ([nextVo.heaterGatheringTime integerValue]-[vo.heaterGatheringTime integerValue]>1) {
|
||||||
for (int i=[vo.heaterGatheringTime intValue]; i<[nextVo.heaterGatheringTime intValue]; i++) {
|
// for (int i=[vo.heaterGatheringTime intValue]; i<[nextVo.heaterGatheringTime intValue]; i++) {
|
||||||
UIView *emptyView = [self viewWithTag:i+100];
|
// UIView *emptyView = [self viewWithTag:i+100];
|
||||||
[self drawDashLine:emptyView lineLength:2 lineSpacing:1 lineColor:[UIColor redColor]];
|
// [self drawDashLine:emptyView lineLength:2 lineSpacing:1 lineColor:[UIColor redColor]];
|
||||||
}
|
// }
|
||||||
}else{
|
// }else{
|
||||||
UIView *lineView = [self viewWithTag:[vo.heaterGatheringTime integerValue]+100];
|
// UIView *lineView = [self viewWithTag:[vo.heaterGatheringTime integerValue]+100];
|
||||||
if([vo.heaterPh integerValue]==Normal_heaterPh&&[nextVo.heaterPh integerValue]==Normal_heaterPh){//正常流量
|
// if([vo.heaterPh integerValue]==Normal_heaterPh&&[nextVo.heaterPh integerValue]==Normal_heaterPh){//正常流量
|
||||||
lineView.layer.backgroundColor = [UIColor greenColor].CGColor;
|
// lineView.layer.backgroundColor = [UIColor greenColor].CGColor;
|
||||||
|
//
|
||||||
}else{
|
// }else{
|
||||||
[self drawDashLine:lineView lineLength:2 lineSpacing:1 lineColor:[UIColor redColor]];
|
// [self drawDashLine:lineView lineLength:2 lineSpacing:1 lineColor:[UIColor redColor]];
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
-(void)drawLine{
|
-(void)drawLine{
|
||||||
|
|
||||||
|
|
||||||
|
if (self.datas==nil) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//1、水温线
|
||||||
UIColor *color = [UIColor redColor];
|
UIColor *color = [UIColor redColor];
|
||||||
[color set]; //设置线条颜色
|
[color set]; //设置线条颜色
|
||||||
|
|
||||||
|
|
@ -124,9 +128,88 @@ Strong NSMutableArray * heaterPhArray;//流量走势
|
||||||
[path addLineToPoint:CGPointFromString(p)];
|
[path addLineToPoint:CGPointFromString(p)];
|
||||||
}
|
}
|
||||||
|
|
||||||
// [path closePath];//第五条线通过调用closePath方法得到的
|
[path stroke];//Draws line 根据坐标点连线
|
||||||
|
|
||||||
|
//每个圆点大小
|
||||||
|
for (int i=0; i<self.line1.count; i++) {
|
||||||
|
|
||||||
|
NSString* p=self.line1[i];
|
||||||
|
CGPoint point=CGPointFromString(p);
|
||||||
|
UIBezierPath *path0 = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(point.x-kSizeFrom750(4), point.y-kSizeFrom750(4), kSizeFrom750(8), kSizeFrom750(8)) cornerRadius:kSizeFrom750(4)];
|
||||||
|
[path0 stroke];
|
||||||
|
[path0 fill];
|
||||||
|
|
||||||
|
}
|
||||||
|
//2、流量线(如果该时间点没有数据,则默认为无水)
|
||||||
|
UIColor *color1 = [UIColor blueColor];
|
||||||
|
[color1 set]; //设置线条颜色
|
||||||
|
UIBezierPath* path1 = [UIBezierPath bezierPath];
|
||||||
|
path1.lineWidth = 1.0;
|
||||||
|
path1.lineCapStyle = kCGLineCapRound; //线条拐角
|
||||||
|
path1.lineJoinStyle = kCGLineJoinRound; //终点处理
|
||||||
|
// Draw the lines
|
||||||
|
//两个时间点之间如果有空余时间点,则该点为缺失点,要添加上去
|
||||||
|
for (int i=0; i<self.datas.count; i++) {
|
||||||
|
IfishHistroyVo*vo=self.datas[i];
|
||||||
|
CGFloat x=Origin_Left +([vo.heaterGatheringTime floatValue]/24.f)*Rect_Width;
|
||||||
|
CGFloat y=kSizeFrom750(315);
|
||||||
|
if ([vo.heaterPh integerValue]!=Normal_heaterPh) {
|
||||||
|
y = Zero_Y;
|
||||||
|
}
|
||||||
|
//正常的点
|
||||||
|
CGPoint p2=CGPointMake(x, y);
|
||||||
|
if (i==0) {
|
||||||
|
[path1 moveToPoint:p2];//起点
|
||||||
|
}else{
|
||||||
|
[path1 addLineToPoint:p2];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (i<self.datas.count-1) {
|
||||||
|
IfishHistroyVo * nextVo = self.datas[i+1];
|
||||||
|
NSInteger hour1 = [vo.heaterGatheringTime integerValue];
|
||||||
|
NSInteger hour2 = [nextVo.heaterGatheringTime integerValue];
|
||||||
|
if (hour2-hour1>1) {
|
||||||
|
for (int j=hour1+1; j<hour2; j++) {
|
||||||
|
|
||||||
|
CGPoint zeroPoint1 = CGPointMake(Origin_Left+j/24.f*Rect_Width, Zero_Y);//无流量的点连线
|
||||||
|
[path1 addLineToPoint:zeroPoint1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
[path1 stroke];//颜色填充
|
||||||
|
|
||||||
|
//添加流量点位
|
||||||
|
for (int i=0; i<self.datas.count; i++) {
|
||||||
|
IfishHistroyVo*vo=self.datas[i];
|
||||||
|
CGFloat x=Origin_Left +([vo.heaterGatheringTime floatValue]/24.f)*Rect_Width;
|
||||||
|
CGFloat y=kSizeFrom750(315);
|
||||||
|
if ([vo.heaterPh integerValue]!=Normal_heaterPh) {
|
||||||
|
y = Zero_Y;
|
||||||
|
}
|
||||||
|
CGPoint point=CGPointMake(x, y);
|
||||||
|
|
||||||
|
if (i<self.datas.count-1) {
|
||||||
|
IfishHistroyVo * nextVo = self.datas[i+1];
|
||||||
|
NSInteger hour1 = [vo.heaterGatheringTime integerValue];
|
||||||
|
NSInteger hour2 = [nextVo.heaterGatheringTime integerValue];
|
||||||
|
if (hour2-hour1>1) {
|
||||||
|
for (int j=hour1+1; j<hour2; j++) {
|
||||||
|
|
||||||
|
CGPoint zeroPoint1 = CGPointMake(Origin_Left+j/24.f*Rect_Width, Zero_Y);//无流量的点
|
||||||
|
UIBezierPath *pathzero = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(zeroPoint1.x-kSizeFrom750(4), zeroPoint1.y-kSizeFrom750(4), kSizeFrom750(8), kSizeFrom750(8)) cornerRadius:kSizeFrom750(4)];
|
||||||
|
[pathzero stroke];
|
||||||
|
[pathzero fill];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
UIBezierPath *path01 = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(point.x-kSizeFrom750(4), point.y-kSizeFrom750(4), kSizeFrom750(8), kSizeFrom750(8)) cornerRadius:kSizeFrom750(4)];
|
||||||
|
[path01 stroke];
|
||||||
|
[path01 fill];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
[path stroke];//Draws line 根据坐标点连线
|
|
||||||
|
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
|
|
||||||
@interface IfishHistoryView()
|
@interface IfishHistoryView()
|
||||||
Strong UIButton *bgButton;
|
Strong UIButton *bgButton;
|
||||||
Strong UIView *bgView;
|
//Strong UIView *bgView;
|
||||||
Strong IfishChatView *chartView;
|
Strong IfishChatView *chartView;
|
||||||
Strong IfishChatView *chartHolder;
|
Strong IfishChatView *chartHolder;
|
||||||
Strong UILabel *titleLabel;
|
Strong UILabel *titleLabel;
|
||||||
|
|
@ -30,12 +30,11 @@ Strong UIImageView *bgImage;
|
||||||
self = [super init];
|
self = [super init];
|
||||||
if (self) {
|
if (self) {
|
||||||
[self addSubview:self.bgButton];
|
[self addSubview:self.bgButton];
|
||||||
[self addSubview:self.bgView];
|
[self addSubview:self.bgImage];
|
||||||
[self.bgView addSubview:self.titleLabel];
|
[self.bgImage addSubview:self.titleLabel];
|
||||||
[self.bgView addSubview:self.bgImage];
|
[self.bgImage addSubview:self.chartHolder];
|
||||||
[self.bgView addSubview:self.chartHolder];
|
[self addSubview:self.predayButton];
|
||||||
[self.bgView addSubview:self.predayButton];
|
[self addSubview:self.nextdayButton];
|
||||||
[self.bgView addSubview:self.nextdayButton];
|
|
||||||
[self loadLayout];
|
[self loadLayout];
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
|
|
@ -48,20 +47,12 @@ Strong UIImageView *bgImage;
|
||||||
}
|
}
|
||||||
return _bgButton;
|
return _bgButton;
|
||||||
}
|
}
|
||||||
- (UIView *)bgView{
|
|
||||||
if (!_bgView) {
|
|
||||||
_bgView = InitObject(UIView);
|
|
||||||
_bgView.backgroundColor = XWhite;
|
|
||||||
_bgView.layer.masksToBounds = YES;
|
|
||||||
_bgView.layer.cornerRadius = 15;
|
|
||||||
}
|
|
||||||
return _bgView;
|
|
||||||
}
|
|
||||||
- (UIImageView *)bgImage{
|
- (UIImageView *)bgImage{
|
||||||
if (!_bgImage) {
|
if (!_bgImage) {
|
||||||
_bgImage = InitObject(UIImageView);
|
_bgImage = InitObject(UIImageView);
|
||||||
[_bgImage setImage:IMAGEBYENAME(@"history_bg")];
|
[_bgImage setImage:IMAGEBYENAME(@"history_bg_new")];
|
||||||
|
_bgImage.layer.masksToBounds = YES;
|
||||||
|
_bgImage.layer.cornerRadius = kSizeFrom750(32);
|
||||||
}
|
}
|
||||||
return _bgImage;
|
return _bgImage;
|
||||||
}
|
}
|
||||||
|
|
@ -77,7 +68,7 @@ Strong UIImageView *bgImage;
|
||||||
_titleLabel = InitObject(UILabel);
|
_titleLabel = InitObject(UILabel);
|
||||||
_titleLabel.textAlignment = NSTextAlignmentCenter;
|
_titleLabel.textAlignment = NSTextAlignmentCenter;
|
||||||
_titleLabel.textColor = RGB(51, 51, 51);
|
_titleLabel.textColor = RGB(51, 51, 51);
|
||||||
_titleLabel.font = [UIFont systemFontOfSize:13];
|
_titleLabel.font = [UIFont systemFontOfSize:14];
|
||||||
}
|
}
|
||||||
return _titleLabel;
|
return _titleLabel;
|
||||||
}
|
}
|
||||||
|
|
@ -85,10 +76,7 @@ Strong UIImageView *bgImage;
|
||||||
- (UIButton *)predayButton{
|
- (UIButton *)predayButton{
|
||||||
if (!_predayButton) {
|
if (!_predayButton) {
|
||||||
_predayButton = InitObject(UIButton);
|
_predayButton = InitObject(UIButton);
|
||||||
// [_predayButton setTitle:@"前一天" forState:UIControlStateNormal];
|
|
||||||
[_predayButton addTarget:self action:@selector(dayChangeClick:) forControlEvents:UIControlEventTouchUpInside];
|
[_predayButton addTarget:self action:@selector(dayChangeClick:) forControlEvents:UIControlEventTouchUpInside];
|
||||||
[_predayButton.titleLabel setFont:[UIFont systemFontOfSize:13]];
|
|
||||||
// [_predayButton setTitleColor:RGB(51, 51, 51) forState:UIControlStateNormal];
|
|
||||||
_predayButton.tag = 10;
|
_predayButton.tag = 10;
|
||||||
}
|
}
|
||||||
return _predayButton;
|
return _predayButton;
|
||||||
|
|
@ -96,10 +84,7 @@ Strong UIImageView *bgImage;
|
||||||
- (UIButton *)nextdayButton{
|
- (UIButton *)nextdayButton{
|
||||||
if (!_nextdayButton) {
|
if (!_nextdayButton) {
|
||||||
_nextdayButton = InitObject(UIButton);
|
_nextdayButton = InitObject(UIButton);
|
||||||
// [_nextdayButton setTitle:@"后一天" forState:UIControlStateNormal];
|
|
||||||
[_nextdayButton addTarget:self action:@selector(dayChangeClick:) forControlEvents:UIControlEventTouchUpInside];
|
[_nextdayButton addTarget:self action:@selector(dayChangeClick:) forControlEvents:UIControlEventTouchUpInside];
|
||||||
[_nextdayButton.titleLabel setFont:[UIFont systemFontOfSize:13]];
|
|
||||||
// [_nextdayButton setTitleColor:RGB(51, 51, 51) forState:UIControlStateNormal];
|
|
||||||
_nextdayButton.tag = 11;
|
_nextdayButton.tag = 11;
|
||||||
}
|
}
|
||||||
return _nextdayButton;
|
return _nextdayButton;
|
||||||
|
|
@ -109,39 +94,33 @@ Strong UIImageView *bgImage;
|
||||||
make.edges.mas_equalTo(self);
|
make.edges.mas_equalTo(self);
|
||||||
}];
|
}];
|
||||||
|
|
||||||
[self.bgView mas_makeConstraints:^(MASConstraintMaker *make) {
|
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||||
|
make.centerX.mas_equalTo(self.bgImage);
|
||||||
|
make.top.mas_equalTo(kSizeFrom750(20));
|
||||||
|
make.height.mas_equalTo(kSizeFrom750(40));
|
||||||
|
}];
|
||||||
|
|
||||||
|
[self.bgImage mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||||
make.width.mas_equalTo(kSizeFrom750(720));
|
make.width.mas_equalTo(kSizeFrom750(720));
|
||||||
make.center.mas_equalTo(self);
|
make.center.mas_equalTo(self);
|
||||||
}];
|
make.height.mas_equalTo(kSizeFrom750(678));
|
||||||
|
|
||||||
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
||||||
make.centerX.mas_equalTo(self.bgView);
|
|
||||||
make.top.mas_equalTo(4);
|
|
||||||
make.height.mas_equalTo(20);
|
|
||||||
}];
|
|
||||||
|
|
||||||
[self.bgImage mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
||||||
make.top.mas_equalTo(self.titleLabel.mas_bottom).offset(8);
|
|
||||||
make.centerX.width.mas_equalTo(self.bgView);
|
|
||||||
make.height.mas_equalTo(kSizeFrom750(335));
|
|
||||||
make.bottom.mas_equalTo(self.bgView.mas_bottom).offset(-10);
|
|
||||||
}];
|
}];
|
||||||
|
|
||||||
[self.chartHolder mas_makeConstraints:^(MASConstraintMaker *make) {
|
[self.chartHolder mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||||
make.top.left.width.mas_equalTo(self.bgImage);
|
make.top.left.width.mas_equalTo(self.bgImage);
|
||||||
make.height.mas_equalTo(kSizeFrom750(260));
|
make.height.mas_equalTo(kSizeFrom750(580));
|
||||||
}];
|
}];
|
||||||
|
|
||||||
[self.predayButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
[self.predayButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||||
make.left.mas_equalTo(kSizeFrom750(20));
|
make.left.mas_equalTo(kSizeFrom750(20));
|
||||||
make.height.mas_equalTo(kSizeFrom750(60));
|
make.height.mas_equalTo(kSizeFrom750(80));
|
||||||
make.width.mas_equalTo(kSizeFrom750(120));
|
make.width.mas_equalTo(kSizeFrom750(140));
|
||||||
make.bottom.mas_equalTo(self.bgView.mas_bottom);
|
make.bottom.mas_equalTo(self.bgImage.mas_bottom);
|
||||||
}];
|
}];
|
||||||
|
|
||||||
[self.nextdayButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
[self.nextdayButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||||
make.width.height.centerY.mas_equalTo(self.predayButton);
|
make.width.height.centerY.mas_equalTo(self.predayButton);
|
||||||
make.right.mas_equalTo(-kSizeFrom750(40));
|
make.right.mas_equalTo(-kSizeFrom750(20));
|
||||||
}];
|
}];
|
||||||
|
|
||||||
[self.bgImage layoutIfNeeded];
|
[self.bgImage layoutIfNeeded];
|
||||||
|
|
@ -177,8 +156,8 @@ Strong UIImageView *bgImage;
|
||||||
[self.chartView removeFromSuperview];
|
[self.chartView removeFromSuperview];
|
||||||
_chartView=nil;
|
_chartView=nil;
|
||||||
}
|
}
|
||||||
self.chartView.datas=datas;
|
[self.chartView loadDatasWithArray:datas];
|
||||||
[self.chartView reloadHeater];
|
// [self.chartView reloadHeater];
|
||||||
self.titleLabel.text=self.curdateStr;
|
self.titleLabel.text=self.curdateStr;
|
||||||
// [self initLineChart];
|
// [self initLineChart];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,6 @@
|
||||||
|
|
||||||
@interface IfishBindDeviceSelectViewController ()<UITableViewDelegate,UITableViewDataSource>
|
@interface IfishBindDeviceSelectViewController ()<UITableViewDelegate,UITableViewDataSource>
|
||||||
@property (nonatomic,strong) UITableView *tableView;
|
@property (nonatomic,strong) UITableView *tableView;
|
||||||
Assign BOOL isConnectP2P;
|
|
||||||
@end
|
@end
|
||||||
extern BOOL isfromCameraView;
|
extern BOOL isfromCameraView;
|
||||||
@implementation IfishBindDeviceSelectViewController
|
@implementation IfishBindDeviceSelectViewController
|
||||||
|
|
@ -27,7 +26,6 @@ extern BOOL isfromCameraView;
|
||||||
- (void)viewDidLoad {
|
- (void)viewDidLoad {
|
||||||
[super viewDidLoad];
|
[super viewDidLoad];
|
||||||
isfromCameraView = NO;
|
isfromCameraView = NO;
|
||||||
_isConnectP2P = NO;
|
|
||||||
// Do any additional setup after loading the view.
|
// Do any additional setup after loading the view.
|
||||||
[self addTitleViewWithTitle:@"选择设备"];
|
[self addTitleViewWithTitle:@"选择设备"];
|
||||||
[self creatTab];
|
[self creatTab];
|
||||||
|
|
@ -51,35 +49,19 @@ extern BOOL isfromCameraView;
|
||||||
NSString *userIDName=[NSString stringWithFormat:@"%d",(int)[model.gwellUserID integerValue]&0x7fffffff];
|
NSString *userIDName=[NSString stringWithFormat:@"%d",(int)[model.gwellUserID integerValue]&0x7fffffff];
|
||||||
|
|
||||||
NSLog(@"%@%@%@",userIDName,model.P2PVerifyCode1,model.P2PVerifyCode2);
|
NSLog(@"%@%@%@",userIDName,model.P2PVerifyCode1,model.P2PVerifyCode2);
|
||||||
if ([userIDName isEqualToString:@"0"]) {
|
// dispatch_queue_t queue = dispatch_queue_create("net.bujige.testQueue", DISPATCH_QUEUE_CONCURRENT);
|
||||||
//
|
|
||||||
[self.view makeToast:@"摄像头用户名空错误码10001"];
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ([model.P2PVerifyCode1 isEqualToString:@""]) {
|
// dispatch_async(queue, ^{
|
||||||
[self.view makeToast:@"摄像头P2PVerifyCode1空错误码10002"];
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if ([model.P2PVerifyCode2 isEqualToString:@""]) {
|
|
||||||
[self.view makeToast:@"摄像头P2PVerifyCode2空错误码10003"];
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
dispatch_queue_t queue = dispatch_queue_create("net.bujige.testQueue", DISPATCH_QUEUE_CONCURRENT);
|
|
||||||
|
|
||||||
dispatch_async(queue, ^{
|
|
||||||
// // 追加任务1
|
// // 追加任务1
|
||||||
if ([GWP2PClient sharedClient].linkStatus!=P2PLinkStatusOK) {
|
if ([GWP2PClient sharedClient].linkStatus!=P2PLinkStatusOK) {
|
||||||
[[GWP2PClient sharedClient] connectWithAccount:userIDName codeStr1:model.P2PVerifyCode1 codeStr2:model.P2PVerifyCode2 sessionID1:model.sessionID sessionID2:model.sessionID2 customerIDs:nil];
|
[[GWP2PClient sharedClient] connectWithAccount:userIDName codeStr1:model.P2PVerifyCode1 codeStr2:model.P2PVerifyCode2 sessionID1:model.sessionID sessionID2:model.sessionID2 customerIDs:nil];
|
||||||
}
|
}
|
||||||
dispatch_async(dispatch_get_main_queue(), ^{
|
// dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
|
|
||||||
[SVProgressHUD dismiss];
|
[SVProgressHUD dismiss];
|
||||||
|
|
||||||
});
|
// });
|
||||||
|
// });
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -49,13 +49,6 @@
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
-(void)viewWillAppear:(BOOL)animated{
|
|
||||||
|
|
||||||
[self connectDevice];
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
-(void)connectDevice{
|
-(void)connectDevice{
|
||||||
|
|
||||||
[[UDPManager sharedDefault] ScanLanDevice];
|
[[UDPManager sharedDefault] ScanLanDevice];
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,7 @@ typedef NS_ENUM(NSInteger,lodingViewdissMissStyle) {
|
||||||
- (void)viewDidLoad {
|
- (void)viewDidLoad {
|
||||||
[super viewDidLoad];
|
[super viewDidLoad];
|
||||||
//智能联机
|
//智能联机
|
||||||
_isDeviceLinkIn = NO;
|
self.isDeviceLinkIn = NO;
|
||||||
self.conectType = conectType_Intelligent;
|
self.conectType = conectType_Intelligent;
|
||||||
self.addresses = [[NSMutableDictionary alloc] initWithCapacity:1];
|
self.addresses = [[NSMutableDictionary alloc] initWithCapacity:1];
|
||||||
self.view.backgroundColor = [UIColor whiteColor];
|
self.view.backgroundColor = [UIColor whiteColor];
|
||||||
|
|
@ -461,6 +461,7 @@ typedef NS_ENUM(NSInteger,lodingViewdissMissStyle) {
|
||||||
|
|
||||||
-(void)dealloc{
|
-(void)dealloc{
|
||||||
[[GWP2PDeviceLinker shareInstance] p2pStopSmartLink];
|
[[GWP2PDeviceLinker shareInstance] p2pStopSmartLink];
|
||||||
|
|
||||||
}
|
}
|
||||||
#pragma mark - UI正常状态
|
#pragma mark - UI正常状态
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -270,26 +270,23 @@
|
||||||
btn.backgroundColor = RGB(0, 184, 239);
|
btn.backgroundColor = RGB(0, 184, 239);
|
||||||
if ([result isEqualToString:@"100"]) {
|
if ([result isEqualToString:@"100"]) {
|
||||||
|
|
||||||
|
|
||||||
// 登录成功
|
// 登录成功
|
||||||
NSDictionary*DataDic=dict[@"data"];
|
NSDictionary*DataDic=dict[@"data"];
|
||||||
NSString*phoneNumber=self.loginPhoneNumberTextField.text;
|
NSString*phoneNumber=self.loginPhoneNumberTextField.text;
|
||||||
NSString*password=self.loginPasswordTextField.text;
|
NSString*password=self.loginPasswordTextField.text;
|
||||||
[[IfishUserDataUnity shareDataInstance] userloginValidationSuccsess:DataDic phoneNumber:phoneNumber passward:password];
|
[[IfishUserDataUnity shareDataInstance] userloginValidationSuccsess:DataDic phoneNumber:phoneNumber passward:password];
|
||||||
//登陆成功之后,验证当前页面devicetoken是否上送成功,如果还未上送,则重新上送devicetoken
|
//重新登陆成功之后,上送deviceToken到服务器
|
||||||
if (![[NSUserDefaults standardUserDefaults] boolForKey:is_Bind_DeviceToken]) {
|
UserModel *model=[[UserModel alloc] initWithDict:[DataDic objectForKey:@"userInfo"]];
|
||||||
UserModel *model=[[UserModel alloc] initWithDict:[DataDic objectForKey:@"userInfo"]];
|
NSDictionary *params = @{@"deviceId":[FuncUserDefault strForKey:kDeviceToken],
|
||||||
NSDictionary *params = @{@"deviceId":[FuncUserDefault strForKey:kDeviceToken],
|
|
||||||
@"userId":model.userId,
|
@"userId":model.userId,
|
||||||
@"phoneType":@"iOS"
|
@"phoneType":@"iOS"
|
||||||
};
|
};
|
||||||
[AFNOHeaderHttpTool requestWihtMethod:RequestTypePost url:Push_BindDevice_Url params:params success:^(id response) {
|
[AFNOHeaderHttpTool requestWihtMethod:RequestTypePost url:Push_BindDevice_Url params:params success:^(id response) {
|
||||||
//绑定成功
|
//绑定成功
|
||||||
[FuncUserDefault setBool:YES key:is_Bind_DeviceToken];//已经上送了本机的devicetoken
|
[FuncUserDefault setBool:YES key:is_Bind_DeviceToken];//已经上送了本机的devicetoken
|
||||||
} failure:^(NSError *err) {
|
} failure:^(NSError *err) {
|
||||||
|
|
||||||
}];
|
}];
|
||||||
}
|
|
||||||
}else if ([result isEqualToString:@"101"]){
|
}else if ([result isEqualToString:@"101"]){
|
||||||
|
|
||||||
[weakSelf.view makeToast:@"登录失败"];
|
[weakSelf.view makeToast:@"登录失败"];
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue