83954b2c by fuenxin

gst

1 parent befb6c8e
...@@ -4,17 +4,8 @@ angular.module('myApp') ...@@ -4,17 +4,8 @@ angular.module('myApp')
4 $rootScope.isRendBike = false; 4 $rootScope.isRendBike = false;
5 $rootScope.isLoadFinish = false; 5 $rootScope.isLoadFinish = false;
6 $scope.unfinishOrder = {}; 6 $scope.unfinishOrder = {};
7 var init = function() {
8 // globalService.init();
9 function getUrl(name){
10 var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
11 var r = window.location.search.substr(1).match(reg);
12 if(r!=null)return unescape(r[2]); return null;
13 }
14 $scope.userinfo = globalService.getData("user");
15 var loginCode = globalService.getData("loginCode");
16 var code = getUrl('code') 7 var code = getUrl('code')
17 if(!$scope.userinfo || (code && (loginCode !== code))) { 8 var loginCode = function (code) {
18 if(code){ 9 if(code){
19 dingdaService.verifyThirdCode(code).success(function (res) { 10 dingdaService.verifyThirdCode(code).success(function (res) {
20 globalService.saveData('loginCode', code) 11 globalService.saveData('loginCode', code)
...@@ -45,15 +36,27 @@ angular.module('myApp') ...@@ -45,15 +36,27 @@ angular.module('myApp')
45 if(res.meta.code == 500){ 36 if(res.meta.code == 500){
46 $state.go('login', {}, {reload: true}); 37 $state.go('login', {}, {reload: true});
47 } 38 }
48 }) 39 })} else {
49 } else {
50 $scope.userinfo = {}; 40 $scope.userinfo = {};
51 $scope.userinfo.userName = "未登录"; 41 $scope.userinfo.userName = "未登录";
52 $scope.userinfo.loginState = false; 42 $scope.userinfo.loginState = false;
53 } 43 }
54 44 }
45 var init = function() {
46 // globalService.init();
47 function getUrl(name){
48 var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
49 var r = window.location.search.substr(1).match(reg);
50 if(r!=null)return unescape(r[2]); return null;
51 }
52 $scope.userinfo = globalService.getData("user");
53 if(!$scope.userinfo ) {
54 loginCode()
55 } else { 55 } else {
56 $scope.userinfo.loginState = true; 56 var loginCode = globalService.getData("loginCode");
57 if(code && (loginCode !== code)){
58 loginCode()
59 }
57 // alert("getUnfinishedOrder") 60 // alert("getUnfinishedOrder")
58 dingdaService.getUnfinishedOrder().success(function(data , status){ 61 dingdaService.getUnfinishedOrder().success(function(data , status){
59 // alert(JSON.stringify(data)) 62 // alert(JSON.stringify(data))
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!