first commit

This commit is contained in:
PC-202306242200\Administrator
2026-03-28 23:09:02 +08:00
commit dac42e3b0c
3512 changed files with 181637 additions and 0 deletions

View File

@@ -0,0 +1 @@
"use strict";function colorGradient(startColor="rgb(0, 0, 0)",endColor="rgb(255, 255, 255)",step=10){const startRGB=hexToRgb(startColor,false);const startR=startRGB[0];const startG=startRGB[1];const startB=startRGB[2];const endRGB=hexToRgb(endColor,false);const endR=endRGB[0];const endG=endRGB[1];const endB=endRGB[2];const sR=(endR-startR)/step;const sG=(endG-startG)/step;const sB=(endB-startB)/step;const colorArr=[];for(let i=0;i<step;i++){let hex=rgbToHex(`rgb(${Math.round(sR*i+startR)},${Math.round(sG*i+startG)},${Math.round(sB*i+startB)})`);if(i===0)hex=rgbToHex(startColor);if(i===step-1)hex=rgbToHex(endColor);colorArr.push(hex)}return colorArr}function hexToRgb(sColor,str=true){const reg=/^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/;sColor=String(sColor).toLowerCase();if(sColor&&reg.test(sColor)){if(sColor.length===4){let sColorNew="#";for(let i=1;i<4;i+=1){sColorNew+=sColor.slice(i,i+1).concat(sColor.slice(i,i+1))}sColor=sColorNew}const sColorChange=[];for(let i=1;i<7;i+=2){sColorChange.push(parseInt(`0x${sColor.slice(i,i+2)}`))}if(!str){return sColorChange}return`rgb(${sColorChange[0]},${sColorChange[1]},${sColorChange[2]})`}if(/^(rgb|RGB)/.test(sColor)){const arr=sColor.replace(/(?:\(|\)|rgb|RGB)*/g,"").split(",");return arr.map((val=>Number(val)))}return sColor}function rgbToHex(rgb){const _this=rgb;const reg=/^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/;if(/^(rgb|RGB)/.test(_this)){const aColor=_this.replace(/(?:\(|\)|rgb|RGB)*/g,"").split(",");let strHex="#";for(let i=0;i<aColor.length;i++){let hex=Number(aColor[i]).toString(16);hex=String(hex).length==1?`${0}${hex}`:hex;if(hex==="0"){hex+=hex}strHex+=hex}if(strHex.length!==7){strHex=_this}return strHex}if(reg.test(_this)){const aNum=_this.replace(/#/,"").split("");if(aNum.length===6){return _this}if(aNum.length===3){let numHex="#";for(let i=0;i<aNum.length;i+=1){numHex+=aNum[i]+aNum[i]}return numHex}}else{return _this}}function colorToRgba(color,alpha){color=rgbToHex(color);const reg=/^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/;let sColor=String(color).toLowerCase();if(sColor&&reg.test(sColor)){if(sColor.length===4){let sColorNew="#";for(let i=1;i<4;i+=1){sColorNew+=sColor.slice(i,i+1).concat(sColor.slice(i,i+1))}sColor=sColorNew}const sColorChange=[];for(let i=1;i<7;i+=2){sColorChange.push(parseInt(`0x${sColor.slice(i,i+2)}`))}return`rgba(${sColorChange.join(",")},${alpha})`}return sColor}const colorGradient$1={colorGradient:colorGradient,hexToRgb:hexToRgb,rgbToHex:rgbToHex,colorToRgba:colorToRgba};exports.colorGradient=colorGradient$1;exports.colorGradient$1=colorGradient;

View File

@@ -0,0 +1 @@
"use strict";let timeout=null;function debounce(func,wait=500,immediate=false){if(timeout!==null)clearTimeout(timeout);if(immediate){const callNow=!timeout;timeout=setTimeout((()=>{timeout=null}),wait);if(callNow)typeof func==="function"&&func()}else{timeout=setTimeout((()=>{typeof func==="function"&&func()}),wait)}}exports.debounce=debounce;

View File

@@ -0,0 +1 @@
"use strict";function strip(num,precision=15){return+parseFloat(Number(num).toPrecision(precision))}function digitLength(num){const eSplit=num.toString().split(/[eE]/);const len=(eSplit[0].split(".")[1]||"").length-+(eSplit[1]||0);return len>0?len:0}function float2Fixed(num){if(num.toString().indexOf("e")===-1){return Number(num.toString().replace(".",""))}const dLen=digitLength(num);return dLen>0?strip(Number(num)*Math.pow(10,dLen)):Number(num)}function checkBoundary(num){{if(num>Number.MAX_SAFE_INTEGER||num<Number.MIN_SAFE_INTEGER){console.warn(`${num} 超出了精度限制,结果可能不正确`)}}}function iteratorOperation(arr,operation){const[num1,num2,...others]=arr;let res=operation(num1,num2);others.forEach((num=>{res=operation(res,num)}));return res}function times(...nums){if(nums.length>2){return iteratorOperation(nums,times)}const[num1,num2]=nums;const num1Changed=float2Fixed(num1);const num2Changed=float2Fixed(num2);const baseNum=digitLength(num1)+digitLength(num2);const leftValue=num1Changed*num2Changed;checkBoundary(leftValue);return leftValue/Math.pow(10,baseNum)}function divide(...nums){if(nums.length>2){return iteratorOperation(nums,divide)}const[num1,num2]=nums;const num1Changed=float2Fixed(num1);const num2Changed=float2Fixed(num2);checkBoundary(num1Changed);checkBoundary(num2Changed);return times(num1Changed/num2Changed,strip(Math.pow(10,digitLength(num2)-digitLength(num1))))}function round(num,ratio){const base=Math.pow(10,ratio);let result=divide(Math.round(Math.abs(times(num,base))),base);if(num<0&&result!==0){result=times(result,-1)}return result}exports.round=round;

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1 @@
"use strict";let platform="none";platform="vue3";platform="mp";platform="alipay";const platform$1=platform;exports.platform=platform$1;

View File

@@ -0,0 +1 @@
"use strict";function email(value){return/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/.test(value)}function mobile(value){return/^1[23456789]\d{9}$/.test(value)}function url(value){return/^((https|http|ftp|rtsp|mms):\/\/)(([0-9a-zA-Z_!~*'().&=+$%-]+: )?[0-9a-zA-Z_!~*'().&=+$%-]+@)?(([0-9]{1,3}.){3}[0-9]{1,3}|([0-9a-zA-Z_!~*'()-]+.)*([0-9a-zA-Z][0-9a-zA-Z-]{0,61})?[0-9a-zA-Z].[a-zA-Z]{2,6})(:[0-9]{1,4})?((\/?)|(\/[0-9a-zA-Z_!~*'().;?:@&=+$,%#-]+)+\/?)$/.test(value)}function date(value){if(!value)return false;if(number(value))value=+value;return!/Invalid|NaN/.test(new Date(value).toString())}function dateISO(value){return/^\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])$/.test(value)}function number(value){return/^[\+-]?(\d+\.?\d*|\.\d+|\d\.\d+e\+\d+)$/.test(value)}function string(value){return typeof value==="string"}function digits(value){return/^\d+$/.test(value)}function idCard(value){return/^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}([0-9]|X)$/.test(value)}function carNo(value){const xreg=/^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}(([0-9]{5}[DF]$)|([DF][A-HJ-NP-Z0-9][0-9]{4}$))/;const creg=/^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}[A-HJ-NP-Z0-9]{4}[A-HJ-NP-Z0-9挂学警港澳]{1}$/;if(value.length===7){return creg.test(value)}if(value.length===8){return xreg.test(value)}return false}function amount(value){return/^[1-9]\d*(,\d{3})*(\.\d{1,2})?$|^0\.\d{1,2}$/.test(value)}function chinese(value){const reg=/^[\u4e00-\u9fa5]+$/gi;return reg.test(value)}function letter(value){return/^[a-zA-Z]*$/.test(value)}function enOrNum(value){const reg=/^[0-9a-zA-Z]*$/g;return reg.test(value)}function contains(value,param){return value.indexOf(param)>=0}function range(value,param){return value>=param[0]&&value<=param[1]}function rangeLength(value,param){return value.length>=param[0]&&value.length<=param[1]}function landline(value){const reg=/^\d{3,4}-\d{7,8}(-\d{3,4})?$/;return reg.test(value)}function empty(value){switch(typeof value){case"undefined":return true;case"string":if(value.replace(/(^[ \t\n\r]*)|([ \t\n\r]*$)/g,"").length==0)return true;break;case"boolean":if(!value)return true;break;case"number":if(value===0||isNaN(value))return true;break;case"object":if(value===null||value.length===0)return true;for(const i in value){return false}return true}return false}function jsonString(value){if(typeof value==="string"){try{const obj=JSON.parse(value);if(typeof obj==="object"&&obj){return true}return false}catch(e){return false}}return false}function array(value){if(typeof Array.isArray==="function"){return Array.isArray(value)}return Object.prototype.toString.call(value)==="[object Array]"}function object(value){return Object.prototype.toString.call(value)==="[object Object]"}function code(value,len=6){return new RegExp(`^\\d{${len}}$`).test(value)}function func(value){return typeof value==="function"}function promise(value){return object(value)&&func(value.then)&&func(value.catch)}function image(value){const newValue=value.split("?")[0];const IMAGE_REGEXP=/\.(jpeg|jpg|gif|png|svg|webp|jfif|bmp|dpg)/i;return IMAGE_REGEXP.test(newValue)}function video(value){const VIDEO_REGEXP=/\.(mp4|mpg|mpeg|dat|asf|avi|rm|rmvb|mov|wmv|flv|mkv|m3u8)/i;return VIDEO_REGEXP.test(value)}function regExp(o){return o&&Object.prototype.toString.call(o)==="[object RegExp]"}const test={email:email,mobile:mobile,url:url,date:date,dateISO:dateISO,number:number,digits:digits,idCard:idCard,carNo:carNo,amount:amount,chinese:chinese,letter:letter,enOrNum:enOrNum,contains:contains,range:range,rangeLength:rangeLength,empty:empty,isEmpty:empty,jsonString:jsonString,landline:landline,object:object,array:array,code:code,func:func,promise:promise,video:video,image:image,regExp:regExp,string:string};exports.array=array;exports.empty=empty;exports.number=number;exports.test=test;

View File

@@ -0,0 +1 @@
"use strict";let flag;function throttle(func,wait=500,immediate=true){if(immediate){if(!flag){flag=true;typeof func==="function"&&func();setTimeout((()=>{flag=false}),wait)}}else if(!flag){flag=true;setTimeout((()=>{flag=false;typeof func==="function"&&func()}),wait)}}exports.throttle=throttle;