|
@@ -1,25 +1,27 @@
|
|
|
(function () {
|
|
|
'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 = {};//客服弹出框
|
|
|
- $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;
|
|
|
}
|
|
|
- $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.panels = [];
|
|
@@ -53,7 +55,7 @@
|
|
|
//修改选择角色
|
|
|
$scope.User.curRoleId = newVal;
|
|
|
AuthUser.setUser($scope.User);
|
|
|
- $bsRouterState.tabs.length=0;
|
|
|
+ $bsRouterState.tabs.length = 0;
|
|
|
$scope.getMenuList(newVal);
|
|
|
$scope.getUserDataScope();
|
|
|
}
|
|
@@ -72,7 +74,7 @@
|
|
|
appkey: $scope.menudatas.appkey,
|
|
|
defrolekey: $scope.menudatas.defrolekey,
|
|
|
roleId: roleId,
|
|
|
- dwId:$scope.User.dwId
|
|
|
+ dwId: $scope.User.dwId
|
|
|
}
|
|
|
}).then(function (result) {
|
|
|
if (result.data.success) {
|
|
@@ -111,7 +113,7 @@
|
|
|
$scope.User.dataDzzdm = res.data.dataDzzdm;
|
|
|
AuthUser.setUser($scope.User);
|
|
|
|
|
|
- $bsRouterState.$showTab($bsRouterState.defaults.initTabName,{});
|
|
|
+ $bsRouterState.$showTab($bsRouterState.defaults.initTabName, {});
|
|
|
//tabs.
|
|
|
|
|
|
});
|
|
@@ -231,9 +233,9 @@
|
|
|
//$scope.roleList = $filter('orderBy')(req.data.item, '-orderby');
|
|
|
$scope.roleList = req.data.item;
|
|
|
$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?$scope.roleList[0].roleid:roleId;
|
|
|
+ $scope.roleList.selectedId = roleId ? $scope.roleList[0].roleid : roleId;
|
|
|
//$scope.getMenuList($scope.roleList.selectedId);
|
|
|
}
|
|
|
}
|
|
@@ -263,6 +265,7 @@
|
|
|
//AuthUser.setlogin();
|
|
|
$scope.User = res.data.item;
|
|
|
$scope.User.isServerMan = res.data.extdata != null ? res.data.extdata.isServerMan : false;
|
|
|
+ AuthUser.setUser($scope.User);
|
|
|
//开始心跳查询是否超时
|
|
|
$scope.userOnlineActivityFun();
|
|
|
//$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) {
|
|
|
if (req.data.success) {
|
|
|
$bsRouterState.tabs.length = 0;
|
|
@@ -302,7 +305,7 @@
|
|
|
duration: 3
|
|
|
});
|
|
|
}*/
|
|
|
- $rootScope.menuToggle=true;
|
|
|
+ $rootScope.menuToggle = true;
|
|
|
AuthUser.clearUser();
|
|
|
$state.go("login");
|
|
|
|
|
@@ -530,6 +533,11 @@
|
|
|
|
|
|
};
|
|
|
return directiveObject;
|
|
|
- }]).filter('ceil', function() { return function(input) { return Math.ceil(input); }; }); ;
|
|
|
+ }]).filter('ceil', function () {
|
|
|
+ return function (input) {
|
|
|
+ return Math.ceil(input);
|
|
|
+ };
|
|
|
+ });
|
|
|
+ ;
|
|
|
|
|
|
})();
|