js_ryl 1.0.25 → 1.0.27

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
@@ -20,6 +20,7 @@
20
20
  10.获取当前年份中,指定月份的天数 -- getMonthDays
21
21
  11.unicode转化emoji表情 -- emoji
22
22
  12.根据输入内容,高亮匹配对应的字符串 -- highLight
23
+ 13.商品飞入购物车效果 -- flyToCart
23
24
 
24
25
  # 使用方法:
25
26
 
@@ -165,16 +166,23 @@
165
166
  #11.unicode转化emoji表情,如果不符合emoji的要求,则转化为字符,如果还不符合,则输出原unicode
166
167
 
167
168
  # 方法:
168
- # emoji(str)
169
+ emoji(str)
169
170
 
170
171
  #12.根据输入内容,高亮匹配对应的字符串
171
172
 
172
173
  # 方法:
173
174
  # 3个参数
174
- # 第一个匹配的值,第二个需要匹配的内容,第三个为匹配后的类名
175
- # 如:<div v-html="setHighLight(name,highLightContent,'initHightLightClassName')"></div>
176
- # 引入 highLight.js
177
- # setHighLight:highLight,
175
+ # 第一个 需要匹配的值(静态或者动态的变量),第二个 需要被匹配的内容(字符串,一般是固定的),第三个 为匹配后的类名
176
+ <div v-html="setHighLight(name,highLightContent,'initHightLightClassName')"></div>
177
+ #引入 highLight.js
178
+ setHighLight:highLight,
179
+
180
+ #13.商品飞入购物车效果
181
+
182
+ # 方法:
183
+ flyToCart(event,image,targets,()=>{})
184
+ # event 目标元素,image 缩略图,targets 购物车的位置,callback 回调(有需要才用)
185
+ # 如:flyToCart(event,'https://v2-saas-1259468876.cos.ap-shanghai.myqcloud.com//system//admin//7c7ec8b02b009d2385db1faae95b9ab0.png',document.querySelector('#shoppps'))
178
186
 
179
187
 
180
188
  # serve with hot reload at localhost:8080
@@ -196,7 +204,8 @@
196
204
  #1.0.19: 验证手机号码 优化
197
205
  #1.0.21: number精度问题优化
198
206
  #1.0.22: 数据补全方法优化
199
- #1.0.25: 新增了emoji,highLight方法(还没上传)
207
+ #1.0.25: 新增了emoji,highLight方法
208
+ #1.0.27: 商品飞入购物车效果
200
209
  ```
201
210
 
202
211
  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),v=n(10),d=n(11),h=n(12);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:v.a,emoji:d.a,highLight: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}])});
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=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,d=(u+l)/2,v=Math.min(c,f)-150;i.style.left=u+"px",i.style.top=c+"px";var p=0,h=performance.now(),m=function t(e){(p=(e-h)/800)>1&&(p=1);var n=(1-p)*(1-p)*u+2*(1-p)*p*d+p*p*l,o=(1-p)*(1-p)*c+2*(1-p)*p*v+p*p*f;i.style.left=n+"px",i.style.top=o+"px",i.style.transform="scale("+(1-.7*p)+")",i.style.opacity=""+(1-p),p<1?requestAnimationFrame(t):(i.remove(),r())};requestAnimationFrame(m)}e.a=r}])});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "js_ryl",
3
- "version": "1.0.25",
3
+ "version": "1.0.27",
4
4
  "private": false,
5
5
  "description": "自定义通用js",
6
6
  "author": "renyuliang <785788909@qq.com>",
package/src/App.vue CHANGED
@@ -20,7 +20,6 @@
20
20
  <br />
21
21
  <br>
22
22
  <br>
23
- <!-- <button @click="phoneCode($event)">验证码</button> -->
24
23
  <a href="javascript:;" @click="phoneCode($event)">验证码</a>
25
24
  <a href="javascript:;" @click="phoneCodeExit()">清空验证码</a>
26
25
  <br>
@@ -32,6 +31,10 @@
32
31
  <span>{{item.sex}}</span>
33
32
  </li>
34
33
  </ul>
34
+ <a href="javascript:;" @click="shopToCart($event)">点击加入购物车</a>
35
+ <div style="text-align:right;margin-top:300px;">
36
+ <span id="shoppps">这是购物车的位置</span>
37
+ </div>
35
38
  </div>
36
39
  </template>
37
40
  <script>
@@ -47,6 +50,7 @@ import filterTable from "./filterTable";
47
50
  import getMonthDays from "./getMonthDays";
48
51
  import emoji from "./emoji";
49
52
  import highLight from "./highLight";
53
+ import flyToCart from "./flyToCart";
50
54
  export default {
51
55
  data() {
52
56
  return {
@@ -145,6 +149,11 @@ export default {
145
149
 
146
150
  },
147
151
  methods: {
152
+ shopToCart(event){
153
+ flyToCart(event,'https://v2-saas-1259468876.cos.ap-shanghai.myqcloud.com//system//admin//7c7ec8b02b009d2385db1faae95b9ab0.png',document.querySelector('#shoppps'),()=>{
154
+ console.log(1)
155
+ })
156
+ },
148
157
  setHighLight:highLight,
149
158
  phoneCode(e){
150
159
  if (verCode.phoneCodeStatus()) {
@@ -0,0 +1,68 @@
1
+ // 飞入购物车效果
2
+ // event 目标元素,image 缩略图,targets 购物车的位置,callback 回调
3
+ export default function flyToCart(event,image,targets,callback=()=>{}) {
4
+ const button = event.target
5
+ // 创建商品图片
6
+ const flyEl = document.createElement('img')
7
+ // 设置缩略图样式
8
+ flyEl.style.cssText = `position: fixed;
9
+ width: 20px;
10
+ height: 20px;
11
+ border-radius: 50%;
12
+ pointer-events: none;
13
+ transition: transform 0.8s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.8s;
14
+ z-index: 10000;
15
+ opacity: 1;
16
+ transform-origin: center center;`
17
+ flyEl.setAttribute('src',image)
18
+ document.body.appendChild(flyEl)
19
+
20
+ // 起点坐标(按钮中心)
21
+ const startRect = button.getBoundingClientRect()
22
+ const startX = startRect.left + startRect.width / 2
23
+ const startY = startRect.top + startRect.height / 2
24
+
25
+ // 终点坐标(购物车中心)
26
+ const cartRect = targets.getBoundingClientRect()
27
+ const endX = cartRect.left + cartRect.width / 2
28
+ const endY = cartRect.top + cartRect.height / 2
29
+
30
+ // 抛物线控制点(控制抛物线弧度)
31
+ // 这里取起点和终点中间上方 150px 作为控制点
32
+ const controlX = (startX + endX) / 2
33
+ const controlY = Math.min(startY, endY) - 150
34
+
35
+ // 设置初始位置
36
+ flyEl.style.left = startX + 'px'
37
+ flyEl.style.top = startY + 'px'
38
+
39
+ let t = 0 // 进度 0~1
40
+ const duration = 800 // 动画时长 ms
41
+ const startTime = performance.now()
42
+
43
+ const animate = (time) => {
44
+ t = (time - startTime) / duration
45
+ if (t > 1) t = 1
46
+
47
+ // 贝塞尔曲线公式计算位置
48
+ // B(t) = (1-t)^2 * P0 + 2(1-t)t * P1 + t^2 * P2
49
+ const x = (1 - t) * (1 - t) * startX + 2 * (1 - t) * t * controlX + t * t * endX
50
+ const y = (1 - t) * (1 - t) * startY + 2 * (1 - t) * t * controlY + t * t * endY
51
+
52
+ flyEl.style.left = x + 'px'
53
+ flyEl.style.top = y + 'px'
54
+
55
+ // 缩放和透明度渐变
56
+ flyEl.style.transform = `scale(${1 - t * 0.7})`
57
+ flyEl.style.opacity = `${1 - t}`
58
+
59
+ if (t < 1) {
60
+ requestAnimationFrame(animate)
61
+ } else {
62
+ // 动画结束,移除元素
63
+ flyEl.remove()
64
+ callback()
65
+ }
66
+ }
67
+ requestAnimationFrame(animate)
68
+ }
package/src/index.js CHANGED
@@ -23,6 +23,8 @@ import getMonthDays from "./getMonthDays";
23
23
  import emoji from "./emoji";
24
24
  // 高亮显示搜索匹配的文字
25
25
  import highLight from "./highLight";
26
+ // 飞入购物车效果
27
+ import flyToCart from "./flyToCart";
26
28
 
27
29
  export default {
28
30
  reg,
@@ -36,5 +38,6 @@ export default {
36
38
  filterTable,
37
39
  getMonthDays,
38
40
  emoji,
39
- highLight
41
+ highLight,
42
+ flyToCart
40
43
  };