Commit a5d543c6 authored by Sandy's avatar Sandy

修改侧边栏顺序

parent 042af6bd
{
"images" : [
{
"idiom" : "universal",
"filename" : "left_scan.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "left_scan@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "left_scan@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
This diff is collapsed.
...@@ -61,14 +61,14 @@ ...@@ -61,14 +61,14 @@
}else if (indexPath.row == 2) {//核销卡券 }else if (indexPath.row == 2) {//核销卡券
[self scanCard]; [self scanCard];
}else if (indexPath.row == 3) {//修改密码 }else if (indexPath.row == 3){
[self scanWatchCode];
}else if (indexPath.row == 4) {//修改密码
ModifyPswTableViewController *modifyVC = [ModifyPswTableViewController viewControllerWithStoryBoardType:STORYBOARD_TYPE_MAIN]; ModifyPswTableViewController *modifyVC = [ModifyPswTableViewController viewControllerWithStoryBoardType:STORYBOARD_TYPE_MAIN];
[kGlobal.mainNaVC pushViewController:modifyVC animated:YES]; [kGlobal.mainNaVC pushViewController:modifyVC animated:YES];
}else if (indexPath.row == 4) {//退出登录 }else if (indexPath.row == 5) {//退出登录
[kGlobal.sideSlipVC dismissViewControllerAnimated:YES completion:nil]; [kGlobal.sideSlipVC dismissViewControllerAnimated:YES completion:nil];
}else if (indexPath.row == 5){
[self scanWatchCode];
} }
} }
......
...@@ -11,19 +11,21 @@ ...@@ -11,19 +11,21 @@
#import "WatchLoginViewController.h" #import "WatchLoginViewController.h"
@interface ScanViewController () @interface ScanViewController ()
@property (strong, nonatomic) UIButton *btnGoInput; @property (strong, nonatomic) UIButton *btnGoInput;
@property (strong, nonatomic) UILabel *labelInfo;
@end @end
@implementation ScanViewController @implementation ScanViewController
- (void)viewDidLoad { - (void)viewDidLoad {
[super viewDidLoad]; [super viewDidLoad];
self.title = @"条形码"; self.title = @"码";
// Do any additional setup after loading the view. // Do any additional setup after loading the view.
} }
- (void)viewDidAppear:(BOOL)animated { - (void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated]; [super viewDidAppear:animated];
[self labelInfo];
switch (self.type) { switch (self.type) {
case scanTypeCard: case scanTypeCard:
...@@ -42,6 +44,21 @@ ...@@ -42,6 +44,21 @@
} }
} }
- (UILabel *)labelInfo {
CGFloat y = kHeight/2 - 44 - (kWidth - 120)/2 - 60;
if (!_labelInfo) {
_labelInfo = [[UILabel alloc] initWithFrame:CGRectMake(0, y, kWidth, 30)];
_labelInfo.text = @"将二维码放入框中,即可自动扫描";
_labelInfo.font = [UIFont systemFontOfSize:13];
_labelInfo.textAlignment = NSTextAlignmentCenter;
_labelInfo.textColor = [UIColor whiteColor];
// _labelInfo.backgroundColor = [UIColor redColor];
[self.view addSubview:_labelInfo];
}
return _labelInfo;
}
- (UIButton *)btnGoInput { - (UIButton *)btnGoInput {
if (!_btnGoInput) { if (!_btnGoInput) {
_btnGoInput = [UIButton buttonWithType:UIButtonTypeCustom]; _btnGoInput = [UIButton buttonWithType:UIButtonTypeCustom];
...@@ -76,8 +93,18 @@ ...@@ -76,8 +93,18 @@
} }
- (void)goWatchLoginWithUrl:(NSString *)url { - (void)goWatchLoginWithUrl:(NSString *)url {
NSString *device = [self getStringAfter:@"deviceId=" string:url];
NSString *token = [self getStringAfter:@"token=" string:url];
WS(weakSelf);
if (device == nil || token == nil) {
[MBProgressHUD j_error:@"设备信息异常!" complete:^{
[weakSelf reStartDevice];
}];
return;
}
WatchLoginViewController *loginVC = [WatchLoginViewController viewControllerWithStoryBoardType:STORYBOARD_TYPE_MAIN]; WatchLoginViewController *loginVC = [WatchLoginViewController viewControllerWithStoryBoardType:STORYBOARD_TYPE_MAIN];
loginVC.LoginUrl = url; loginVC.device = device;
loginVC.token = token;
[kGlobal.mainNaVC pushViewController:loginVC animated:YES]; [kGlobal.mainNaVC pushViewController:loginVC animated:YES];
} }
#pragma mark -实现类继承该方法,作出对应处理 #pragma mark -实现类继承该方法,作出对应处理
...@@ -115,12 +142,36 @@ ...@@ -115,12 +142,36 @@
if (self.type == scanTypeCard) { if (self.type == scanTypeCard) {
[self goCardVCWithNumber:strResult]; [self goCardVCWithNumber:strResult];
}else if (self.type == scanTypeLogin){ }else if (self.type == scanTypeLogin){
[self goWatchLoginWithUrl:strResult]; [self goWatchLoginWithUrl:strResult];
} }
} }
/**
从prefix后开始截取连续字符串(字符串中可包涵数字字母)
@param prefix 从哪里开始截取
@param string 需要截取的字符串
@return 截取后的字符串
*/
- (NSString *)getStringAfter:(NSString *)prefix string:(NSString *)string {
NSString *grex = [NSString stringWithFormat:@"%@[a-z0-9A-Z]*",prefix];
NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:grex options:NSRegularExpressionCaseInsensitive error:nil];
NSArray * matches = [regex matchesInString:string options:0 range:NSMakeRange(0, [string length])];
if (matches.count == 1) {
NSTextCheckingResult *result = matches[0];
NSString *tempString = [string substringWithRange:result.range];
NSString *matchedString = [tempString componentsSeparatedByString:@"="][1];
return matchedString;
}
CLog(@"无法匹配到prefix:%@ \n string = %@",prefix, string);
return nil;
}
//- (void)goWatchLoginViewWith //- (void)goWatchLoginViewWith
- (void)didReceiveMemoryWarning { - (void)didReceiveMemoryWarning {
......
...@@ -9,5 +9,6 @@ ...@@ -9,5 +9,6 @@
#import "BaseViewController.h" #import "BaseViewController.h"
@interface WatchLoginViewController : BaseViewController @interface WatchLoginViewController : BaseViewController
@property (strong, nonatomic) NSString *LoginUrl; @property (strong, nonatomic) NSString *device;
@property (strong, nonatomic) NSString *token;
@end @end
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
- (void)viewDidLoad { - (void)viewDidLoad {
[super viewDidLoad]; [super viewDidLoad];
self.title = @"授权登录";
// Do any additional setup after loading the view. // Do any additional setup after loading the view.
} }
- (IBAction)actionLogin:(id)sender { - (IBAction)actionLogin:(id)sender {
...@@ -23,17 +24,10 @@ ...@@ -23,17 +24,10 @@
} }
- (void)httpAllowLogin { - (void)httpAllowLogin {
NSString *device = [self getStringAfter:@"deviceId=" string:self.LoginUrl];
NSString *token = [self getStringAfter:@"token=" string:self.LoginUrl]; NSDictionary *param = @{@"deviceId":self.device,
@"token":self.token};
WS(weakSelf); WS(weakSelf);
if (device == nil || token == nil) {
[MBProgressHUD j_error:@"设备信息异常!" complete:^{
[weakSelf.navigationController popViewControllerAnimated:YES];
}];
}
NSDictionary *param = @{@"deviceId":device,
@"token":token};
[kHttp GET:kWatchLogin parameters:param complete:^(id _Nullable response, NSError * _Nullable error) { [kHttp GET:kWatchLogin parameters:param complete:^(id _Nullable response, NSError * _Nullable error) {
if (kRsSuccess(response)) { if (kRsSuccess(response)) {
[MBProgressHUD j_success:@"登录成功!" complete:^{ [MBProgressHUD j_success:@"登录成功!" complete:^{
...@@ -53,29 +47,11 @@ ...@@ -53,29 +47,11 @@
}]; }];
} }
- (IBAction)actionCancel:(id)sender {
[self.navigationController popViewControllerAnimated:YES];
}
/**
从prefix后开始截取连续字符串(字符串中可包涵数字字母)
@param prefix 从哪里开始截取
@param string 需要截取的字符串
@return 截取后的字符串
*/
- (NSString *)getStringAfter:(NSString *)prefix string:(NSString *)string {
NSString *grex = [NSString stringWithFormat:@"%@[a-z0-9A-Z]*",prefix];
NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:grex options:NSRegularExpressionCaseInsensitive error:nil];
NSArray * matches = [regex matchesInString:string options:0 range:NSMakeRange(0, [string length])];
if (matches.count == 1) {
NSTextCheckingResult *result = matches[0];
NSString *tempString = [string substringWithRange:result.range];
NSString *matchedString = [tempString componentsSeparatedByString:@"="][1];
return matchedString;
}
CLog(@"无法匹配到prefix:%@ \n string = %@",prefix, string);
return nil;
}
- (void)didReceiveMemoryWarning { - (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning]; [super didReceiveMemoryWarning];
......
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