diff --git a/LekangGuard.xcodeproj/project.pbxproj b/LekangGuard.xcodeproj/project.pbxproj index 054a5e9..31a8dd7 100644 --- a/LekangGuard.xcodeproj/project.pbxproj +++ b/LekangGuard.xcodeproj/project.pbxproj @@ -274,7 +274,6 @@ 61BE9D282963BF2800962512 /* wav.mm in Sources */ = {isa = PBXBuildFile; fileRef = 61BE9D212963BF2800962512 /* wav.mm */; }; 61BE9D292963BF2800962512 /* amrFileCodec.mm in Sources */ = {isa = PBXBuildFile; fileRef = 61BE9D222963BF2800962512 /* amrFileCodec.mm */; }; 61CA2BB72934876100605022 /* ContactsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 61CA2BB62934876100605022 /* ContactsViewController.m */; }; - 61CA2BBA29349D4E00605022 /* FamilyTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 61CA2BB929349D4E00605022 /* FamilyTableViewCell.m */; }; 61CA2BBE29349D6F00605022 /* OtherTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 61CA2BBD29349D6F00605022 /* OtherTableViewCell.m */; }; 61CA2BC229349E0300605022 /* ContactsModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 61CA2BC129349E0300605022 /* ContactsModel.m */; }; 61CA2BC529359AB600605022 /* ChoosePersonAddressVC.m in Sources */ = {isa = PBXBuildFile; fileRef = 61CA2BC429359AB600605022 /* ChoosePersonAddressVC.m */; }; @@ -1017,8 +1016,6 @@ 61BE9D242963BF2800962512 /* wav.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = wav.h; sourceTree = ""; }; 61CA2BB52934876100605022 /* ContactsViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ContactsViewController.h; sourceTree = ""; }; 61CA2BB62934876100605022 /* ContactsViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ContactsViewController.m; sourceTree = ""; }; - 61CA2BB829349D4E00605022 /* FamilyTableViewCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FamilyTableViewCell.h; sourceTree = ""; }; - 61CA2BB929349D4E00605022 /* FamilyTableViewCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FamilyTableViewCell.m; sourceTree = ""; }; 61CA2BBC29349D6F00605022 /* OtherTableViewCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = OtherTableViewCell.h; sourceTree = ""; }; 61CA2BBD29349D6F00605022 /* OtherTableViewCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = OtherTableViewCell.m; sourceTree = ""; }; 61CA2BC029349E0300605022 /* ContactsModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ContactsModel.h; sourceTree = ""; }; @@ -2624,8 +2621,6 @@ 61CA2BBB29349D5300605022 /* View */ = { isa = PBXGroup; children = ( - 61CA2BB829349D4E00605022 /* FamilyTableViewCell.h */, - 61CA2BB929349D4E00605022 /* FamilyTableViewCell.m */, 61CA2BBC29349D6F00605022 /* OtherTableViewCell.h */, 61CA2BBD29349D6F00605022 /* OtherTableViewCell.m */, 61CA2BC629359C8F00605022 /* ChooseContactTableViewCell.h */, @@ -3705,7 +3700,6 @@ 614F0CF8296571F0007A912A /* XHPhotographyHelper.m in Sources */, 614F0CE8296571F0007A912A /* XHMessageBubbleFactory.m in Sources */, 614F0CF2296571F0007A912A /* XHLocationHelper.m in Sources */, - 61CA2BBA29349D4E00605022 /* FamilyTableViewCell.m in Sources */, 61D7AAE22987A28900E982AA /* UITraitCollection+QMUI.m in Sources */, 61D478CC295C3371002FC2D4 /* DLUtility.m in Sources */, 6133637328E2ECD200BF4A14 /* TabBarViewController.m in Sources */, diff --git a/LekangGuard.xcworkspace/xcuserdata/ecell.xcuserdatad/UserInterfaceState.xcuserstate b/LekangGuard.xcworkspace/xcuserdata/ecell.xcuserdatad/UserInterfaceState.xcuserstate index 6c8cbb0..981fc59 100644 Binary files a/LekangGuard.xcworkspace/xcuserdata/ecell.xcuserdatad/UserInterfaceState.xcuserstate and b/LekangGuard.xcworkspace/xcuserdata/ecell.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/LekangGuard.xcworkspace/xcuserdata/ecell.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/LekangGuard.xcworkspace/xcuserdata/ecell.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist index 21541f5..ecc3423 100644 --- a/LekangGuard.xcworkspace/xcuserdata/ecell.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +++ b/LekangGuard.xcworkspace/xcuserdata/ecell.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist @@ -199,22 +199,6 @@ - - - - @@ -318,8 +302,8 @@ filePath = "LekangGuard/AppDelegate.m" startingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807" - startingLineNumber = "596" - endingLineNumber = "596" + startingLineNumber = "594" + endingLineNumber = "594" landmarkName = "-applicationDidBecomeActive:" landmarkType = "7"> @@ -414,8 +398,8 @@ filePath = "LekangGuard/Home/Contacts(电话本)/ContactsViewController.m" startingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807" - startingLineNumber = "202" - endingLineNumber = "202" + startingLineNumber = "201" + endingLineNumber = "201" landmarkName = "-tableView:didSelectRowAtIndexPath:" landmarkType = "7"> @@ -423,65 +407,113 @@ + + + + + + + startingLineNumber = "266" + endingLineNumber = "266" + landmarkName = "RemindMessageViewController" + landmarkType = "3"> + + + + diff --git a/LekangGuard/AppDelegate.m b/LekangGuard/AppDelegate.m index db827e6..b796be8 100644 --- a/LekangGuard/AppDelegate.m +++ b/LekangGuard/AppDelegate.m @@ -256,8 +256,6 @@ didReceiveNotificationResponse:(UNNotificationResponse *)response //其他的消息 , 比如 主动定位推送的消息,群解散 等 的f [[NSNotificationCenter defaultCenter] postNotificationName:dict[@"type"] object:dict]; } - - } } diff --git a/LekangGuard/Common/BaseViewController.m b/LekangGuard/Common/BaseViewController.m index ca66837..c55b411 100644 --- a/LekangGuard/Common/BaseViewController.m +++ b/LekangGuard/Common/BaseViewController.m @@ -291,11 +291,14 @@ } if([NSStringFromClass([viewController class]) isEqualToString:@"WatchHomeViewController"] || - [NSStringFromClass([viewController class]) isEqualToString:@"HAndTViewController"] ){ + [NSStringFromClass([viewController class]) isEqualToString:@"HAndTViewController"] ) + { //在首页或者是 心率/体温页面 刷新数据 [self viewWillAppear:YES]; return; - }else{ + } + else + { return; } } @@ -826,6 +829,7 @@ [[NSNotificationCenter defaultCenter] removeObserver:self name:AccountMessageNotification object:nil]; [[NSNotificationCenter defaultCenter] removeObserver:self name:PUSH_type_chatGroupDisband object:nil]; [[NSNotificationCenter defaultCenter] removeObserver:self name:PUSH_type_chatGroupRemove object:nil]; + [[NSNotificationCenter defaultCenter] removeObserver:self name:@"updateBatteryAndLocation" object:nil]; } /* diff --git a/LekangGuard/Home/Contacts(电话本)/AmendContactsViewController.m b/LekangGuard/Home/Contacts(电话本)/AmendContactsViewController.m index c2ca9d1..bf7b09d 100644 --- a/LekangGuard/Home/Contacts(电话本)/AmendContactsViewController.m +++ b/LekangGuard/Home/Contacts(电话本)/AmendContactsViewController.m @@ -228,7 +228,7 @@ NSMutableDictionary *parameters = [NSMutableDictionary dictionary]; [parameters setValue:self.conModel.Id forKey:@"id"]; [parameters setValue:@(self.relationshipId) forKey:@"image"]; - [parameters setValue:self.relationship forKey:@"relation"]; + [parameters setValue:self.contactField.text forKey:@"relation"]; [parameters setValue:self.contactField.text forKey:@"name"]; [parameters setValue:self.phoneField.text forKey:@"phone"]; [parameters setValue:APIManager.sharedManager.deviceModel.imei forKey:@"imei"]; diff --git a/LekangGuard/Home/Contacts(电话本)/ContactsViewController.m b/LekangGuard/Home/Contacts(电话本)/ContactsViewController.m index c5c7e17..ef3b5f1 100644 --- a/LekangGuard/Home/Contacts(电话本)/ContactsViewController.m +++ b/LekangGuard/Home/Contacts(电话本)/ContactsViewController.m @@ -7,7 +7,6 @@ #import "ContactsViewController.h" #import "OtherTableViewCell.h" -#import "FamilyTableViewCell.h" #import "ChoosePersonAddressVC.h" #import "AmendContactsViewController.h" diff --git a/LekangGuard/Home/Contacts(电话本)/View/FamilyTableViewCell.h b/LekangGuard/Home/Contacts(电话本)/View/FamilyTableViewCell.h deleted file mode 100644 index d0dab1c..0000000 --- a/LekangGuard/Home/Contacts(电话本)/View/FamilyTableViewCell.h +++ /dev/null @@ -1,19 +0,0 @@ -// -// FamilyTableViewCell.h -// LekangGuard -// -// Created by ecell on 2022/11/28. -// - -#import "ZZTableViewCell.h" - -NS_ASSUME_NONNULL_BEGIN - -@class ContactsModel; -@interface FamilyTableViewCell : ZZTableViewCell - -@property (nonatomic ,strong) ContactsModel *contactsModel; - -@end - -NS_ASSUME_NONNULL_END diff --git a/LekangGuard/Home/Contacts(电话本)/View/FamilyTableViewCell.m b/LekangGuard/Home/Contacts(电话本)/View/FamilyTableViewCell.m deleted file mode 100644 index 6cd33d4..0000000 --- a/LekangGuard/Home/Contacts(电话本)/View/FamilyTableViewCell.m +++ /dev/null @@ -1,116 +0,0 @@ -// -// FamilyTableViewCell.m -// LekangGuard -// -// Created by ecell on 2022/11/28. -// - -#import "FamilyTableViewCell.h" - -@interface FamilyTableViewCell () - -/// 头像 -@property (nonatomic ,weak) UIImageView *iconImg; - - -@property (nonatomic ,weak) UILabel *typeLabel; - -/// 姓名 -@property (nonatomic ,weak) UILabel *nameLabel; - -/// 手机号 -@property (nonatomic ,weak) UILabel *phoneLabel; - -@end - -@implementation FamilyTableViewCell - -- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier -{ - self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; - if (self) - { - self.selectionStyle = UITableViewCellSelectionStyleNone; - self.backgroundColor = KKWhiteColorColor; - [self subCellView]; - } - - return self; -} - -- (void)setContactsModel:(ContactsModel *)contactsModel -{ - _contactsModel = contactsModel; - self.iconImg.image = [UICommon getClickRelationshipImageWithCodeID:contactsModel.image deviceType:APIManager.sharedManager.deviceModel.deviceType]; - self.nameLabel.text = GJText(contactsModel.name); - self.phoneLabel.text = contactsModel.phone; - NSString *str; - if ([contactsModel.openId isEqualToString:APIManager.sharedManager.loginModel.openid] ) - { - str = contactsModel.identity == 2 ? GJText(@"(我) 管理员") : GJText(@"(我)"); - } - else - { - str = contactsModel.identity == 2 ? GJText(@"管理员") : @""; - } - self.typeLabel.text = str; -} - -- (void)subCellView -{ - UIImageView *iconImg = [UICommon ui_imageView:CGRectZero fileName:@""]; - self.iconImg = iconImg; - [self.contentView addSubview:iconImg]; - [iconImg mas_makeConstraints:^(MASConstraintMaker *make) { - make.left.equalTo(self.contentView).offset(15); - make.centerY.equalTo(self.contentView); - make.size.mas_equalTo(CGSizeMake(Adapted(40), Adapted(40))); - }]; - - - UILabel *nameLabel = [UICommon ui_label:CGRectZero lines:0 align:NSTextAlignmentCenter font:FontADA_(15) textColor:KKTextBlackColor text:@"" Radius:0]; - self.nameLabel = nameLabel; - [self.contentView addSubview:nameLabel]; - [nameLabel mas_makeConstraints:^(MASConstraintMaker *make) { - make.left.equalTo(iconImg.mas_right).offset(10); - make.top.equalTo(iconImg); - }]; - - UILabel *phoneLabel = [UICommon ui_label:CGRectZero lines:0 align:NSTextAlignmentCenter font:FontADA_(13) textColor:KKGrey102 text:@"" Radius:0]; - self.phoneLabel = phoneLabel; - [self.contentView addSubview:phoneLabel]; - [phoneLabel mas_makeConstraints:^(MASConstraintMaker *make) { - make.left.equalTo(nameLabel); - make.bottom.equalTo(iconImg.mas_bottom); - }]; - - - UILabel *typeLabel = [UICommon ui_label:CGRectZero lines:0 align:NSTextAlignmentCenter font:FontADA_(15) textColor:KKMainColor text:@"" Radius:0]; - self.typeLabel = typeLabel; - [self.contentView addSubview:typeLabel]; - [typeLabel mas_makeConstraints:^(MASConstraintMaker *make) { - make.left.equalTo(nameLabel.mas_right).offset(5); - make.centerY.equalTo(nameLabel); - }]; - - UIImageView *rightImg = [UICommon ui_imageView:CGRectZero fileName:@"icon_enter_gray"]; - [self.contentView addSubview:rightImg]; - [rightImg mas_makeConstraints:^(MASConstraintMaker *make) { - make.right.equalTo(self.contentView.mas_right).inset(15); - make.centerY.equalTo(self.contentView); - make.size.mas_equalTo(rightImg.image.size); - }]; -} - -- (void)awakeFromNib { - [super awakeFromNib]; - // Initialization code -} - -- (void)setSelected:(BOOL)selected animated:(BOOL)animated { - [super setSelected:selected animated:animated]; - - // Configure the view for the selected state -} - -@end diff --git a/LekangGuard/Home/Contacts(电话本)/View/OtherTableViewCell.m b/LekangGuard/Home/Contacts(电话本)/View/OtherTableViewCell.m index 3dc9382..58910a4 100644 --- a/LekangGuard/Home/Contacts(电话本)/View/OtherTableViewCell.m +++ b/LekangGuard/Home/Contacts(电话本)/View/OtherTableViewCell.m @@ -58,7 +58,7 @@ //NSLog(@"-->%@",contactsModel); _contactsModel = contactsModel; self.iconImg.image = [UICommon getClickRelationshipImageWithCodeID:contactsModel.image deviceType:APIManager.sharedManager.deviceModel.deviceType]; - self.nameLabel.text = contactsModel.name; + self.nameLabel.text = contactsModel.relation; self.phoneLabel.text = contactsModel.phone; self.selectImg.image = contactsModel.isSelect ? ImageName_(@"icon_selectImg_Yes") : ImageName_(@"icon_selectImg_No"); diff --git a/LekangGuard/Home/Homes/AddWatchViewController.m b/LekangGuard/Home/Homes/AddWatchViewController.m index 4b47aba..0a02d55 100644 --- a/LekangGuard/Home/Homes/AddWatchViewController.m +++ b/LekangGuard/Home/Homes/AddWatchViewController.m @@ -310,7 +310,7 @@ [parameters setValue:@(self.relationshipId) forKey:@"relationshipId"]; [parameters setValue:@(self.sex) forKey:@"sex"]; [parameters setValue:self.weightBtn.currentTitle forKey:@"weight"]; - [[[APIManager sharedManager] uploadFileWithURL:AddDevice_URL parameters:parameters filePath:@"" fileData:self.iconFile] subscribeNext:^(id _Nullable x) { + [[[APIManager sharedManager] uploadImageWithURL:AddDevice_URL parameters:parameters images:@[self.iconBtn.currentImage]] subscribeNext:^(id _Nullable x) { [UICommon HidenLoading]; [UICommon MessageSuccessText:@"添加成功"]; [[NSNotificationCenter defaultCenter] postNotificationName:UPDATA_DeviceList object:nil]; diff --git a/LekangGuard/Home/Homes/HomeViewController.m b/LekangGuard/Home/Homes/HomeViewController.m index a9b3b33..54d9e3c 100644 --- a/LekangGuard/Home/Homes/HomeViewController.m +++ b/LekangGuard/Home/Homes/HomeViewController.m @@ -65,6 +65,10 @@ { [self GetLatest:APIManager.sharedManager.deviceModel.imei]; }]; + [[[NSNotificationCenter defaultCenter] rac_addObserverForName:@"deviceNowLocation" object:nil] subscribeNext:^(NSNotification *x) + { + [self GetLatest:APIManager.sharedManager.deviceModel.imei]; + }]; [self.view addSubview:self.homeTable]; [self.homeTable mas_makeConstraints:^(MASConstraintMaker *make) { diff --git a/LekangGuard/Home/Homes/View/HomeTableViewCell.m b/LekangGuard/Home/Homes/View/HomeTableViewCell.m index 8d7dfe3..94e656f 100644 --- a/LekangGuard/Home/Homes/View/HomeTableViewCell.m +++ b/LekangGuard/Home/Homes/View/HomeTableViewCell.m @@ -7,6 +7,29 @@ #import "HomeTableViewCell.h" +@interface NSTimer (XRTimer) ++ (NSTimer *)xr_timerWithTimeInterval:(NSTimeInterval)interval repeats:(BOOL)repeats block:(void (^)(NSTimer *))block; +@end + + +@implementation NSTimer (XRTimer) + ++ (NSTimer *)xr_timerWithTimeInterval:(NSTimeInterval)interval repeats:(BOOL)repeats block:(void (^)(NSTimer *))block { + if ([self respondsToSelector:@selector(timerWithTimeInterval:repeats:block:)]) { + return [self timerWithTimeInterval:interval repeats:repeats block:block]; + } + return [self timerWithTimeInterval:interval target:self selector:@selector(timerAction:) userInfo:block repeats:repeats]; +} + ++ (void)timerAction:(NSTimer *)timer { + void (^block)(NSTimer *timer) = timer.userInfo; + if (block) block(timer); +} +@end + +//倒计时时间 +#define DefineCountdownTime 60 + @interface HomeTableViewCell () /// 背景图片 @@ -18,7 +41,7 @@ @property (nonatomic ,weak) UILabel *timeLabel; /// 右边 fed0df -@property (nonatomic ,weak) UILabel *rightLabel; +@property (nonatomic ,weak) UIButton *rightBtn; /// 温度或者心率 @property (nonatomic ,weak) UILabel *commLabel; @@ -26,6 +49,9 @@ @property (nonatomic ,weak) UILabel *tiLabel; +///定时器 +@property (nonatomic, strong) NSTimer *timer; + @end @implementation HomeTableViewCell @@ -50,14 +76,14 @@ if ([titleStr isEqualToString:GJText(@"心率")]) { self.bgimg.image = ImageName_(@"img_heart_rate_bg"); - self.rightLabel.layer.borderColor = RGB(254, 74, 102).CGColor; - self.rightLabel.textColor = RGB(254, 74, 102); + self.rightBtn.layer.borderColor = RGB(254, 74, 102).CGColor; + [self.rightBtn setTitleColor:RGB(254, 74, 102) forState:0]; } if ([titleStr isEqualToString:GJText(@"体温")]) { self.bgimg.image = ImageName_(@"img_body_temperature_bg"); - self.rightLabel.layer.borderColor = KKMainColor.CGColor; - self.rightLabel.textColor = KKMainColor; + self.rightBtn.layer.borderColor = KKMainColor.CGColor; + [self.rightBtn setTitleColor:KKMainColor forState:0]; } } @@ -110,16 +136,45 @@ }]; /// 右边 fed0df - UILabel *rightLabel = [UICommon ui_label:CGRectZero lines:0 align:NSTextAlignmentCenter font:FontADA_(12) textColor:KKMainColor text:GJText(@"开始测量") Radius:Adapted(15)]; - CGSize titlesize = [rightLabel.text sizeWithFont:FontADA_(12) constrainedToSize:CGSizeMake(MAXFLOAT, 30)]; - rightLabel.layer.borderWidth = 1; - rightLabel.layer.borderColor = KKMainColor.CGColor; - self.rightLabel = rightLabel; - [self.contentView addSubview:rightLabel]; - [rightLabel mas_makeConstraints:^(MASConstraintMaker *make) { + UIButton *rightBtn = [UICommon ui_buttonSimple:CGRectZero font:FontADA_(12) normalColor:KKMainColor normalText:GJText(@"开始测量") click:^(UIButton *btn){ + kWeakSelf(self) + NSLog(@"%@",self.titleLabel.text); + @try { + + [HeartAndTempModel postHeartAndTempDataWithType:[self.titleLabel.text isEqualToString:GJText(@"心率")] ? 1 : 2 cmd:2 obj:@"-1" success:^(id responseObject) { + NSString * tempKey; + if([self.titleLabel.text isEqualToString:GJText(@"心率")]) + { + //心率 + tempKey = [NSString stringWithFormat:@"%@&%@",HeartMeasurementTimeKey,APIManager.sharedManager.deviceModel.imei]; + }else{ + //体温 + tempKey = [NSString stringWithFormat:@"%@&%@",TempMeasurementTimeKey,APIManager.sharedManager.deviceModel.imei]; + } + //设置 倒计时时间后的 时间戳 + [UserDefaults setValue:[NSDate dateWithTimeIntervalSince1970:([NSDate date].timeIntervalSince1970 + DefineCountdownTime)] forKey:tempKey]; + //先调用一次 + [weakself calculateFun]; + [weakself startTimer]; + } failure:^(NSError * _Nonnull error) { + + }]; + } @catch (NSException *exception) { + + } @finally { + + } + }]; + rightBtn.layer.borderWidth = 1; + rightBtn.layer.borderColor = KKMainColor.CGColor; + rightBtn.layer.cornerRadius = Adapted(15); + self.rightBtn = rightBtn; + [self.contentView addSubview:rightBtn]; + CGRect titlesize = [UICommon GetTextWidth:rightBtn.currentTitle ViewHeight:Adapted(30) fontSize:FontADA_(12) type:@"w"]; + [rightBtn mas_makeConstraints:^(MASConstraintMaker *make) { make.right.equalTo(bgimg.mas_right).inset(20); make.centerY.equalTo(bgimg); - make.size.mas_equalTo(CGSizeMake(Adapted(titlesize.width+12 ), Adapted(30))); + make.size.mas_equalTo(CGSizeMake(Adapted(titlesize.size.width+20), Adapted(30))); }]; /// 温度或心率 @@ -139,8 +194,79 @@ make.left.equalTo(commLabel.mas_right).offset(5); make.bottom.equalTo(commLabel.mas_bottom); }]; +} + + +#pragma mark- --------定时器相关方法-------- +- (void)startTimer +{ + //如果定时器已开启,先停止再重新开启 + if (self.timer) [self stopTimer]; + __weak typeof(self) weakSelf = self; + self.timer = [NSTimer xr_timerWithTimeInterval:1 repeats:YES block:^(NSTimer * _Nonnull timer) { + [weakSelf calculateFun]; + }]; + [[NSRunLoop currentRunLoop] addTimer:self.timer forMode:NSRunLoopCommonModes]; +} + +- (void)stopTimer +{ + [self.timer invalidate]; + self.timer = nil; - +} + +/// 倒计时计算方法 +- (void)calculateFun +{ + NSString *tempKey; + if([self.titleLabel.text isEqualToString:GJText(@"心率")]) + { + //心率 + tempKey = [NSString stringWithFormat:@"%@&%@",HeartMeasurementTimeKey,APIManager.sharedManager.deviceModel.imei]; + } + else + { + //体温 + tempKey = [NSString stringWithFormat:@"%@&%@",TempMeasurementTimeKey,APIManager.sharedManager.deviceModel.imei]; + } + NSDate *tempDate = [UserDefaults valueForKey:tempKey]; + if(tempDate) + { + NSTimeInterval tempTime = tempDate.timeIntervalSince1970; + if ( (tempTime - [NSDate date].timeIntervalSince1970) < 1 ) + { + [UserDefaults removeObjectForKey:tempKey]; + [self stopTimer]; + [self.rightBtn setTitle:GJText(@"开始测量") forState:0]; + //MARK: 这里倒计时结束时需要回调刷新页面的数据 +// if(self.measurementEndBlock) +// { +// self.measurementEndBlock(); +// } + } + else + { + [UserDefaults setValue:[NSDate dateWithTimeIntervalSince1970:tempTime] forKey:tempKey]; + [self.rightBtn setTitle:[NSString stringWithFormat:GJText(@"测量中(%ds)"),(int)(tempTime - [NSDate date].timeIntervalSince1970)] forState:0]; + } + } + else + { + [self stopTimer]; + [self.rightBtn setTitle:GJText(@"开始测量") forState:0]; + //MARK: 这里倒计时结束时需要回调刷新页面的数据 +// if(self.measurementEndBlock) +// { +// self.measurementEndBlock(); +// } + } + CGRect titlesize = [UICommon GetTextWidth:self.rightBtn.currentTitle ViewHeight:Adapted(30) fontSize:FontADA_(12) type:@"w"]; + [self.rightBtn mas_remakeConstraints:^(MASConstraintMaker *make) { + make.right.equalTo(self.bgimg.mas_right).inset(20); + make.centerY.equalTo(self.bgimg); + make.size.mas_equalTo(CGSizeMake(Adapted(titlesize.size.width+20), Adapted(30))); + }]; } diff --git a/LekangGuard/Home/MoreService (更多功能)/EditDeviceViewController.m b/LekangGuard/Home/MoreService (更多功能)/EditDeviceViewController.m index 20f77e6..7e793bb 100644 --- a/LekangGuard/Home/MoreService (更多功能)/EditDeviceViewController.m +++ b/LekangGuard/Home/MoreService (更多功能)/EditDeviceViewController.m @@ -529,7 +529,7 @@ [parameters setValue:@(self.devModel.relationImageId) forKey:@"relationImageId"]; [parameters setValue:@(self.Sex) forKey:@"sex"]; [parameters setValue:self.Weight forKey:@"weight"]; - [[[APIManager sharedManager] uploadFileWithURL:UpdateDeviceInfo_URL parameters:parameters filePath:@"" fileData:self.iconFile] subscribeNext:^(id _Nullable x) { + [[[APIManager sharedManager] uploadImageWithURL:UpdateDeviceInfo_URL parameters:parameters images:@[self.iconBtn.currentImage]] subscribeNext:^(id _Nullable x) { [super updataNotificat]; [UICommon HidenLoading]; [UICommon MessageSuccessText:@"修改成功"]; diff --git a/LekangGuard/Login/RegisterViewController.m b/LekangGuard/Login/RegisterViewController.m index 2be205a..f3cd426 100644 --- a/LekangGuard/Login/RegisterViewController.m +++ b/LekangGuard/Login/RegisterViewController.m @@ -200,12 +200,12 @@ } else if (self.passField.text.length < 6 || self.passField.text.length > 16) { - [UICommon MessageErrorText:@"请输入密码"]; + [UICommon MessageErrorText:@"密码应该为6-16位数"]; return; } else if (self.passIField.text.length < 6 || self.passIField.text.length > 16) { - [UICommon MessageErrorText:@"请输入密码"]; + [UICommon MessageErrorText:@"密码应该为6-16位数"]; return; } else if (![self.passField.text isEqualToString:self.passIField.text]) @@ -220,13 +220,16 @@ [parameters setValue:self.emailField.text forKey:@"email"]; [parameters setValue:self.passIField.text forKey:@"password"]; [[[APIManager sharedManager] APPOST:self.isViewType == 0 ? Register_URL : UpdatePwd_URL parameters:parameters isJson:YES resultClass:nil] subscribeNext:^(id _Nullable x) { - NSMutableDictionary *userDic = [NSMutableDictionary dictionary]; - [userDic setValue:self.emailField.text forKey:@"email"]; - [userDic setValue:@"" forKey:@"password"]; - [userDic setValue:@"0" forKey:@"isRememberPWD"]; - YYCache *userCache = [YYCache cacheWithName:UserCacheName]; - [userCache setObject:userDic forKey:UserCacheKey]; - self.isRegisterSuccess(); + if (self.isViewType == 0) + { + NSMutableDictionary *userDic = [NSMutableDictionary dictionary]; + [userDic setValue:self.emailField.text forKey:@"email"]; + [userDic setValue:@"" forKey:@"password"]; + [userDic setValue:@"0" forKey:@"isRememberPWD"]; + YYCache *userCache = [YYCache cacheWithName:UserCacheName]; + [userCache setObject:userDic forKey:UserCacheKey]; + self.isRegisterSuccess(); + } [UICommon MessageSuccessText:self.isViewType == 0 ? GJText(@"注册成功,请登录账号") : GJText(@"密码重置成功,请登录账号")]; AfterDispatch(1, ^{ diff --git a/LekangGuard/Managers/APIManager.h b/LekangGuard/Managers/APIManager.h index 0f45375..2e08aa7 100644 --- a/LekangGuard/Managers/APIManager.h +++ b/LekangGuard/Managers/APIManager.h @@ -76,10 +76,6 @@ extern NSString *const sDeviceKey; -/// 上传单张或多张图片 -/// @param ImgArr 图片数组 -- (RACSignal *)updateFile:(NSArray *)ImgArr; - /// 下载文件 /// @param url url /// @param path 下载目标路径 @@ -89,6 +85,14 @@ extern NSString *const sDeviceKey; /// 使用body传数据 - (RACSignal *)PostBodyWithApi:(NSString *)api json:(id)json; +/// 上传图片文件 +/// @param url 接口名 +/// @param parameters 参数 +/// @param images 图片数组 +- (RACSignal *)uploadImageWithURL:(NSString *)url + parameters:(NSDictionary *)parameters + images:(NSArray * __nullable)images; + @end diff --git a/LekangGuard/Managers/APIManager.m b/LekangGuard/Managers/APIManager.m index cfe86ca..bb76113 100644 --- a/LekangGuard/Managers/APIManager.m +++ b/LekangGuard/Managers/APIManager.m @@ -283,34 +283,25 @@ NSInteger const kErrorException = 500; } -/// 上传单张或多张图片 -/// @param ImgArr 图片数组 -- (RACSignal *)updateFile:(NSArray *)ImgArr + +/// 下载文件 +/// @param url url +/// @param path 下载目标路径 +- (RACSignal *)downloadWithURL:(NSString *)url filePath:(NSString *)path { - NSString *const kHostUrl = dHostUrl; [MSNetwork openLog]; - //[MSNetwork setBaseURL:kHostUrl]; - NSDictionary *dic = [NSDictionary new]; - RACSignal *requestSignal = [RACSignal createSignal:^RACDisposable * _Nullable(id _Nonnull subscriber) { - [MSNetwork uploadImageURL:F(@"%@%@", kHostUrl,@"/file/upload") parameters:dic headers:[self setHttpHeader] images:ImgArr name:@"file" fileName:[UICommon getRandomEightCode] imageScale:1 imageType:@"png" progress:^(NSProgress * _Nonnull progress) { - - - } success:^(id _Nonnull responseObject) { + [MSNetwork downloadWithURL:url fileDir:path progress:^(NSProgress * _Nonnull progress) { + } success:^(NSString * _Nonnull path) { [UICommon HidenLoading]; - [UICommon MessageSuccessText:@"上传成功"]; - - NSLog(@"上传成功:%@",responseObject); - [subscriber sendNext:responseObject]; + [subscriber sendNext:path]; [subscriber sendCompleted]; + } failure:^(NSError * _Nonnull error) { - NSLog(@"上传错误:%@",error); [subscriber sendError:error]; - [UICommon HidenLoading]; - [UICommon MessageErrorText:F(@"上传错误:%@",error)]; - }]; + return [RACDisposable disposableWithBlock:^{ NSLog(@"6 订阅流程结束,可清理资源"); }]; @@ -331,62 +322,45 @@ NSInteger const kErrorException = 500; return [RACSignal createSignal:^RACDisposable *(id subscriber) { - [UICommon HidenLoading]; - //@strongify(self); - NSString *status = F(@"%@", data[@"code"]); - id resultObj = data[@"data"]; - if ([status isKindOfClass:[NSString class]] && [status isEqualToString:@"200"]) - { - [subscriber sendNext:resultObj]; - } - else - { - //有网络 - NSString *content = data[@"message"]; - NSString *message = [content isNotBlank] ? content : @""; - NSDictionary *userInfo = @{NSLocalizedDescriptionKey : message,@"detail":status}; - //其他错误 - NSError *error = [NSError errorWithDomain:kErrorDomain code:kErrorException userInfo:userInfo]; - [subscriber sendError:error]; - - } - [subscriber sendCompleted]; - if ([status isEqualToString:@"401"]) { - [[NSNotificationCenter defaultCenter] postNotificationName:sRelogin object:nil]; - } + [subscriber sendNext:data]; return nil; }]; }] doNext:extraHandlerSingal]; } - - -/// 下载文件 -/// @param url url -/// @param path 下载目标路径 -- (RACSignal *)downloadWithURL:(NSString *)url filePath:(NSString *)path +/// 上传图片文件 +/// @param url 接口名 +/// @param parameters 参数 +/// @param images 图片数组 +- (RACSignal *)uploadImageWithURL:(NSString *)url + parameters:(NSDictionary *)parameters + images:(NSArray * __nullable)images { [MSNetwork openLog]; - RACSignal *requestSignal = [RACSignal createSignal:^RACDisposable * _Nullable(id _Nonnull subscriber) { - [MSNetwork downloadWithURL:url fileDir:path progress:^(NSProgress * _Nonnull progress) { - } success:^(NSString * _Nonnull path) { + RACSignal *requestSignal; + + requestSignal = [RACSignal createSignal:^RACDisposable * _Nullable(id _Nonnull subscriber) { + [MSNetwork uploadImageURL:[NSString stringWithFormat:@"%@%@",dHostUrl,url] parameters:parameters headers:[self setHttpHeader] images:images name:@"file" fileName:@"image" imageScale:0.3 imageType:@"png" progress:^(NSProgress * _Nonnull progress) { + + } success:^(id _Nonnull responseObject) { [UICommon HidenLoading]; - [subscriber sendNext:path]; + [subscriber sendNext:responseObject]; [subscriber sendCompleted]; - } failure:^(NSError * _Nonnull error) { - [subscriber sendError:error]; [UICommon HidenLoading]; + [UICommon MessageErrorText:F(@"上传错误:%@",error)]; }]; + return [RACDisposable disposableWithBlock:^{ NSLog(@"6 订阅流程结束,可清理资源"); }]; }]; + void (^extraHandlerSingal)(id value) = ^(RACTuple * value) { }; @@ -401,15 +375,35 @@ NSInteger const kErrorException = 500; return [RACSignal createSignal:^RACDisposable *(id subscriber) { + [UICommon HidenLoading]; - [subscriber sendNext:data]; + //@strongify(self); + NSString *status = F(@"%@", data[@"code"]); + id resultObj = data[@"data"]; + if ([status isKindOfClass:[NSString class]] && [status isEqualToString:@"200"]) + { + [subscriber sendNext:resultObj]; + } + else + { + //有网络 + NSString *content = data[@"msg"]; + NSString *message = [content isNotBlank] ? content : @""; + NSDictionary *userInfo = @{NSLocalizedDescriptionKey : message,@"detail":status}; + //其他错误 + NSError *error = [NSError errorWithDomain:kErrorDomain code:kErrorException userInfo:userInfo]; + [subscriber sendError:error]; + + } + [subscriber sendCompleted]; + if ([status isEqualToString:@"401"]) { + [[NSNotificationCenter defaultCenter] postNotificationName:sRelogin object:nil]; + } return nil; }]; }] doNext:extraHandlerSingal]; } - - /// 上传文件 /// @param url 接口名 /// @param parameters 参数 @@ -446,6 +440,13 @@ NSInteger const kErrorException = 500; else { requestSignal = [RACSignal createSignal:^RACDisposable * _Nullable(id _Nonnull subscriber) { + [MSNetwork uploadImageURL:[NSString stringWithFormat:@"%@%@",dHostUrl,url] parameters:parameters headers:[self setHttpHeader] images:@[] name:@"file" fileName:@"image" imageScale:0.5 imageType:@"png" progress:^(NSProgress * _Nonnull progress) { + + } success:^(id _Nonnull responseObject) { + + } failure:^(NSError * _Nonnull error) { + + }]; [MSNetwork uploadFileDataWithURL:[NSString stringWithFormat:@"%@%@",dHostUrl,url] parameters:parameters headers:[self setHttpHeader] name:@"file" fileData:fileData progress:^(NSProgress * _Nonnull progress) { } success:^(id _Nonnull responseObject) { @@ -491,7 +492,7 @@ NSInteger const kErrorException = 500; else { //有网络 - NSString *content = data[@"message"]; + NSString *content = data[@"msg"]; NSString *message = [content isNotBlank] ? content : @""; NSDictionary *userInfo = @{NSLocalizedDescriptionKey : message,@"detail":status}; //其他错误 @@ -639,7 +640,7 @@ NSInteger const kErrorException = 500; else { //有网络 - NSString *content = dictFromData[@"message"]; + NSString *content = dictFromData[@"msg"]; NSString *message = [content isNotBlank] ? content : @""; NSDictionary *userInfo = @{NSLocalizedDescriptionKey : message,@"detail":status}; //其他错误 diff --git a/LekangGuard/Map/VC/MapViewController.m b/LekangGuard/Map/VC/MapViewController.m index 0579736..35f3bd4 100644 --- a/LekangGuard/Map/VC/MapViewController.m +++ b/LekangGuard/Map/VC/MapViewController.m @@ -55,6 +55,10 @@ [[[NSNotificationCenter defaultCenter] rac_addObserverForName:@"updateBatteryAndLocation" object:nil] subscribeNext:^(NSNotification *x){ [self UpdataLatestlocation:APIManager.sharedManager.deviceModel.imei]; }]; + [[[NSNotificationCenter defaultCenter] rac_addObserverForName:@"deviceNowLocation" object:nil] subscribeNext:^(NSNotification *x) + { + [self UpdataLatestlocation:APIManager.sharedManager.deviceModel.imei]; + }]; } diff --git a/LekangGuard/My/VC/Message(消息)/AttentionMessageViewController.m b/LekangGuard/My/VC/Message(消息)/AttentionMessageViewController.m index b776acd..2680786 100644 --- a/LekangGuard/My/VC/Message(消息)/AttentionMessageViewController.m +++ b/LekangGuard/My/VC/Message(消息)/AttentionMessageViewController.m @@ -20,9 +20,6 @@ @implementation AttentionMessageViewController -- (void)viewWillAppear:(BOOL)animated{ - [super viewWillAppear:animated]; -} - (UITableView *)myTableView { @@ -120,6 +117,7 @@ [UICommon HidenLoading]; [UICommon MessageSuccessText:@"删除成功"]; [self GetQueryFollowInfo:TableisReload_h]; + [[NSNotificationCenter defaultCenter] postNotificationName:KK_UPDATE_ALL_NEWS_MESSAGE object:nil]; } error:^(NSError * _Nullable error) { NSDictionary *dic = error.userInfo; @@ -251,8 +249,31 @@ AttentionModel *dMessage = self.modelListArr[indexPath.row]; [UICommon MessageUpload:@"加载中"]; + [self updateInfoStatus:dMessage]; +} + +//- (void)viewWillAppear:(BOOL)animated +//{ +// [super viewWillAppear:animated]; +// [self xiaoxiyidu]; +//} + + +- (void)xiaoxiyidu +{ + [self.modelListArr enumerateObjectsUsingBlock:^(AttentionModel *model, NSUInteger idx, BOOL * _Nonnull stop) { + if (model.read && model.read == 0) + { + [self updateInfoStatus:model]; + } + }]; +} + +- (void)updateInfoStatus:(AttentionModel *)model +{ + kWeakSelf(self) NSMutableDictionary *parameters = [NSMutableDictionary dictionary]; - [[[APIManager sharedManager] APGET:F(@"%@%@/1", UpdateInfoStatus_URL,dMessage.Id) parameters:parameters resultClass:nil] subscribeNext:^(id _Nullable x) { + [[[APIManager sharedManager] APGET:F(@"%@%@/1", UpdateInfoStatus_URL,model.Id) parameters:parameters resultClass:nil] subscribeNext:^(id _Nullable x) { [UICommon HidenLoading]; [[NSNotificationCenter defaultCenter] postNotificationName:KK_UPDATE_ALL_NEWS_MESSAGE object:nil]; } error:^(NSError * _Nullable error) { diff --git a/LekangGuard/My/VC/Message(消息)/RemindMessageViewController.m b/LekangGuard/My/VC/Message(消息)/RemindMessageViewController.m index f4bf2d3..e6f8e5c 100644 --- a/LekangGuard/My/VC/Message(消息)/RemindMessageViewController.m +++ b/LekangGuard/My/VC/Message(消息)/RemindMessageViewController.m @@ -18,11 +18,6 @@ @implementation RemindMessageViewController -- (void)viewWillAppear:(BOOL)animated{ - [super viewWillAppear:animated]; - //[self loadMoreDataWithDMessage:nil]; -} - - (UITableView *)myTableView { @@ -118,6 +113,7 @@ [UICommon HidenLoading]; [UICommon MessageSuccessText:@"删除成功"]; [self GetRemindList:TableisReload_h]; + [[NSNotificationCenter defaultCenter] postNotificationName:KK_UPDATE_ALL_NEWS_MESSAGE object:nil]; } error:^(NSError * _Nullable error) { NSDictionary *dic = error.userInfo; @@ -259,27 +255,45 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { - kWeakSelf(self) RemindModel *dMessage = self.modelListArr[indexPath.row]; if (dMessage.messageRead && [dMessage.messageRead intValue] == 0) { [UICommon MessageUpload:@"加载中"]; - NSMutableDictionary *parameters = [NSMutableDictionary dictionary]; - [parameters setValue:dMessage.Id forKey:@"id"]; - [parameters setValue:@"1" forKey:@"messageRead"]; - [[[APIManager sharedManager] APPOST:UpdateRemind_URL parameters:parameters isJson:YES resultClass:nil] subscribeNext:^(id _Nullable x) { - [UICommon HidenLoading]; - dMessage.messageRead = @"1"; - [weakself.myTableView reloadData]; - [[NSNotificationCenter defaultCenter] postNotificationName:KK_UPDATE_ALL_NEWS_MESSAGE object:nil]; - } error:^(NSError * _Nullable error) { - NSDictionary *dic = error.userInfo; - [UICommon MessageErrorText:dic[NSLocalizedDescriptionKey]]; - }]; + [self updateRemind:dMessage]; } } +//- (void)viewWillDisappear:(BOOL)animated +//{ +// [super viewWillDisappear:animated]; +// [self xiaoxiyidu]; +//} +- (void)xiaoxiyidu +{ + [self.modelListArr enumerateObjectsUsingBlock:^(RemindModel *model, NSUInteger idx, BOOL * _Nonnull stop) { + if (model.messageRead && model.messageRead == 0) + { + [self updateRemind:model]; + } + }]; +} +- (void)updateRemind:(RemindModel *)model +{ + kWeakSelf(self) + NSMutableDictionary *parameters = [NSMutableDictionary dictionary]; + [parameters setValue:model.Id forKey:@"id"]; + [parameters setValue:@"1" forKey:@"messageRead"]; + [[[APIManager sharedManager] APPOST:UpdateRemind_URL parameters:parameters isJson:YES resultClass:nil] subscribeNext:^(id _Nullable x) { + [UICommon HidenLoading]; + model.messageRead = @"1"; + [weakself.myTableView reloadData]; + [[NSNotificationCenter defaultCenter] postNotificationName:KK_UPDATE_ALL_NEWS_MESSAGE object:nil]; + } error:^(NSError * _Nullable error) { + NSDictionary *dic = error.userInfo; + [UICommon MessageErrorText:dic[NSLocalizedDescriptionKey]]; + }]; +} - (CGFloat)getLineHeight:(NSString *)string withWidth:(CGFloat)width withFont:(UIFont *)font diff --git a/LekangGuard/My/VC/Message(消息)/SystermMessageViewController.m b/LekangGuard/My/VC/Message(消息)/SystermMessageViewController.m index d1e26ec..7fe52d7 100644 --- a/LekangGuard/My/VC/Message(消息)/SystermMessageViewController.m +++ b/LekangGuard/My/VC/Message(消息)/SystermMessageViewController.m @@ -20,11 +20,6 @@ @implementation SystermMessageViewController -- (void)viewWillAppear:(BOOL)animated{ - [super viewWillAppear:animated]; -} - - - (UITableView *)myTableView { if (!_myTableView) @@ -119,6 +114,7 @@ [UICommon HidenLoading]; [UICommon MessageSuccessText:@"删除成功"]; [self GetNotifyList:TableisReload_h]; + [[NSNotificationCenter defaultCenter] postNotificationName:KK_UPDATE_ALL_NEWS_MESSAGE object:nil]; } error:^(NSError * _Nullable error) { NSDictionary *dic = error.userInfo; @@ -261,23 +257,45 @@ SystermModel *dMessage = self.modelListArr[indexPath.row]; if (dMessage.messageRead && [dMessage.messageRead intValue] == 0) { - kWeakSelf(self) [UICommon MessageUpload:@"加载中"]; - NSMutableDictionary *parameters = [NSMutableDictionary dictionary]; - [parameters setValue:dMessage.Id forKey:@"id"]; - [parameters setValue:@"1" forKey:@"messageRead"]; - [[[APIManager sharedManager] APPOST:UpdateNotify_URL parameters:parameters isJson:YES resultClass:nil] subscribeNext:^(id _Nullable x) { - [UICommon HidenLoading]; - dMessage.messageRead = @"1"; - [[NSNotificationCenter defaultCenter] postNotificationName:KK_UPDATE_ALL_NEWS_MESSAGE object:nil]; - [weakself.myTableView reloadData]; - } error:^(NSError * _Nullable error) { - NSDictionary *dic = error.userInfo; - [UICommon MessageErrorText:dic[NSLocalizedDescriptionKey]]; - }]; + [self updateNotify:dMessage]; } } +//- (void)viewWillAppear:(BOOL)animated +//{ +// [super viewWillAppear:animated]; +// [self xiaoxiyidu]; +//} + + +- (void)xiaoxiyidu +{ + [self.modelListArr enumerateObjectsUsingBlock:^(SystermModel *model, NSUInteger idx, BOOL * _Nonnull stop) { + if (model.messageRead && model.messageRead == 0) + { + [self updateNotify:model]; + } + }]; +} + +- (void)updateNotify:(SystermModel *)model +{ + kWeakSelf(self) + NSMutableDictionary *parameters = [NSMutableDictionary dictionary]; + [parameters setValue:model.Id forKey:@"id"]; + [parameters setValue:@"1" forKey:@"messageRead"]; + [[[APIManager sharedManager] APPOST:UpdateNotify_URL parameters:parameters isJson:YES resultClass:nil] subscribeNext:^(id _Nullable x) { + [UICommon HidenLoading]; + model.messageRead = @"1"; + [[NSNotificationCenter defaultCenter] postNotificationName:KK_UPDATE_ALL_NEWS_MESSAGE object:nil]; + [weakself.myTableView reloadData]; + } error:^(NSError * _Nullable error) { + NSDictionary *dic = error.userInfo; + [UICommon MessageErrorText:dic[NSLocalizedDescriptionKey]]; + }]; +} + diff --git a/LekangGuard/My/VC/ModifyDataViewController.m b/LekangGuard/My/VC/ModifyDataViewController.m index e31dff6..f92d20d 100644 --- a/LekangGuard/My/VC/ModifyDataViewController.m +++ b/LekangGuard/My/VC/ModifyDataViewController.m @@ -64,7 +64,7 @@ UIImageView *iconImg = [UIImageView new]; iconImg.layer.cornerRadius = 5; iconImg.layer.masksToBounds = YES; - [iconImg sd_setImageWithURL:[NSURL URLWithString:self.model.image] placeholderImage:ImageName_(@"icon_unclick_waigong_head_portrait")]; + [iconImg sd_setImageWithURL:[NSURL URLWithString:self.model.image] placeholderImage:ImageName_(@"icon_adults_occupies_the_head")]; self.iconImg = iconImg; [bgView addSubview:iconImg]; [iconImg mas_makeConstraints:^(MASConstraintMaker *make) { @@ -135,15 +135,11 @@ return; } [UICommon MessageUpload:@"加载中"]; - if (self.model.image.length > 0 || self.isSelectIcon) - self.iconFile = UIImageJPEGRepresentation(self.iconImg.image, 1.0f); - else - self.iconFile = [NSData new]; NSMutableDictionary *parameters = [NSMutableDictionary dictionary]; [parameters setValue:self.model.imei forKey:@"imei"]; [parameters setValue:self.nameStr forKey:@"name"]; [parameters setValue:self.phoneStr forKey:@"phone"]; - [[[APIManager sharedManager] uploadFileWithURL:UpdateInfo_URL parameters:parameters filePath:@"" fileData:self.iconFile] subscribeNext:^(id _Nullable x) { + [[[APIManager sharedManager] uploadImageWithURL:UpdateInfo_URL parameters:parameters images:self.isSelectIcon ? @[self.iconImg.image] : nil] subscribeNext:^(id _Nullable x) { NSLog(@"%@",x); [UICommon HidenLoading]; [UICommon MessageSuccessText:@"保存成功"]; @@ -151,7 +147,8 @@ [self.navigationController popViewControllerAnimated:YES]; }); } error:^(NSError * _Nullable error) { - + NSDictionary *dic = error.userInfo; + [UICommon MessageErrorText:dic[NSLocalizedDescriptionKey]]; }]; diff --git a/LekangGuard/en.lproj/Localizable.strings b/LekangGuard/en.lproj/Localizable.strings index 91345b1..8d9d9d2 100644 --- a/LekangGuard/en.lproj/Localizable.strings +++ b/LekangGuard/en.lproj/Localizable.strings @@ -163,7 +163,7 @@ "奶奶" = "Grandma"; -"外公" = "Grandpa"; +"外公" = "Grandfather"; "外婆" = "Grandmother"; @@ -811,3 +811,5 @@ "设备已被%@绑定,请选择关系后向管理员申请关注!" = "The device has been bound with %@. Please select the relationship and apply to the administrator for attention!"; "手机号不能为空" = "The mobile phone number cannot be empty"; + +"密码应该为6-16位数" = "The password should be 6 to 16 digits long"; diff --git a/LekangGuard/zh-Hans.lproj/Localizable.strings b/LekangGuard/zh-Hans.lproj/Localizable.strings index b912d62..8f05f96 100644 --- a/LekangGuard/zh-Hans.lproj/Localizable.strings +++ b/LekangGuard/zh-Hans.lproj/Localizable.strings @@ -810,6 +810,6 @@ "手机号不能为空" = "手机号不能为空"; -"" = ""; +"密码应该为6-16位数" = "密码应该为6-16位数"; "" = "";