|
@@ -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', '$modal', 'api_auth',
|
|
2
|
+ function ($rootScope, $scope, $state, $translate, $localStorage, $cookieStore, $auth, $window, $document, $timeout, $filter, $http, cfpLoadingBar, Restangular, api_login, api_is_category, SweetAlert, api_msg, $modal, api_auth) {
|
3
|
3
|
$rootScope.app.layout.isNavbarFixed = false;
|
4
|
4
|
$rootScope.app.layout.isSidebarFixed = false;
|
|
5
|
+ sessionStorage.clear();
|
|
6
|
+ localStorage.clear();
|
5
|
7
|
//判断项目归属 start
|
6
|
8
|
//因项目众多,前端为了加以区分,所以用域名加以判断,后期有更好的方式可以自行修改
|
7
|
9
|
// 中南财大
|
|
@@ -555,9 +557,66 @@ app.controller('LoginCtrl', ['$rootScope', '$scope', '$state', '$translate', '$l
|
555
|
557
|
// if (!resp.error || resp.error != 500) {
|
556
|
558
|
if (resp.data && resp.data.user && resp.data.user.id) {
|
557
|
559
|
// console.log(resp.error);
|
558
|
|
- $rootScope.getpending();
|
559
|
|
- $state.go('app.dashboard');
|
560
|
|
- $rootScope.app.isLoginFixed = false;
|
|
560
|
+ var firstLineFlag = resp.data.user.role.some(function(v){
|
|
561
|
+ return v.rolecode === 'first-line support';
|
|
562
|
+ });
|
|
563
|
+ var callCenterFlag = resp.data.user.role.some(function(v){
|
|
564
|
+ return v.rolecode === 'call center';
|
|
565
|
+ });
|
|
566
|
+ if(firstLineFlag && callCenterFlag){
|
|
567
|
+ // 同时拥有服务台和一线运维的角色
|
|
568
|
+ // 强制选择登录用途 start
|
|
569
|
+ var modalInstance = $modal.open({
|
|
570
|
+ templateUrl: "assets/views/customform/tpl/loginPurpose.html",
|
|
571
|
+ controller: function ($scope, $rootScope, scope, $modalInstance, api_auth) {
|
|
572
|
+ $scope.title = "选择登录用途";
|
|
573
|
+ $scope.loginPurpose = 0;
|
|
574
|
+ $scope.ok = function (item) {
|
|
575
|
+ if(item){
|
|
576
|
+ $modalInstance.close(item);
|
|
577
|
+ }else{
|
|
578
|
+ SweetAlert.swal("操作失败", "请选择登录用途!", "error");
|
|
579
|
+ }
|
|
580
|
+ };
|
|
581
|
+ $scope.cancel = function () {
|
|
582
|
+ $modalInstance.dismiss("cancel");
|
|
583
|
+ };
|
|
584
|
+ },
|
|
585
|
+ size: "sm",
|
|
586
|
+ resolve: {
|
|
587
|
+ scope: function () {
|
|
588
|
+ return $scope;
|
|
589
|
+ },
|
|
590
|
+ },
|
|
591
|
+ });
|
|
592
|
+ modalInstance.result.then(function (selectedItem) {
|
|
593
|
+ if (selectedItem) {
|
|
594
|
+ $rootScope.isMask = true;
|
|
595
|
+ var flag = selectedItem == 1 ? true : (selectedItem == 2 ? false : undefined);
|
|
596
|
+ api_auth.resetDuty({isDuty: flag})
|
|
597
|
+ .then(function (response) {
|
|
598
|
+ $rootScope.isMask = false;
|
|
599
|
+ if (response.status == 200) {
|
|
600
|
+ sessionStorage.setItem('resetDuty', flag);
|
|
601
|
+ $rootScope.getpending();
|
|
602
|
+ $state.go('app.dashboard');
|
|
603
|
+ $rootScope.app.isLoginFixed = false;
|
|
604
|
+ } else {
|
|
605
|
+ SweetAlert.swal("操作失败", "操作失败!", "error");
|
|
606
|
+ }
|
|
607
|
+ }).catch(function(err){
|
|
608
|
+ $rootScope.isMask = false;
|
|
609
|
+ });
|
|
610
|
+ }else{
|
|
611
|
+ SweetAlert.swal("操作失败", "请选择登录用途!", "error");
|
|
612
|
+ }
|
|
613
|
+ });
|
|
614
|
+ // 强制选择登录用途 end
|
|
615
|
+ }else{
|
|
616
|
+ $rootScope.getpending();
|
|
617
|
+ $state.go('app.dashboard');
|
|
618
|
+ $rootScope.app.isLoginFixed = false;
|
|
619
|
+ }
|
561
|
620
|
// console.log(resp);
|
562
|
621
|
// api_wechatfile.getDictionary({ "type": "list", "key": "hjzx_cornet" }).then(function(data) {
|
563
|
622
|
// $scope.runNumber = data;
|