hai_kits
Version:
1 lines • 3.83 kB
JavaScript
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("Kits",[],t):"object"==typeof exports?exports.Kits=t():e.Kits=t()}(self,(function(){return e={850:(e,t,r)=>{var n=r(813);e.exports=n},813:e=>{var t={randomInt:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return Math.floor(Math.random()*(t-e+1)+e)},formateDate:function(e){var t=e?new Date(e):new Date,r=t.getFullYear(),n=t.getMonth()+1,o=t.getDate(),a=t.getHours(),i=t.getMinutes(),u=t.getSeconds();return{year:r,month:n=n<10?"0"+n:n,day:o=o<10?"0"+o:o,hour:a=a<10?"0"+a:a,minute:i=i<10?"0"+i:i,second:u=u<10?"0"+u:u}},countDownDate:function(e){var t=parseInt(e%864e5/36e5),r=parseInt(e%36e5/6e4),n=parseInt(e%6e4/1e3),o=parseInt(e%1e3);return{hours:t=t<10?"0"+t:t,min:r=r<10?"0"+r:r,sec:n=n<10?"0"+n:n,millisec:o=o<10?"0"+o:o}},InitTime:function(e,t){var r,n,o=null,a=(new Date(e)-new Date(t))/1e3;return a<=0?"结束":(r=(r=Math.floor(a/60/60%24))<10?"0"+r:r)+":"+(n=(n=Math.floor(a/60%60))<10?"0"+n:n)+":"+(o=(o=Math.floor(a%60))<10?"0"+o:o)},primaryKey:function(){return Date.now()+""+t.randomInt(1e5,999999)},arrlevel:function(e,t,r){var n=[];return e.forEach((function(r,o){r.parentId==t&&(n.push(r),r.child=fn1(e,r.id))})),n},getSearchParams:function(){var e=location.search.substr(1).split("&");return e.forEach((function(t){e=t.split("="),prams[e[0]]=e[1]})),{}},setSaveMode:function(){return document.onkeydown=function(e){e.ctrlKey&&(67===e.key||86===e.key)&&(e.returnValue=!1),e.ctrlKey&&e.shiftKey&&73===e.key&&(e.returnValue=!1),123===e.key&&(e.returnValue=!1)},document.oncontextmenu=function(e){e.preventDefault()},document.querySelector("html").setAttribute("onselectstart","return false"),!0},setStore:function(e,t){e&&window.localStorage.setItem(e,JSON.stringify(t))},getStore:function(e){if(e)return"undefined"!==window.localStorage.getItem(e)?JSON.parse(window.localStorage.getItem(e)):null},removeStore:function(e){e&&window.localStorage.removeItem(e)},getRandomColor:function(){for(var e=[],t=0;t<3;++t){var r=Math.floor(256*Math.random()).toString(16);r=1===r.length?"0"+r:r,e.push(r)}return"#"+e.join("")},checkPhone:function(e){return/^((13|14|15|16|17|18|19)[0-9]{1}\d{8})$/.test(e)},isWeiXin:function(){return"micromessenger"==navigator.userAgent.toLowerCase().match(/MicroMessenger/i)},isWifi:function(){try{var e=!0,t=window.navigator.userAgent,r=window.navigator.connection;if(/MicroMessenger/.test(t)){if(t.indexOf("WIFI")>=0)return!0;e=!1}else if(r){var n=r.type;"wifi"!==n&&"2"!==n&&"unknown"!==n&&(e=!1)}return e}catch(e){return!1}},fistLetterUpper:function(e){return e.charAt(0).toUpperCase()+e.slice(1)},illegalFilter:function(e){return!/[`~!@#$%^&*()_+<>?:"{},.\/;'[\]]/im.test(e)&&!/[·!#¥(——):;“”‘、,|《。》?、【】[\]]/im.test(e)},moneyturn:function(e){var t=["角","分"],r=["零","壹","贰","叁","肆","伍","陆","柒","捌","玖"],n=[["元","万","亿"],["","拾","佰","仟"]],o=e<0?"欠":"";e=Math.abs(e);for(var a="",i=0;i<t.length;i++)a+=(r[Math.floor(10*e*Math.pow(10,i))%10]+t[i]).replace(/零./,"");for(a=a||"",e=Math.floor(e),i=0;i<n[0].length&&e>0;i++){for(var u="",c=0;c<n[1].length&&e>0;c++)u=r[e%10]+n[1][c]+u,e=Math.floor(e/10);a=u.replace(/(零.)*零$/,"").replace(/^$/,"零")+n[0][i]+a}return o+a.replace(/(零.)*零元/,"元").replace(/(零.)+/g,"零").replace(/^整$/,"零元")},toDx:function(e){var t={0:"零",1:"壹",2:"贰",3:"叁",4:"肆",5:"伍",6:"陆",7:"柒",8:"捌",9:"玖",x:"拾",X:"拾"},r="";return e.split("").forEach((function(e){r+=t[e]})),r}};e.exports=t}},t={},function r(n){var o=t[n];if(void 0!==o)return o.exports;var a=t[n]={exports:{}};return e[n](a,a.exports,r),a.exports}(850);var e,t}));