Browse Source

【代码优化】修复bug

master
公司电脑 1 year ago
parent
commit
0817732357
  1. 4
      LekangGuard.xcodeproj/project.pbxproj
  2. BIN
      LekangGuard.xcworkspace/xcuserdata/ecell.xcuserdatad/UserInterfaceState.xcuserstate
  3. 8
      LekangGuard/Common/UICommon.m
  4. 59
      LekangGuard/Map/Fence(电子围栏)/AddRailViewController.m
  5. 3
      LekangGuard/Map/Fence(电子围栏)/Model/SafetyRailModel.h
  6. 38
      LekangGuard/Map/Fence(电子围栏)/MoreRailAddressViewController.m
  7. 20
      LekangGuard/Map/Fence(电子围栏)/RailAddressViewController.m
  8. 2
      LekangGuard/Map/Fence(电子围栏)/RailNameTagViewController.m
  9. 7
      LekangGuard/Map/Fence(电子围栏)/View/ElectronicFenceTableViewCell.m
  10. 48
      LekangGuard/Protection(守护星)/VC/ProtectionViewController.m

4
LekangGuard.xcodeproj/project.pbxproj

@ -4247,7 +4247,7 @@ @@ -4247,7 +4247,7 @@
"$(PROJECT_DIR)/LekangGuard/Common/VoiceConvert/lib",
"$(PROJECT_DIR)/LekangGuard/sdk/lib/ios",
);
MARKETING_VERSION = 1.0;
MARKETING_VERSION = 1.0.0;
ONLY_ACTIVE_ARCH = NO;
PRODUCT_BUNDLE_IDENTIFIER = com.cct.studentcard.guard;
PRODUCT_NAME = "ECell care";
@ -4336,7 +4336,7 @@ @@ -4336,7 +4336,7 @@
"$(PROJECT_DIR)/LekangGuard/Common/VoiceConvert/lib",
"$(PROJECT_DIR)/LekangGuard/sdk/lib/ios",
);
MARKETING_VERSION = 1.0;
MARKETING_VERSION = 1.0.0;
ONLY_ACTIVE_ARCH = NO;
PRODUCT_BUNDLE_IDENTIFIER = com.cct.studentcard.guard;
PRODUCT_NAME = "ECell care";

BIN
LekangGuard.xcworkspace/xcuserdata/ecell.xcuserdatad/UserInterfaceState.xcuserstate generated

Binary file not shown.

8
LekangGuard/Common/UICommon.m

@ -507,8 +507,8 @@ @@ -507,8 +507,8 @@
+ (NSAttributedString *)labelFontSize:(NSString *)text
{
NSRange symbolRange = [text rangeOfString:GJText(@"条轨迹")];
NSRange symbolRange1 = [text rangeOfString:GJText(@"多边形围栏")];
NSRange symbolRange2 = [text rangeOfString:GJText(@"圆形围栏")];
NSRange symbolRange1 = [text rangeOfString:GJText(@"多边形")];
NSRange symbolRange2 = [text rangeOfString:GJText(@"圆形")];
NSMutableAttributedString *string = [[NSMutableAttributedString alloc] initWithString:text];
@ -517,10 +517,10 @@ @@ -517,10 +517,10 @@
[string addAttribute:NSForegroundColorAttributeName value:KKGrey121 range:NSMakeRange(symbolRange.location, symbolRange.length)];
}
if (symbolRange1.location != NSNotFound) {
[string addAttribute:NSForegroundColorAttributeName value:KKMainColor range:NSMakeRange(symbolRange1.location, symbolRange1.length)];
[string addAttribute:NSForegroundColorAttributeName value:RGB(255, 173, 1) range:NSMakeRange(symbolRange1.location, symbolRange1.length)];
}
if (symbolRange2.location != NSNotFound) {
[string addAttribute:NSForegroundColorAttributeName value:KKMainColor range:NSMakeRange(symbolRange2.location, symbolRange2.length)];
[string addAttribute:NSForegroundColorAttributeName value:RGB(255, 173, 1) range:NSMakeRange(symbolRange2.location, symbolRange2.length)];
}
// if (xingRange.location != NSNotFound) {
// [string addAttribute:NSFontAttributeName value:FontADA_(11) range:NSMakeRange(xingRange.location, xingRange.length)];

59
LekangGuard/Map/Fence(电子围栏)/AddRailViewController.m

