/***检查字符串是否包含特殊字符*@param{String}newName待检查的字符串*@return{Boolean}false|true返回一个布尔值*/exportconsthasSpecialChar=function(newName){letregEn=/[`~!@#$%^&*()_+<>?:"{},.\/;'[\]]/im,regCn=/[·!#¥(——):;""',,|《。》?,【】[\]]/im;if(regEn.test(newName)||regCn.test(newName)){returntrue;}else{returnfalse;}}/***检查字符串是否为空[nullundefined'']三种情况*@param{String}str待检查字符串*@return{Boolean}false|true返回一个布尔值*/exportconstisEmpty=function(str){if(str===null||str===undefined||str===""){returntrue}else{returnfalse}}/***removestringhtmltag*@param{String}str待处理字符串*@return{String}result返回处理后的字符串*/exportconstremoveHtmlTag=function(str){returnstr.replace(/<.*?>/ig,"");}/***对url路径中的json参数进行编码*@param{Object}paramObj需要转换的json对象*@return{String}paramStr返回处理后的json字符串*/exportconstencodeURIParams=function(paramObj){returnencodeURIComponent(JSON.stringify(paramObj))}/***解码url路径中的json参数*@param{String}paramStr待处理的json字符串*@return{Object}paramObj返回转换jsonobject*/exportconstdecodeURIParams=function(paramStr){returnJSON.parse(decodeURIComponent(paramStr))}/***生成一个随机整数,包括下限值,但不包括上限值*@param{Number}lowerlowerlimit*@param{Number}upperupperlimit*@return{Number}返回一个介于下限和上限之间的随机整数*/exportconstrandom=function(lower,upper){returnMath.floor(Math.random()*(上-下))+下;}
