File tree Expand file tree Collapse file tree 3 files changed +29
-7
lines changed
Expand file tree Collapse file tree 3 files changed +29
-7
lines changed Original file line number Diff line number Diff line change 1616 " com.ionic.keyboard" ,
1717 " org.apache.cordova.device" ,
1818 " org.apache.cordova.console" ,
19- " org.apache.cordova.inappbrowser"
19+ " org.apache.cordova.inappbrowser" ,
20+ " com.phonegap.plugins.barcodescanner" ,
21+ " com.verso.cordova.clipboard"
2022 ],
2123 "cordovaPlatforms" : [
2224 {
3032 "locator" : " ios"
3133 }
3234 ]
33- }
35+ }
Original file line number Diff line number Diff line change @@ -8,6 +8,14 @@ <h1 class="title">登录</h1>
88 </ ion-header-bar >
99 < ion-content >
1010 < form ng-submit ="doLogin(accessToken) ">
11+ < div class ="item item-text-wrap text-note ">
12+ 请登录网页版
13+ < a class ="button-link positive "
14+ external-link ="{{API.server}} ">
15+ {{API.server}}
16+ </ a >
17+ 并拷贝设置页中的'Access Token'字符串< span ng-if ="canScan "> 或者扫描其二维码</ span > 完成登录
18+ </ div >
1119 < div class ="list ">
1220 < label class ="item item-input ">
1321 < span class ="input-label "> Access Token</ span >
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ angular.module('ionic-nodeclub')
22
33.factory ' authService' , (
44 $q
5+ API
56 toast
67 storage
78 $window
@@ -10,6 +11,8 @@ angular.module('ionic-nodeclub')
1011 Restangular
1112 $ionicModal
1213 $ionicLoading
14+ $ionicPlatform
15+ IONIC_BACK_PRIORITY
1316 $cordovaBarcodeScanner
1417) ->
1518
@@ -33,6 +36,7 @@ angular.module('ionic-nodeclub')
3336 # 我创建一个scope以便之后让login-modal调用
3437 mkLoginModalScope = ->
3538 angular .extend $rootScope .$new (),
39+ API : API
3640 loginModal : null
3741 canScan : $window .cordova ?
3842
@@ -45,15 +49,23 @@ angular.module('ionic-nodeclub')
4549 toast ' 登录失败: ' + error ? .data ? .error_msg
4650
4751 doScan : ->
48- # FIXME 屏幕旋转,login-modal 界面显示有点乱
52+
53+ # 我在这里覆盖'点返回按钮关闭modal'的逻辑
54+ # 为了修复扫码的时候按了返回按钮把loginModal关掉的BUG
55+ deregisterBackButton = $ionicPlatform
56+ .registerBackButtonAction angular .noop , IONIC_BACK_PRIORITY .modal + 1
57+
58+ # 开始扫码
4959 $cordovaBarcodeScanner
5060 .scan ()
51- .then (imageData) =>
52- @loginModal ? .hide ()
53- toast ' 扫码成功,正在登录...'
54- @ doLogin (imageData .text )
61+ .then (result) =>
62+ if ! result .cancelled
63+ @ doLogin (result .text )
5564 , (error ) ->
5665 toast ' 扫码错误 ' + error
66+ .finally ->
67+ # 我在去掉上面的‘点返回按钮关闭modal’的覆盖
68+ $timeout deregisterBackButton, 500
5769
5870 # 创建一个新的scope
5971 scope = mkLoginModalScope ()
You can’t perform that action at this time.
0 commit comments