js_ryl 1.0.17 → 1.0.19
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 +8 -0
- package/dist/build.js +1 -1
- package/package.json +1 -1
- package/src/App2.vue +4 -1
- package/src/cookie/index.js +24 -15
- package/src/getMonthDays/index.js +7 -0
- package/src/index.js +4 -1
- package/src/reg/index.js +1 -1
package/README.md
CHANGED
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
7.对象深拷贝 -- deepCopy
|
|
18
18
|
8.验证码 -- verCode
|
|
19
19
|
9.table中的数据补全方法 -- filterTable
|
|
20
|
+
10.获取当前年份中,指定月份的天数 -- getMonthDays
|
|
20
21
|
|
|
21
22
|
# 使用方法:
|
|
22
23
|
|
|
@@ -156,6 +157,11 @@
|
|
|
156
157
|
# 第一个参数为:数据源,第二个参数选填(为补全的符号,默认为 -- )
|
|
157
158
|
let list = filterTable(data)
|
|
158
159
|
|
|
160
|
+
#10.获取当前年份中,指定月份的天数
|
|
161
|
+
|
|
162
|
+
#第一个参数为:年份,第二个参数为:月份
|
|
163
|
+
let day = getMonthDays(year,month)
|
|
164
|
+
|
|
159
165
|
|
|
160
166
|
|
|
161
167
|
# serve with hot reload at localhost:8080
|
|
@@ -173,6 +179,8 @@
|
|
|
173
179
|
#1.0.15: 结构调整,把验证码效果,从 正则 中提取出来
|
|
174
180
|
#1.0.16: 剔除不用的包,如element
|
|
175
181
|
#1.0.17: 添加 数据补全方法 如:table中有数据为空时,自动补全 ‘--’ 符号
|
|
182
|
+
#1.0.18: 添加 获取当前年份中,指定月份的天数
|
|
183
|
+
#1.0.19: 验证手机号码 优化
|
|
176
184
|
```
|
|
177
185
|
|
|
178
186
|
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=1)}([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";Object.defineProperty(e,"__esModule",{value:!0});var r=n(2),o=n(3),i=n(4),
|
|
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=1)}([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";Object.defineProperty(e,"__esModule",{value:!0});var r=n(2),o=n(3),i=n(4),a=n(0),u=n(5),c=n(6),l=n(7),s=n(8),f=n(9),d=n(10);e.default={reg:r.a,time:o.a,cookie:i.a,fun:a.a,num:u.a,copy:c.a,deepCopy:l.a,verCode:s.a,filterTable:f.a,getMonthDays:d.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]:"手机号码格式有误",r=/^[1][3,4,5,6,7,8,9][0-9]{9}$/;return t?!!r.test(t)||n: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]:"邮箱格式有误",r=/^([0-9A-Za-z\-_\.]+)@([0-9a-z]+\.[a-z]{2,3}(\.[a-z]{2})?)$/g;return t?!!r.test(t)||n: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]:"身份证号码格式有误",r=/(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/;return t?!!r.test(t)||n: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]:"只能包含数字、字母以及下划线",r=/^[a-zA-Z0-9_]+$/;return t?!!r.test(t)||n: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号码格式错误",r=/^[1-9][0-9]{4,10}$/gim;return t?!!r.test(t)||n: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]:"金额格式错误",r=/(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/;return t?!!r.test(t)||n: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(),l=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(l)},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=n.domain?";domain="+n.domain:"",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=(n(0),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}}),o=function(t){t=Number(t);var e=r(t),n=t.toString().toUpperCase();return 2===n.split("E").length?Math.round(t*Math.pow(10,e)):Number(n.replace(".",""))},i=function(t,e,n,r){var o=0;switch(t){case"add":o=e+n;break;case"sub":o=e-n;break;case"div":o=e/n;break;case"mul":o=e*n}return Math.abs(r-o)>1?o:r},a={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,o,a;try{n=r(t)+1}catch(t){n=0}try{o=r(e)+1}catch(t){o=0}a=Math.pow(10,Math.max(n,o));var u=(this.mul(t,a)+this.mul(e,a))/a;return i("add",t,e,u)},sub:function(t,e){t=this.NumFilter(Number(t)),e=this.NumFilter(Number(e));var n,o,a;try{n=r(t)+1}catch(t){n=0}try{o=r(e)+1}catch(t){o=0}a=Math.pow(10,Math.max(n,o));var u=Number((this.mul(t,a)-this.mul(e,a))/a);return i("sub",t,e,u)},div:function(t,e){t=Number(t),e=Number(e);var n,a,u=0,c=0;try{u=r(t)}catch(t){}try{c=r(e)}catch(t){}n=o(t),a=o(e);var l=this.mul(n/a,Math.pow(10,c-u));return i("div",t,e,l)},mul:function(t,e){t=Number(t),e=Number(e);var n=0,a=t.toString(),u=e.toString();try{n+=r(a)}catch(t){}try{n+=r(u)}catch(t){}var c=o(a)*o(u)/Math.pow(10,n);return i("mul",t,e,c)}};e.a=a},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){return["",void 0,null].some(function(e){return e===t})}var o=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"--",n=[];for(var o in t){for(var i={},a=Object.entries(t[o]),u=0;u<a.length;u++){var c=a[u];r(c[1])&&(c[1]=e),i[c[0]]=c[1]}n.push(i)}return n};e.a=o},function(t,e,n){"use strict";var r=function(t,e){return new Date(t,e,0).getDate()};e.a=r}])});
|
package/package.json
CHANGED
package/src/App2.vue
CHANGED
|
@@ -42,6 +42,7 @@ import copy from "./copy";
|
|
|
42
42
|
import deepCopy from "./deepCopy";
|
|
43
43
|
import verCode from "./verCode";
|
|
44
44
|
import filterTable from "./filterTable";
|
|
45
|
+
import getMonthDays from "./getMonthDays";
|
|
45
46
|
export default {
|
|
46
47
|
data() {
|
|
47
48
|
return {
|
|
@@ -122,7 +123,9 @@ export default {
|
|
|
122
123
|
let arr00 = [1,2,3,4,5]
|
|
123
124
|
let arr002 = deepCopy([],arr00)
|
|
124
125
|
arr002[0]=111
|
|
125
|
-
console.log(arr002,arr00)
|
|
126
|
+
console.log(arr002,arr00),
|
|
127
|
+
|
|
128
|
+
console.log(getMonthDays(2022,11), '// 获取当前年份中,指定月份的天数')
|
|
126
129
|
},
|
|
127
130
|
methods: {
|
|
128
131
|
phoneCode(e){
|
package/src/cookie/index.js
CHANGED
|
@@ -6,6 +6,8 @@ const cookie = {
|
|
|
6
6
|
ops = ops || {};
|
|
7
7
|
// 处理默认路径
|
|
8
8
|
let path = ops.path ? ";Path=" + ops.path : "";
|
|
9
|
+
// 处理默认域名
|
|
10
|
+
let domain = ops.domain ? ";domain=" + ops.domain :""
|
|
9
11
|
// 处理默认有效期
|
|
10
12
|
let expires = "";
|
|
11
13
|
if (ops.expires) {
|
|
@@ -15,23 +17,30 @@ const cookie = {
|
|
|
15
17
|
expires = ";expires=" + exp.toGMTString();
|
|
16
18
|
}
|
|
17
19
|
// 设置cookie
|
|
18
|
-
document.cookie = `${key}=${val}${path}${expires}`;
|
|
20
|
+
document.cookie = `${key}=${encodeURIComponent(val)}${domain}${path}${expires}`;
|
|
19
21
|
},
|
|
20
22
|
// 获取cookie
|
|
21
|
-
get: (
|
|
22
|
-
// 获取所有的cookie
|
|
23
|
-
let str = document.cookie;
|
|
24
|
-
// 第一次分割,将每组名字和值分割出来
|
|
25
|
-
let arr = str.split("; ");
|
|
26
|
-
for (let i = 0; i < arr.length; i++) {
|
|
27
|
-
// 第二次分割将每个名字和值分割开
|
|
28
|
-
if (arr[i].split("=")[0] === key) {
|
|
29
|
-
// 将值返回
|
|
30
|
-
return arr[i].split("=")[1];
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
// 如果循环结束没有匹配项就返回空
|
|
34
|
-
return "";
|
|
23
|
+
get: (name) => {
|
|
24
|
+
// // 获取所有的cookie
|
|
25
|
+
// let str = document.cookie;
|
|
26
|
+
// // 第一次分割,将每组名字和值分割出来
|
|
27
|
+
// let arr = str.split("; ");
|
|
28
|
+
// for (let i = 0; i < arr.length; i++) {
|
|
29
|
+
// // 第二次分割将每个名字和值分割开
|
|
30
|
+
// if (arr[i].split("=")[0] === key) {
|
|
31
|
+
// // 将值返回
|
|
32
|
+
// return arr[i].split("=")[1];
|
|
33
|
+
// }
|
|
34
|
+
// }
|
|
35
|
+
// // 如果循环结束没有匹配项就返回空
|
|
36
|
+
// return "";
|
|
37
|
+
const value = `; ${document.cookie}`
|
|
38
|
+
const parts = value.split(`; ${name}=`)
|
|
39
|
+
if (parts.length === 2) {
|
|
40
|
+
return decodeURIComponent(parts.pop().split(';').shift())
|
|
41
|
+
} else {
|
|
42
|
+
return null
|
|
43
|
+
}
|
|
35
44
|
},
|
|
36
45
|
// 移除cookie
|
|
37
46
|
remove: (key, ops) => {
|
package/src/index.js
CHANGED
|
@@ -17,6 +17,8 @@ import deepCopy from "./deepCopy";
|
|
|
17
17
|
import verCode from "./verCode";
|
|
18
18
|
// table中 空值 转为 --
|
|
19
19
|
import filterTable from "./filterTable";
|
|
20
|
+
// 获取当前年份中,指定月份的天数
|
|
21
|
+
import getMonthDays from "./getMonthDays";
|
|
20
22
|
|
|
21
23
|
export default {
|
|
22
24
|
reg,
|
|
@@ -27,5 +29,6 @@ export default {
|
|
|
27
29
|
copy,
|
|
28
30
|
deepCopy,
|
|
29
31
|
verCode,
|
|
30
|
-
filterTable
|
|
32
|
+
filterTable,
|
|
33
|
+
getMonthDays
|
|
31
34
|
};
|