(function () { //var settingsRoute = require('settings/settings-states.js'); "use strict"; angular.module('ylmis', ['ui.router', 'oc.lazyLoad', 'ngSanitize', 'ngAnimate', 'mgcrea.ngStrap', 'ngFileUpload', 'ngCookies', 'devself.common', 'angularAwesomeSlider']).config(function ($stateProvider, $urlRouterProvider, $modalProvider, $tooltipProvider, $asideProvider, $httpProvider, $qProvider, $cookiesProvider, $bsRouterStateProvider) { angular.extend($modalProvider.defaults, { animation: 'am-flip-x', backdrop: 'static' }); angular.extend($tooltipProvider.defaults, { html: true }); angular.extend($asideProvider.defaults, { container: 'body', html: true }); $qProvider.errorOnUnhandledRejections(false); document.addEventListener("mousewheel", function () { var evt = event || window.event; if (evt.srcElement.tagName.toLowerCase() == 'input' && evt.srcElement.type.toLowerCase() == 'number') { if (evt.preventDefault) { // Firefox evt.preventDefault(); evt.stopPropagation(); } else { // IE evt.cancelBubble = true; evt.returnValue = false; } return false; } }, { passive: false }); $httpProvider.interceptors.push('authInterceptor'); // Initialize get if not there if (!$httpProvider.defaults.headers.get) { $httpProvider.defaults.headers.get = {}; } // Enables Request.IsAjaxRequest() in ASP.NET MVC //$httpProvider.defaults.headers.common["X-Requested-With"] = 'XMLHttpRequest'; //禁用IE对ajax的缓存 $httpProvider.defaults.headers.get['Cache-Control'] = 'no-cache'; $httpProvider.defaults.headers.get['Pragma'] = 'no-cache'; $urlRouterProvider.otherwise("/login"); //设置路由 $stateProvider.state("login", { url: "/login", templateUrl: "login.html?" + window.sysVersion, controller: "loginCtrl", resolve: { load: ['$ocLazyLoad', function ($ocLazyLoad) { $ocLazyLoad.load('css/login.css?' + window.sysVersion); return $ocLazyLoad.load('login.js?' + window.sysVersion); }] } }).state("homeTabs", { url: "/tabindex", templateUrl: "home-tabs.html?" + window.sysVersion, controller: "homeCtrl", resolve: { load: ['$ocLazyLoad', function ($ocLazyLoad) { $ocLazyLoad.load(['css/theme1.css?' + window.sysVersion, 'home-tabs.css?' + window.sysVersion, 'css/gt_style.css?' + window.sysVersion]); return $ocLazyLoad.load(['controllers.js?' + window.sysVersion, 'home-tabs.js?' + window.sysVersion ]); }] } }).state("home", { url: "/?uid", templateUrl: "home.html?" + window.sysVersion, controller: "homeCtrl", resolve: { load: ['$ocLazyLoad', function ($ocLazyLoad) { $ocLazyLoad.load(['css/theme1.css?' + window.sysVersion, 'css/gt_style.css?' + window.sysVersion]); return $ocLazyLoad.load(['controllers.js?' + window.sysVersion]); }] } }).state("home.index", { url: "mainindex", templateUrl: "home/mainindex.html?" + window.sysVersion, controller: "mainindexCtrl", resolve: { load: ['$ocLazyLoad', function ($ocLazyLoad) { $ocLazyLoad.load(['../main/css/redmenu.css?' + window.sysVersion]); return $ocLazyLoad.load('home/mainindex.js?' + window.sysVersion); }] } }).state("home.mynotice", { url: "mynotice", templateUrl: "home/mynotice.html?" + window.sysVersion, controller: "mynoticeCtrl", resolve: { load: ['$ocLazyLoad', function ($ocLazyLoad) { return $ocLazyLoad.load('home/mynotice.js?' + window.sysVersion); }] } }).state("home.settings_dictionary", { url: "dictionary", templateUrl: "systemsetting/dictionary/list.html?" + window.sysVersion, controller: "dictionaryCtrl", resolve: { load: ['$ocLazyLoad', function ($ocLazyLoad) { return $ocLazyLoad.load('systemsetting/dictionary/list.js?' + window.sysVersion); }] } }).state("home.settings_announcement", { url: "announcement", templateUrl: "systemsetting/announcement/list.html?" + window.sysVersion, controller: "announcementCtrl", resolve: { load: ['$ocLazyLoad', function ($ocLazyLoad) { $ocLazyLoad.load('systemsetting/announcement/edit.js?' + window.sysVersion); return $ocLazyLoad.load('systemsetting/announcement/list.js?' + window.sysVersion); }] } }).state("home.settings_role", { url: "role", templateUrl: "systemsetting/role/list.html?" + window.sysVersion, controller: "roleCtrl", resolve: { load: ['$ocLazyLoad', function ($ocLazyLoad) { return $ocLazyLoad.load('systemsetting/role/list.js?' + window.sysVersion); }] } }).state("home.settings_user", { url: "user", templateUrl: "systemsetting/user/list.html?" + window.sysVersion, controller: "userCtrl", resolve: { load: ['$ocLazyLoad', function ($ocLazyLoad) { return $ocLazyLoad.load('systemsetting/user/list.js?' + window.sysVersion); }] } }).state("home.buildingList", { url: "buildingList", templateUrl: "building/list.html?" + window.sysVersion, controller: "buildingListCtrl", resolve: { load: ['$ocLazyLoad', function ($ocLazyLoad) { $ocLazyLoad.load('building/edit.js?' + window.sysVersion); return $ocLazyLoad.load('building/list.js?' + window.sysVersion); }] } }).state("home.roomList", { url: "roomList", templateUrl: "room/list.html?" + window.sysVersion, controller: "roomListCtrl", resolve: { load: ['$ocLazyLoad', function ($ocLazyLoad) { $ocLazyLoad.load('room/edit.js?' + window.sysVersion); return $ocLazyLoad.load('room/list.js?' + window.sysVersion); }] } }).state("home.depOrServiceList", { url: "depOrServiceList", templateUrl: "depOrService/list.html?" + window.sysVersion, controller: "depOrServiceCtrl", resolve: { load: ['$ocLazyLoad', function ($ocLazyLoad) { $ocLazyLoad.load('depOrService/edit.js?' + window.sysVersion); $ocLazyLoad.load('depOrService/selectRoom.js?' + window.sysVersion); return $ocLazyLoad.load('depOrService/list.js?' + window.sysVersion); }] } }).state("map", { url: "/map", templateUrl: "map.html?" + window.sysVersion, controller: "mapCtrl", resolve: { load: ['$ocLazyLoad', function ($ocLazyLoad) { return $ocLazyLoad.load('map.js?' + window.sysVersion); }] } }).state("map-index", { url: "/map-index", templateUrl: "map-index.html?" + window.sysVersion, controller: "mapIndexCtrl", resolve: { load: ['$ocLazyLoad', function ($ocLazyLoad) { return $ocLazyLoad.load('map-index.js?' + window.sysVersion); }] } }); if (customerState) { customerState.config($stateProvider); }; $bsRouterStateProvider.copyUrlState($stateProvider.getStates()); }) //.config(['$locationProvider', '$sceDelegateProvider', '$sceProvider', '$stateProvider', settingsRoute]) .run(['$rootScope', '$http', '$log', '$window', '$location', '$q', function ($rootScope, $http, $loading, $window, $location, $q) { //var lstorage = $window.localStorage; //if (lstorage["islogin"] == "1" && $rootScope.istkcon != 1) { // var connection = new signalR.HubConnectionBuilder().withUrl("/hubs/token?userID=" + lstorage['UserID']).build(); // console.info('onapp'); // connection.keepAliveIntervalInMilliseconds = 12e4; // connection.serverTimeoutInMilliseconds = 6e4 * 60 * 24; // connection.on("getToken", function (token) { // lstorage['token'] = token; // console.info(token); // }); // connection.start(); // $rootScope.istkcon = 1; //} /*$http.get('/api/resource/GetResources').then( function (res) { $rootScope.htmlResource = res.data.Data; document.title = $rootScope.htmlResource.Title; } );*/ $rootScope.$on('$stateChangeSuccess', function (event, toState, toParams, fromState, fromParams) { if (toState.name == 'homeTabs') { angular.element('.theme-red').css('overflow-y', 'hidden'); } else { angular.element('.theme-red').css('overflow-y', 'auto'); } }); }]); })();