@ -30,9 +30,15 @@ @@ -30,9 +30,15 @@
@property (nonatomic ,weak) UIButton *duoBtn;
@property (nonatomic ,weak) UIButton *yuanBtn;
@property (nonatomic ,weak) UIButton *anBtn;
@property (nonatomic ,weak) UIButton *weiBtn;
/// 围栏类型
@property (nonatomic ,assign) NSInteger railType;
/// 安全区域
@property (nonatomic ,assign) NSInteger property;
@end
@implementation AddRailViewController
@ -45,10 +51,14 @@ @@ -45,10 +51,14 @@
if (self.isRedact == 1)
{
self.railType = 1;
self.property = 1;
self.railModel = [[SafetyRailModel alloc] init];
}
else
{
self.railType = self.railModel.type;
self.property = self.railModel.property;
}
[self zx_setRightBtnWithText:GJText(@"保存") clickedBlock:^(ZXNavItemBtn * _Nonnull btn) {
[self AddRails];
@ -56,7 +66,7 @@ @@ -56,7 +66,7 @@
kWeakSelf(self)
NSArray *arr = @[GJText(@"围栏类型"),GJText(@"地址名称"),GJText(@"地址"),GJText(@"有效时间"),GJText(@"星期")];
NSArray *arr = @[GJText(@"围栏类型"),GJText(@"安全区域"),GJText(@"地址名称"),GJText(@"地址"),GJText(@"有效时间"),GJText(@"星期")];
NSArray *timeArr = @[GJText(@"一"),GJText(@"二"),GJText(@"三"),GJText(@"四"),GJText(@"五"),GJText(@"六"),GJText(@"日")];
UIView *bgView = [UICommon ui_view:CGRectMake(0, iPhoneX_NavHeight, SCREEN_WIDTH, Adapted(55)*arr.count) backgroundColor:KKWhiteColorColor cornerRadius:0 borderWidth:0 borderColor:KKWhiteColorColor];
@ -119,7 +129,39 @@ @@ -119,7 +129,39 @@
}
}
else if (i > 0 &&i < 3)
else if (i == 1)
{
UIButton *weiBtn = [UICommon ui_buttonSimple:CGRectZero font:Font_(14) normalColor:KKTextBlackColor normalText:@" 危险区域" click:^(UIButton *btn) {
self.property = 2;
[self selectbtnImg:btn :self.anBtn];
}];
self.weiBtn = weiBtn;
[bgView addSubview:weiBtn];
[weiBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.equalTo(bgView.mas_right).inset(15);
make.centerY.equalTo(titleLabel);
make.size.mas_equalTo(CGSizeMake(100, 40));
}];
UIButton *anBtn = [UICommon ui_buttonSimple:CGRectZero font:Font_(14) normalColor:KKTextBlackColor normalText:@" 安全区域" click:^(UIButton *btn) {
self.property = 1;
[self selectbtnImg:btn :self.weiBtn];
}];
self.anBtn = anBtn;
[bgView addSubview:anBtn];
[anBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.equalTo(weiBtn.mas_left).inset(15);
make.centerY.equalTo(titleLabel);
make.size.mas_equalTo(CGSizeMake(100, 40));
}];
if (self.property == 1)
[self selectbtnImg:self.anBtn :self.weiBtn];
else
[self selectbtnImg:self.weiBtn :self.anBtn];
}
else if (i > 1 &&i < 4)
{
UIImageView *rightImg = [UICommon ui_imageView:CGRectZero fileName:@"icon_enter_gray"];
[bgView addSubview:rightImg];
@ -129,12 +171,12 @@ @@ -129,12 +171,12 @@
make.size.mas_equalTo(CGSizeMake(Adapted(rightImg.image.size.width), Adapted(rightImg.image.size.height)));
}];
NSString *text;
if (i == 1)
text = self.isRedact == 1 ? GJText(@"请设置地址名称") : self.railModel.name;
if (i == 2)
text = self.isRedact == 1 ? GJText(@"请设置地址名称") : self.railModel.name;
if (i == 3)
text = self.isRedact == 1 ? GJText(@"请设置详细地址") : self.railModel.address;
UIButton *rightBtn = [UICommon ui_buttonSimple:CGRectZero font:FontADA_(13) normalColor:self.isRedact == 1 ? KKGrey121 : KKTextBlackColor normalText:text click:^(UIButton *btn) {
if (btn.tag == 1)
if (btn.tag == 2)
{
RailNameTagViewController *vc = [RailNameTagViewController new];
vc.addressName = weakself.nameBtn.currentTitle;
@ -182,8 +224,8 @@ @@ -182,8 +224,8 @@
}];
rightBtn.tag = i;
rightBtn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentRight;
if (i == 1) self.nameBtn = rightBtn;
if (i == 2) self.addressBtn = rightBtn;
if (i == 2) self.nameBtn = rightBtn;
if (i == 3) self.addressBtn = rightBtn;
[bgView addSubview:rightBtn];
[rightBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.equalTo(rightImg.mas_left).inset(5);
@ -193,7 +235,7 @@ @@ -193,7 +235,7 @@
}];
}
else if (i == 3)
else if (i == 4)
{
UIButton *endTime = [UICommon ui_buttonSimple:CGRectZero font:FontADA_(13) normalColor:KKTextBlackColor normalText:self.isRedact == 2 ? self.railModel.endTime : @"17:00" click:^(id x) {
@ -318,6 +360,7 @@ @@ -318,6 +360,7 @@
[parameters setValue:self.railModel.address forKey:@"address"];
[parameters setValue:self.nameBtn.currentTitle forKey:@"name"];
[parameters setValue:[self.btnArr componentsJoinedByString:@""] forKey:@"week"];
[parameters setValue:@(self.property) forKey:@"property"];
NSString *urlStr;
if (self.railType == 1)
{

3
LekangGuard/Map/Fence(电子围栏)/Model/SafetyRailModel.h

@ -41,6 +41,9 @@ NS_ASSUME_NONNULL_BEGIN @@ -41,6 +41,9 @@ NS_ASSUME_NONNULL_BEGIN
/// string example: 安全区域名字
@property (nonatomic ,copy) NSString *name;
/// string 属性 选项:1-安全区域和 2-危险区域
@property (nonatomic ,assign) NSInteger property;
/// integer($int32) example: 安全区域半径
@property (nonatomic ,assign) NSInteger radius;

38
LekangGuard/Map/Fence(电子围栏)/MoreRailAddressViewController.m

@ -65,6 +65,23 @@ @@ -65,6 +65,23 @@
make.bottom.equalTo(self.bottomView.mas_top);
}];
UIButton *weiBtn = [UICommon ui_buttonSimple:CGRectZero font:Font_(14) normalColor:KKTextBlackColor normalText:@"" click:^(UIButton *btn) {
if(self.mapView.userLocation.updating && self.mapView.userLocation.location)
{
[self.mapView setCenterCoordinate:self.mapView.userLocation.location.coordinate animated:YES];
CLLocation *curLocation = [[CLLocation alloc] initWithLatitude:self.mapView.userLocation.location.coordinate.latitude
longitude:self.mapView.userLocation.location.coordinate.longitude];
[self getAddressWithLocation:curLocation];
}
}];
[weiBtn setImage:ImageName_(@"map_button_gps") forState:0];
[self.view addSubview:weiBtn];
[weiBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.equalTo(self.view.mas_right).inset(20);
make.top.equalTo(self.topView.mas_bottom).offset(15);
make.size.mas_equalTo(CGSizeMake(42, 42));
}];
//初始化 MAUserLocationRepresentation 对象
MAUserLocationRepresentation *r = [[MAUserLocationRepresentation alloc] init];
@ -290,18 +307,23 @@ @@ -290,18 +307,23 @@
CLPlacemark *placemark = [placemarks firstObject];
NSLog(@"详细信息:%@",placemark.addressDictionary);
NSString *name;
if (placemark.addressDictionary)
{
name = placemark.addressDictionary[@"FormattedAddressLines"][0];
}
else if(placemark.subLocality)
// if (placemark.addressDictionary)
// {
// name = placemark.addressDictionary[@"FormattedAddressLines"][0];
// }
// else
// NSLog(@"%@\n%@\n%@\n%@\n%@\n%@\n%@\n%@",placemark.name,placemark.thoroughfare,placemark.subThoroughfare,placemark.locality,placemark.subLocality,placemark.administrativeArea,placemark.subAdministrativeArea,placemark.postalCode);
if(placemark.subLocality)
{
name = [NSString stringWithFormat:@"%@%@",
placemark.subLocality,placemark.name];
name = [NSString stringWithFormat:@"%@%@%@%@%@",
placemark.administrativeArea,placemark.locality,placemark.thoroughfare,placemark.subLocality,placemark.name];
}else{
name = [NSString stringWithFormat:@"%@ %@",
placemark.locality,placemark.name];
}
if([name rangeOfString:@"(null)"].location != NSNotFound)
name = [name stringByReplacingOccurrencesOfString:@"(null)" withString:@""];
weakself.railModel.address = name;
//在导航栏上赋值地址
@ -424,7 +446,7 @@ @@ -424,7 +446,7 @@
return _annotations;
}
/// 保存
- (void)setbao
{
NSMutableArray *arr = [NSMutableArray new];

20
LekangGuard/Map/Fence(电子围栏)/RailAddressViewController.m

@ -209,20 +209,28 @@ @@ -209,20 +209,28 @@
CLPlacemark *placemark = [placemarks firstObject];
NSLog(@"详细信息:%@",placemark.addressDictionary);
NSString *name;
if(placemark.subLocality){
name = [NSString stringWithFormat:@"%@ %@",
placemark.subLocality,placemark.name];
// if(placemark.subLocality){
// name = [NSString stringWithFormat:@"%@ %@",
// placemark.subLocality,placemark.name];
// }else{
// name = [NSString stringWithFormat:@"%@ %@",
// placemark.locality,placemark.name];
// }
if(placemark.subLocality)
{
name = [NSString stringWithFormat:@"%@%@%@%@%@",
placemark.administrativeArea,placemark.locality,placemark.thoroughfare,placemark.subLocality,placemark.name];
}else{
name = [NSString stringWithFormat:@"%@ %@",
placemark.locality,placemark.name];
}
if([name rangeOfString:@"(null)"].location != NSNotFound)
name = [name stringByReplacingOccurrencesOfString:@"(null)" withString:@""];
if (placemark.name)
{
weakself.railModel.address = name;
//在导航栏上赋值地址
weakself.searchBar.text = name;
}
weakself.railModel.lon = F(@"%f", location.coordinate.longitude);
weakself.railModel.lat = F(@"%f", location.coordinate.latitude);
//[weakself.myTableView reloadData];

2
LekangGuard/Map/Fence(电子围栏)/RailNameTagViewController.m

@ -37,7 +37,7 @@ @@ -37,7 +37,7 @@
}];
self.modelListArr = [NSMutableArray arrayWithArray:@[GJText(@"学校"),GJText(@"家"),GJText(@"朋友"),GJText(@"公园"),GJText(@"超市"),GJText(@"广场"),]];
UITextField *nameField = [UICommon ui_textField:CGRectZero textColor:KKTextBlackColor backColor:KKWhiteColorColor font:FontADA_(14) maxTextNum:50 placeholderColor:KKGrey143 placeholder:GJText(@"请输入地址名称") toMaxNum:^(UITextField *textField) {
UITextField *nameField = [UICommon ui_textField:CGRectZero textColor:KKTextBlackColor backColor:KKWhiteColorColor font:FontADA_(14) maxTextNum:18 placeholderColor:KKGrey143 placeholder:GJText(@"请输入地址名称") toMaxNum:^(UITextField *textField) {
} change:^(UITextField *textField) {

7
LekangGuard/Map/Fence(电子围栏)/View/ElectronicFenceTableViewCell.m

@ -47,10 +47,11 @@ @@ -47,10 +47,11 @@
{
_railModel = railModel;
self.tagLabel.text = railModel.name;
NSString *propertyStr = railModel.property == 1 ? @"安全区域" : @"危险区域";
if (self.railModel.type == 1)
self.scopeLabel.attributedText = [UICommon labelFontSize:F(GJText(@"圆形围栏 范围%ld米"), railModel.radius)];
self.scopeLabel.attributedText = [UICommon labelFontSize:F(GJText(@"%@ 圆形 安全范围:%ld米") ,propertyStr, railModel.radius)];
else
self.scopeLabel.attributedText = [UICommon labelFontSize:@"多边形围栏"];
self.scopeLabel.attributedText = [UICommon labelFontSize:F(@"%@ 多边形", propertyStr)];
self.openBtn.selected = railModel.status;
self.addressLabel.text = railModel.address;
NSMutableArray *weekArr = [UICommon getWeekStr:railModel.week];
@ -74,7 +75,7 @@ @@ -74,7 +75,7 @@
}];
/// 范围
UILabel *scopeLabel = [UICommon ui_label:CGRectZero lines:0 align:NSTextAlignmentLeft font:FontADA_(13) textColor:RGB(255, 173, 1) text:@"" Radius:0];
UILabel *scopeLabel = [UICommon ui_label:CGRectZero lines:0 align:NSTextAlignmentLeft font:FontADA_(13) textColor:KKMainColor text:@"" Radius:0];
self.scopeLabel = scopeLabel;
[self.contentView addSubview:scopeLabel];
[scopeLabel mas_makeConstraints:^(MASConstraintMaker *make) {

48
LekangGuard/Protection(守护星)/VC/ProtectionViewController.m

@ -106,32 +106,32 @@ @@ -106,32 +106,32 @@
};
[setView DevicePosition];
// /// 远程关机
// UIButton *shutdownBtn = [UICommon ui_buttonSimple:CGRectMake(10, setView.bottom+Adapted(60), SCREEN_WIDTH-20, Adapted(44)) font:FontADA_(15) normalColor:KKWhiteColorColor normalText:GJText(@"远程关机") click:^(id x) {
//
// EasyAlertView *alertV = [EasyAlertView alertViewWithTitle:GJText(@"远程关机") subtitle:GJText(@"\n设备将会远程关机是否确认") AlertViewType:AlertViewTypeSystemAlert config:nil];
// [alertV addAlertItem:^EasyAlertItem *{
// return [EasyAlertItem itemWithTitle:GJText(@"取消") type:AlertItemTypeSystemCancel callback:nil];
// }];
// [alertV addAlertItem:^EasyAlertItem *{
// return [EasyAlertItem itemWithTitle:GJText(@"确定") type:AlertItemTypeSystemDefault callback:^(EasyAlertView *showview, long index) {
// [self DeviceShutDown];
// }];
// }];
// [alertV showAlertView];
//
// }];
// shutdownBtn.backgroundColor = KKMainColor;
// shutdownBtn.layer.cornerRadius = Adapted(22);
// shutdownBtn.layer.masksToBounds = YES;
// [self.menuScroll addSubview:shutdownBtn];
/// 远程关机
UIButton *shutdownBtn = [UICommon ui_buttonSimple:CGRectMake(10, setView.bottom+Adapted(60), SCREEN_WIDTH-20, Adapted(44)) font:FontADA_(15) normalColor:KKWhiteColorColor normalText:GJText(@"远程关机") click:^(id x) {
EasyAlertView *alertV = [EasyAlertView alertViewWithTitle:GJText(@"远程关机") subtitle:GJText(@"\n远程关机后将无法通话与定位,是否确认关机?") AlertViewType:AlertViewTypeSystemAlert config:nil];
[alertV addAlertItem:^EasyAlertItem *{
return [EasyAlertItem itemWithTitle:GJText(@"取消") type:AlertItemTypeSystemCancel callback:nil];
}];
[alertV addAlertItem:^EasyAlertItem *{
return [EasyAlertItem itemWithTitle:GJText(@"确定") type:AlertItemTypeSystemDefault callback:^(EasyAlertView *showview, long index) {
[self DeviceShutDown];
}];
}];
[alertV showAlertView];
}];
shutdownBtn.backgroundColor = KKMainColor;
shutdownBtn.layer.cornerRadius = Adapted(22);
shutdownBtn.layer.masksToBounds = YES;
[self.menuScroll addSubview:shutdownBtn];
NSString *msg = GJText(@"\n解除绑定后,将无法对设备进行监护,设备将重启,其他绑定该设备的用户,将自动解绑");
if(APIManager.sharedManager.deviceModel.identity == 2)
msg = GJText(@"\n您是设备的管理员,如果您进行解绑,其他绑定该设备的用户,将自动解绑,确认解除绑定吗?");
/// 解除与设备的绑定
UIButton *unbundleBtn = [UICommon ui_buttonSimple:CGRectMake(10, setView.bottom+Adapted(60), SCREEN_WIDTH-20, Adapted(44)) font:FontADA_(15) normalColor:KKMainColor normalText:GJText(@"解除与设备的绑定") click:^(id x) {
UIButton *unbundleBtn = [UICommon ui_buttonSimple:CGRectMake(10, shutdownBtn.bottom+20, SCREEN_WIDTH-20, Adapted(44)) font:FontADA_(15) normalColor:KKMainColor normalText:GJText(@"解除与设备的绑定") click:^(id x) {
EasyAlertView *alertV = [EasyAlertView alertViewWithTitle:GJText(@"设备解绑") subtitle:GJText(msg) AlertViewType:AlertViewTypeSystemAlert config:nil];
[alertV addAlertItem:^EasyAlertItem *{
@ -200,10 +200,10 @@ @@ -200,10 +200,10 @@
// [self.menuImgArr addObject:@"icon_class_disable"];
// }
// if([APIManager sharedManager].deviceModel.chatFun)
// {
// [self.menuArr addObject:GJText(@"微聊")];
// [self.menuImgArr addObject:@"icon_wechat"];
// }
{
[self.menuArr addObject:GJText(@"微聊")];
[self.menuImgArr addObject:@"icon_wechat"];
}
if([APIManager sharedManager].deviceModel.lookupFun)
{
[self.menuArr addObject:GJText(@"查找设备")];

Loading…
Cancel
Save