js_ryl 1.0.26 → 1.0.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -26,20 +26,17 @@
26
26
 
27
27
  #1.正则表达式 -- reg
28
28
 
29
- Email() #邮箱
30
29
  Phone() #手机
30
+ Email() #邮箱
31
31
  IdCard() #身份证号码
32
32
  Common() #只能包含数字、字母以及下划线
33
33
  QQ() #QQ
34
34
  Money() #金额
35
+ imgUrl() #图片路径是否包含了base64
36
+ verChinese() #是否包含中文
35
37
 
36
38
  # 使用方法
37
- # 第一个参数是值,第二个参数(提示输入,可不填),三个参数(错误后的提示,可不填),第二三个参数有默认值
38
- reg.Phone(this.name,'请输入...','完犊子').then(()=>{
39
- console.log('成功')
40
- }).catch(e=>{
41
- console.log(e)
42
- })
39
+ reg.Phone(this.phone); 返回true or false
43
40
 
44
41
 
45
42
  #2.时间戳与时间的转化 -- time
@@ -180,8 +177,8 @@
180
177
  #13.商品飞入购物车效果
181
178
 
182
179
  # 方法:
183
- flyToCart(event,image,targets)
184
- # event 目标元素,image 缩略图,targets 购物车的位置
180
+ flyToCart(event,image,targets,()=>{})
181
+ # event 目标元素,image 缩略图,targets 购物车的位置,callback 回调(有需要才用)
185
182
  # 如:flyToCart(event,'https://v2-saas-1259468876.cos.ap-shanghai.myqcloud.com//system//admin//7c7ec8b02b009d2385db1faae95b9ab0.png',document.querySelector('#shoppps'))
186
183
 
187
184
 
@@ -205,7 +202,7 @@
205
202
  #1.0.21: number精度问题优化
206
203
  #1.0.22: 数据补全方法优化
207
204
  #1.0.25: 新增了emoji,highLight方法
