'添加code验证'
Showing
5 changed files
with
34 additions
and
22 deletions
| ... | @@ -109,7 +109,7 @@ | ... | @@ -109,7 +109,7 @@ |
| 109 | <!--pnt test ak | 109 | <!--pnt test ak |
| 110 | <script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=ykvgUlEv77wstKqmFovr56pl4cKRUUEz"></script>--> | 110 | <script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=ykvgUlEv77wstKqmFovr56pl4cKRUUEz"></script>--> |
| 111 | <!--pnt prod ak--> | 111 | <!--pnt prod ak--> |
| 112 | <script type="text/javascript" src="//api.map.baidu.com/api?v=2.0&ak=QVYxRW2ZxRxLGHycLEcZUTtNfBK8rvwp"></script> | 112 | <script type="text/javascript" src="//api.map.baidu.com/api?v=2.0&ak=xa9jEseYXEP96bR5x76vo8FoGo0hnrfI"></script> |
| 113 | <script type="text/javascript" src="js/layer/layer.js"></script> | 113 | <script type="text/javascript" src="js/layer/layer.js"></script> |
| 114 | <script type="text/javascript" src="js/layer/layerMobile/layer.js"></script> | 114 | <script type="text/javascript" src="js/layer/layerMobile/layer.js"></script> |
| 115 | <script type="text/javascript" src="js/JSBridge.js"></script> | 115 | <script type="text/javascript" src="js/JSBridge.js"></script> | ... | ... |
| ... | @@ -107,7 +107,7 @@ AppClient.prototype.getGPS = function (jsonStr, callback) { | ... | @@ -107,7 +107,7 @@ AppClient.prototype.getGPS = function (jsonStr, callback) { |
| 107 | }) | 107 | }) |
| 108 | callback(30.2741500000, 120.1551500000, function(){}) | 108 | callback(30.2741500000, 120.1551500000, function(){}) |
| 109 | } | 109 | } |
| 110 | }, 3000) | 110 | }, 10000) |
| 111 | }; | 111 | }; |
| 112 | 112 | ||
| 113 | if(isAndroid || isiOS) { | 113 | if(isAndroid || isiOS) { | ... | ... |
| ... | @@ -15,29 +15,30 @@ angular.module('myApp') | ... | @@ -15,29 +15,30 @@ angular.module('myApp') |
| 15 | if(!$scope.userinfo) { | 15 | if(!$scope.userinfo) { |
| 16 | var code = getUrl('code') | 16 | var code = getUrl('code') |
| 17 | if(code){ | 17 | if(code){ |
| 18 | dingdaService.verifyThirdCode(code).success(function (res) { | 18 | dingdaService.loginByCode(code).success(function (res) { |
| 19 | if(res.mate.code == 200) { | 19 | if(res.mate.code == 200) { |
| 20 | dingdaService.verifyPhoneCode(res.data.mobile, res.data.code).success(function (data) { | 20 | if (data.meta.code == 200) { |
| 21 | if (data.meta.code == 200) { | 21 | data.data.userName = $scope.phoneNumberVal; |
| 22 | data.data.userName = $scope.phoneNumberVal; | 22 | globalService.saveData('user',data.data); |
| 23 | globalService.saveData('user',data.data); | 23 | // layer.open({ |
| 24 | // layer.open({ | 24 | // content: '登录成功', |
| 25 | // content: '登录成功', | 25 | // time:1 |
| 26 | // time:1 | 26 | // }); |
| 27 | // }); | 27 | setTimeout(function() { |
| 28 | setTimeout(function() { | 28 | location.reload(); |
| 29 | location.reload(); | 29 | } , 300); |
| 30 | } , 300); | 30 | } else if (data.meta.code == 401) { |
| 31 | } else if (data.meta.code == 401) { | 31 | layer.open({ |
| 32 | layer.open({ | 32 | content: data.meta.message, |
| 33 | content: data.meta.message, | 33 | time:1 |
| 34 | time:1 | 34 | }); |
| 35 | }); | ||
| 36 | // alert(data.meta.message); | 35 | // alert(data.meta.message); |
| 37 | // layer.msg(data.data.error); | 36 | // layer.msg(data.data.error); |
| 38 | return; | 37 | return; |
| 39 | } | 38 | } |
| 40 | }) | 39 | // dingdaService.verifyPhoneCode(res.data.mobile, res.data.code).success(function (data) { |
| 40 | // | ||
| 41 | // }) | ||
| 41 | } | 42 | } |
| 42 | if(res.mate.code == 500){ | 43 | if(res.mate.code == 500){ |
| 43 | $state.go('login', {}, {reload: true}); | 44 | $state.go('login', {}, {reload: true}); | ... | ... |
| ... | @@ -10,6 +10,15 @@ angular.module('myApp.services') | ... | @@ -10,6 +10,15 @@ angular.module('myApp.services') |
| 10 | }); | 10 | }); |
| 11 | return res; | 11 | return res; |
| 12 | }, | 12 | }, |
| 13 | loginByCode:function (code) { | ||
| 14 | var url = globalService.getParam('dingaCodeAPI') + '/open-api/user/get/bycode/' + code; | ||
| 15 | var res = $http.post(url, {}).success(function(data, status) { | ||
| 16 | |||
| 17 | }).error(function(data, status) { | ||
| 18 | alert(data.meta.message) | ||
| 19 | }); | ||
| 20 | return res; | ||
| 21 | }, | ||
| 13 | verifyPhoneCode : function(phone , code){ | 22 | verifyPhoneCode : function(phone , code){ |
| 14 | var url = globalService.getParam('dingdaLoginAPI') + '/login/sms?mobile=' + phone + '&code=' + code; | 23 | var url = globalService.getParam('dingdaLoginAPI') + '/login/sms?mobile=' + phone + '&code=' + code; |
| 15 | var res = $http.post(url, {}).success(function(data, status) { | 24 | var res = $http.post(url, {}).success(function(data, status) { | ... | ... |
| ... | @@ -44,6 +44,8 @@ angular.module('myApp.services') | ... | @@ -44,6 +44,8 @@ angular.module('myApp.services') |
| 44 | // 测试环境 | 44 | // 测试环境 |
| 45 | // var dingdaLoginAPI = "https://auth.api.dingdachuxing.com"; | 45 | // var dingdaLoginAPI = "https://auth.api.dingdachuxing.com"; |
| 46 | globalConfig.setParam("dingdaLoginAPI", dingdaLoginAPI); | 46 | globalConfig.setParam("dingdaLoginAPI", dingdaLoginAPI); |
| 47 | var dingaCodeAPI = "http://112.13.95.178:7080" | ||
| 48 | globalConfig.setParam("dingaCodeAPI", dingaCodeAPI); | ||
| 47 | 49 | ||
| 48 | $rootScope.$watch("data.user",function(newVal, oldVal){ | 50 | $rootScope.$watch("data.user",function(newVal, oldVal){ |
| 49 | if(!newVal){ | 51 | if(!newVal){ | ... | ... |
-
Please register or sign in to post a comment