app.js 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  1. 'use strict';
  2. // 全局第三方库 ,说明文档:https://github.com/jsdelivr/jsdelivr
  3. var jsLib = {
  4. echarts: "https://cdn.washpayer.com/npm/echarts@4.2.0-rc.2/dist/echarts.min.js",
  5. colorPicker: "https://cdn.washpayer.com/npm/@simonwep/pickr/dist/pickr.es5.min.js",
  6. colorPickerCss: "https://cdn.washpayer.com/npm/@simonwep/pickr/dist/pickr.min.css",
  7. qrCode: "https://cdn.washpayer.com/npm/jquery.qrcode@1.0.3/jquery.qrcode.min.js",// npm版本名字要注意,不知道的话去npm查看名字
  8. clipboard: "https://cdn.washpayer.com/npm/clipboard@2.0.4/dist/clipboard.min.js",// 2.0开始 Clipboard() to ClipboardJS()
  9. moment: "https://cdn.washpayer.com/npm/moment@2.24.0/min/moment.min.js",
  10. momentZh: "https://cdn.washpayer.com/npm/moment@2.24.0/locale/zh-cn.js",
  11. compressor: "https://cdn.washpayer.com/npm/compressorjs@1.0.5/dist/compressor.min.js",// image-compressor已经停止维护,所以使用compressor
  12. particles: "https://cdn.washpayer.com/npm/@dschau/particles.js@2.0.0/dist/particles.min.js",//注意是 @dschau的版本
  13. jszip: "https://cdn.washpayer.com/npm/jszip@3.2.1/dist/jszip.min.js",
  14. FileSaver: "https://cdn.washpayer.com/npm/file-saver@2.0.2/dist/FileSaver.min.js",
  15. }
  16. // jconfirm全局配置 http://craftpip.github.io/jquery-confirm/v3.3.2/#globaldefaults
  17. if (window.jconfirm) {
  18. jconfirm.defaults = {
  19. title: '温馨提示',
  20. titleClass: '',
  21. draggable: true,
  22. content: '您确定吗?',
  23. buttons: {
  24. ok: {
  25. text: '确定', btnClass: 'btn-blue',
  26. action: function () {
  27. }
  28. },
  29. close: {
  30. text: '关闭',
  31. action: function () {
  32. }
  33. },
  34. },
  35. animation: 'top',
  36. closeAnimation: 'top',
  37. animationSpeed: 300,
  38. animationBounce: 1,
  39. offsetTop: 40,
  40. offsetBottom: 40,
  41. };
  42. }
  43. //如果某几个关键字是包含关系,短的关键字放后面,因为设备真实名称一般是比较长的,比如:XXX脉冲充电桩.indexOf('汽车充电桩')
  44. window.DEV_ICON_MAP = {
  45. "空气净化": "kongqijinghuaqi",
  46. "吸氧": "xiyangji",
  47. "制氧": "yangqi",
  48. "微波炉": "weibolu",
  49. "洗衣机": "xiyiji",
  50. "烘干": "hongganji",
  51. "洗鞋": "xiezi",
  52. "洗澡": "xizao",
  53. "搓澡": "xizaomuyu",
  54. "淋浴": "xizaomuyu",
  55. "吹风": "chuifengji",
  56. "售液": "water",
  57. "啤酒": "pijiu",
  58. "售水": "yinshuiji",
  59. "饮料": "yinshuiji",
  60. "喝水": "yinshuiji",
  61. "饮水": "yinshuiji",
  62. "漱口水": "pingzi",
  63. "洗手液": "xishouye",
  64. "洗衣液": "xiyiye",
  65. "游戏": "game",
  66. "射": "sheqiang",
  67. "枪": "sheqiang",
  68. "摇摇车": "yaoyaoche",
  69. "儿童车": "ertongche",
  70. "娃娃机": "zhuawawa",
  71. "购物车": "gouwuche",
  72. "咖啡": "kafei",
  73. "格子": "shouhuoji",
  74. "售货": "shouhuoji",
  75. "储物": "chuwugui",
  76. "纸巾": "zhijin",
  77. "体重": "tizhong",
  78. "洗车": "xicheji",
  79. "汽车充电": "qichechongdian",
  80. "充电桩": "chongdianzhuang",
  81. "充电": "chongdian",
  82. "足底按摩": "zuliao",
  83. "足疗": "zuliao",
  84. "按摩抱枕": "baozhen",
  85. "按摩": "anmoyi",//有按摩坐垫、按摩椅、足底按摩机
  86. "水疗": "shuiliaoyi",
  87. "床": "chuang",
  88. };
  89. function getDevIconName(typeName) {
  90. if (typeName) {
  91. for (var key in DEV_ICON_MAP) {
  92. if (typeName.indexOf(key) > -1) {
  93. return "icon-" + DEV_ICON_MAP[key];
  94. }
  95. }
  96. }
  97. return "icon-device";
  98. }
  99. Date.prototype.format = function (fmt) { //author: meizz
  100. var o = {
  101. "M+": this.getMonth() + 1, //月份
  102. "d+": this.getDate(), //日
  103. "h+": this.getHours(), //小时
  104. "m+": this.getMinutes(), //分
  105. "s+": this.getSeconds(), //秒
  106. "q+": Math.floor((this.getMonth() + 3) / 3), //季度
  107. "S": this.getMilliseconds() //毫秒
  108. };
  109. if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
  110. for (var k in o)
  111. if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
  112. return fmt;
  113. };
  114. function getQueryString(name) {
  115. var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
  116. var r = window.location.search.substr(1).match(reg);
  117. if (r != null)
  118. return decodeURI(r[2]);
  119. return null;
  120. }
  121. var userAgent = navigator.userAgent;
  122. var BROWSER_TYPE = "";
  123. if (userAgent.match(/MicroMessenger/i)) {
  124. BROWSER_TYPE = "wechat";
  125. } else if (userAgent.match(/Alipay/i)) {
  126. BROWSER_TYPE = "alipay";
  127. } else {
  128. }
  129. //动画遮盖层
  130. function Mask(text) {
  131. //可能直接传递option
  132. var optionIn = {};
  133. var performance = false;
  134. if ($.isPlainObject(text)) {
  135. optionIn = text;
  136. performance = optionIn.performance;//某些场景不要有动画,否则性能问题
  137. text = optionIn.text;
  138. }
  139. var dom = $('<div class="load-mask"><div class="loader-inner ' + (performance ? '' : 'ball-pulse') + '"><div></div><div></div><div></div><span class="load-text"></span></div></div>');
  140. this.dom = dom;
  141. if (text != null) {
  142. dom.find(".load-text").html(text);
  143. }
  144. }
  145. Mask.prototype.show = function (quickly) {
  146. var dom = this.dom;
  147. $("body").append(dom);
  148. if (quickly) {
  149. dom.addClass("active");
  150. } else {
  151. setTimeout(function () {
  152. dom.addClass("active");
  153. }, 400);
  154. }
  155. return this;
  156. };
  157. Mask.prototype.hide = function () {
  158. this.dom.hide();
  159. return this;
  160. };
  161. Mask.prototype.dark = function () {
  162. this.dom.addClass("dark");
  163. return this;
  164. };
  165. Mask.prototype.text = function (text) {
  166. if (text != null) {
  167. this.dom.find(".load-text").html(text);
  168. }
  169. return this;
  170. };
  171. Mask.prototype.remove = function () {
  172. if (this.dom) {
  173. this.dom.remove();
  174. this.dom = null;
  175. }
  176. };
  177. angular.module('app', [
  178. 'ngAnimate',
  179. 'ngCookies',
  180. 'ngStorage',
  181. 'ngSanitize',//避免ng-bind-html报错
  182. 'ui.router',
  183. 'ui.bootstrap',
  184. 'ui.load',
  185. 'ui.grid',
  186. 'ui.grid.pagination',
  187. 'ui.grid.selection',
  188. 'ui.grid.resizeColumns',
  189. 'ui.grid.expandable',
  190. 'ui.validate',
  191. 'oc.lazyLoad',
  192. 'angular-md5',
  193. 'toaster',
  194. ]);