|
@@ -1,25 +1,27 @@
|
|
(function () {
|
|
(function () {
|
|
'use strict';
|
|
'use strict';
|
|
- angular.module('gtPartyApp').controller("homeCtrl", function ($scope, $state, $http, AuthUser, $modal, $interval, $q, $filter, $loading, $bsfiles, $alert, $bsRouterState,$timeout,$rootScope,$desData) {
|
|
|
|
|
|
+ angular.module('gtPartyApp').controller("homeCtrl", function ($scope, $state, $http, AuthUser, $modal, $interval, $q, $filter, $loading, $bsfiles, $alert, $bsRouterState, $timeout, $rootScope, $desData) {
|
|
|
|
|
|
var gsModal = {};//客服弹出框
|
|
var gsModal = {};//客服弹出框
|
|
- $scope.userOnlineIsOut=false;
|
|
|
|
- $scope.sysName=window.sysCompanyName;
|
|
|
|
- $scope.userOnlineActivityFun=function(){
|
|
|
|
|
|
+ $scope.userOnlineIsOut = false;
|
|
|
|
+ $scope.sysName = window.sysCompanyName;
|
|
|
|
+ $scope.userOnlineActivityFun = function () {
|
|
//判断是否已经退出登陆
|
|
//判断是否已经退出登陆
|
|
- if($scope.userOnlineIsOut){
|
|
|
|
|
|
+ if ($scope.userOnlineIsOut) {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
- $http.post("../../api/home/setOnlineUser", {
|
|
|
|
- uid: AuthUser.getUser().Id
|
|
|
|
- }).then(function (res) {
|
|
|
|
- if(res.data.success){
|
|
|
|
- $timeout($scope.userOnlineActivityFun,60*1000);
|
|
|
|
- } else {
|
|
|
|
- $scope.loginOutCookie();
|
|
|
|
- }
|
|
|
|
|
|
+ if (AuthUser.getUser().Id) {
|
|
|
|
+ $http.post("../../api/home/setOnlineUser", {
|
|
|
|
+ uid: AuthUser.getUser().Id
|
|
|
|
+ }).then(function (res) {
|
|
|
|
+ if (res.data.success) {
|
|
|
|
+ $timeout($scope.userOnlineActivityFun, 60 * 1000);
|
|
|
|
+ } else {
|
|
|
|
+ $scope.loginOutCookie();
|
|
|
|
+ }
|
|
|
|
|
|
- });
|
|
|
|
|
|
+ });
|
|
|
|
+ }
|
|
};
|
|
};
|
|
$scope.User = {name: ''};
|
|
$scope.User = {name: ''};
|
|
$scope.panels = [];
|
|
$scope.panels = [];
|
|
@@ -53,7 +55,7 @@
|
|
//修改选择角色
|
|
//修改选择角色
|
|
$scope.User.curRoleId = newVal;
|
|
$scope.User.curRoleId = newVal;
|
|
AuthUser.setUser($scope.User);
|
|
AuthUser.setUser($scope.User);
|
|
- $bsRouterState.tabs.length=0;
|
|
|
|
|
|
+ $bsRouterState.tabs.length = 0;
|
|
$scope.getMenuList(newVal);
|
|
$scope.getMenuList(newVal);
|
|
$scope.getUserDataScope();
|
|
$scope.getUserDataScope();
|
|
}
|
|
}
|
|
@@ -72,7 +74,7 @@
|
|
appkey: $scope.menudatas.appkey,
|
|
appkey: $scope.menudatas.appkey,
|
|
defrolekey: $scope.menudatas.defrolekey,
|
|
defrolekey: $scope.menudatas.defrolekey,
|
|
roleId: roleId,
|
|
roleId: roleId,
|
|
- dwId:$scope.User.dwId
|
|
|
|
|
|
+ dwId: $scope.User.dwId
|
|
}
|
|
}
|
|
}).then(function (result) {
|
|
}).then(function (result) {
|
|
if (result.data.success) {
|
|
if (result.data.success) {
|
|
@@ -111,7 +113,7 @@
|
|
$scope.User.dataDzzdm = res.data.dataDzzdm;
|
|
$scope.User.dataDzzdm = res.data.dataDzzdm;
|
|
AuthUser.setUser($scope.User);
|
|
AuthUser.setUser($scope.User);
|
|
|
|
|
|
- $bsRouterState.$showTab($bsRouterState.defaults.initTabName,{});
|
|
|
|
|
|
+ $bsRouterState.$showTab($bsRouterState.defaults.initTabName, {});
|
|
//tabs.
|
|
//tabs.
|
|
|
|
|
|
});
|
|
});
|
|
@@ -231,9 +233,9 @@
|
|
//$scope.roleList = $filter('orderBy')(req.data.item, '-orderby');
|
|
//$scope.roleList = $filter('orderBy')(req.data.item, '-orderby');
|
|
$scope.roleList = req.data.item;
|
|
$scope.roleList = req.data.item;
|
|
$scope.roleName = $scope.roleList[0].rolename;
|
|
$scope.roleName = $scope.roleList[0].rolename;
|
|
- var roleId=AuthUser.getUser().curRoleId;
|
|
|
|
|
|
+ var roleId = AuthUser.getUser().curRoleId || '';
|
|
//$scope.roleList.selectedId =roleId==null||roleId=='null'?$scope.roleList[0].roleid:roleId;
|
|
//$scope.roleList.selectedId =roleId==null||roleId=='null'?$scope.roleList[0].roleid:roleId;
|
|
- $scope.roleList.selectedId =roleId?$scope.roleList[0].roleid:roleId;
|
|
|
|
|
|
+ $scope.roleList.selectedId = roleId ? $scope.roleList[0].roleid : roleId;
|
|
//$scope.getMenuList($scope.roleList.selectedId);
|
|
//$scope.getMenuList($scope.roleList.selectedId);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -263,6 +265,7 @@
|
|
//AuthUser.setlogin();
|
|
//AuthUser.setlogin();
|
|
$scope.User = res.data.item;
|
|
$scope.User = res.data.item;
|
|
$scope.User.isServerMan = res.data.extdata != null ? res.data.extdata.isServerMan : false;
|
|
$scope.User.isServerMan = res.data.extdata != null ? res.data.extdata.isServerMan : false;
|
|
|
|
+ AuthUser.setUser($scope.User);
|
|
//开始心跳查询是否超时
|
|
//开始心跳查询是否超时
|
|
$scope.userOnlineActivityFun();
|
|
$scope.userOnlineActivityFun();
|
|
//$scope.getMenuList();
|
|
//$scope.getMenuList();
|
|
@@ -279,13 +282,13 @@
|
|
|
|
|
|
};
|
|
};
|
|
|
|
|
|
- $scope.loginOutCookie=function(){
|
|
|
|
|
|
+ $scope.loginOutCookie = function () {
|
|
|
|
|
|
- $scope.userOnlineIsOut=true;
|
|
|
|
- $http.get("../../api/home/logout",{
|
|
|
|
- params:{
|
|
|
|
- uid:AuthUser.getUser().Id
|
|
|
|
- }
|
|
|
|
|
|
+ $scope.userOnlineIsOut = true;
|
|
|
|
+ $http.get("../../api/home/logout", {
|
|
|
|
+ params: {
|
|
|
|
+ uid: AuthUser.getUser().Id
|
|
|
|
+ }
|
|
}).then(function (req) {
|
|
}).then(function (req) {
|
|
if (req.data.success) {
|
|
if (req.data.success) {
|
|
$bsRouterState.tabs.length = 0;
|
|
$bsRouterState.tabs.length = 0;
|
|
@@ -302,7 +305,7 @@
|
|
duration: 3
|
|
duration: 3
|
|
});
|
|
});
|
|
}*/
|
|
}*/
|
|
- $rootScope.menuToggle=true;
|
|
|
|
|
|
+ $rootScope.menuToggle = true;
|
|
AuthUser.clearUser();
|
|
AuthUser.clearUser();
|
|
$state.go("login");
|
|
$state.go("login");
|
|
|
|
|
|
@@ -530,6 +533,11 @@
|
|
|
|
|
|
};
|
|
};
|
|
return directiveObject;
|
|
return directiveObject;
|
|
- }]).filter('ceil', function() { return function(input) { return Math.ceil(input); }; }); ;
|
|
|
|
|
|
+ }]).filter('ceil', function () {
|
|
|
|
+ return function (input) {
|
|
|
|
+ return Math.ceil(input);
|
|
|
|
+ };
|
|
|
|
+ });
|
|
|
|
+ ;
|
|
|
|
|
|
})();
|
|
})();
|