208
- #1.0.26: 商品飞入购物车效果
205
+ #1.0.28: 商品飞入购物车效果
209
206
  ```
210
207
 
211
208
  For detailed explanation on how things work, consult the [docs for vue-loader](http://vuejs.github.io/vue-loader).
package/dist/build.js CHANGED
@@ -1 +1 @@
1
- !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("js_ryl",[],e):"object"==typeof exports?exports.js_ryl=e():t.js_ryl=e()}("undefined"!=typeof self?self:this,function(){return function(t){function e(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,e),o.l=!0,o.exports}var n={};return e.m=t,e.c=n,e.d=function(t,n,r){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:r})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="/dist/",e(e.s=0)}([function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(1),o=n(2),i=n(3),a=n(4),u=n(5),c=n(6),s=n(7),l=n(8),f=n(9),d=n(10),v=n(11),p=n(12),h=n(13);e.default={reg:r.a,time:o.a,cookie:i.a,fun:a.a,num:u.a,copy:c.a,deepCopy:s.a,verCode:l.a,filterTable:f.a,getMonthDays:d.a,emoji:v.a,highLight:p.a,flyToCart:h.a}},function(t,e,n){"use strict";var r={Phone:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"请输入手机号码",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"手机号码格式有误";return new Promise(function(r,o){var i=/^[1][3,4,5,6,7,8,9][0-9]{9}$/;t?i.test(t)?r():o(n):o(e)})},Email:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"请输入邮箱",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"邮箱格式有误";return new Promise(function(r,o){var i=/^([0-9A-Za-z\-_\.]+)@([0-9a-z]+\.[a-z]{2,3}(\.[a-z]{2})?)$/g;t?i.test(t)?r():o(n):o(e)})},IdCard:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"请输入身份证号码",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"身份证号码格式有误";return new Promise(function(r,o){var i=/(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/;t?i.test(t)?r():o(n):o(e)})},Common:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"请输入包含数字、字母以及下划线的内容",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"只能包含数字、字母以及下划线";return new Promise(function(r,o){var i=/^[a-zA-Z0-9_]+$/;t?i.test(t)?r():o(n):o(e)})},QQ:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"请输入QQ号码",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"QQ号码格式错误";return new Promise(function(r,o){var i=/^[1-9][0-9]{4,10}$/gim;t?i.test(t)?r():o(n):o(e)})},Money:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"请输入金额(最多保留2位小数点)",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"金额格式错误";return new Promise(function(r,o){var i=/(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/;t?i.test(t)?r():o(n):o(e)})}};e.a=r},function(t,e,n){"use strict";function r(t){return t<10?"0"+t:t}var o={toDate:function(t,e){var n="";n=10==String(t).length?new Date(1e3*t):new Date(t);var o=n.getFullYear(),i=n.getMonth()+1,a=n.getDate(),u=n.getHours(),c=n.getMinutes(),s=n.getSeconds();return"yyyy-MM-dd"==e?o+"-"+r(i)+"-"+r(a):"yyyy-MM-dd HH:mm"==e?o+"-"+r(i)+"-"+r(a)+" "+r(u)+":"+r(c):o+"-"+r(i)+"-"+r(a)+" "+r(u)+":"+r(c)+":"+r(s)},toStamp:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Date,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10,n=new Date(t.replace(/-/g,"/")).getTime().toString();return 10==e&&(n=n.substr(0,10)),parseInt(n)},getNow:function(){var t=(new Date).getTime();return o.toDate(t)}};e.a=o},function(t,e,n){"use strict";var r={set:function(t,e,n){n=n||{};var r=n.path?";Path="+n.path:"",o="";if(n.domain&&"domain"==n.domain){o=";domain="+window.location.hostname.split(".").slice(-2).join(".")}var i="";if(n.expires){i=";expires="+(10==String(n.expires).length?new Date(1e3*n.expires):new Date(n.expires)).toGMTString()}document.cookie=t+"="+encodeURIComponent(e)+o+r+i},get:function(t){var e="; "+document.cookie,n=e.split("; "+t+"=");return 2===n.length?decodeURIComponent(n.pop().split(";").shift()):null},remove:function(t,e){e=e||{},e.expires=-1,r.set(t,null,e)}};e.a=r},function(t,e,n){"use strict";var r={throole:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:500,n=0;return function(){var r=this,o=Date.now();o-n>e&&(t.call(r,arguments),n=o)}},debounce:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:500,n=null;return function(){var r=arguments,o=this;clearTimeout(n),n=setTimeout(function(){t.apply(o,r)},e)}}};e.a=r},function(t,e,n){"use strict";function r(t){return Math.floor(100*t)===100*t}var o=function(t){var e=0;try{t=Number(t);var n=t.toString().toUpperCase();if(2===n.split("E").length){var r=!1;2===n.split(".").length&&(n=n.split(".")[1],0!==parseInt(n.split("E")[0])&&(r=!0));var o=n.split("E");r&&(e=o[0].length),e-=parseInt(o[1])}else 2===n.split(".").length&&0!==parseInt(n.split(".")[1])&&(e=n.split(".")[1].length)}catch(t){throw t}finally{return(isNaN(e)||e<0)&&(e=0),e}},i=function(t){t=Number(t);var e=o(t),n=t.toString().toUpperCase();return 2===n.split("E").length?Math.round(t*Math.pow(10,e)):Number(n.replace(".",""))},a=function(t,e,n,o){var i=0;switch(t){case"add":i=e+n;break;case"sub":i=e-n;break;case"div":i=e/n;break;case"mul":i=e*n}return Math.abs(o-i)>1?i:(r(o)||(o=Number(o.toFixed(2))),o)},u={NumFilter:function(t){var e=String(t).indexOf(".")+1,n=String(t).length-e;return n>0&&n>=3&&(t=Math.floor(100*t)/100),t},add:function(t,e){t=this.NumFilter(Number(t)),e=this.NumFilter(Number(e));var n,r,i;try{n=o(t)+1}catch(t){n=0}try{r=o(e)+1}catch(t){r=0}i=Math.pow(10,Math.max(n,r));var u=(this.mul(t,i)+this.mul(e,i))/i;return a("add",t,e,u)},sub:function(t,e){t=this.NumFilter(Number(t)),e=this.NumFilter(Number(e));var n,r,i;try{n=o(t)+1}catch(t){n=0}try{r=o(e)+1}catch(t){r=0}i=Math.pow(10,Math.max(n,r));var u=Number((this.mul(t,i)-this.mul(e,i))/i);return a("sub",t,e,u)},div:function(t,e){t=Number(t),e=Number(e);var n,r,u=0,c=0;try{u=o(t)}catch(t){}try{c=o(e)}catch(t){}n=i(t),r=i(e);var s=this.mul(n/r,Math.pow(10,c-u));return a("div",t,e,s)},mul:function(t,e){t=Number(t),e=Number(e);var n=0,r=t.toString(),u=e.toString();try{n+=o(r)}catch(t){}try{n+=o(u)}catch(t){}var c=i(r)*i(u)/Math.pow(10,n);return a("mul",t,e,c)}};e.a=u},function(t,e,n){"use strict";function r(t,e){var n=document.createElement("input");n.setAttribute("readonly","readonly"),n.setAttribute("value",t),document.body.appendChild(n),document.execCommand("copy")?(n.select(),document.execCommand("copy"),e({code:200,msg:"复制成功"})):e({code:100,msg:"当前浏览器不支持,请更换浏览器后重试"}),document.body.removeChild(n)}e.a=r},function(t,e,n){"use strict";function r(t,e){var n=t||{};for(var i in e)"object"===o(e[i])?(n[i]=e[i].constructor===Array?[]:{},r(n[i],e[i])):n[i]=e[i];return n}e.a=r;var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t}},function(t,e,n){"use strict";var r=!1,o=null,i="",a=null,u={PhoneCode:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:60,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"后重新获取";if(i=t.target.innerText,a=t,!r){r=!0,t.target.innerText=n-1+"s"+u;var c=n-1;o=setInterval(function(){c--,c<=0?(t.target.innerText=i,e.PhoneCodeClear()):t.target.innerText=c+"s"+u},1e3)}},PhoneCodeClear:function(){r=!1,a&&(a.target.innerText=i),clearInterval(o)},phoneCodeStatus:function(){return r}};e.a=u},function(t,e,n){"use strict";function r(t){if(Array.isArray(t)){for(var e=0,n=Array(t.length);e<t.length;e++)n[e]=t[e];return n}return Array.from(t)}function o(t){return i.some(function(e){return e===t})}var i=["",void 0,null],a=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"--",n=arguments[2];n&&n.length&&(i=[].concat(r(i),r(n)));var a=[];for(var u in t){for(var c={},s=Object.entries(t[u]),l=0;l<s.length;l++){var f=s[l];o(f[1])&&(f[1]=e),c[f[0]]=f[1]}a.push(c)}return a};e.a=a},function(t,e,n){"use strict";var r=function(t,e){return new Date(t,e,0).getDate()};e.a=r},function(t,e,n){"use strict";function r(t){var e=/U\+([0-9A-Fa-f]{4,6})|\[u\+([0-9A-Fa-f]{4,6})\]|\\u\{([0-9A-Fa-f]{4,6})\}/g;return t?t.replace(e,function(t,e,n,r){var a=e||n||r,u=parseInt(a,16);if(isNaN(u)||u<0||u>1114111)return t;try{var c=String.fromCodePoint(u);return o(u)?c:i(c)?c:t}catch(e){return t}}):t}function o(t){return u.some(function(e){var n=a(e,2),r=n[0],o=n[1];return t>=r&&t<=o})}function i(t){return"�"!==t}e.a=r;var a=function(){function t(t,e){var n=[],r=!0,o=!1,i=void 0;try{for(var a,u=t[Symbol.iterator]();!(r=(a=u.next()).done)&&(n.push(a.value),!e||n.length!==e);r=!0);}catch(t){o=!0,i=t}finally{try{!r&&u.return&&u.return()}finally{if(o)throw i}}return n}return function(e,n){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),u=[[8986,8987],[9193,9196],[9200,9200],[9203,9203],[9642,9643],[9654,9654],[9664,9664],[9723,9726],[9728,9732],[9742,9742],[9745,9745],[9748,9749],[9752,9752],[9757,9757],[9760,9760],[9762,9763],[9766,9766],[9770,9770],[9774,9775],[9784,9786],[9792,9792],[9794,9794],[9800,9811],[9823,9824],[9827,9827],[9829,9830],[9832,9832],[9851,9851],[9855,9855],[9874,9879],[9881,9881],[9883,9884],[9888,9889],[9898,9899],[9904,9905],[9917,9918],[9924,9925],[9928,9928],[9934,9935],[9937,9937],[9939,9940],[9961,9962],[9968,9973],[9975,9978],[9981,9981],[9986,9986],[9989,9989],[9992,9997],[9999,9999],[10002,10002],[10004,10004],[10006,10006],[10013,10013],[10017,10017],[10024,10024],[10035,10036],[10052,10052],[10055,10055],[10060,10060],[10062,10062],[10067,10069],[10071,10071],[10083,10084],[10133,10135],[10145,10145],[10160,10160],[10175,10175],[10548,10549],[11013,11015],[11035,11036],[11088,11088],[11093,11093],[126980,126980],[127183,127183],[127344,127345],[127358,127359],[127374,127374],[127377,127386],[127462,127487],[127489,127490],[127514,127514],[127535,127535],[127538,127546],[127568,127569],[127744,128511],[128512,128591],[128640,128767],[128768,128895],[128896,129023],[129024,129279],[129280,129535],[129536,129647],[129648,129791],[129792,130047]]},function(t,e,n){"use strict";function r(t,e,n){if(console.log(t,e,n,"//"),!t)return e;var r=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),o=new RegExp("("+r+")","gi");return e.replace(o,'<span class="'+n+'">$1</span>')}e.a=r},function(t,e,n){"use strict";function r(t,e,n){var r=t.target,o=document.createElement("img");o.style.cssText="position: fixed;\n width: 20px;\n height: 20px;\n border-radius: 50%;\n pointer-events: none;\n transition: transform 0.8s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.8s;\n z-index: 10000;\n opacity: 1;\n transform-origin: center center;",o.setAttribute("src",e),document.body.appendChild(o);var i=r.getBoundingClientRect(),a=i.left+i.width/2,u=i.top+i.height/2,c=n.getBoundingClientRect(),s=c.left+c.width/2,l=c.top+c.height/2,f=(a+s)/2,d=Math.min(u,l)-150;o.style.left=a+"px",o.style.top=u+"px";var v=0,p=performance.now(),h=function t(e){(v=(e-p)/800)>1&&(v=1);var n=(1-v)*(1-v)*a+2*(1-v)*v*f+v*v*s,r=(1-v)*(1-v)*u+2*(1-v)*v*d+v*v*l;o.style.left=n+"px",o.style.top=r+"px",o.style.transform="scale("+(1-.7*v)+")",o.style.opacity=""+(1-v),v<1&&requestAnimationFrame(t)};requestAnimationFrame(h)}e.a=r}])});
1
+ !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("js_ryl",[],e):"object"==typeof exports?exports.js_ryl=e():t.js_ryl=e()}("undefined"!=typeof self?self:this,function(){return function(t){function e(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,e),o.l=!0,o.exports}var n={};return e.m=t,e.c=n,e.d=function(t,n,r){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:r})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="/dist/",e(e.s=0)}([function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(1),o=n(2),i=n(3),a=n(4),u=n(5),c=n(6),s=n(7),l=n(8),f=n(9),p=n(10),d=n(11),m=n(12),h=n(13);e.default={reg:r.a,time:o.a,cookie:i.a,fun:a.a,num:u.a,copy:c.a,deepCopy:s.a,verCode:l.a,filterTable:f.a,getMonthDays:p.a,emoji:d.a,highLight:m.a,flyToCart:h.a}},function(t,e,n){"use strict";var r={Phone:function(t){return/^[1][3,4,5,6,7,8,9][0-9]{9}$/.test(t)},Email:function(t){return/^([0-9A-Za-z\-_\.]+)@([0-9a-z]+\.[a-z]{2,3}(\.[a-z]{2})?)$/g.test(t)},IdCard:function(t){return/(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/.test(t)},Common:function(t){return/^[a-zA-Z0-9_]+$/.test(t)},QQ:function(t){return/^[1-9][0-9]{4,10}$/gim.test(t)},Money:function(t){return/(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/.test(t)},imgUrl:function(t){return/^\s*data:([a-z]+\/[a-z0-9-+.]+(;[a-z-]+=[a-z0-9-]+)?)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s]*?)\s*$/i.test(t)},verChinese:function(t){return/[\u4e00-\u9fa5]/.test(t)}};e.a=r},function(t,e,n){"use strict";function r(t){return t<10?"0"+t:t}var o={toDate:function(t,e){var n="";n=10==String(t).length?new Date(1e3*t):new Date(t);var o=n.getFullYear(),i=n.getMonth()+1,a=n.getDate(),u=n.getHours(),c=n.getMinutes(),s=n.getSeconds();return"yyyy-MM-dd"==e?o+"-"+r(i)+"-"+r(a):"yyyy-MM-dd HH:mm"==e?o+"-"+r(i)+"-"+r(a)+" "+r(u)+":"+r(c):o+"-"+r(i)+"-"+r(a)+" "+r(u)+":"+r(c)+":"+r(s)},toStamp:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Date,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10,n=new Date(t.replace(/-/g,"/")).getTime().toString();return 10==e&&(n=n.substr(0,10)),parseInt(n)},getNow:function(){var t=(new Date).getTime();return o.toDate(t)}};e.a=o},function(t,e,n){"use strict";var r={set:function(t,e,n){n=n||{};var r=n.path?";Path="+n.path:"",o="";if(n.domain&&"domain"==n.domain){o=";domain="+window.location.hostname.split(".").slice(-2).join(".")}var i="";if(n.expires){i=";expires="+(10==String(n.expires).length?new Date(1e3*n.expires):new Date(n.expires)).toGMTString()}document.cookie=t+"="+encodeURIComponent(e)+o+r+i},get:function(t){var e="; "+document.cookie,n=e.split("; "+t+"=");return 2===n.length?decodeURIComponent(n.pop().split(";").shift()):null},remove:function(t,e){e=e||{},e.expires=-1,r.set(t,null,e)}};e.a=r},function(t,e,n){"use strict";var r={throole:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:500,n=0;return function(){var r=this,o=Date.now();o-n>e&&(t.call(r,arguments),n=o)}},debounce:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:500,n=null;return function(){var r=arguments,o=this;clearTimeout(n),n=setTimeout(function(){t.apply(o,r)},e)}}};e.a=r},function(t,e,n){"use strict";function r(t){return Math.floor(100*t)===100*t}var o=function(t){var e=0;try{t=Number(t);var n=t.toString().toUpperCase();if(2===n.split("E").length){var r=!1;2===n.split(".").length&&(n=n.split(".")[1],0!==parseInt(n.split("E")[0])&&(r=!0));var o=n.split("E");r&&(e=o[0].length),e-=parseInt(o[1])}else 2===n.split(".").length&&0!==parseInt(n.split(".")[1])&&(e=n.split(".")[1].length)}catch(t){throw t}finally{return(isNaN(e)||e<0)&&(e=0),e}},i=function(t){t=Number(t);var e=o(t),n=t.toString().toUpperCase();return 2===n.split("E").length?Math.round(t*Math.pow(10,e)):Number(n.replace(".",""))},a=function(t,e,n,o){var i=0;switch(t){case"add":i=e+n;break;case"sub":i=e-n;break;case"div":i=e/n;break;case"mul":i=e*n}return Math.abs(o-i)>1?i:(r(o)||(o=Number(o.toFixed(2))),o)},u={NumFilter:function(t){var e=String(t).indexOf(".")+1,n=String(t).length-e;return n>0&&n>=3&&(t=Math.floor(100*t)/100),t},add:function(t,e){t=this.NumFilter(Number(t)),e=this.NumFilter(Number(e));var n,r,i;try{n=o(t)+1}catch(t){n=0}try{r=o(e)+1}catch(t){r=0}i=Math.pow(10,Math.max(n,r));var u=(this.mul(t,i)+this.mul(e,i))/i;return a("add",t,e,u)},sub:function(t,e){t=this.NumFilter(Number(t)),e=this.NumFilter(Number(e));var n,r,i;try{n=o(t)+1}catch(t){n=0}try{r=o(e)+1}catch(t){r=0}i=Math.pow(10,Math.max(n,r));var u=Number((this.mul(t,i)-this.mul(e,i))/i);return a("sub",t,e,u)},div:function(t,e){t=Number(t),e=Number(e);var n,r,u=0,c=0;try{u=o(t)}catch(t){}try{c=o(e)}catch(t){}n=i(t),r=i(e);var s=this.mul(n/r,Math.pow(10,c-u));return a("div",t,e,s)},mul:function(t,e){t=Number(t),e=Number(e);var n=0,r=t.toString(),u=e.toString();try{n+=o(r)}catch(t){}try{n+=o(u)}catch(t){}var c=i(r)*i(u)/Math.pow(10,n);return a("mul",t,e,c)}};e.a=u},function(t,e,n){"use strict";function r(t,e){var n=document.createElement("input");n.setAttribute("readonly","readonly"),n.setAttribute("value",t),document.body.appendChild(n),document.execCommand("copy")?(n.select(),document.execCommand("copy"),e({code:200,msg:"复制成功"})):e({code:100,msg:"当前浏览器不支持,请更换浏览器后重试"}),document.body.removeChild(n)}e.a=r},function(t,e,n){"use strict";function r(t,e){var n=t||{};for(var i in e)"object"===o(e[i])?(n[i]=e[i].constructor===Array?[]:{},r(n[i],e[i])):n[i]=e[i];return n}e.a=r;var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t}},function(t,e,n){"use strict";var r=!1,o=null,i="",a=null,u={PhoneCode:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:60,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"后重新获取";if(i=t.target.innerText,a=t,!r){r=!0,t.target.innerText=n-1+"s"+u;var c=n-1;o=setInterval(function(){c--,c<=0?(t.target.innerText=i,e.PhoneCodeClear()):t.target.innerText=c+"s"+u},1e3)}},PhoneCodeClear:function(){r=!1,a&&(a.target.innerText=i),clearInterval(o)},phoneCodeStatus:function(){return r}};e.a=u},function(t,e,n){"use strict";function r(t){if(Array.isArray(t)){for(var e=0,n=Array(t.length);e<t.length;e++)n[e]=t[e];return n}return Array.from(t)}function o(t){return i.some(function(e){return e===t})}var i=["",void 0,null],a=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"--",n=arguments[2];n&&n.length&&(i=[].concat(r(i),r(n)));var a=[];for(var u in t){for(var c={},s=Object.entries(t[u]),l=0;l<s.length;l++){var f=s[l];o(f[1])&&(f[1]=e),c[f[0]]=f[1]}a.push(c)}return a};e.a=a},function(t,e,n){"use strict";var r=function(t,e){return new Date(t,e,0).getDate()};e.a=r},function(t,e,n){"use strict";function r(t){var e=/U\+([0-9A-Fa-f]{4,6})|\[u\+([0-9A-Fa-f]{4,6})\]|\\u\{([0-9A-Fa-f]{4,6})\}/g;return t?t.replace(e,function(t,e,n,r){var a=e||n||r,u=parseInt(a,16);if(isNaN(u)||u<0||u>1114111)return t;try{var c=String.fromCodePoint(u);return o(u)?c:i(c)?c:t}catch(e){return t}}):t}function o(t){return u.some(function(e){var n=a(e,2),r=n[0],o=n[1];return t>=r&&t<=o})}function i(t){return"�"!==t}e.a=r;var a=function(){function t(t,e){var n=[],r=!0,o=!1,i=void 0;try{for(var a,u=t[Symbol.iterator]();!(r=(a=u.next()).done)&&(n.push(a.value),!e||n.length!==e);r=!0);}catch(t){o=!0,i=t}finally{try{!r&&u.return&&u.return()}finally{if(o)throw i}}return n}return function(e,n){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),u=[[8986,8987],[9193,9196],[9200,9200],[9203,9203],[9642,9643],[9654,9654],[9664,9664],[9723,9726],[9728,9732],[9742,9742],[9745,9745],[9748,9749],[9752,9752],[9757,9757],[9760,9760],[9762,9763],[9766,9766],[9770,9770],[9774,9775],[9784,9786],[9792,9792],[9794,9794],[9800,9811],[9823,9824],[9827,9827],[9829,9830],[9832,9832],[9851,9851],[9855,9855],[9874,9879],[9881,9881],[9883,9884],[9888,9889],[9898,9899],[9904,9905],[9917,9918],[9924,9925],[9928,9928],[9934,9935],[9937,9937],[9939,9940],[9961,9962],[9968,9973],[9975,9978],[9981,9981],[9986,9986],[9989,9989],[9992,9997],[9999,9999],[10002,10002],[10004,10004],[10006,10006],[10013,10013],[10017,10017],[10024,10024],[10035,10036],[10052,10052],[10055,10055],[10060,10060],[10062,10062],[10067,10069],[10071,10071],[10083,10084],[10133,10135],[10145,10145],[10160,10160],[10175,10175],[10548,10549],[11013,11015],[11035,11036],[11088,11088],[11093,11093],[126980,126980],[127183,127183],[127344,127345],[127358,127359],[127374,127374],[127377,127386],[127462,127487],[127489,127490],[127514,127514],[127535,127535],[127538,127546],[127568,127569],[127744,128511],[128512,128591],[128640,128767],[128768,128895],[128896,129023],[129024,129279],[129280,129535],[129536,129647],[129648,129791],[129792,130047]]},function(t,e,n){"use strict";function r(t,e,n){if(console.log(t,e,n,"//"),!t)return e;var r=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),o=new RegExp("("+r+")","gi");return e.replace(o,'<span class="'+n+'">$1</span>')}e.a=r},function(t,e,n){"use strict";function r(t,e,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:function(){},o=t.target,i=document.createElement("img");i.style.cssText="position: fixed;\n width: 20px;\n height: 20px;\n border-radius: 50%;\n pointer-events: none;\n transition: transform 0.8s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.8s;\n z-index: 10000;\n opacity: 1;\n transform-origin: center center;",i.setAttribute("src",e),document.body.appendChild(i);var a=o.getBoundingClientRect(),u=a.left+a.width/2,c=a.top+a.height/2,s=n.getBoundingClientRect(),l=s.left+s.width/2,f=s.top+s.height/2,p=(u+l)/2,d=Math.min(c,f)-150;i.style.left=u+"px",i.style.top=c+"px";var m=0,h=performance.now(),v=function t(e){(m=(e-h)/800)>1&&(m=1);var n=(1-m)*(1-m)*u+2*(1-m)*m*p+m*m*l,o=(1-m)*(1-m)*c+2*(1-m)*m*d+m*m*f;i.style.left=n+"px",i.style.top=o+"px",i.style.transform="scale("+(1-.7*m)+")",i.style.opacity=""+(1-m),m<1?requestAnimationFrame(t):(i.remove(),r())};requestAnimationFrame(v)}e.a=r}])});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "js_ryl",
3
- "version": "1.0.26",
3
+ "version": "1.0.28",
4
4
  "private": false,
5
5
  "description": "自定义通用js",
6
6
  "author": "renyuliang <785788909@qq.com>",
package/src/App.vue CHANGED
@@ -1,5 +1,11 @@
1
1
  <template>
2
2
  <div id="app">
3
+ <input
4
+ type="text"
5
+ id="input"
6
+ v-model="namePhone"
7
+ @input="sdfl"
8
+ />
3
9
  <input
4
10
  type="text"
5
11
  id="input"
@@ -55,6 +61,7 @@ export default {
55
61
  data() {
56
62
  return {
57
63
  name: "",
64
+ namePhone: '',
58
65
  highLightContent: '234234234234',
59
66
  list: [
60
67
  {
@@ -150,7 +157,9 @@ export default {
150
157
  },
151
158
  methods: {
152
159
  shopToCart(event){
153
- flyToCart(event,'https://v2-saas-1259468876.cos.ap-shanghai.myqcloud.com//system//admin//7c7ec8b02b009d2385db1faae95b9ab0.png',document.querySelector('#shoppps'))
160
+ flyToCart(event,'https://v2-saas-1259468876.cos.ap-shanghai.myqcloud.com//system//admin//7c7ec8b02b009d2385db1faae95b9ab0.png',document.querySelector('#shoppps'),()=>{
161
+ console.log(1)
162
+ })
154
163
  },
155
164
  setHighLight:highLight,
156
165
  phoneCode(e){
@@ -186,12 +195,11 @@ export default {
186
195
  getCookie() {
187
196
  console.log(cookie.get("test2"));
188
197
  },
198
+ sdfl(){
199
+ console.log(reg.verChinese(this.namePhone))
200
+ },
189
201
  inputBlur() {
190
- reg.Email(this.name,'请是是是','完犊子').then(()=>{
191
- console.log('成功')
192
- }).catch(e=>{
193
- console.log(e)
194
- })
202
+ console.log(reg.Email(this.name))
195
203
  // const regPhone = reg.Phone(this.name);
196
204
  // console.log(regPhone,'regPhone')
197
205
  // if (regPhone == true) {
@@ -1,6 +1,6 @@
1
1
  // 飞入购物车效果
2
- // event 目标元素,image 缩略图,targets 购物车的位置
3
- export default function flyToCart(event,image,targets) {
2
+ // event 目标元素,image 缩略图,targets 购物车的位置,callback 回调
3
+ export default function flyToCart(event,image,targets,callback=()=>{}) {
4
4
  const button = event.target
5
5
  // 创建商品图片
6
6
  const flyEl = document.createElement('img')
@@ -59,8 +59,9 @@ export default function flyToCart(event,image,targets) {
59
59
  if (t < 1) {
60
60
  requestAnimationFrame(animate)
61
61
  } else {
62
- // 动画结束,移除元素
63
- // flyEl.remove()
62
+ // 动画结束,移除元素
63
+ flyEl.remove()
64
+ callback()
64
65
  }
65
66
  }
66
67
  requestAnimationFrame(animate)
package/src/reg/index.js CHANGED
@@ -1,114 +1,44 @@
1
1
  // 正则匹配
2
2
  let reg = {
3
3
  // 手机号验证
4
- Phone(
5
- value,
6
- noValueMsg = "请输入手机号码",
7
- errValueMsg = "手机号码格式有误"
8
- ) {
9
- return new Promise((resolve,reject)=>{
10
- let reg = /^[1][3,4,5,6,7,8,9][0-9]{9}$/;
11
- if (value) {
12
- if (reg.test(value)) {
13
- resolve()
14
- } else {
15
- reject(errValueMsg)
16
- }
17
- } else {
18
- reject(noValueMsg)
19
- }
20
- })
4
+ Phone(value) {
5
+ let reg = /^[1][3,4,5,6,7,8,9][0-9]{9}$/;
6
+ return reg.test(value)
21
7
  },
22
8
  // 邮箱验证
23
- Email(value, noValueMsg = "请输入邮箱", errValueMsg = "邮箱格式有误") {
24
- return new Promise((resolve,reject)=>{
25
- let reg = /^([0-9A-Za-z\-_\.]+)@([0-9a-z]+\.[a-z]{2,3}(\.[a-z]{2})?)$/g;
26
- if (value) {
27
- if (reg.test(value)) {
28
- resolve()
29
- } else {
30
- reject(errValueMsg)
31
- }
32
- } else {
33
- reject(noValueMsg)
34
- }
35
- })
9
+ Email(value) {
10
+ let reg = /^([0-9A-Za-z\-_\.]+)@([0-9a-z]+\.[a-z]{2,3}(\.[a-z]{2})?)$/g;
11
+ return reg.test(value)
36
12
  },
37
13
  // 身份证号码验证
38
- IdCard(
39
- value,
40
- noValueMsg = "请输入身份证号码",
41
- errValueMsg = "身份证号码格式有误"
42
- ) {
43
- return new Promise((resolve,reject)=>{
44
- let reg = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/;
45
- if (value) {
46
- if (reg.test(value)) {
47
- resolve()
48
- } else {
49
- reject(errValueMsg)
50
- }
51
- } else {
52
- reject(noValueMsg)
53
- }
54
- })
14
+ IdCard(value) {
15
+ let reg = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/;
16
+ return reg.test(value)
55
17
  },
56
18
  // 只能包含数字、字母以及下划线
57
- Common(
58
- value,
59
- noValueMsg = "请输入包含数字、字母以及下划线的内容",
60
- errValueMsg = "只能包含数字、字母以及下划线"
61
- ) {
62
- return new Promise((resolve,reject)=>{
63
- let reg = /^[a-zA-Z0-9_]+$/;
64
- if (value) {
65
- if (reg.test(value)) {
66
- resolve()
67
- } else {
68
- reject(errValueMsg)
69
- }
70
- } else {
71
- reject(noValueMsg)
72
- }
73
- })
19
+ Common(value) {
20
+ let reg = /^[a-zA-Z0-9_]+$/;
21
+ return reg.test(value)
74
22
  },
75
23
  // QQ验证
76
- QQ(
77
- value,
78
- noValueMsg = "请输入QQ号码",
79
- errValueMsg = "QQ号码格式错误"
80
- ) {
81
- return new Promise((resolve,reject)=>{
82
- let reg = /^[1-9][0-9]{4,10}$/gim;
83
- if (value) {
84
- if (reg.test(value)) {
85
- resolve()
86
- } else {
87
- reject(errValueMsg)
88
- }
89
- } else {
90
- reject(noValueMsg)
91
- }
92
- })
24
+ QQ(value) {
25
+ let reg = /^[1-9][0-9]{4,10}$/gim;
26
+ return reg.test(value)
93
27
  },
94
28
  // 金额
95
- Money(
96
- value,
97
- noValueMsg = "请输入金额(最多保留2位小数点)",
98
- errValueMsg = "金额格式错误"
99
- ) {
100
- return new Promise((resolve,reject)=>{
101
- let reg = /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/;
102
- if (value) {
103
- if (reg.test(value)) {
104
- resolve()
105
- } else {
106
- reject(errValueMsg)
107
- }
108
- } else {
109
- reject(noValueMsg)
110
- }
111
- })
29
+ Money(value) {
30
+ let reg = /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/;
31
+ return reg.test(value)
32
+ },
33
+ // 图片路径是否包含了base64
34
+ imgUrl(value){
35
+ let reg = /^\s*data:([a-z]+\/[a-z0-9-+.]+(;[a-z-]+=[a-z0-9-]+)?)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s]*?)\s*$/i;
36
+ return reg.test(value)
37
+ },
38
+ // 是否包含中文
39
+ verChinese(value){
40
+ let reg = /[\u4e00-\u9fa5]/;
41
+ return reg.test(value)
112
42
  }
113
43
  };
114
44