app.js 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237
  1. (function () {
  2. //var settingsRoute = require('settings/settings-states.js');
  3. "use strict";
  4. angular.module('ylmis', ['ui.router', 'oc.lazyLoad', 'ngSanitize', 'ngAnimate', 'mgcrea.ngStrap',
  5. 'ngFileUpload', 'ngCookies', 'devself.common', 'angularAwesomeSlider']).config(function ($stateProvider, $urlRouterProvider, $modalProvider,
  6. $tooltipProvider, $asideProvider, $httpProvider, $qProvider, $cookiesProvider, $bsRouterStateProvider) {
  7. angular.extend($modalProvider.defaults, {
  8. animation: 'am-flip-x',
  9. backdrop: 'static'
  10. });
  11. angular.extend($tooltipProvider.defaults, {
  12. html: true
  13. });
  14. angular.extend($asideProvider.defaults, {
  15. container: 'body',
  16. html: true
  17. });
  18. $qProvider.errorOnUnhandledRejections(false);
  19. document.addEventListener("mousewheel", function () {
  20. var evt = event || window.event;
  21. if (evt.srcElement.tagName.toLowerCase() == 'input' && evt.srcElement.type.toLowerCase() == 'number') {
  22. if (evt.preventDefault) {
  23. // Firefox
  24. evt.preventDefault();
  25. evt.stopPropagation();
  26. } else {
  27. // IE
  28. evt.cancelBubble = true;
  29. evt.returnValue = false;
  30. }
  31. return false;
  32. }
  33. }, { passive: false });
  34. $httpProvider.interceptors.push('authInterceptor');
  35. // Initialize get if not there
  36. if (!$httpProvider.defaults.headers.get) {
  37. $httpProvider.defaults.headers.get = {};
  38. }
  39. // Enables Request.IsAjaxRequest() in ASP.NET MVC
  40. //$httpProvider.defaults.headers.common["X-Requested-With"] = 'XMLHttpRequest';
  41. //禁用IE对ajax的缓存
  42. $httpProvider.defaults.headers.get['Cache-Control'] = 'no-cache';
  43. $httpProvider.defaults.headers.get['Pragma'] = 'no-cache';
  44. $urlRouterProvider.otherwise("/login");
  45. //设置路由
  46. $stateProvider.state("login", {
  47. url: "/login",
  48. templateUrl: "login.html?" + window.sysVersion,
  49. controller: "loginCtrl",
  50. resolve: {
  51. load: ['$ocLazyLoad', function ($ocLazyLoad) {
  52. $ocLazyLoad.load('css/login.css?' + window.sysVersion);
  53. return $ocLazyLoad.load('login.js?' + window.sysVersion);
  54. }]
  55. }
  56. }).state("homeTabs", {
  57. url: "/tabindex",
  58. templateUrl: "home-tabs.html?" + window.sysVersion,
  59. controller: "homeCtrl",
  60. resolve: {
  61. load: ['$ocLazyLoad', function ($ocLazyLoad) {
  62. $ocLazyLoad.load(['css/theme1.css?' + window.sysVersion, 'home-tabs.css?' + window.sysVersion, 'css/gt_style.css?' + window.sysVersion]);
  63. return $ocLazyLoad.load(['controllers.js?' + window.sysVersion,
  64. 'home-tabs.js?' + window.sysVersion
  65. ]);
  66. }]
  67. }
  68. }).state("home", {
  69. url: "/?uid",
  70. templateUrl: "home.html?" + window.sysVersion,
  71. controller: "homeCtrl",
  72. resolve: {
  73. load: ['$ocLazyLoad', function ($ocLazyLoad) {
  74. $ocLazyLoad.load(['css/theme1.css?' + window.sysVersion, 'css/gt_style.css?' + window.sysVersion]);
  75. return $ocLazyLoad.load(['controllers.js?' + window.sysVersion]);
  76. }]
  77. }
  78. }).state("home.index", {
  79. url: "mainindex",
  80. templateUrl: "home/mainindex.html?" + window.sysVersion,
  81. controller: "mainindexCtrl",
  82. resolve: {
  83. load: ['$ocLazyLoad', function ($ocLazyLoad) {
  84. $ocLazyLoad.load(['../main/css/redmenu.css?' + window.sysVersion]);
  85. return $ocLazyLoad.load('home/mainindex.js?' + window.sysVersion);
  86. }]
  87. }
  88. }).state("home.mynotice", {
  89. url: "mynotice",
  90. templateUrl: "home/mynotice.html?" + window.sysVersion,
  91. controller: "mynoticeCtrl",
  92. resolve: {
  93. load: ['$ocLazyLoad', function ($ocLazyLoad) {
  94. return $ocLazyLoad.load('home/mynotice.js?' + window.sysVersion);
  95. }]
  96. }
  97. }).state("home.settings_dictionary", {
  98. url: "dictionary",
  99. templateUrl: "systemsetting/dictionary/list.html?" + window.sysVersion,
  100. controller: "dictionaryCtrl",
  101. resolve: {
  102. load: ['$ocLazyLoad', function ($ocLazyLoad) {
  103. return $ocLazyLoad.load('systemsetting/dictionary/list.js?' + window.sysVersion);
  104. }]
  105. }
  106. }).state("home.settings_announcement", {
  107. url: "announcement",
  108. templateUrl: "systemsetting/announcement/list.html?" + window.sysVersion,
  109. controller: "announcementCtrl",
  110. resolve: {
  111. load: ['$ocLazyLoad', function ($ocLazyLoad) {
  112. $ocLazyLoad.load('systemsetting/announcement/edit.js?' + window.sysVersion);
  113. return $ocLazyLoad.load('systemsetting/announcement/list.js?' + window.sysVersion);
  114. }]
  115. }
  116. }).state("home.settings_role", {
  117. url: "role",
  118. templateUrl: "systemsetting/role/list.html?" + window.sysVersion,
  119. controller: "roleCtrl",
  120. resolve: {
  121. load: ['$ocLazyLoad', function ($ocLazyLoad) {
  122. return $ocLazyLoad.load('systemsetting/role/list.js?' + window.sysVersion);
  123. }]
  124. }
  125. }).state("home.settings_user", {
  126. url: "user",
  127. templateUrl: "systemsetting/user/list.html?" + window.sysVersion,
  128. controller: "userCtrl",
  129. resolve: {
  130. load: ['$ocLazyLoad', function ($ocLazyLoad) {
  131. return $ocLazyLoad.load('systemsetting/user/list.js?' + window.sysVersion);
  132. }]
  133. }
  134. }).state("home.buildingList", {
  135. url: "buildingList",
  136. templateUrl: "building/list.html?" + window.sysVersion,
  137. controller: "buildingListCtrl",
  138. resolve: {
  139. load: ['$ocLazyLoad', function ($ocLazyLoad) {
  140. $ocLazyLoad.load('building/edit.js?' + window.sysVersion);
  141. return $ocLazyLoad.load('building/list.js?' + window.sysVersion);
  142. }]
  143. }
  144. }).state("home.roomList", {
  145. url: "roomList",
  146. templateUrl: "room/list.html?" + window.sysVersion,
  147. controller: "roomListCtrl",
  148. resolve: {
  149. load: ['$ocLazyLoad', function ($ocLazyLoad) {
  150. $ocLazyLoad.load('room/edit.js?' + window.sysVersion);
  151. return $ocLazyLoad.load('room/list.js?' + window.sysVersion);
  152. }]
  153. }
  154. }).state("home.depOrServiceList", {
  155. url: "depOrServiceList",
  156. templateUrl: "depOrService/list.html?" + window.sysVersion,
  157. controller: "depOrServiceCtrl",
  158. resolve: {
  159. load: ['$ocLazyLoad', function ($ocLazyLoad) {
  160. $ocLazyLoad.load('depOrService/edit.js?' + window.sysVersion);
  161. $ocLazyLoad.load('depOrService/selectRoom.js?' + window.sysVersion);
  162. return $ocLazyLoad.load('depOrService/list.js?' + window.sysVersion);
  163. }]
  164. }
  165. }).state("map", {
  166. url: "/map",
  167. templateUrl: "map.html?" + window.sysVersion,
  168. controller: "mapCtrl",
  169. resolve: {
  170. load: ['$ocLazyLoad', function ($ocLazyLoad) {
  171. return $ocLazyLoad.load('map.js?' + window.sysVersion);
  172. }]
  173. }
  174. }).state("map-index", {
  175. url: "/map-index",
  176. templateUrl: "map-index.html?" + window.sysVersion,
  177. controller: "mapIndexCtrl",
  178. resolve: {
  179. load: ['$ocLazyLoad', function ($ocLazyLoad) {
  180. return $ocLazyLoad.load('map-index.js?' + window.sysVersion);
  181. }]
  182. }
  183. });
  184. if (customerState) {
  185. customerState.config($stateProvider);
  186. };
  187. $bsRouterStateProvider.copyUrlState($stateProvider.getStates());
  188. })
  189. //.config(['$locationProvider', '$sceDelegateProvider', '$sceProvider', '$stateProvider', settingsRoute])
  190. .run(['$rootScope', '$http', '$log', '$window', '$location', '$q', function ($rootScope, $http, $loading, $window, $location, $q) {
  191. //var lstorage = $window.localStorage;
  192. //if (lstorage["islogin"] == "1" && $rootScope.istkcon != 1) {
  193. // var connection = new signalR.HubConnectionBuilder().withUrl("/hubs/token?userID=" + lstorage['UserID']).build();
  194. // console.info('onapp');
  195. // connection.keepAliveIntervalInMilliseconds = 12e4;
  196. // connection.serverTimeoutInMilliseconds = 6e4 * 60 * 24;
  197. // connection.on("getToken", function (token) {
  198. // lstorage['token'] = token;
  199. // console.info(token);
  200. // });
  201. // connection.start();
  202. // $rootScope.istkcon = 1;
  203. //}
  204. /*$http.get('/api/resource/GetResources').then(
  205. function (res) {
  206. $rootScope.htmlResource = res.data.Data;
  207. document.title = $rootScope.htmlResource.Title;
  208. }
  209. );*/
  210. $rootScope.$on('$stateChangeSuccess', function (event, toState, toParams, fromState, fromParams) {
  211. if (toState.name == 'homeTabs') {
  212. angular.element('.theme-red').css('overflow-y', 'hidden');
  213. } else {
  214. angular.element('.theme-red').css('overflow-y', 'auto');
  215. }
  216. });
  217. }]);
  218. })();