5c959d43 by unknown

'添加code验证'

1 parent f27bb7db
......@@ -109,7 +109,7 @@
<!--pnt test ak
<script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=ykvgUlEv77wstKqmFovr56pl4cKRUUEz"></script>-->
<!--pnt prod ak-->
<script type="text/javascript" src="//api.map.baidu.com/api?v=2.0&ak=QVYxRW2ZxRxLGHycLEcZUTtNfBK8rvwp"></script>
<script type="text/javascript" src="//api.map.baidu.com/api?v=2.0&ak=xa9jEseYXEP96bR5x76vo8FoGo0hnrfI"></script>
<script type="text/javascript" src="js/layer/layer.js"></script>
<script type="text/javascript" src="js/layer/layerMobile/layer.js"></script>
<script type="text/javascript" src="js/JSBridge.js"></script>
......
......@@ -107,7 +107,7 @@ AppClient.prototype.getGPS = function (jsonStr, callback) {
})
callback(30.2741500000, 120.1551500000, function(){})
}
}, 3000)
}, 10000)
};
if(isAndroid || isiOS) {
......
......@@ -15,29 +15,30 @@ angular.module('myApp')
if(!$scope.userinfo) {
var code = getUrl('code')
if(code){
dingdaService.verifyThirdCode(code).success(function (res) {
dingdaService.loginByCode(code).success(function (res) {
if(res.mate.code == 200) {
dingdaService.verifyPhoneCode(res.data.mobile, res.data.code).success(function (data) {
if (data.meta.code == 200) {
data.data.userName = $scope.phoneNumberVal;
globalService.saveData('user',data.data);
// layer.open({
// content: '登录成功',
// time:1
// });
setTimeout(function() {
location.reload();
} , 300);
} else if (data.meta.code == 401) {
layer.open({
content: data.meta.message,
time:1
});
if (data.meta.code == 200) {
data.data.userName = $scope.phoneNumberVal;
globalService.saveData('user',data.data);
// layer.open({
// content: '登录成功',
// time:1
// });
setTimeout(function() {
location.reload();
} , 300);
} else if (data.meta.code == 401) {
layer.open({
content: data.meta.message,
time:1
});
// alert(data.meta.message);
// layer.msg(data.data.error);
return;
}
})
return;
}
// dingdaService.verifyPhoneCode(res.data.mobile, res.data.code).success(function (data) {
//
// })
}
if(res.mate.code == 500){
$state.go('login', {}, {reload: true});
......
......@@ -10,6 +10,15 @@ angular.module('myApp.services')
});
return res;
},
loginByCode:function (code) {
var url = globalService.getParam('dingaCodeAPI') + '/open-api/user/get/bycode/' + code;
var res = $http.post(url, {}).success(function(data, status) {
}).error(function(data, status) {
alert(data.meta.message)
});
return res;
},
verifyPhoneCode : function(phone , code){
var url = globalService.getParam('dingdaLoginAPI') + '/login/sms?mobile=' + phone + '&code=' + code;
var res = $http.post(url, {}).success(function(data, status) {
......
......@@ -44,6 +44,8 @@ angular.module('myApp.services')
// 测试环境
// var dingdaLoginAPI = "https://auth.api.dingdachuxing.com";
globalConfig.setParam("dingdaLoginAPI", dingdaLoginAPI);
var dingaCodeAPI = "http://112.13.95.178:7080"
globalConfig.setParam("dingaCodeAPI", dingaCodeAPI);
$rootScope.$watch("data.user",function(newVal, oldVal){
if(!newVal){
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!