Commit 413f2c69 by 李威

热电

parent e41afef7
......@@ -10,7 +10,14 @@
1CA57422038A0DCD4DC42056 /* Pods_HJMDrWarter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 82BD61577192800BFFDBFA48 /* Pods_HJMDrWarter.framework */; };
28CBDA67CE2B933E3BE49AD0 /* Pods_DJMPS2.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BE531B568DE2714EB3C17FBC /* Pods_DJMPS2.framework */; };
29B4811846DA9AFF6B864DFF /* Pods_DJMHomeTY.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1C7A66C6D755F78ABD051F3B /* Pods_DJMHomeTY.framework */; };
390516C72BAA75D000935EDE /* DXHotElecticView.m in Sources */ = {isa = PBXBuildFile; fileRef = 390516C62BAA75D000935EDE /* DXHotElecticView.m */; };
390516C82BAAB94A00935EDE /* DXHotElecticView.m in Sources */ = {isa = PBXBuildFile; fileRef = 390516C62BAA75D000935EDE /* DXHotElecticView.m */; };
390516C92BAAB95000935EDE /* DXHotElecticView.m in Sources */ = {isa = PBXBuildFile; fileRef = 390516C62BAA75D000935EDE /* DXHotElecticView.m */; };
390516CA2BAAB95100935EDE /* DXHotElecticView.m in Sources */ = {isa = PBXBuildFile; fileRef = 390516C62BAA75D000935EDE /* DXHotElecticView.m */; };
390516CB2BAAB95100935EDE /* DXHotElecticView.m in Sources */ = {isa = PBXBuildFile; fileRef = 390516C62BAA75D000935EDE /* DXHotElecticView.m */; };
39E082752BB3BA6800786B9D /* DXRDSmartRec.m in Sources */ = {isa = PBXBuildFile; fileRef = 39E082742BB3BA6800786B9D /* DXRDSmartRec.m */; };
39E082762BB3BCEF00786B9D /* DXRDSmartRec.m in Sources */ = {isa = PBXBuildFile; fileRef = 39E082742BB3BA6800786B9D /* DXRDSmartRec.m */; };
39E082772BB3BCF000786B9D /* DXRDSmartRec.m in Sources */ = {isa = PBXBuildFile; fileRef = 39E082742BB3BA6800786B9D /* DXRDSmartRec.m */; };
39E082782BB3BCF000786B9D /* DXRDSmartRec.m in Sources */ = {isa = PBXBuildFile; fileRef = 39E082742BB3BA6800786B9D /* DXRDSmartRec.m */; };
39E50A9E2BA81F8900D48C7D /* DXHotElectricVC.m in Sources */ = {isa = PBXBuildFile; fileRef = 39E50A9D2BA81F8900D48C7D /* DXHotElectricVC.m */; };
39E50A9F2BA81F8900D48C7D /* DXHotElectricVC.m in Sources */ = {isa = PBXBuildFile; fileRef = 39E50A9D2BA81F8900D48C7D /* DXHotElectricVC.m */; };
39E50AA02BA81F8900D48C7D /* DXHotElectricVC.m in Sources */ = {isa = PBXBuildFile; fileRef = 39E50A9D2BA81F8900D48C7D /* DXHotElectricVC.m */; };
......@@ -19,6 +26,7 @@
39E50AA52BA8272800D48C7D /* DXProgressBarView.m in Sources */ = {isa = PBXBuildFile; fileRef = 39E50AA32BA8272800D48C7D /* DXProgressBarView.m */; };
39E50AA62BA8272800D48C7D /* DXProgressBarView.m in Sources */ = {isa = PBXBuildFile; fileRef = 39E50AA32BA8272800D48C7D /* DXProgressBarView.m */; };
39E50AA72BA8272800D48C7D /* DXProgressBarView.m in Sources */ = {isa = PBXBuildFile; fileRef = 39E50AA32BA8272800D48C7D /* DXProgressBarView.m */; };
39ED5F292BAD2ACA00AD85FD /* DXHEUpkeepVC.m in Sources */ = {isa = PBXBuildFile; fileRef = 39ED5F282BAD2ACA00AD85FD /* DXHEUpkeepVC.m */; };
6C7891792B0B2CEB0051C70B /* BlueToothUpdate.m in Sources */ = {isa = PBXBuildFile; fileRef = 6C7891772B0B2CEB0051C70B /* BlueToothUpdate.m */; };
6C78917A2B0B2CEB0051C70B /* BlueToothUpdate.m in Sources */ = {isa = PBXBuildFile; fileRef = 6C7891772B0B2CEB0051C70B /* BlueToothUpdate.m */; };
6C78917B2B0B2CEB0051C70B /* BlueToothUpdate.m in Sources */ = {isa = PBXBuildFile; fileRef = 6C7891772B0B2CEB0051C70B /* BlueToothUpdate.m */; };
......@@ -653,11 +661,15 @@
2DDF3A57856A2F27B92CD379 /* Pods-HJMDrWarter.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-HJMDrWarter.debug.xcconfig"; path = "Target Support Files/Pods-HJMDrWarter/Pods-HJMDrWarter.debug.xcconfig"; sourceTree = "<group>"; };
390516C52BAA75D000935EDE /* DXHotElecticView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DXHotElecticView.h; sourceTree = "<group>"; };
390516C62BAA75D000935EDE /* DXHotElecticView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DXHotElecticView.m; sourceTree = "<group>"; };
39E082732BB3BA6800786B9D /* DXRDSmartRec.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DXRDSmartRec.h; sourceTree = "<group>"; };
39E082742BB3BA6800786B9D /* DXRDSmartRec.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DXRDSmartRec.m; sourceTree = "<group>"; };
39E1E5FF031957A0EABCCB00 /* Pods-DJMHomeTY.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-DJMHomeTY.debug.xcconfig"; path = "Target Support Files/Pods-DJMHomeTY/Pods-DJMHomeTY.debug.xcconfig"; sourceTree = "<group>"; };
39E50A9C2BA81F8900D48C7D /* DXHotElectricVC.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DXHotElectricVC.h; sourceTree = "<group>"; };
39E50A9D2BA81F8900D48C7D /* DXHotElectricVC.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DXHotElectricVC.m; sourceTree = "<group>"; };
39E50AA22BA8272800D48C7D /* DXProgressBarView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DXProgressBarView.h; sourceTree = "<group>"; };
39E50AA32BA8272800D48C7D /* DXProgressBarView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DXProgressBarView.m; sourceTree = "<group>"; };
39ED5F272BAD2ACA00AD85FD /* DXHEUpkeepVC.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DXHEUpkeepVC.h; sourceTree = "<group>"; };
39ED5F282BAD2ACA00AD85FD /* DXHEUpkeepVC.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DXHEUpkeepVC.m; sourceTree = "<group>"; };
43682A934E6B0849B0B6F729 /* Pods-DJMHomeTY.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-DJMHomeTY.release.xcconfig"; path = "Target Support Files/Pods-DJMHomeTY/Pods-DJMHomeTY.release.xcconfig"; sourceTree = "<group>"; };
6C7891772B0B2CEB0051C70B /* BlueToothUpdate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BlueToothUpdate.m; sourceTree = "<group>"; };
6C7891782B0B2CEB0051C70B /* BlueToothUpdate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BlueToothUpdate.h; sourceTree = "<group>"; };
......@@ -1114,6 +1126,8 @@
6CAFE7322AF4C71C00C929A7 /* DXHFXUpkeepVC.m */,
39E50A9C2BA81F8900D48C7D /* DXHotElectricVC.h */,
39E50A9D2BA81F8900D48C7D /* DXHotElectricVC.m */,
39ED5F272BAD2ACA00AD85FD /* DXHEUpkeepVC.h */,
39ED5F282BAD2ACA00AD85FD /* DXHEUpkeepVC.m */,
);
path = Controller;
sourceTree = "<group>";
......@@ -1123,6 +1137,8 @@
children = (
6CAFE7372AFB76E400C929A7 /* DXHFXVideoModel.h */,
6CAFE7382AFB76E400C929A7 /* DXHFXVideoModel.m */,
39E082732BB3BA6800786B9D /* DXRDSmartRec.h */,
39E082742BB3BA6800786B9D /* DXRDSmartRec.m */,
);
path = Model;
sourceTree = "<group>";
......@@ -2415,6 +2431,7 @@
88DA475B2AE39D9200313BB8 /* XHDr03View.m in Sources */,
883150B12A0A2CB70025FDDE /* XHAlterTools.m in Sources */,
883150B22A0A2CB70025FDDE /* XHPersonalViewModel.m in Sources */,
39E082782BB3BCF000786B9D /* DXRDSmartRec.m in Sources */,
883150B32A0A2CB70025FDDE /* XHRegistSecondView.m in Sources */,
883150B42A0A2CB70025FDDE /* XHCustomTabBarController.m in Sources */,
883150B52A0A2CB70025FDDE /* UIViewExt.m in Sources */,
......@@ -2532,6 +2549,7 @@
883151212A0A2CB70025FDDE /* XHAgreementView.m in Sources */,
883151222A0A2CB70025FDDE /* XHSetOrPersonalView.m in Sources */,
88DA47552AE39D9200313BB8 /* XHDr03VC.m in Sources */,
390516CA2BAAB95100935EDE /* DXHotElecticView.m in Sources */,
883151232A0A2CB70025FDDE /* XHDataManager.m in Sources */,
883151242A0A2CB70025FDDE /* ZXSegmentHeaderModel.m in Sources */,
883151252A0A2CB70025FDDE /* XHMD5.m in Sources */,
......@@ -2558,6 +2576,7 @@
88D323892A177CDC00334372 /* XHPersonalViewModel.m in Sources */,
88D3238A2A177CDC00334372 /* XHRegistSecondView.m in Sources */,
88DA475E2AE39D9200313BB8 /* XHDr03View.m in Sources */,
39E082762BB3BCEF00786B9D /* DXRDSmartRec.m in Sources */,
88D3238B2A177CDC00334372 /* XHCustomTabBarController.m in Sources */,
88D3238C2A177CDC00334372 /* UIViewExt.m in Sources */,
88D3238D2A177CDC00334372 /* XHDatePickerView.m in Sources */,
......@@ -2675,6 +2694,7 @@
88D323FC2A177CDC00334372 /* XHAgreementView.m in Sources */,
88D323FD2A177CDC00334372 /* XHSetOrPersonalView.m in Sources */,
88DA47582AE39D9200313BB8 /* XHDr03VC.m in Sources */,
390516C82BAAB94A00935EDE /* DXHotElecticView.m in Sources */,
88D323FE2A177CDC00334372 /* XHDataManager.m in Sources */,
88D323FF2A177CDC00334372 /* ZXSegmentHeaderModel.m in Sources */,
88D324002A177CDC00334372 /* XHMD5.m in Sources */,
......@@ -2701,6 +2721,7 @@
88314FCC2A0A1BC30025FDDE /* XHDRView.m in Sources */,
88EE69692A04D3C900C37EE2 /* XHCountDownButton.m in Sources */,
88EE696A2A04D3C900C37EE2 /* XHMineSetSexVC.m in Sources */,
39E082772BB3BCF000786B9D /* DXRDSmartRec.m in Sources */,
88EE696B2A04D3C900C37EE2 /* XHTabBar.m in Sources */,
88EE696C2A04D3C900C37EE2 /* UIView+SDAutoLayout.m in Sources */,
88EE696D2A04D3C900C37EE2 /* XHSetOrPersonalVC.m in Sources */,
......@@ -2818,6 +2839,7 @@
88EE69D72A04D3C900C37EE2 /* XHAgreementView.m in Sources */,
88EE69D82A04D3C900C37EE2 /* XHSetOrPersonalView.m in Sources */,
88DA47572AE39D9200313BB8 /* XHDr03VC.m in Sources */,
390516C92BAAB95000935EDE /* DXHotElecticView.m in Sources */,
88EE69D92A04D3C900C37EE2 /* XHDataManager.m in Sources */,
88EE69DA2A04D3C900C37EE2 /* ZXSegmentHeaderModel.m in Sources */,
88EE69DB2A04D3C900C37EE2 /* XHMD5.m in Sources */,
......@@ -2913,6 +2935,7 @@
88E7FC3B29B32A7200F8585F /* ZJAnimationPopView.m in Sources */,
88314FB52A0A1AEF0025FDDE /* XHDRVC.m in Sources */,
884E463B29A600B600A58A9A /* HJBluetoothManager.m in Sources */,
39ED5F292BAD2ACA00AD85FD /* DXHEUpkeepVC.m in Sources */,
884E45FE29A600B600A58A9A /* UITextView+XHPinchZoom.m in Sources */,
884E463529A600B600A58A9A /* XHUINavigationController.m in Sources */,
88314F972A0A168A0025FDDE /* XHSmartView.m in Sources */,
......@@ -2961,8 +2984,9 @@
884E45FD29A600B600A58A9A /* UITextView+XHSelect.m in Sources */,
88F07F1A29C1C4BF00B2EBE6 /* XHAgreementView.m in Sources */,
88C3CA8329CEC273004301FC /* XHSetOrPersonalView.m in Sources */,
390516C72BAA75D000935EDE /* DXHotElecticView.m in Sources */,
390516CB2BAAB95100935EDE /* DXHotElecticView.m in Sources */,
884E463A29A600B600A58A9A /* XHDataManager.m in Sources */,
39E082752BB3BA6800786B9D /* DXRDSmartRec.m in Sources */,
884E460329A600B600A58A9A /* ZXSegmentHeaderModel.m in Sources */,
884E460E29A600B600A58A9A /* XHMD5.m in Sources */,
88E90C8E29A6FC30009FAB0E /* XHSetHomeVC.m in Sources */,
......
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "组 55@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "组 55@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "矩形 8 拷贝 7@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "矩形 8 拷贝 7@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
......@@ -158,4 +158,10 @@
/*海菲秀获取BANNER列表*/
#define HFXGetBannerList [NSString stringWithFormat:@"%@%@",URL,@"/hfx/getBanner"]
/*热电获取视频列表*/
#define RDGetVideoList [NSString stringWithFormat:@"%@%@",URL,@"/ldm/api/operateVideos"]
/*热电获取智能调控能量和温度*/
#define RDGetSmartRec [NSString stringWithFormat:@"%@%@",URL,@"/ldm/api/smartRec"]
#endif /* XHURL_h */
//
// DXHEUpkeepVC.h
// DJMHomeTY
//
// Created by nana on 2024/3/22.
//
#import "XHParentVC.h"
NS_ASSUME_NONNULL_BEGIN
@interface DXHEUpkeepVC : XHParentVC
@end
NS_ASSUME_NONNULL_END
//
// DXHEUpkeepVC.m
// DJMHomeTY
//
// Created by nana on 2024/3/22.
//
#import "DXHEUpkeepVC.h"
#import "ZFPlayer.h"
#import <ZFPlayer/ZFPlayerControlView.h>
#import <ZFPlayer/ZFAVPlayerManager.h>
#import "DXHFXVideoModel.h"
#import "KTVHTTPCache.h"
@interface DXHEUpkeepVC ()
@property (nonatomic, strong) ZFPlayerControlView *controlView;
@property (nonatomic,strong) ZFPlayerController *playerView;
@property (nonatomic,strong) UIView *containerView;
@property (nonatomic,strong)DXHFXVideoDetailsModel *videoListModel;
@end
@implementation DXHEUpkeepVC
- (void)viewDidLoad {
[super viewDidLoad];
[self initData];
[self initUI];
[self requestVideoList];
// Do any additional setup after loading the view.
}
-(void)initData {
}
-(void)initUI {
self.title = @"Dr-05";
self.view.backgroundColor = XHColorRGB(247, 247, 247);
// self.navigationController.navigationBar.backgroundColor = [UIColor whiteColor];
UILabel *titleLb = [UILabel new];
titleLb.text = HJLocalizedString(@"探头清洁指引");
titleLb.font = XHFontSize(17);
titleLb.textColor = [UIColor blackColor];
[self.view addSubview:titleLb];
[titleLb mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.equalTo(self.view);
make.top.equalTo(@(HJNavHeight + 35*IPhone6ScaleHeight));
}];
UIView *linel = [UIView new];
linel.backgroundColor = XHColorRGB(175, 44, 35);
UIView *liner = [UIView new];
liner.backgroundColor = XHColorRGB(175, 44, 35);
[self.view addSubview:linel];
[self.view addSubview:liner];
[linel mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerY.equalTo(titleLb);
make.size.mas_equalTo(CGSizeMake(40, 0.5));
make.right.equalTo(titleLb.mas_left).offset(-20);
}];
[liner mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerY.equalTo(titleLb);
make.size.mas_equalTo(CGSizeMake(40, 0.5));
make.left.equalTo(titleLb.mas_right).offset(20);
}];
_containerView = [UIView new];
_containerView.backgroundColor = [UIColor blueColor];
_containerView.layer.cornerRadius = 10.f;
_containerView.layer.masksToBounds = YES;
[self.view addSubview:_containerView];
[_containerView mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.equalTo(@(HJScreenWidth - 38));
make.centerX.equalTo(self);
make.height.equalTo(@((HJScreenWidth - 38) * 0.5625));
// make.height.equalTo(@0);
make.top.equalTo(titleLb.mas_bottom).offset(42*IPhone6ScaleHeight);
}];
ZFAVPlayerManager *playerManager = [[ZFAVPlayerManager alloc] init];
playerManager.shouldAutoPlay = YES;
if([HJUserDefaults objectForKey:@"videoSwitchIsOn"]){
NSString *videoSwitchIsOn = [HJUserDefaults objectForKey:@"videoSwitchIsOn"];
if([videoSwitchIsOn isEqualToString:@"1"]){
playerManager.shouldAutoPlay = YES;
}else{
playerManager.shouldAutoPlay = NO;
}
}else{
playerManager.shouldAutoPlay = YES;
}
_playerView = [[ZFPlayerController alloc]initWithPlayerManager:playerManager containerView:_containerView];
/// 调节播放进度
// - (void)seekToTime:(NSTimeInterval)time completionHandler:(void (^ __nullable)(BOOL finished))completionHandler;
self.playerView.controlView = self.controlView;
self.playerView.allowOrentitaionRotation = NO;
self.playerView.containerView.backgroundColor = [UIColor blueColor];
self.playerView.currentPlayerManager.scalingMode = ZFPlayerScalingModeAspectFill;
self.playerView.pauseWhenAppResignActive = YES;
self.playerView.pauseByEvent = YES;
UILabel *detailLabel = [[UILabel alloc] init];
detailLabel.text = HJLocalizedString(@"使用纸巾擦拭探头,将探头残余凝胶清洁干净 后,再次使用酒精棉片或生理盐水重新擦拭探 头,保持探头干净卫生,更助于仪器的长期使 ");
detailLabel.numberOfLines = 0;
detailLabel.font = XHFontSize(17);
detailLabel.textColor = [UIColor blackColor];
[self.view addSubview:detailLabel];
[detailLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.equalTo(@(HJScreenWidth - 38));
make.centerX.equalTo(self);
// make.height.equalTo(@0);
make.top.equalTo(_containerView.mas_bottom).offset(42*IPhone6ScaleHeight);
}];
}
-(void)requestVideoList {
HJSelfWeak;
NSMutableDictionary *paramsDic = [NSMutableDictionary dictionary];
[paramsDic setObject:@"0" forKey:@"type"];
[[XHHttpRequestManager shareManager] getHttpRequestURL:HFXGetVideoList isJson:NO parameters:paramsDic success:^(id responseObject) {
[SVProgressHUD dismiss];
NSLog(@"responseObject:\n%@===%@",responseObject,responseObject[@"msg"]);
NSArray *urlArray = responseObject[@"data"];
if (urlArray.count>0) {
weakSelf.videoListModel = [DXHFXVideoDetailsModel mj_objectWithKeyValues:urlArray[0]];
NSLog(@"%@",weakSelf.videoListModel);
}
} fail:^(id failMessage) {
}networkRequestsFail:^(id networkFail) {
}];
}
-(void)setVideoListModel:(DXHFXVideoDetailsModel *)videoListModel {
_videoListModel = videoListModel;
NSURL *proxyURL = [KTVHTTPCache proxyURLWithOriginalURL:[NSURL URLWithString:videoListModel.videoUrl]];
self.playerView.assetURL = proxyURL;
HJSelfWeak;
self.playerView.playerDidToEnd = ^(id _Nonnull asset) {
weakSelf.playerView.assetURL = proxyURL;
};
}
- (NSMutableArray *)setTimeLineWithString:(NSString *)describeInfo{
NSArray *itemTitleArray = [describeInfo componentsSeparatedByString:@","];
NSMutableArray *titleArray = [NSMutableArray array];
NSMutableArray *titleTimeArray = [NSMutableArray array];
NSMutableArray *timeArray = [NSMutableArray array];
for (int i = 0; i < itemTitleArray.count; i ++) {
NSArray *temparray = [itemTitleArray[i] componentsSeparatedByString:@":"];
[titleArray addObject:temparray[0]];
[titleTimeArray addObject:temparray[1]];
[timeArray addObject:temparray[2]];
}
NSMutableArray *titleTimeArray1 = [NSMutableArray array];
for (__strong NSString *titleTime in titleTimeArray) {
if([titleTime intValue] < 60){
if (!titleTime || [titleTime isEqualToString:@""]) {
titleTime = @"";
// titleTime = [NSString stringWithFormat:@"%@s",titleTime];
}else{
titleTime = [NSString stringWithFormat:@"%@s",titleTime];
}
}else if([titleTime intValue] % 60 == 0){
titleTime = [NSString stringWithFormat:@"%dmin",[titleTime intValue] / 60];
}else{
titleTime = [NSString stringWithFormat:@"%dmins %ds",[titleTime intValue] / 60,[titleTime intValue] % 60];
}
[titleTimeArray1 addObject:titleTime];
}
return timeArray;
}
/*
#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
......@@ -7,10 +7,17 @@
#import "DXHotElectricVC.h"
#import "DXProgressBarView.h"
@interface DXHotElectricVC (){
#import "DXHotElecticView.h"
#import "DXHFXVideoModel.h"
#import "DXRDSmartRec.h"
@interface DXHotElectricVC ()<BluetoothDelegate>{
CGFloat palyTime;
}
@property (nonatomic,strong)DXHotElecticView *dxHotElectView;
@property (nonatomic,strong)DXHFXVideoDetailsModel *videoListModel;
@property (nonatomic,strong)NSMutableArray *smartRecModelArray;
@end
......@@ -19,12 +26,334 @@
- (void)viewDidLoad {
[super viewDidLoad];
self.title = HJLocalizedString(@"DR-05");
self.navigationItem.titleView = [self switchButtonView];
[HJGetBluetoothManager startScaning];
[self addNotification];
[self initUI];
[self initData];
// Do any additional setup after loading the view.
}
-(void)initUI {
self.dxHotElectView = [[DXHotElecticView alloc]initWithFrame:CGRectMake(0, HJNavHeight, HJScreenWidth, HJScreenHeight-HJNavHeight)];
[self.view addSubview:self.dxHotElectView];
// [self.dxHotElectView mas_makeConstraints:^(MASConstraintMaker *make) {
// make.top.mas_equalTo(HJNavHeight);
// make.left.right.bottom.mas_equalTo(0);
// }];
}
-(void)initData {
[self requestVideoList];
[self requestSmartRec];
}
-(UIView *)switchButtonView {
// UIImageView *backImageView = [[UIImageView alloc] init];
// backImageView.userInteractionEnabled = YES;
UIButton *topbutton = [UIButton buttonWithType:UIButtonTypeCustom];
topbutton.frame = CGRectMake(0, 0, 203/2, 63/2);
[topbutton setTitle:HJLocalizedString(@" 智能推荐 ") forState:UIControlStateNormal];
[topbutton setImage:[UIImage imageNamed:@"switchButtonImg"] forState:UIControlStateNormal];
[topbutton setBackgroundColor:XHColorRGB_Alpha(243, 243, 243, 1)];
[topbutton setBackgroundImage:[UIImage imageNamed:@"swithBackImage"] forState:UIControlStateNormal];
[topbutton setTitleColor:XHColorRGB_Alpha(51, 51, 51, 1) forState:UIControlStateNormal];
// topbutton.contentHorizontalAlignment = UIControlContentHorizontalAlignmentCenter;
// topbutton.semanticContentAttribute = UISemanticContentAttributeForceRightToLeft;
topbutton.titleLabel.font = [UIFont boldSystemFontOfSize:13];
topbutton.layer.cornerRadius = 17.5;
// topbutton.titleEdgeInsets = UIEdgeInsetsMake(0, 20, 0, 0);
// topbutton.imageEdgeInsets = UIEdgeInsetsMake(0, topbutton.titleLabel.bounds.size.width + 25, 0, -(topbutton.titleLabel.bounds.size.width + 10));
[topbutton addTarget:self action:@selector(topBtnClik:) forControlEvents:UIControlEventTouchUpInside];
return topbutton;
}
-(void)topBtnClik:(UIButton *)button {
if (button.selected) {
[button setTitle:HJLocalizedString(@" 自定义 ") forState:UIControlStateNormal];
}else {
[button setTitle:HJLocalizedString(@" 智能推荐 ") forState:UIControlStateNormal];
}
button.selected = !button.selected;
}
#pragma mark ======= ble收到命令 =======
- (void)didUpdateValueForCharacteristicValue:(NSString *)value{
// HJSelfWeak;
// NSLog(@"valuevaluevaluevaluevalue:%@",value);
// NSString *str = [value uppercaseString];
// if(HJStringNSNotFound(str,DR04_HFX_get_start)){//开始
// if(!self.isUpkeep){
// [self startAction];
// }
//
// }else if (HJStringNSNotFound(value, DR04_HFX_get_stop)){//暂停
// if(self.myView.startBtn.selected){
// dispatch_async(dispatch_get_main_queue(), ^{
// weakSelf.myView.startBtn.selected = false;
// });
//
// self.isStart = false;
// /// 暂停计时器
// [self.timer invalidate];
// self.timer=nil;
// }
// }else if (HJStringNSNotFound(value, DR04_HFX_get_Version)){//固件版本
//
//
//// [self checkDeviceVersionWithResult:^(BOOL isUpdate) {
////
//// } binUrl:^(NSString *url) {
////
//// }];
//
//
//
//
// //版本号
// NSInteger versions = strtoul([[value substringWithRange:NSMakeRange(16, 1)] UTF8String],0,16);
// NSInteger versions1 = strtoul([[value substringWithRange:NSMakeRange(17, 1)] UTF8String],0,16);
// XHGetDataManager.machineVersion = [NSString stringWithFormat:@"V%ld.%ld",versions,versions1];
// NSLog(@"XHGetDataManager.machineVersion:%@",XHGetDataManager.machineVersion);
// if(!self.isChecked){
// [self checkDeviceVersionWithResult:^(BOOL isUpdate) {
//
// } binUrl:^(NSString *url) {
//
// }];
// }
//
// //绑定仪器
// [self bindMyDevice];
// }else if (HJStringNSNotFound(value, DR04_HFX_get_Energy)){//当前档位
// NSInteger currentValue1 = strtoul([[value substringWithRange:NSMakeRange(16, 2)] UTF8String],0,16);
// //更新当前能量
// [self updateEnergyNum:currentValue1];
//
// }else if(HJStringNSNotFound(value,DR04_HFX_get_UVState)){//UV灯状态
//
// NSInteger uvstate = strtoul([[value substringWithRange:NSMakeRange(17, 1)] UTF8String],0,16);
// if(uvstate == 1){
// self.myView.uvBtn.selected = YES;
// }else{
// self.myView.uvBtn.selected = NO;
// }
//
// }else if(HJStringNSNotFound(value,DR04_HFX_get_UVNewState)){//UV灯状态
//
// NSInteger uvstate = strtoul([[value substringWithRange:NSMakeRange(17, 1)] UTF8String],0,16);
// if(uvstate == 1){
// self.myView.uvBtn.selected = YES;
// }else{
// self.myView.uvBtn.selected = NO;
// }
//
// }
// else if (HJStringNSNotFound(value,DR04_HFX_get_Energy)){
// NSInteger energy = strtoul([[value substringWithRange:NSMakeRange(17, 1)] UTF8String],0,16);
// self.currentStress = energy;
// self.myView.currentStress = [NSString stringWithFormat:@"%ld",self.currentStress];
// }else if (HJStringNSNotFound(value,DR04_HFX_get_DeviceEnergy)){
//
// NSInteger energy = strtoul([[value substringWithRange:NSMakeRange(17, 1)] UTF8String],0,16);
// self.currentStress = energy;
// self.myView.currentStress = [NSString stringWithFormat:@"%ld",self.currentStress];
// }else if (HJStringNSNotFound(value,DR04_HFX_get_shortPress)){//短按
// if (self.totalTime > 0) {
// if(self.myView.startBtn.selected){
//// dispatch_async(dispatch_get_main_queue(), ^{
//// weakSelf.myView.startBtn.selected = false;
//// });
// [self stopDr04Action];
//// self.isStart = false;
//// /// 暂停计时器
//// [self.timer invalidate];
//// self.timer=nil;
// }else{
// if(!self.isUpkeep){
// [HJGetBluetoothManager writeStr:[DR04_HFX_send_start withCrc16Modbus]];
//// [self startAction];
// }
// }
// }else{
// [SVProgressHUD showInfoWithStatus:@"请扫描耗材二维码"];
// }
//
// }
// [self updateDeviceWithValue:value];
}
#pragma mark notification_Method
-(void)addNotification{
//断开连接
[HJNotificationCenter addObserver:self selector:@selector(disconnect) name:HJNotificationDisconnect object:nil];
//连接成功
[HJNotificationCenter addObserver:self selector:@selector(connect) name:HJNotificationConnect object:nil];
/// 前台
[HJNotificationCenter addObserver:self selector:@selector(appWillEnterForeground) name:HJAPPWillEnterForeground object:nil];
/// 后台
[HJNotificationCenter addObserver:self selector:@selector(appDidEnterBackground) name:HJAPPDidEnterBackground object:nil];
}
-(void)appWillEnterForeground{
// self.isBackground = false;
}
-(void)appDidEnterBackground{
// self.isBackground = true;
// if(self.guestureId){
// [self saveLocationRecord];
// }
//
// if(self.isStart){
// [self stopDr04Action];//暂停
// }
}
#pragma mark ----------断开连接----------
-(void)disconnect{
// if(self.totalTime > 0){
// if((XHGetDataManager.deviceID || self.deviceid) && self.guestureId){
// [self saveLocationRecord];
// }
// }
//
// HJSelfWeak;
// [SVProgressHUD showSuccessWithStatus:HJLocalizedString(@"断开连接")];
// dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
// [SVProgressHUD dismiss];
// });
// dispatch_async(dispatch_get_main_queue(), ^{
// weakSelf.myNoconnectView.hidden = false;
// [weakSelf setNavState:true];
// [weakSelf stopDr04Action];
// weakSelf.BLEConnect = false;
// weakSelf.isConnected = false;
// weakSelf.isStart = false;
// });
// HJGetBluetoothManager.noReconnect = false;
}
#pragma mark ----------连接成功----------
-(void)connect{
//// [HJGetBluetoothManager writeStr:[DR04_HFX_send_getUpdateVersion withCrc16Modbus]];
// self.deviceid = XHGetDataManager.deviceID.copy;
// self.BLEConnect = true;
// self.isConnected = true;
//
// if ([XHGetDataManager.deviceCode isEqualToString:@"Dr-04"]) {
// self.isStrengthen = NO;
// self.myView.is041 = NO;
// }else if ([XHGetDataManager.deviceCode isEqualToString:@"Dr-04-1"]){
// self.isStrengthen = YES;
// self.myView.is041 = YES;
// }else{
// self.isStrengthen = NO;
// self.myView.is041 = NO;
// }
//
//
// if (XHGetDataManager.deviceCode) {
// if (self.isStrengthen) {
// self.xdtotalTime = 50;
//
// }else {
// self.xdtotalTime = 25;
// }
// [self requestData];
// }
//
// if(self.totalTime<=0){
// [self getUseTimes:^(BOOL getTimesSuccessful) {
//
// }];
// }
//// [HJGetBluetoothManager writeStr:[[NSString stringWithFormat:DR04_HFX_send_getVersion] withCrc16Modbus]];
// dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.00 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
// //获取固件版本
//// [self showUploadAlert];
// [HJGetBluetoothManager writeStr:[[NSString stringWithFormat:DR04_HFX_send_getVersion] withCrc16Modbus]];
// });
// dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.02 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
// //获取档位
// [HJGetBluetoothManager writeStr:[[NSString stringWithFormat:DR04_HFX_send_getEnergy] withCrc16Modbus]];
// });
// dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.04 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
// //获取UV灯状态
// [HJGetBluetoothManager writeStr:[[NSString stringWithFormat:DR04_HFX_send_getUVState] withCrc16Modbus]];
// });
}
- (void)requestVideoList{
HJSelfWeak;
NSMutableDictionary *paramsDic = [NSMutableDictionary dictionary];
[paramsDic setObject:@"0" forKey:@"type"];
[[XHHttpRequestManager shareManager] getHttpRequestURL:RDGetVideoList isJson:NO parameters:paramsDic success:^(id responseObject) {
[SVProgressHUD dismiss];
NSLog(@"responseObject:\n%@===%@",responseObject,responseObject[@"msg"]);
NSArray *urlArray = responseObject[@"data"];
if (urlArray.count>0) {
weakSelf.videoListModel = [DXHFXVideoDetailsModel mj_objectWithKeyValues:urlArray[0]];
NSLog(@"%@",weakSelf.videoListModel);
weakSelf.dxHotElectView.videoModel = weakSelf.videoListModel;
}
} fail:^(id failMessage) {
}networkRequestsFail:^(id networkFail) {
}];
}
-(void)requestSmartRec {
HJSelfWeak;
NSMutableDictionary *paramsDic = [NSMutableDictionary dictionary];
[paramsDic setObject:@"0" forKey:@"type"];
[[XHHttpRequestManager shareManager] getHttpRequestURL:RDGetSmartRec isJson:NO parameters:paramsDic success:^(id responseObject) {
[SVProgressHUD dismiss];
NSLog(@"responseObject:\n%@===%@",responseObject,responseObject[@"msg"]);
NSArray *urlArray = responseObject[@"data"];
if (urlArray.count>0) {
weakSelf.smartRecModelArray = [DXRDSmartRec mj_objectArrayWithKeyValuesArray:urlArray];
NSLog(@"%@",weakSelf.videoListModel);
weakSelf.dxHotElectView.smartRecModelArray = weakSelf.smartRecModelArray;
}
} fail:^(id failMessage) {
}networkRequestsFail:^(id networkFail) {
}];
}
- (void)setIsBack:(BOOL)isBack{
[self.navigationController popViewControllerAnimated:YES];
}
......@@ -37,6 +366,35 @@
}
-(void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
[HJGetBluetoothManager.delegate addBluetoothDelegate:self];
[self.dxHotElectView.playerView.currentPlayerManager play];
if([HJUserDefaults objectForKey:@"videoVolumeIsOn"]){
NSString *videoVolumeIsOn = [HJUserDefaults objectForKey:@"videoVolumeIsOn"];
if([videoVolumeIsOn isEqualToString:@"1"]){
self.dxHotElectView.playerView.currentPlayerManager.muted = NO;
}else{
self.dxHotElectView.playerView.currentPlayerManager.muted = YES;
}
}else{
self.dxHotElectView.playerView.currentPlayerManager.muted = YES;
}
}
-(void)dealloc {
//防止重复
HJGetBluetoothManager.noReconnect = true;
[HJGetBluetoothManager stopScanning];
[HJGetBluetoothManager stopConnect];
[HJGetBluetoothManager.delegate removeBluetoothDelegate:self];
}
/*
......
//
// DXRDSmartRec.h
// DJMHomeTY
//
// Created by nana on 2024/3/27.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface DXRDSmartRec : NSObject
@property (nonatomic,strong)NSString *keystr;
@property (nonatomic,strong)NSString *remark;
@property (nonatomic,strong)NSString *keyvalue;
@property (nonatomic,strong)NSString *recID;
@end
NS_ASSUME_NONNULL_END
//
// DXRDSmartRec.m
// DJMHomeTY
//
// Created by nana on 2024/3/27.
//
#import "DXRDSmartRec.h"
@implementation DXRDSmartRec
+ (NSDictionary *)mj_replacedKeyFromPropertyName {
return @{@"recID" : @"id",
};
}
@end
......@@ -6,11 +6,31 @@
//
#import <UIKit/UIKit.h>
#import "ZFPlayer.h"
#import <ZFPlayer/ZFPlayerControlView.h>
#import <ZFPlayer/ZFAVPlayerManager.h>
#import "DXHFXVideoModel.h"
#import "DXRDSmartRec.h"
NS_ASSUME_NONNULL_BEGIN
typedef enum : NSUInteger{
ItemWenduDec,
ItemWenduAdd,
ItemNengLdec,
ItemNebgLadd,
ItemHEstartOrstop,
ItemHEClearTime
}itemHotType;
@interface DXHotElecticView : UIView
@property (nonatomic,strong) ZFPlayerController *playerView;
@property (nonatomic,strong) DXHFXVideoDetailsModel *videoModel;
@property (nonatomic,strong) NSMutableArray <DXRDSmartRec *>*smartRecModelArray;
//模式切换 0.智能推荐 1.自定义
-(void)switchingModeType:(NSInteger)type;
@end
NS_ASSUME_NONNULL_END
......@@ -6,18 +6,484 @@
//
#import "DXHotElecticView.h"
#import "DXProgressBarView.h"
@interface DXHotElecticView ()<DXProgressBarViewDelegate>
@property (nonatomic, strong) ZFPlayerControlView *controlView;
@property (nonatomic,strong) UIView *containerView;
@property (nonatomic ,strong)DXProgressBarView *progressBarView;
@property (nonatomic,strong) NSMutableArray *timeArray;
@property (nonatomic,strong)UILabel *titleLabel;
@property (nonatomic,strong)UILabel *titleNtitle;
@property (nonatomic,strong) UIView *centerline;
@property (nonatomic,strong) UIButton *xdBtn;
@property (nonatomic,strong) UIButton *hlBtn;
@property (nonatomic,strong) UIButton *decBtn;
@property (nonatomic,strong) UIButton *addBtn;
@property (nonatomic,strong) UILabel *timeLb;
@property (nonatomic,strong) UIImageView *timeImg;
@property (nonatomic,strong) UIButton *startBtn;
@property (nonatomic,strong) UIButton *clearTimeBtn;
@property (nonatomic,strong) UISlider *wdSlider;
@property (nonatomic,strong) UISlider *nlSlider;
@property (nonatomic,strong) UILabel *wdNumLabel;
@property (nonatomic,strong) UILabel *nlNumLabel;
@end
@implementation DXHotElecticView
-(instancetype)init {
self = [super init];
-(instancetype)initWithFrame:(CGRect)frame{
self = [super initWithFrame:frame];
if(self) {
self.backgroundColor = XHColorRGB_Alpha(247, 247, 247, 1);
[self initUI];
}
return self;
}
-(void)initUI {
// UIButton *topbutton = [UIButton buttonWithType:UIButtonTypeCustom];
// [topbutton setTitle:HJLocalizedString(@" 智能推荐 ") forState:UIControlStateNormal];
// [topbutton setImage:[UIImage imageNamed:@"switchButtonImg"] forState:UIControlStateNormal];
// [topbutton setBackgroundColor:XHColorRGB_Alpha(243, 243, 243, 1)];
// [topbutton setTitleColor:XHColorRGB_Alpha(51, 51, 51, 1) forState:UIControlStateNormal];
// // topbutton.contentHorizontalAlignment = UIControlContentHorizontalAlignmentCenter;
//// topbutton.semanticContentAttribute = UISemanticContentAttributeForceRightToLeft;
// topbutton.titleLabel.font = [UIFont boldSystemFontOfSize:13];
// topbutton.layer.cornerRadius = 17.5;
// // topbutton.titleEdgeInsets = UIEdgeInsetsMake(0, 20, 0, 0);
// // topbutton.imageEdgeInsets = UIEdgeInsetsMake(0, topbutton.titleLabel.bounds.size.width + 25, 0, -(topbutton.titleLabel.bounds.size.width + 10));
// [topbutton addTarget:self action:@selector(topBtnClik:) forControlEvents:UIControlEventTouchUpInside];
// [self addSubview:topbutton];
//
// // topbutton.layer.shadowColor = XHColorRGB_Alpha(255, 255, 255, 1).CGColor;
// // topbutton.layer.shadowOffset = CGSizeMake(-3,-4);
// // topbutton.layer.shadowOpacity = 1;
// // topbutton.layer.shadowRadius = 10;
//
// [topbutton mas_makeConstraints:^(MASConstraintMaker *make) {
// make.centerX.equalTo(self);
// make.top.mas_equalTo(15.5);
// make.height.mas_equalTo(35);
// }];
// topbutton.layer.shadowColor = XHColorRGB_Alpha(177, 176, 176, 0.5).CGColor;
// topbutton.layer.masksToBounds = NO;
// //阴影半径,默认3
// topbutton.layer.shadowRadius = 3;
// //shadowOffset阴影偏移,默认(0, -3),这个跟shadowRadius配合使用
// topbutton.layer.shadowOffset = CGSizeMake(0.0f,0.0f);
// // 阴影透明度,默认0
// topbutton.layer.shadowOpacity = 1;
_controlView = [ZFPlayerControlView new];
_controlView.fastViewAnimated = YES;
_controlView.autoHiddenTimeInterval = 5;
_controlView.autoFadeTimeInterval = 0.5;
// _controlView.prepareShowLoading = YES;
_controlView.prepareShowControlView = NO;
// _controlView.showCustomStatusBar = YES;
_containerView = [UIView new];
_containerView.backgroundColor = [UIColor blueColor];
_containerView.layer.cornerRadius = 10.f;
_containerView.layer.masksToBounds = YES;
[self addSubview:_containerView];
[_containerView mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.equalTo(@(HJScreenWidth - 38));
make.centerX.equalTo(self);
make.height.equalTo(@((HJScreenWidth - 38) * 0.5625));
// make.height.equalTo(@0);
make.top.equalTo(@21);
}];
ZFAVPlayerManager *playerManager = [[ZFAVPlayerManager alloc] init];
playerManager.shouldAutoPlay = YES;
if([HJUserDefaults objectForKey:@"videoSwitchIsOn"]){
NSString *videoSwitchIsOn = [HJUserDefaults objectForKey:@"videoSwitchIsOn"];
if([videoSwitchIsOn isEqualToString:@"1"]){
playerManager.shouldAutoPlay = YES;
}else{
playerManager.shouldAutoPlay = NO;
}
}else{
playerManager.shouldAutoPlay = YES;
}
_playerView = [[ZFPlayerController alloc]initWithPlayerManager:playerManager containerView:_containerView];
/// 调节播放进度
// - (void)seekToTime:(NSTimeInterval)time completionHandler:(void (^ __nullable)(BOOL finished))completionHandler;
self.playerView.controlView = self.controlView;
self.playerView.allowOrentitaionRotation = NO;
self.playerView.containerView.backgroundColor = [UIColor blueColor];
self.playerView.currentPlayerManager.scalingMode = ZFPlayerScalingModeAspectFill;
self.playerView.pauseWhenAppResignActive = YES;
self.playerView.pauseByEvent = YES;
HJSelfWeak;
self.playerView.playerPlayTimeChanged = ^(id<ZFPlayerMediaPlayback> _Nonnull asset, NSTimeInterval currentTime, NSTimeInterval duration) {
if (!weakSelf.progressBarView.timeArray) {
[weakSelf.progressBarView progressBarTimeArray:weakSelf.timeArray Totaltime:duration];
NSLog(@"当前播放时间=%f",currentTime);
}
weakSelf.progressBarView.playTime = currentTime;
};
self.progressBarView = [[DXProgressBarView alloc] init];
self.progressBarView.delegate = self;
[self addSubview:self.progressBarView];
[self.progressBarView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.mas_equalTo(0);
make.top.equalTo(self.containerView.mas_bottom).offset(10);
}];
NSArray *array = @[@0,@38];
[self.progressBarView progressBarTimeArray:array Totaltime:60];
UIView *bottomView = [[UIView alloc] init];
//bottomView.backgroundColor = [UIColor whiteColor];
bottomView.layer.cornerRadius = 20.f;
bottomView.layer.masksToBounds = YES;
bottomView.backgroundColor = XHColorRGB(247, 247, 247);
[self addSubview:bottomView];
[bottomView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.equalTo(self);
make.bottom.equalTo(@0);
make.top.equalTo(self.containerView.mas_bottom).offset(40*IPhone6ScaleHeight);
}];
[self layoutIfNeeded];
CALayer *bottomlayer = [CALayer layer];
bottomlayer.frame = bottomView.frame;
bottomlayer.shadowColor= [UIColor blackColor].CGColor;
bottomlayer.shadowOffset = CGSizeMake(-1,-1);
bottomlayer.shadowOpacity = 0.08;
bottomlayer.cornerRadius = 20;
CGRect frame = bottomView.bounds;
frame.origin.x= frame.origin.x;//向左减 向右加
frame.origin.y= frame.origin.y-3;//向上减 向下加
frame.size.width= frame.size.width;//阴影的宽度
frame.size.height= frame.size.height;//阴影的高度
bottomlayer.shadowPath = [[UIBezierPath bezierPathWithRect:frame] CGPath ];
//这里self表示当前自定义的view
[self.layer insertSublayer:bottomlayer below:bottomView.layer];
self.titleLabel = [[UILabel alloc] init];
self.titleLabel.text = HJLocalizedString(@"智能控温");
self.titleLabel.textColor = XHColorRGB(51, 51, 51);
self.titleLabel.font = [UIFont boldSystemFontOfSize:13];
[bottomView addSubview:self.titleLabel];
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(@20);
make.top.equalTo(@(31 *IPhone6ScaleHeight));
}];
_decBtn = [UIButton buttonWithType:UIButtonTypeCustom];
[_decBtn setBackgroundImage:[UIImage imageNamed:@"HFX_041_lit_dis"] forState:UIControlStateNormal];
[_decBtn setBackgroundImage:[UIImage imageNamed:@"HFX_041_lit"] forState:UIControlStateDisabled];
[_decBtn addTarget:self action:@selector(controlWithItem:) forControlEvents:UIControlEventTouchUpInside];
_decBtn.tag = ItemWenduDec;
[bottomView addSubview:_decBtn];
[_decBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(@20);
make.size.mas_equalTo(CGSizeMake(50, 50));
make.top.equalTo(self.titleLabel.mas_bottom).offset(20 *IPhone6ScaleHeight);
}];
_wdSlider = [[UISlider alloc] init];
//大于当前滑动的颜色
_wdSlider.maximumTrackTintColor=XHColorRGB(233, 233, 233);
UIView *yuanImageView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 15, 15)];
yuanImageView.layer.cornerRadius = 7.5;
yuanImageView.backgroundColor = [UIColor whiteColor];
[_wdSlider setThumbImage:[self convertViewToImage:yuanImageView] forState:UIControlStateNormal];
_wdSlider.minimumTrackTintColor=XHColorRGB(164, 47, 36);
//当前滑动值的颜色
// _wdSlider.thumbTintColor=XHColorRGB(255, 255, 255);
//添加事件
[_wdSlider addTarget:self action:@selector(sliderbutton:) forControlEvents:UIControlEventTouchUpInside];
[_wdSlider addTarget:self action:@selector(sliderChangedbutton:) forControlEvents:UIControlEventValueChanged];
[bottomView addSubview:_wdSlider];
_wdNumLabel = [[UILabel alloc] init];
_wdNumLabel.textColor = XHColorRGB_Alpha(0, 0, 0, 1);
_wdNumLabel.font = [UIFont boldSystemFontOfSize:24];
_wdNumLabel.text = @"0%";
_wdNumLabel.textAlignment = NSTextAlignmentCenter;
[bottomView addSubview:_wdNumLabel];
_addBtn = [UIButton buttonWithType:UIButtonTypeCustom];
[_addBtn setBackgroundImage:[UIImage imageNamed:@"HFX_041_add_dis"] forState:UIControlStateNormal];
[_addBtn setBackgroundImage:[UIImage imageNamed:@"HFX_041_add"] forState:UIControlStateDisabled];
[_addBtn addTarget:self action:@selector(controlWithItem:) forControlEvents:UIControlEventTouchUpInside];
_addBtn.tag = ItemWenduAdd;
[bottomView addSubview:_addBtn];
[_addBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.equalTo(@-20);
make.size.mas_equalTo(CGSizeMake(50, 50));
make.top.equalTo(self.titleLabel.mas_bottom).offset(20 *IPhone6ScaleHeight);
}];
[_wdSlider mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(_decBtn.mas_right).offset(15);
make.centerY.equalTo(_decBtn.mas_centerY);
make.right.equalTo(_addBtn.mas_left).offset(-15);
}];
[_wdNumLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.equalTo(bottomView);
make.bottom.equalTo(_wdSlider.mas_top).offset(-20);
}];
self.centerline = [UIView new];
_centerline.backgroundColor = XHColorRGB(231, 230, 230);
[bottomView addSubview:_centerline];
[_centerline mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.decBtn.mas_left).offset(-2);
make.right.equalTo(self.addBtn.mas_right).offset(2);
make.top.equalTo(self.addBtn.mas_bottom).offset(10);
make.height.equalTo(@0.5);
}];
self.titleNtitle = [[UILabel alloc] init];
self.titleNtitle.text = HJLocalizedString(@"能量舒控");
self.titleNtitle.textColor = XHColorRGB(51, 51, 51);
self.titleNtitle.font = [UIFont boldSystemFontOfSize:13];
[bottomView addSubview:self.titleNtitle];
[self.titleNtitle mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(@20);
make.top.equalTo(self.decBtn.mas_bottom).offset(28 *IPhone6ScaleHeight);
}];
_xdBtn = [UIButton buttonWithType:UIButtonTypeCustom];
[_xdBtn setBackgroundImage:[UIImage imageNamed:@"HFX_041_lit_dis"] forState:UIControlStateNormal];
[_xdBtn setBackgroundImage:[UIImage imageNamed:@"HFX_041_lit"] forState:UIControlStateDisabled];
[_xdBtn addTarget:self action:@selector(controlWithItem:) forControlEvents:UIControlEventTouchUpInside];
_xdBtn.tag = ItemNengLdec;
[bottomView addSubview:_xdBtn];
[_xdBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(@20);
make.size.mas_equalTo(CGSizeMake(50, 50));
make.top.equalTo(self.titleNtitle.mas_bottom).offset(20 *IPhone6ScaleHeight);
}];
_hlBtn = [UIButton buttonWithType:UIButtonTypeCustom];
[_hlBtn setBackgroundImage:[UIImage imageNamed:@"HFX_041_add_dis"] forState:UIControlStateNormal];
[_hlBtn setBackgroundImage:[UIImage imageNamed:@"HFX_041_add"] forState:UIControlStateDisabled];
[_hlBtn addTarget:self action:@selector(controlWithItem:) forControlEvents:UIControlEventTouchUpInside];
_hlBtn.tag = ItemNebgLadd;
[bottomView addSubview:_hlBtn];
[_hlBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.equalTo(@-20);
make.size.mas_equalTo(CGSizeMake(50, 50));
make.top.equalTo(self.titleNtitle.mas_bottom).offset(20 *IPhone6ScaleHeight);
}];
_nlSlider = [[UISlider alloc] init];
//大于当前滑动的颜色
_nlSlider.maximumTrackTintColor=XHColorRGB(233, 233, 233);
[_nlSlider setThumbImage:[self convertViewToImage:yuanImageView] forState:UIControlStateNormal];
_nlSlider.minimumTrackTintColor=XHColorRGB(164, 47, 36);
//当前滑动值的颜色
// _nlSlider.thumbTintColor=XHColorRGB(255, 255, 255);
//添加事件
[_nlSlider addTarget:self action:@selector(sliderbutton:) forControlEvents:UIControlEventTouchUpInside];
[_nlSlider addTarget:self action:@selector(sliderChangedbutton:) forControlEvents:UIControlEventValueChanged];
[bottomView addSubview:_nlSlider];
[_nlSlider mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(_xdBtn.mas_right).offset(15);
make.centerY.equalTo(_xdBtn.mas_centerY);
make.right.equalTo(_hlBtn.mas_left).offset(-15);
}];
_nlNumLabel = [[UILabel alloc] init];
_nlNumLabel.textColor = XHColorRGB_Alpha(0, 0, 0, 1);
_nlNumLabel.font = [UIFont boldSystemFontOfSize:24];
_nlNumLabel.text = @"0%";
_nlNumLabel.textAlignment = NSTextAlignmentCenter;
[bottomView addSubview:_nlNumLabel];
[_nlNumLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.equalTo(bottomView);
make.bottom.equalTo(_nlSlider.mas_top).offset(-20);
}];
_timeImg = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"HFX_time"]];
[bottomView addSubview:_timeImg];
[_timeImg mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.equalTo(self.decBtn);
make.top.equalTo(self.xdBtn.mas_bottom).offset(42*IPhone6ScaleHeight);
make.size.mas_equalTo(CGSizeMake(22, 22));
}];
_timeLb = [UILabel new];
_timeLb.text = @"00:00";
_timeLb.font = [UIFont boldSystemFontOfSize:23];
_timeLb.textColor = XHColorRGB(175, 44, 35);
[bottomView addSubview:_timeLb];
[_timeLb mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.equalTo(self.timeImg);
make.top.equalTo(self.timeImg.mas_bottom).offset(5*IPhone6ScaleHeight);
}];
//_timeLb.hidden = YES;
_startBtn = [UIButton buttonWithType:UIButtonTypeCustom];
[_startBtn setBackgroundImage:[UIImage imageNamed:@"HFX_041_start"] forState:UIControlStateNormal];
[_startBtn setBackgroundImage:[UIImage imageNamed:@"HFX_stop"] forState:UIControlStateSelected];
[_startBtn addTarget:self action:@selector(controlWithItem:) forControlEvents:UIControlEventTouchUpInside];
_startBtn.tag = ItemHEstartOrstop;
[bottomView addSubview:_startBtn];
[_startBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.equalTo(bottomView);
make.centerY.equalTo(self.timeImg).multipliedBy(1.1);
}];
_clearTimeBtn = [UIButton buttonWithType:UIButtonTypeCustom];
[_clearTimeBtn setBackgroundImage:[UIImage imageNamed:@"HFX_clearTime"] forState:UIControlStateNormal];
[_clearTimeBtn addTarget:self action:@selector(controlWithItem:) forControlEvents:UIControlEventTouchUpInside];
_clearTimeBtn.tag = ItemHEClearTime;
[bottomView addSubview:_clearTimeBtn];
[_clearTimeBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.equalTo(self.addBtn);
make.centerY.equalTo(self.startBtn);
}];
}
//使用该方法不会模糊,根据屏幕密度计算
- (UIImage *)convertViewToImage:(UIView *)view {
UIImage *imageRet = [[UIImage alloc]init];
//UIGraphicsBeginImageContextWithOptions(区域大小, 是否是非透明的, 屏幕密度);
UIGraphicsBeginImageContextWithOptions(view.frame.size, NO, [UIScreen mainScreen].scale);
[view.layer renderInContext:UIGraphicsGetCurrentContext()];
imageRet = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return imageRet;
}
-(void)setVideoModel:(DXHFXVideoDetailsModel *)videoModel {
_videoModel = videoModel;
}
-(void)setSmartRecModelArray:(NSMutableArray<DXRDSmartRec *> *)smartRecModelArray {
_smartRecModelArray = smartRecModelArray;
}
-(void)switchingModeType:(NSInteger)type {
if (type == 0) {
for (int i = 0; i<_smartRecModelArray.count; i++) {
DXRDSmartRec *model = _smartRecModelArray[i];
if ([model.keystr isEqualToString:@"dr_05_smart_temperature"]) {
NSArray *array = [model.keyvalue componentsSeparatedByString:@":"];
if (array.count == 2) {
_wdSlider.minimumValue = [array[0] floatValue];
_wdSlider.maximumValue = [array[1] floatValue];
}
}
else if ([model.keystr isEqualToString:@"dr_05_smart_energy"]){
NSArray *array = [model.keyvalue componentsSeparatedByString:@":"];
if (array.count == 2) {
_nlSlider.minimumValue = [array[0] floatValue];
_nlSlider.maximumValue = [array[1] floatValue];
}
}
}
}else {
}
}
-(void)controlWithItem:(UIButton *)button {
}
-(void)sliderbutton:(UISlider *)slider {
if (self.nlSlider == slider) {
float value = _nlSlider.value;
_nlNumLabel.text = [NSString stringWithFormat:@"%.f%%",value/_nlSlider.maximumValue*100];
}else {
float value = _wdSlider.value;
_wdNumLabel.text = [NSString stringWithFormat:@"%.f%%",value/_wdSlider.maximumValue*100];
}
}
-(void)sliderChangedbutton:(UISlider *)slider {
if (self.nlSlider == slider) {
float value = _nlSlider.value;
_nlNumLabel.text = [NSString stringWithFormat:@"%.f%%",value/_nlSlider.maximumValue*100];
}else {
float value = _wdSlider.value;
_wdNumLabel.text = [NSString stringWithFormat:@"%.f%%",value/_wdSlider.maximumValue*100];
}
}
-(void)playVideoTime:(CGFloat)time {
}
-(void)topBtnClik:(UIButton *)button {
}
/*
......
......@@ -213,12 +213,12 @@ static NSString *dxmachineCell = @"DXDeviceListCell";
@"imgName":@"DXDr_HFX",
@"tag":@(DR04BtnTag)
},
// @{@"DeviceType":@"Dr.热电仪",
// @"DeviceCode":@"Dr-05",
// @"DeviceId":@"Dr-05",
// @"imgName":@"DXDr_HFX",
// @"tag":@(DR05BtnTag)
// }
@{@"DeviceType":@"Dr.热电仪",
@"DeviceCode":@"Dr-05",
@"DeviceId":@"Dr-05",
@"imgName":@"DXDr_HFX",
@"tag":@(DR05BtnTag)
}
];
self.dataArr = [XHDeviceListModel mj_objectArrayWithKeyValuesArray:arr];
[self.myTabView reloadData];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment