|
|
@@ -25,6 +25,7 @@
|
|
|
@interface mineViewController ()
|
|
|
@property(nonatomic,strong)UIButton *netButton;
|
|
|
@property(nonatomic,strong)UILabel *snLabel;
|
|
|
+@property(nonatomic,strong)UIButton *snCopyButton;
|
|
|
@property(nonatomic,strong)MineCommonUsedView *MineCommonUsedV;
|
|
|
@end
|
|
|
|
|
|
@@ -97,12 +98,27 @@
|
|
|
make.height.mas_equalTo(20);
|
|
|
}];
|
|
|
|
|
|
+// UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(copySnFun)];
|
|
|
+// [_snLabel addGestureRecognizer:tap];
|
|
|
+
|
|
|
+ _snCopyButton = [[UIButton alloc] init];
|
|
|
+ _snCopyButton.tag = 1;
|
|
|
+ [_snCopyButton addTarget:self action:@selector(didClickButtonFun:) forControlEvents:UIControlEventTouchUpInside];
|
|
|
+ [self.view addSubview:_snCopyButton];
|
|
|
+ //_snCopyButton.backgroundColor = [UIColor redColor];
|
|
|
+
|
|
|
+ [_snCopyButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.left.mas_equalTo(_snLabel.mas_left);
|
|
|
+ make.top.equalTo(_snLabel.mas_top).offset(-5);
|
|
|
+ make.right.mas_equalTo(_snLabel.mas_right);
|
|
|
+ make.bottom.equalTo(_snLabel.mas_bottom).offset(2);
|
|
|
+ }];
|
|
|
+
|
|
|
|
|
|
_netButton = [[UIButton alloc] init];
|
|
|
[_netButton setImage:[UIImage imageNamed:@"mine_net_icon"] forState:UIControlStateNormal];
|
|
|
[_netButton setTitleColor:[UIColor hwColor:@"#058DFB"] forState:UIControlStateNormal];
|
|
|
_netButton.titleLabel.font = [UIFont systemFontOfSize:12.0];
|
|
|
- //_netButton.tag = 1;
|
|
|
//[_netButton addTarget:self action:@selector(didClickButtonFun:) forControlEvents:UIControlEventTouchUpInside];
|
|
|
_netButton.userInteractionEnabled = NO;
|
|
|
[self.view addSubview:_netButton];
|
|
|
@@ -473,8 +489,23 @@
|
|
|
#pragma mark 数据设置
|
|
|
- (void)setDataFun
|
|
|
{
|
|
|
- NSString *fullSNStr = [[NSString alloc] initWithFormat:@"SN:%@",ksharedAppDelegate.DeviceThirdIdMod.data.changeSn];
|
|
|
- _snLabel.text = fullSNStr;
|
|
|
+ NSString *SNLeftStr = [[NSString alloc] initWithFormat:@"SN:%@",ksharedAppDelegate.DeviceThirdIdMod.data.changeSn];
|
|
|
+ NSString *SNMidStr = @" | ";
|
|
|
+ NSString *SNRightStr = NSLocalizedString(@"common_copy",nil);
|
|
|
+
|
|
|
+ NSString *fullTitle = [[NSString alloc] initWithFormat:@"%@%@%@",SNLeftStr,SNMidStr,SNRightStr];
|
|
|
+ NSMutableAttributedString *attrStr = [[NSMutableAttributedString alloc] initWithString:fullTitle];
|
|
|
+
|
|
|
+ NSRange midRange = NSMakeRange([fullTitle rangeOfString:SNMidStr].location, [fullTitle rangeOfString:SNMidStr].length);
|
|
|
+ UIColor *midColor =[UIColor hwColor:@"#828D9A" alpha:1.0];
|
|
|
+ [attrStr addAttribute:NSForegroundColorAttributeName value:midColor range:midRange];
|
|
|
+
|
|
|
+ NSRange rightRange = NSMakeRange([fullTitle rangeOfString:SNRightStr].location, [fullTitle rangeOfString:SNRightStr].length);
|
|
|
+ UIColor *rightColor =[UIColor hwColor:@"#058DFB" alpha:1.0];
|
|
|
+ [attrStr addAttribute:NSForegroundColorAttributeName value:rightColor range:rightRange];
|
|
|
+
|
|
|
+ _snLabel.attributedText = attrStr;
|
|
|
+
|
|
|
|
|
|
NSString *NetButText = NSLocalizedString(@"mine_net_LAN",nil);
|
|
|
if(![pingManager shareManager].isPingOk){
|
|
|
@@ -570,8 +601,6 @@
|
|
|
#pragma mark 点击PC 扫码登录
|
|
|
- (void)didClickButtonFun:(UIButton*)but
|
|
|
{
|
|
|
-// [self getPCloginFun];
|
|
|
-// return;
|
|
|
|
|
|
NSInteger tag = but.tag;
|
|
|
|
|
|
@@ -579,6 +608,20 @@
|
|
|
scanToPCLoginViewController *nextVC = [scanToPCLoginViewController new];
|
|
|
[self.navigationController pushViewController:nextVC animated:YES];
|
|
|
}
|
|
|
+ else if(tag == 1){
|
|
|
+ [self copySnFun];
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+#pragma mark 复制SN
|
|
|
+- (void)copySnFun
|
|
|
+{
|
|
|
+ NSString *snStr = ksharedAppDelegate.DeviceThirdIdMod.data.changeSn;
|
|
|
+ UIPasteboard * Pasteboard = [UIPasteboard generalPasteboard];
|
|
|
+ Pasteboard.string = snStr;
|
|
|
+
|
|
|
+ NSString *tipStr = NSLocalizedString(@"sn_copy_suc",nil);
|
|
|
+ [[iToast makeText:tipStr] show];
|
|
|
}
|
|
|
|
|
|
#pragma mark PC 获取码登录
|