123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218 |
- 'use strict';
- // 全局第三方库 ,说明文档:https://github.com/jsdelivr/jsdelivr
- var jsLib = {
- echarts: "https://cdn.washpayer.com/npm/echarts@4.2.0-rc.2/dist/echarts.min.js",
- colorPicker: "https://cdn.washpayer.com/npm/@simonwep/pickr/dist/pickr.es5.min.js",
- colorPickerCss: "https://cdn.washpayer.com/npm/@simonwep/pickr/dist/pickr.min.css",
- qrCode: "https://cdn.washpayer.com/npm/jquery.qrcode@1.0.3/jquery.qrcode.min.js",// npm版本名字要注意,不知道的话去npm查看名字
- clipboard: "https://cdn.washpayer.com/npm/clipboard@2.0.4/dist/clipboard.min.js",// 2.0开始 Clipboard() to ClipboardJS()
- moment: "https://cdn.washpayer.com/npm/moment@2.24.0/min/moment.min.js",
- momentZh: "https://cdn.washpayer.com/npm/moment@2.24.0/locale/zh-cn.js",
- compressor: "https://cdn.washpayer.com/npm/compressorjs@1.0.5/dist/compressor.min.js",// image-compressor已经停止维护,所以使用compressor
- particles: "https://cdn.washpayer.com/npm/@dschau/particles.js@2.0.0/dist/particles.min.js",//注意是 @dschau的版本
- jszip: "https://cdn.washpayer.com/npm/jszip@3.2.1/dist/jszip.min.js",
- FileSaver: "https://cdn.washpayer.com/npm/file-saver@2.0.2/dist/FileSaver.min.js",
- }
- // jconfirm全局配置 http://craftpip.github.io/jquery-confirm/v3.3.2/#globaldefaults
- if (window.jconfirm) {
- jconfirm.defaults = {
- title: '温馨提示',
- titleClass: '',
- draggable: true,
- content: '您确定吗?',
- buttons: {
- ok: {
- text: '确定', btnClass: 'btn-blue',
- action: function () {
- }
- },
- close: {
- text: '关闭',
- action: function () {
- }
- },
- },
- animation: 'top',
- closeAnimation: 'top',
- animationSpeed: 300,
- animationBounce: 1,
- offsetTop: 40,
- offsetBottom: 40,
- };
- }
- //如果某几个关键字是包含关系,短的关键字放后面,因为设备真实名称一般是比较长的,比如:XXX脉冲充电桩.indexOf('汽车充电桩')
- window.DEV_ICON_MAP = {
- "空气净化": "kongqijinghuaqi",
- "吸氧": "xiyangji",
- "制氧": "yangqi",
- "微波炉": "weibolu",
- "洗衣机": "xiyiji",
- "烘干": "hongganji",
- "洗鞋": "xiezi",
- "洗澡": "xizao",
- "搓澡": "xizaomuyu",
- "淋浴": "xizaomuyu",
- "吹风": "chuifengji",
- "售液": "water",
- "啤酒": "pijiu",
- "售水": "yinshuiji",
- "饮料": "yinshuiji",
- "喝水": "yinshuiji",
- "饮水": "yinshuiji",
- "漱口水": "pingzi",
- "洗手液": "xishouye",
- "洗衣液": "xiyiye",
- "游戏": "game",
- "射": "sheqiang",
- "枪": "sheqiang",
- "摇摇车": "yaoyaoche",
- "儿童车": "ertongche",
- "娃娃机": "zhuawawa",
- "购物车": "gouwuche",
- "咖啡": "kafei",
- "格子": "shouhuoji",
- "售货": "shouhuoji",
- "储物": "chuwugui",
- "纸巾": "zhijin",
- "体重": "tizhong",
- "洗车": "xicheji",
- "汽车充电": "qichechongdian",
- "充电桩": "chongdianzhuang",
- "充电": "chongdian",
- "足底按摩": "zuliao",
- "足疗": "zuliao",
- "按摩抱枕": "baozhen",
- "按摩": "anmoyi",//有按摩坐垫、按摩椅、足底按摩机
- "水疗": "shuiliaoyi",
- "床": "chuang",
- };
- function getDevIconName(typeName) {
- if (typeName) {
- for (var key in DEV_ICON_MAP) {
- if (typeName.indexOf(key) > -1) {
- return "icon-" + DEV_ICON_MAP[key];
- }
- }
- }
- return "icon-device";
- }
- Date.prototype.format = function (fmt) { //author: meizz
- var o = {
- "M+": this.getMonth() + 1, //月份
- "d+": this.getDate(), //日
- "h+": this.getHours(), //小时
- "m+": this.getMinutes(), //分
- "s+": this.getSeconds(), //秒
- "q+": Math.floor((this.getMonth() + 3) / 3), //季度
- "S": this.getMilliseconds() //毫秒
- };
- if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
- for (var k in o)
- if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
- return fmt;
- };
- function getQueryString(name) {
- var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
- var r = window.location.search.substr(1).match(reg);
- if (r != null)
- return decodeURI(r[2]);
- return null;
- }
- var userAgent = navigator.userAgent;
- var BROWSER_TYPE = "";
- if (userAgent.match(/MicroMessenger/i)) {
- BROWSER_TYPE = "wechat";
- } else if (userAgent.match(/Alipay/i)) {
- BROWSER_TYPE = "alipay";
- } else {
- }
- //动画遮盖层
- function Mask(text) {
- //可能直接传递option
- var optionIn = {};
- var performance = false;
- if ($.isPlainObject(text)) {
- optionIn = text;
- performance = optionIn.performance;//某些场景不要有动画,否则性能问题
- text = optionIn.text;
- }
- 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>');
- this.dom = dom;
- if (text != null) {
- dom.find(".load-text").html(text);
- }
- }
- Mask.prototype.show = function (quickly) {
- var dom = this.dom;
- $("body").append(dom);
- if (quickly) {
- dom.addClass("active");
- } else {
- setTimeout(function () {
- dom.addClass("active");
- }, 400);
- }
- return this;
- };
- Mask.prototype.hide = function () {
- this.dom.hide();
- return this;
- };
- Mask.prototype.dark = function () {
- this.dom.addClass("dark");
- return this;
- };
- Mask.prototype.text = function (text) {
- if (text != null) {
- this.dom.find(".load-text").html(text);
- }
- return this;
- };
- Mask.prototype.remove = function () {
- if (this.dom) {
- this.dom.remove();
- this.dom = null;
- }
- };
- angular.module('app', [
- 'ngAnimate',
- 'ngCookies',
- 'ngStorage',
- 'ngSanitize',//避免ng-bind-html报错
- 'ui.router',
- 'ui.bootstrap',
- 'ui.load',
- 'ui.grid',
- 'ui.grid.pagination',
- 'ui.grid.selection',
- 'ui.grid.resizeColumns',
- 'ui.grid.expandable',
- 'ui.validate',
- 'oc.lazyLoad',
- 'angular-md5',
- 'toaster',
- ]);
|