Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
C
Car-iOS-Merchant
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张杰
Car-iOS-Merchant
Commits
a5d543c6
Commit
a5d543c6
authored
Jan 11, 2017
by
Sandy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改侧边栏顺序
parent
042af6bd
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
162 additions
and
79 deletions
+162
-79
Contents.json
...Assets.xcassets/LeftView/left_scan.imageset/Contents.json
+23
-0
left_scan.png
...Assets.xcassets/LeftView/left_scan.imageset/left_scan.png
+0
-0
left_scan@2x.png
...ets.xcassets/LeftView/left_scan.imageset/left_scan@2x.png
+0
-0
left_scan@3x.png
...ets.xcassets/LeftView/left_scan.imageset/left_scan@3x.png
+0
-0
Main.storyboard
Car/Base.lproj/Main.storyboard
+73
-41
LeftTableViewController.m
...eClass/LeftView/ViewControllers/LeftTableViewController.m
+4
-4
ScanViewController.m
Car/CodeClass/LeftView/ViewControllers/ScanViewController.m
+53
-2
WatchLoginViewController.h
...Class/LeftView/ViewControllers/WatchLoginViewController.h
+2
-1
WatchLoginViewController.m
...Class/LeftView/ViewControllers/WatchLoginViewController.m
+7
-31
No files found.
Car/Assets.xcassets/LeftView/left_scan.imageset/Contents.json
0 → 100644
View file @
a5d543c6
{
"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
Car/Assets.xcassets/LeftView/left_scan.imageset/left_scan.png
0 → 100644
View file @
a5d543c6
1.19 KB
Car/Assets.xcassets/LeftView/left_scan.imageset/left_scan@2x.png
0 → 100644
View file @
a5d543c6
1.47 KB
Car/Assets.xcassets/LeftView/left_scan.imageset/left_scan@3x.png
0 → 100644
View file @
a5d543c6
1.83 KB
Car/Base.lproj/Main.storyboard
View file @
a5d543c6
This diff is collapsed.
Click to expand it.
Car/CodeClass/LeftView/ViewControllers/LeftTableViewController.m
View file @
a5d543c6
...
@@ -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
];
}
}
}
}
...
...
Car/CodeClass/LeftView/ViewControllers/ScanViewController.m
View file @
a5d543c6
...
@@ -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
{
...
...
Car/CodeClass/LeftView/ViewControllers/WatchLoginViewController.h
View file @
a5d543c6
...
@@ -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
Car/CodeClass/LeftView/ViewControllers/WatchLoginViewController.m
View file @
a5d543c6
...
@@ -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
];
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment