初始化项目, 添加TDesign等包

This commit is contained in:
zhengw
2025-11-28 16:49:36 +08:00
commit 3e53beb7bb
980 changed files with 39201 additions and 0 deletions

View File

@@ -0,0 +1,14 @@
export default function generateBase64Url(canvas: any, { width, height, gapX, gapY, offsetLeft, offsetTop, rotate, alpha, watermarkContent, lineSpace, watermarkColor, layout, }: {
width: any;
height: any;
gapX: any;
gapY: any;
offsetLeft: any;
offsetTop: any;
rotate: any;
alpha: any;
watermarkContent: any;
lineSpace: any;
watermarkColor: any;
layout: any;
}, onFinish: any): void;

View File

@@ -0,0 +1 @@
import{systemInfo}from"../../common/utils";export default function generateBase64Url(t,{width:a,height:e,gapX:o,gapY:l,offsetLeft:r,offsetTop:n,rotate:s,alpha:i,watermarkContent:c,lineSpace:f,watermarkColor:h,layout:g},m){const d="hexagonal"===g,p=t.getContext("2d");if(!p)return console.warn("当前环境不支持Canvas, 无法绘制水印"),void m("");const u=systemInfo.pixelRatio||1;let v={width:o+a};const x=(o+a)*u,w=(l+e)*u,y=a*u,I=e*u,C=x,A=w,D=(o+a)*u,R=(l+e)*u;t.width=x,t.height=w,d&&(t.width=2*x,t.height=2*w,v={width:o+2*a+a/2}),p.translate(r*u,n*u),p.globalAlpha=i,p.fillStyle="transparent",p.fillRect(0,0,y,I);const S=(t,a,e,o)=>{t.translate(a,e),t.rotate(Math.PI/180*Number(o)),t.translate(-a,-e)},$=Array.isArray(c)?c:[Object.assign({},c)];let b=0,E=0,L=0;$.forEach(t=>{t.top=b,t.url?(b+=e,L+=d?2:1):t.text&&(b+=f)});const U=(o,l=0,r=0,n=0,i=0)=>{var c,f;if(o.url){const{url:c,isGrayscale:f=!1}=o,h=t.createImage();h.crossOrigin="anonymous",h.referrerPolicy="no-referrer",h.src=c,h.onload=()=>{var c,g;if(null===(c=p.save)||void 0===c||c.call(p),S(p,n,i,s),f){p.drawImage(h,l,r+o.top*u,a*u,e*u);const t=p.getImageData(0,0,p.canvas.width,p.canvas.height),n=t.data;for(let t=0;t<n.length;t+=4){const a=(n[t]+n[t+1]+n[t+2])/3;n[t]=a,n[t+1]=a,n[t+2]=a}p.putImageData(t,0,0)}else p.drawImage(h,l,r+o.top*u,a*u,e*u);null===(g=p.restore)||void 0===g||g.call(p),E+=1,E===L&&m(t.toDataURL(),v)}}else if(o.text){const{text:t,fontSize:a=16,fontFamily:e="normal",fontWeight:g="normal"}=o,m=(null==o?void 0:o.fontColor)||h;null===(c=p.save)||void 0===c||c.call(p),S(p,n,i,s),((t,a,e,o,l,r,n,s,i)=>{t.font=`normal normal ${r} ${n*u}px/${o}px ${s}`,t.fillStyle=i,t.textAlign="start",t.textBaseline="top",t.fillText(l,a,e)})(p,l,r+o.top*u,I,t,g,a,e,m),null===(f=p.restore)||void 0===f||f.call(p)}};$.forEach(t=>{U(t,0,0,0,0)}),d&&$.forEach(t=>{U(t,D,R,C,A)}),0===L&&m(t.toDataURL(),v)}

View File

@@ -0,0 +1,10 @@
export default function randomMovingStyle(): {
left0: string;
left25: string;
left50: string;
left75: string;
top0: string;
top25: string;
top50: string;
top75: string;
};

View File

@@ -0,0 +1 @@
export default function randomMovingStyle(){const t=Math.floor(4*Math.random()),o=Math.floor(70*Math.random())+30;return{left0:`${1===t?90:3===t?0:o}%`,left25:`${0===t?90:2===t?0:100-o}%`,left50:`${1===t?0:3===t?90:100-o}%`,left75:`${0===t?0:2===t?90:o}%`,top0:`${0===t?0:2===t?95:o}%`,top25:`${1===t?95:3===t?0:o}%`,top50:`${0===t?95:2===t?0:100-o}%`,top75:`${1===t?0:3===t?95:100-o}%`}}