liujq 2 tygodni temu
rodzic
commit
4f4db260fd
1 zmienionych plików z 52 dodań i 38 usunięć
  1. 52 38
      src/pagesRoom/dtl.jsx

+ 52 - 38
src/pagesRoom/dtl.jsx

@@ -806,26 +806,34 @@ class Index extends Component {
 
 
      // 添加水印图片
-    let watermark = cvs.createImage();
-    watermark.src = 'https://img.honglounews.com/20260113025251-2897.png_adm0';
+    // let watermark = cvs.createImage();
+    // watermark.src = 'https://img.honglounews.com/20260113025251-2897.png_adm0';
+    // await new Promise(resolve => {
+    //   watermark.onload = resolve;
+    // });
+    // // 平铺图片
+    // const tileSize = 175;
+    // const canvasWidth = 700;
+    // const canvasHeight = 1516;
+    // const cols = Math.ceil(canvasWidth / tileSize);
+    // const rows = Math.ceil(canvasHeight / tileSize);
+    // ctx.globalAlpha = 0.7;
+    // for (let y = 0; y < rows; y++) {
+    //   for (let x = 0; x < cols; x++) {
+    //     const destX = x * tileSize;
+    //     const destY = y * tileSize;
+    //     ctx.drawImage(watermark, destX, destY, tileSize, tileSize);
+    //   }
+    // }
+    // ctx.globalAlpha = 1.0;
+
+    let syImg = cvs.createImage();
     await new Promise(resolve => {
-      watermark.onload = resolve;
-    });
-    // 平铺图片
-    const tileSize = 175;
-    const canvasWidth = 700;
-    const canvasHeight = 1516;
-    const cols = Math.ceil(canvasWidth / tileSize);
-    const rows = Math.ceil(canvasHeight / tileSize);
-    ctx.globalAlpha = 0.7;
-    for (let y = 0; y < rows; y++) {
-      for (let x = 0; x < cols; x++) {
-        const destX = x * tileSize;
-        const destY = y * tileSize;
-        ctx.drawImage(watermark, destX, destY, tileSize, tileSize);
-      }
-    }
-    ctx.globalAlpha = 1.0;
+      syImg.onload = resolve;
+      syImg.src = 'https://img.honglounews.com/20260126025023-1045.png_adm0'
+    })
+    ctx.drawImage(syImg, 0, 530, 700, 580)
+
 
     // let base64 = ctx.canvas.toDataURL("image/png")
     // that.setState({
@@ -968,26 +976,32 @@ class Index extends Component {
 
 
      // 添加水印图片
-    let watermark = cvs.createImage();
-    watermark.src = 'https://img.honglounews.com/20260113025251-2897.png_adm0';
+    // let watermark = cvs.createImage();
+    // watermark.src = 'https://img.honglounews.com/20260113025251-2897.png_adm0';
+    // await new Promise(resolve => {
+    //   watermark.onload = resolve;
+    // });
+    // // 平铺图片
+    // const tileSize = 175;
+    // const canvasWidth = 700;
+    // const canvasHeight = 1516;
+    // const cols = Math.ceil(canvasWidth / tileSize);
+    // const rows = Math.ceil(canvasHeight / tileSize);
+    // ctx.globalAlpha = 0.7;
+    // for (let y = 0; y < rows; y++) {
+    //   for (let x = 0; x < cols; x++) {
+    //     const destX = x * tileSize;
+    //     const destY = y * tileSize;
+    //     ctx.drawImage(watermark, destX, destY, tileSize, tileSize);
+    //   }
+    // }
+    // ctx.globalAlpha = 1.0;
+    let syImg = cvs.createImage();
     await new Promise(resolve => {
-      watermark.onload = resolve;
-    });
-    // 平铺图片
-    const tileSize = 175;
-    const canvasWidth = 700;
-    const canvasHeight = 1516;
-    const cols = Math.ceil(canvasWidth / tileSize);
-    const rows = Math.ceil(canvasHeight / tileSize);
-    ctx.globalAlpha = 0.7;
-    for (let y = 0; y < rows; y++) {
-      for (let x = 0; x < cols; x++) {
-        const destX = x * tileSize;
-        const destY = y * tileSize;
-        ctx.drawImage(watermark, destX, destY, tileSize, tileSize);
-      }
-    }
-    ctx.globalAlpha = 1.0;
+      syImg.onload = resolve;
+      syImg.src = 'https://img.honglounews.com/20260126025023-1045.png_adm0'
+    })
+    ctx.drawImage(syImg, 0, 530, 700, 580)
 
     // let base64 = ctx.canvas.toDataURL("image/png")
     // that.setState({