|
@@ -1,7 +1,9 @@
|
1
|
|
-app.controller('LoginCtrl', ['$rootScope', '$scope', '$state', '$translate', '$localStorage', '$cookieStore', '$auth', '$window', '$document', '$timeout', '$filter', '$http', 'cfpLoadingBar', 'Restangular', 'api_login', 'api_is_category', 'SweetAlert','api_msg',
|
2
|
|
- function ($rootScope, $scope, $state, $translate, $localStorage, $cookieStore, $auth, $window, $document, $timeout, $filter, $http, cfpLoadingBar, Restangular, api_login, api_is_category, SweetAlert,api_msg) {
|
|
1
|
+app.controller('LoginCtrl', ['$rootScope', '$scope', '$state', '$translate', '$localStorage', '$cookieStore', '$auth', '$window', '$document', '$timeout', '$filter', '$http', 'cfpLoadingBar', 'Restangular', 'api_login', 'api_is_category', 'SweetAlert', 'api_msg',
|
|
2
|
+ function ($rootScope, $scope, $state, $translate, $localStorage, $cookieStore, $auth, $window, $document, $timeout, $filter, $http, cfpLoadingBar, Restangular, api_login, api_is_category, SweetAlert, api_msg) {
|
3
|
3
|
$rootScope.app.layout.isNavbarFixed = false;
|
4
|
4
|
$rootScope.app.layout.isSidebarFixed = false;
|
|
5
|
+ // 是否单点登录
|
|
6
|
+ $scope.isSSo = location.search.length > 0;
|
5
|
7
|
//初始化,获取版本类别,处理人/处理科室-seimin
|
6
|
8
|
$scope.isCategoryHandle = function () {
|
7
|
9
|
api_is_category.isCategory({ "idx": 0, "sum": 1000, "systemConfiguration": { "keyconfig": "repairMain" } })
|
|
@@ -66,7 +68,11 @@ app.controller('LoginCtrl', ['$rootScope', '$scope', '$state', '$translate', '$l
|
66
|
68
|
$scope.licensePassSub = function () {
|
67
|
69
|
if ($scope.licenseIsAdmin) {
|
68
|
70
|
$scope.licensePassShow = false;
|
69
|
|
- $state.go('login.license');
|
|
71
|
+ if ($scope.isSSo) {
|
|
72
|
+ location.href = 'http://' + document.domain + '/#/login/license';
|
|
73
|
+ } else {
|
|
74
|
+ $state.go('login.license');
|
|
75
|
+ }
|
70
|
76
|
} else {
|
71
|
77
|
$scope.licensePassShow = false;
|
72
|
78
|
}
|
|
@@ -74,19 +80,31 @@ app.controller('LoginCtrl', ['$rootScope', '$scope', '$state', '$translate', '$l
|
74
|
80
|
$scope.licenseSoonShowSub = function () {
|
75
|
81
|
$scope.licenseSoonShow = false;
|
76
|
82
|
$rootScope.getpending();
|
77
|
|
- $state.go('app.dashboard');
|
|
83
|
+ if ($scope.isSSo) {
|
|
84
|
+ location.href = 'http://' + document.domain + '/#/app/dashboard';
|
|
85
|
+ } else {
|
|
86
|
+ $state.go('app.dashboard');
|
|
87
|
+ }
|
78
|
88
|
}
|
79
|
89
|
$scope.licenseTrialSub = function () {
|
80
|
90
|
$scope.licenseTrialShow = false;
|
81
|
91
|
$rootScope.getpending();
|
82
|
|
- $state.go('app.dashboard');
|
|
92
|
+ if ($scope.isSSo) {
|
|
93
|
+ location.href = 'http://' + document.domain + '/#/app/dashboard';
|
|
94
|
+ } else {
|
|
95
|
+ $state.go('app.dashboard');
|
|
96
|
+ }
|
83
|
97
|
}
|
84
|
98
|
$scope.licenseTrialActivation = function () {
|
85
|
|
- $state.go('login.license');
|
|
99
|
+ if ($scope.isSSo) {
|
|
100
|
+ location.href = 'http://' + document.domain + '/#/login/license';
|
|
101
|
+ } else {
|
|
102
|
+ $state.go('login.license');
|
|
103
|
+ }
|
86
|
104
|
}
|
87
|
105
|
$scope.licenseIsAdmin = "";
|
88
|
106
|
|
89
|
|
- // 未读消息数量
|
|
107
|
+ // 未读消息数量
|
90
|
108
|
// $scope.noReadData=0
|
91
|
109
|
// $rootScope.getMsgNum=function(id){
|
92
|
110
|
// api_msg.msgDataList({idx: 0, sum: 1, messageStation: {readStatus: 0, userId: id}}).then(function(data) {
|
|
@@ -98,12 +116,20 @@ app.controller('LoginCtrl', ['$rootScope', '$scope', '$state', '$translate', '$l
|
98
|
116
|
// return $rootScope.noReadData
|
99
|
117
|
// })
|
100
|
118
|
// }
|
101
|
|
-
|
102
|
119
|
//登录
|
103
|
120
|
$scope.handleLoginClick = function (e) {
|
104
|
121
|
// api_login.getLicense({}).then(function(res){
|
105
|
122
|
// $auth.submitLogin($scope.loginForm)
|
106
|
|
- api_login.login($scope.loginForm)
|
|
123
|
+ // var ssoStr = location.search.replace('?', '').split('&')[0].split('=')[1];
|
|
124
|
+ var ssoStr = '';
|
|
125
|
+ var ssoJson;
|
|
126
|
+ if ($scope.isSSo) {
|
|
127
|
+ ssoStr = location.search.replace('?', '').split('&')[0].split('=')[1];
|
|
128
|
+ ssoStr = Base64.decode(decodeURIComponent(ssoStr));
|
|
129
|
+ ssoJson = JSON.parse(ssoStr);
|
|
130
|
+ }
|
|
131
|
+ var postData = $scope.isSSo ? { username: ssoJson.a, password: ssoJson.u, t: false } : $scope.loginForm;
|
|
132
|
+ api_login.login(postData)
|
107
|
133
|
.then(function (resp) {
|
108
|
134
|
console.log(resp);
|
109
|
135
|
if (resp.state == "10000") {//license失效
|
|
@@ -456,7 +482,11 @@ app.controller('LoginCtrl', ['$rootScope', '$scope', '$state', '$translate', '$l
|
456
|
482
|
if (resp.data && resp.data.user && resp.data.user.id) {
|
457
|
483
|
// console.log(resp.error);
|
458
|
484
|
$rootScope.getpending();
|
459
|
|
- $state.go('app.dashboard');
|
|
485
|
+ if ($scope.isSSo) {
|
|
486
|
+ location.href = 'http://' + document.domain + '/#/app/dashboard';
|
|
487
|
+ } else {
|
|
488
|
+ $state.go('app.dashboard');
|
|
489
|
+ }
|
460
|
490
|
$rootScope.app.isLoginFixed = false;
|
461
|
491
|
// console.log(resp);
|
462
|
492
|
// api_wechatfile.getDictionary({ "type": "list", "key": "hjzx_cornet" }).then(function(data) {
|
|
@@ -487,6 +517,9 @@ app.controller('LoginCtrl', ['$rootScope', '$scope', '$state', '$translate', '$l
|
487
|
517
|
});
|
488
|
518
|
// })
|
489
|
519
|
};
|
|
520
|
+ if ($scope.isSSo) {
|
|
521
|
+ $scope.handleLoginClick();
|
|
522
|
+ }
|
490
|
523
|
$scope.handleloginEnter = function (e) {
|
491
|
524
|
if (e.keyCode == 13) {
|
492
|
525
|
$scope.handleLoginClick();
|