ionic 开发当中,有一些常用的方法。

在开发项目的时候,有些常用的功能封装到一个类里。

以后要用的话,直接导入过来就可以用了,有一些方法是从网站复制过来的,有些方法是网上复制过来,然后自己修改了一下,标记一下吧!

  1. /** 
  2.   * 一些共用方法 
  3.   * @class Utility 
  4. */  
  5.  angular.module('LHB')  
  6.  .service('Utility', ['$rootScope''$timeout''$interval'"XiaotuniVersion"function ($rootScope, $timeout, $interval, XiaotuniVersion) {  //应用范围:service,controller,run,factory  
  7.   
  8.         var _TempSaveContent = {};  
  9.         var __key = "Xiaotuni@pz!365_com";  
  10.   
  11.         /** 
  12.          * 设置内容,这里主要是用来存放临时数据的。 
  13.          * @method _SetContent 
  14.          * @param key  键值,用于下次的时候获取内容用的。其实就是 _TempSaveContent的属性名称。 
  15.          * @param content 要存储的内容 
  16.          * @param isSaveLocalStorage 是否保存到本地存储里面 
  17.          * @param IsUser 根据用户uid 来获取缓存里的数据。 
  18.          * @private 
  19.          */  
  20.         var _SetContent = function (key, content, isSaveLocalStorage, IsUser) {  
  21.             try {  
  22.                 if (isSaveLocalStorage) {  
  23.                     var __Content = content;  
  24.                     if (IsUser) {  
  25.                         var __CheckIn = _TempSaveContent[_Const.API_CheckIn];  
  26.                         if (null !== __CheckIn && typeof  __CheckIn !== "undefined") {  
  27.                             __Content = {};  
  28.                             __Content[__CheckIn.uid] = content;  
  29.                         }  
  30.                     }  
  31.                     __Content = JSON.stringify(__Content);  
  32.                     //__content = CryptoJS.AES.encrypt(__Content, __key);  
  33.                     window.localStorage.setItem(key, __Content);  
  34.                 }  
  35.                 _TempSaveContent[key] = content;  
  36.             }  
  37.             catch (ex) {  
  38.                 console.log(ex);  
  39.             }  
  40.         }  
  41.   
  42.         /** 
  43.          * 删除指定字段值。 
  44.          * @method __RemoveContent 
  45.          * @param key 
  46.          * @return {null} 
  47.          * @private 
  48.          */  
  49.         var __RemoveContent = function (key, IsRemoveLocalStorage) {  
  50.             try {  
  51.                 if (null === key || typeof key === 'undefined') {  
  52.                     return;  
  53.                 }  
  54.                 if (_TempSaveContent.hasOwnProperty(key)) {  
  55.                     delete _TempSaveContent[key];  
  56.                     //_TempSaveContent[key] = null;  
  57.                 }  
  58.                 if (IsRemoveLocalStorage) {  
  59.                     window.localStorage.removeItem(key);  
  60.                 }  
  61.             }  
  62.             catch (ex) {  
  63.                 __PrintLog(ex.toString());  
  64.             }  
  65.         }  
  66.   
  67.         /** 
  68.          * 获取内容, 
  69.          * @method _GetContent 
  70.          * @param key 健名称。其实就是 _TempSaveContent的属性名称。 
  71.          * @return {*} 返回内容 
  72.          * @private 
  73.          */  
  74.         var _GetContent = function (key, IsUser) {  
  75.             try {  
  76.                 var __Content = null;  
  77.                 if (_TempSaveContent.hasOwnProperty(key)) {  
  78.                     __Content = _TempSaveContent[key];  
  79.                     return __Content;  
  80.                 }  
  81.                 if (null === __Content || typeof __Content === "undefined") {  
  82.                     var _value = window.localStorage.getItem(key);  
  83.                     if (null != _value && '' !== _value && typeof _value !== 'undefined') {  
  84.                         /*  // Decrypt  解密 
  85.                          var bytes = CryptoJS.AES.decrypt(_value, __key); 
  86.                          _value = JSON.parse(bytes.toString(CryptoJS.enc.Utf8)); 
  87.                          _TempSaveContent[key] = _value; 
  88.                          */  
  89.                         var __JSONValue = JSON.parse(_value);  
  90.                         _TempSaveContent[key] = JSON.parse(_value);  
  91.                         if (IsUser) {  
  92.                             if (_TempSaveContent.hasOwnProperty(_Const.API_CheckIn)) {  
  93.                                 var __CheckInfo = _TempSaveContent[_Const.API_CheckIn];  
  94.                                 if (__JSONValue.hasOwnProperty(__CheckInfo.uid)) {  
  95.                                     _TempSaveContent[key] = __JSONValue[__CheckInfo.uid];  
  96.                                 }  
  97.                                 else {  
  98.                                     _TempSaveContent[key] = null;  
  99.                                 }  
  100.                             }  
  101.                             else {  
  102.                                 _TempSaveContent[key] = null;  
  103.                             }  
  104.                         }  
  105.                         __Content = _TempSaveContent[key];  
  106.                     }  
  107.                 }  
  108.   
  109.                 return __Content;  
  110.             }  
  111.             catch (ex) {  
  112.                 console.log(ex);  
  113.                 return null;  
  114.             }  
  115.         }  
  116.   
  117.         /** 
  118.          * 清空本地存储 
  119.          * @method __ClearLocalStorage 
  120.          * @private 
  121.          */  
  122.         var __ClearLocalStorage = function () {  
  123.             try {  
  124.                 __RemoveContent(_Const.AddressInfo, true);  
  125.                 __RemoveContent(_Const.CacheUserCartGoods, true);  
  126.                 __RemoveContent(_Const.CacheUserDefaultAddress, true);  
  127.                 __RemoveContent(_Const.CacheUserHistorySearch, true);  
  128.                 __RemoveContent(_Const.CacheUserLatelySelectAddress, true);  
  129.                 __RemoveContent(_Const.AddressManagerSelectAddress, true);  
  130.             }  
  131.             catch (ex) {  
  132.                 __PrintLog(ex.toString());  
  133.             }  
  134.         };  
  135.   
  136.         /** 
  137.          * 清空当前页面缓存数据 
  138.          * @method __ClearCacheData 
  139.          * @private 
  140.          */  
  141.         var __ClearCacheData = function () {  
  142.             _TempSaveContent = {};  
  143.         };  
  144.   
  145.         /** 
  146.          * 获取对像属性值 
  147.          * @method __GetObjectPropertyValue 
  148.          * @param obj 对象 
  149.          * @param key 属性 
  150.          * @param IsReturnNull 默认(null)是返回 null,否则返回 '' 
  151.          * @return {*} 
  152.          * @private 
  153.          */  
  154.         var __GetObjectPropertyValue = function (obj, key, IsReturnNull) {  
  155.             if (null === obj || typeof obj === 'undefined' || '' === obj  
  156.                 || null == key || typeof key === 'undefined' || '' === key) {  
  157.                 return IsReturnNull === false ? '' : null;  
  158.             }  
  159.             if (obj.hasOwnProperty(key)) {  
  160.                 var __value = obj[key];  
  161.                 return obj[key]  
  162.             }  
  163.             return IsReturnNull === false ? '' : null;  
  164.         }  
  165.   
  166.         /** 
  167.          * 触发事件 
  168.          * @method __Emit 
  169.          * @param eventName 事件名称 
  170.          * @param {object} param1 参数1 
  171.          * @param {object} param2 参数2 
  172.          * @param {object} param3 参数3 
  173.          * @param {object} param4 参数4 
  174.          * @param {object} param5 参数5 
  175.          * @param {object} param6 参数6 
  176.          * @param {object} param7 参数7 
  177.          * @private 
  178.          */  
  179.         var __Emit = function (eventName, param1, param2, param3, param4, param5, param6, param7) {  
  180.             $rootScope.$emit(eventName, param1, param2, param3, param4, param5, param6, param7);  
  181.         }  
  182.   
  183.         /** 
  184.          * 广播事件 
  185.          * @method __Broadcast 
  186.          * @param eventName 广播事件名称 
  187.          * @param {object} param1 参数1 
  188.          * @param {object} param2 参数2 
  189.          * @param {object} param3 参数3 
  190.          * @param {object} param4 参数4 
  191.          * @param {object} param5 参数5 
  192.          * @param {object} param6 参数6 
  193.          * @param {object} param7 参数7 
  194.          * @private 
  195.          */  
  196.         var __Broadcast = function (eventName, param1, param2, param3, param4, param5, param6, param7) {  
  197.             $rootScope.$broadcast(eventName, param1, param2, param3, param4, param5, param6, param7);  
  198.         }  
  199.   
  200.         /** 
  201.          * 弹出对话框 
  202.          * @method __Alert 
  203.          * @param {object} param 参数 
  204.          * @example 
  205.          *  Utility.Alert({title: '购物袋', template: '请选择要结算的商品'}); 
  206.          * @constructor 
  207.          */  
  208.         var __Alert = function (param) {  
  209.             $rootScope.$emit(_Const.Alert, param);  
  210.         };  
  211.   
  212.         /** 
  213.          * 打印输出日志 
  214.          * @method __PrintLog 
  215.          * @param {object} args 内容 
  216.          * @private 
  217.          */  
  218.         var __PrintLog = function (args) {  
  219.             try {  
  220.                 var __callmethod = '';  
  221.                 try {  
  222.                     throw new Error();  
  223.                 } catch (e) {  
  224.                     //console.log(e.stack);  
  225.                     __callmethod = e.stack.replace(/Error\n/).split(/\n/)[1].replace(/^\s+|\s+$/, "");  
  226.                 }  
  227.   
  228.                 var _curDate = new Date();  
  229.                 var _aa = _curDate.toLocaleDateString() + " " + _curDate.toLocaleTimeString() + "." + _curDate.getMilliseconds();  
  230.                 console.log("--begin->", _aa, ' call method :', __callmethod);  
  231.                 var __content = "";  
  232.                 if (angular.isObject(args) || angular.isArray(args)) {  
  233.                     __content = JSON.stringify(args);  
  234.                 }  
  235.                 else {  
  236.                     __content = args;  
  237.                 }  
  238.                 console.log(__content)  
  239.             }  
  240.             catch (ex) {  
  241.                 console.log('---------输出日志,传入的内容传为JSON出现在异常--------------');  
  242.                 console.log(ex);  
  243.                 console.log('---------输出日志,内容为下--------------');  
  244.                 console.log(args);  
  245.             }  
  246.         };  
  247.   
  248.         /** 
  249.          * 判断输入的是否是手机号 
  250.          * @method __PhonePattern 
  251.          * @param {number} phone 手机号 
  252.          * @return {boolean} true 成功;false 失败 
  253.          * @example 
  254.          *  Utility.PhonePattern('13000100100'); 
  255.          * @private 
  256.          */  
  257.         var __PhonePattern = function (phone) {  
  258.             var ex = /^(13[0-9]|14[0-9]|15[0-9]|17[0-9]|18[0-9])\d{8}$/;  
  259.             return ex.test(phone);  
  260.         }  
  261.   
  262.         /** 
  263.          * 密码验证 
  264.          * @method __PasswordPattern 
  265.          * @param {string} password 密码 
  266.          * @return {boolean} true 成功;false 失败 
  267.          * @private 
  268.          */  
  269.         var __PasswordPattern = function (password) {  
  270.             //test("/^[_0-9a-z]{6,16}$/i");  
  271.             var ex = /^[_0-9a-zA-Z]{6,25}$/;  
  272.             return ex.test(password);  
  273.         }  
  274.   
  275.         /** 
  276.          * 是否含有中文(也包含日文和韩文) 
  277.          * @method __IsChineseChar 
  278.          * @param {string} str 要判断的内容 
  279.          * @return {boolean} true:成功;false:失败. 
  280.          * @private 
  281.          */  
  282.         var __IsChineseChar = function (str) {  
  283.             //var reg = !/^[\u4E00-\u9FA5]/g;    //\uF900-\uFA2D  
  284.             //return !/^[\u4e00-\u9fa5]+$/gi.test(str);//.test(str);  
  285.   
  286.             var regu = "^[\u4e00-\u9fa5]+$";  
  287.             var re = new RegExp(regu);  
  288.             return re.test(str);  
  289.         }  
  290.   
  291.         /** 
  292.          * 同理,是否含有全角符号的函数 
  293.          * @method __IsFullWidthChar 
  294.          * @param {string} str 要判断的内容 
  295.          * @return {boolean}  true:成功;false:失败. 
  296.          * @private 
  297.          */  
  298.         var __IsFullWidthChar = function (str) {  
  299.             var reg = /[\uFF00-\uFFEF]/;  
  300.             return reg.test(str);  
  301.         }  
  302.   
  303.   
  304.         /** 
  305.          * 常量 
  306.          * @class _Const 
  307.          * @type {{}} 
  308.          * @private 
  309.          */  
  310.         var _Const = {  
  311.             FromPageUrl: "XiaotuniFromPageName",//  
  312.             IsFirstStartApp: 'XiaotuniIsFirstStartApp'//是否是第一次启动APP  
  313.             LoadingHide: 'XiaotuniLoadingHide',      //隐藏加载  
  314.             Loading: 'XiaotuniLoading',    //显示加载  
  315.             LoadingDefined: "XiaotuniLoadingDefined",  
  316.             Alert: 'XiaotuniAlert',        //弹出对话框  
  317.             HomePage: 'tab.home.goods',        //跳到首页  
  318.             GoBack: 'XiaotuniGoBack',      //返回  
  319.             GoToPage: 'XiaotuniGoToPage',  //页面跳转  
  320.             GoHome: 'XiaotuniGoHome',      //转到tab的首页上去,  
  321.             ToPage: "XiaotuniToPage",      //这个是  
  322.             FromWhereEnterSearch: "XiaotuniFromWhereEnterSearch",//从哪个界面里进入搜索界面的。  
  323.   
  324.             CacheUserCartGoods: "XiaotuniCacheUserCartGoods"//用于临时保存当前购物袋里goodsId,amount。这主要用于首页,商品搜索页时显示数量用的。  
  325.             CacheUserHistorySearch: "XiaotuniCacheUserHistorySearch",//保存当前历史搜索记录  
  326.             CacheUserDefaultAddress: "XiaotuniCacheUserDefaultAddress",//用户默认地址  
  327.             CacheUserLatelySelectAddress: "XiaotuniCacheUserLatelySelectAddress",    //保存用户最近选中的地址。  
  328.             CartListShippingModel: 'XiaotuniCartListShippingModel',   //购物袋配送方式  
  329.             GifiCertificate: 'XiaotuniGifiCertificate',                //优惠券  
  330.             GoodsListSelect: 'XiaotuniGoodsListSelectIndex',          //当前选中商品标签搜索  
  331.             AddressInfo: 'XiaotuniAddressInfo',                         //地址信息  
  332.             AddressManagerSelectAddress: 'XiaotuniAddressManagerSelectAddress',//订单界面,当前选中的地址  
  333.             AddressManagerAddressList: 'XiaotuniAddressManagerAddressList',    //地址管理,所有地址信息  
  334.             PositionInfo: 'XiaotuniSavePositionInfo',                         //位置信息  
  335.             OrderDetail: 'XiaotuniOrderDetail',              //订单详情  
  336.             OrderStatusParam: "XiaotuniOrderStatusParam",//订单状态参数  
  337.             API_Locate: 'XiaotuniApiLocateResult',                            //本地位置定位  
  338.             API_CheckIn: 'XiaotuniApiCheckinResult',                          //登录  
  339.             API_Coupon: 'XiaotuniApiCoupon',                                   //优惠券  
  340.             API_Build: 'XiaotuniApiBuild',                                     //生成订单  
  341.             API_Order_Detail: 'XiaotuniApiOrderDetail',                       //订单明细  
  342.             API_Order_Total: 'XiaotuniApiOrderTotal',                         //订单统计  
  343.             API_Order_Status: 'XiaotuniApiOrderStatus',                       //订单统计  
  344.             API_TrolleySettle: 'XiaotuniApiTrolleySettle',                     //购物袋结算  
  345.             API_TrollerDelete: 'XiaotuniApiTrollerDelete',                    //删除购物袋  
  346.             API_TrollerDeleteError: 'XiaotuniApiTrollerDeleteError',         //删除购物袋  
  347.             API_TrollerDeleteComplete: 'XiaotuniApiTrollerDeleteComplete',  //删除购物袋  
  348.             API_Goods_Detail: 'XiaotuniApiGoodsDetail',                       //商品明细  
  349.             API_Address_Delete: 'XiaotuniApiAddressDelete',  
  350.             API_Version: "XiaotuniApiVersion",//版本信息  
  351.   
  352.             GetLocation: 'onXiaotuniGetLocation',                             //获取定位  
  353.             GetLocationComplete: 'onXiaotuniGetLocationComplete',           //定位完成  
  354.             GetLocationCompleteNotFound: "onXiaotuniGetLocationCompleteNotFound"//没有定位到商铺  
  355.             GetLocationError: 'onXiaotuniGetLocationError',                  //定位出错  
  356.             OnBarcodeScanner: 'onXiaotuniBarcodeScanner',                   //条码扫描  
  357.             OnActionSheet: "onXiaotuniActionSheet",     //弹出内容出来。  
  358.             OnGetUpdateTabsIconStatus: "onXiaotuniGetUpdateTabsIconStatus",//更新状态图标  
  359.             OnGetUpdateTabsIconStatusComplete: "onXiaotuniUpdateTabsIconStatusComplete",//更新状态图标  
  360.             OnImageLoadingComplete: "onXiaotuniImageLoadingComplete",//图片加截完成。  
  361.             OnUpdateSettle: "onXiaotuniUpdateSettle",  
  362.             OnEnterSearch: "onXiaotuniEnterSearch",//点击搜索的时候事件。  
  363.             OnOrderConfirm: "onXiaotuniOrderConfirm",//订单确认  
  364.             OnOrderCancel: "onXiaotuniOrderCancel",//订单取消  
  365.             OnGoodsDetailImage: "onXiaotuniGoodsDetailImage",//商品明细详情里的图片。  
  366.             OnOrderTotal: "onXiaotuniOrderTotal",//订单统计总数  
  367.             OnTralley: "onXiaotuniTralley",//  
  368.             OnVersion: "onXiaotuniVersion",//版本信息  
  369.             OnCloseInAppBrowser: "onXiaotuniCloseInAppBrowser",//关闭浏览器窗体  
  370.         }  
  371.   
  372.         
  373.         /** 
  374.          * 对Date的扩展,将 Date 转化为指定格式的String 
  375.          * 月(M)、日(d)、小时(h)、分(m)、秒(s)、季度(q) 可以用 1-2 个占位符, 
  376.          * 年(y)可以用 1-4 个占位符,毫秒(S)只能用 1 个占位符(是 1-3 位的数字) 
  377.          * @method __FormatDate 
  378.          * @param fmt 
  379.          * @param date 
  380.          * @return {*} 
  381.          * @example 
  382.          *  Utility.FormatDate("yyyy-MM-dd hh:mm:ss.S",new Date()); 
  383.          * @constructor 
  384.          */  
  385.         var __FormatDate = function (fmt, date) {  
  386.             var __this = new Date();  
  387.             if (null !== date) {  
  388.                 if (angular.isDate(date)) {  
  389.                     __this = date;  
  390.                 }  
  391.                 else {  
  392.                     try {  
  393.                         __this = new Date(date);  
  394.                     }  
  395.                     catch (ex) {  
  396.                         __this = new Date();  
  397.                     }  
  398.                 }  
  399.             }  
  400.             var o = {  
  401.                 "M+": __this.getMonth() + 1, //月份  
  402.                 "d+": __this.getDate(), //日  
  403.                 "H+": __this.getHours(), //小时  
  404.                 "m+": __this.getMinutes(), //分  
  405.                 "s+": __this.getSeconds(), //秒  
  406.                 "q+": Math.floor((__this.getMonth() + 3) / 3), //季度  
  407.                 "S": __this.getMilliseconds() //毫秒  
  408.             };  
  409.             if (/(y+)/.test(fmt)) {  
  410.                 var a = /(y+)/.test(fmt);  
  411.                 var fmt1 = fmt.replace(RegExp.$1, (__this.getFullYear() + "").substr(4 - RegExp.$1.length));  
  412.                 fmt = fmt1;  
  413.             }  
  414.   
  415.             for (var k in o) {  
  416.                 if (new RegExp("(" + k + ")").test(fmt)) {  
  417.                     fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));  
  418.                 }  
  419.             }  
  420.             return fmt;  
  421.         }  
  422.   
  423.         /** 
  424.          * 判断是第一次启动。位置是否已经定位了。 
  425.          * @method __JudgeIsFirstStartAndLocate 
  426.          * @private 
  427.          */  
  428.         var __JudgeIsFirstStartAndLocate = function () {  
  429.             var _IsFirstStartApp = _GetContent(_Const.IsFirstStartApp);  
  430.             if (null === _IsFirstStartApp) {  
  431.                 __Emit(_Const.ToPage, "startapp");  
  432.                 return;  
  433.             }  
  434.             var __location = _GetContent(_Const.API_Locate);  
  435.             if (null === __location) {  
  436.                 __Emit(_Const.ToPage, "location");  
  437.                 return;  
  438.             }  
  439.             return false;  
  440.         }  
  441.   
  442.         /** 
  443.          * 解析URL地址 
  444.          * @method __ParseURL 
  445.          *@param {string} url 完整的URL地址 
  446.          *@return {object} 自定义的对象 
  447.          *@example 
  448.          *  用法示例:var myURL = parseURL('http://abc.com:8080/dir/index.html?id=255&m=hello#top'); 
  449.          * myURL.file='index.html' 
  450.          * myURL.hash= 'top' 
  451.          * myURL.host= 'abc.com' 
  452.          * myURL.query= '?id=255&m=hello' 
  453.          * myURL.params= Object = { id: 255, m: hello } 
  454.          * myURL.path= '/dir/index.html' 
  455.          * myURL.segments= Array = ['dir', 'index.html'] 
  456.          * myURL.port= '8080' 
  457.          * yURL.protocol= 'http' 
  458.          * myURL.source= 'http://abc.com:8080/dir/index.html?id=255&m=hello#top' 
  459.          */  
  460.         var __ParseURL = function (url) {  
  461.             var a = document.createElement('a');  
  462.             a.href = url;  
  463.             return {  
  464.                 source: url,  
  465.                 protocol: a.protocol.replace(':'''),  
  466.                 host: a.hostname,  
  467.                 port: a.port,  
  468.                 query: a.search,  
  469.                 params: (function () {  
  470.                     var ret = {},  
  471.                         seg = a.search.replace(/^\?/, '').split('&'),  
  472.                         len = seg.length, i = 0, s;  
  473.                     for (; i < len; i++) {  
  474.                         if (!seg[i]) {  
  475.                             continue;  
  476.                         }  
  477.                         s = seg[i].split('=');  
  478.                         ret[s[0]] = s[1];  
  479.                     }  
  480.                     return ret;  
  481.                 })(),  
  482.                 file: (a.pathname.match(/\/([^\/?#]+)$/i) || [, ''])[1],  
  483.                 hash: a.hash.replace('#'''),  
  484.                 path: a.pathname.replace(/^([^\/])/, '/$1'),  
  485.                 relative: (a.href.match(/tps?:\/\/[^\/]+(.+)/) || [, ''])[1],  
  486.                 segments: a.pathname.replace(/^\//, '').split('/')  
  487.             };  
  488.         }  
  489.   
  490.         var _Browser = {  
  491.             versions: function () {  
  492.                 var u = navigator.userAgent, app = navigator.appVersion;  
  493.                 return {  
  494.                     trident: u.indexOf('Trident') > -1, //IE内核  
  495.                     presto: u.indexOf('Presto') > -1, //opera内核  
  496.                     webKit: u.indexOf('AppleWebKit') > -1, //苹果、谷歌内核  
  497.                     gecko: u.indexOf('Gecko') > -1 && u.indexOf('KHTML') == -1,//火狐内核  
  498.                     mobile: !!u.match(/AppleWebKit.*Mobile.*/), //是否为移动终端  
  499.                     ios: !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/), //ios终端  
  500.                     android: u.indexOf('Android') > -1 || u.indexOf('Adr') > -1, //android终端  
  501.                     iPhone: u.indexOf('iPhone') > -1, //是否为iPhone或者QQHD浏览器  
  502.                     iPad: u.indexOf('iPad') > -1, //是否iPad  
  503.                     webApp: u.indexOf('Safari') == -1, //是否web应该程序,没有头部与底部  
  504.                     weixin: u.indexOf('MicroMessenger') > -1, //是否微信 (2015-01-22新增)  
  505.                     qq: u.match(/\sQQ/i) == " qq" //是否QQ  
  506.                 };  
  507.             }(),  
  508.             language: (navigator.browserLanguage || navigator.language).toLowerCase()  
  509.         }  
  510.   
  511.   
  512.         var _UtilityService = {  
  513.             IsChineseChar: __IsChineseChar,//是否包含汉字  
  514.             IsFullWidthChar: __IsFullWidthChar,//是否包含全角符  
  515.             Emit: __Emit,            //事件  
  516.             Broadcast: __Broadcast,  //广播事件  
  517.             Alert: __Alert,          //弹出对话框  
  518.             PrintLog: __PrintLog,    //打印输入日志  
  519.             ConstItem: _Const,      //常量  
  520.             GetContent: _GetContent, //获取内容  
  521.             SetContent: _SetContent, //保存内容  
  522.             RemoveContent: __RemoveContent,//删除不要的内容  
  523.             TokenApi: _TokenApi,    //访问这些接口的时候要加token。  
  524.             ClearCacheData: __ClearCacheData,            //清空缓存数据  
  525.             ClearLocalStorage: __ClearLocalStorage,      //清空本地存储数据  
  526.             GetObjectPropertyValue: __GetObjectPropertyValue, //获取对象值  
  527.             PhonePattern: __PhonePattern,      //判断是否是手机号。  
  528.             PasswordPattern: __PasswordPattern,  //密码验证  
  529.             FormatDate: __FormatDate,   //格式化日期  
  530.             JudgeIsFirstStartAndLocate: __JudgeIsFirstStartAndLocate,//判断是第一启动和位置定位  
  531.             ParseURL: __ParseURL,  
  532.             XiaotuniVersion: __XiaotuniVersion,  
  533.         };  
  534.   
  535.         return _UtilityService;  
  536.     }])  

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值