Procházet zdrojové kódy

Merge branch 'iteration-20240926-tag' into jenkins-test

lex-xin před 9 měsíci
rodič
revize
341c3cf25e

+ 15 - 18
src/views/co-ai/imageFunction.ts

@@ -38,11 +38,8 @@ export const imgToCanvas = async (url: string) => {
 
 export const addWatermark = async (canvas: any) => {
   try {
-    const ctx = canvas.getContext('2d');
-    // ctx.fillStyle = '#fff'
     const img = document.createElement('img');
     img.setAttribute('crossOrigin', 'anonymous');
-
     // 为了处理base64 和 连接加载不同的
     if (
       imgList &&
@@ -53,25 +50,25 @@ export const addWatermark = async (canvas: any) => {
     } else {
       img.src = imgList;
     }
-
     // 防止跨域引起的 Failed to execute 'toDataURL' on 'HTMLCanvasElement': Tainted canvases may not be exported.
     await new Promise(resolve => (img.onload = resolve));
-
-    // 创建canvas DOM元素,并设置其宽高和图片一样
+    // 容器
     const water = document.createElement('canvas');
-    water.width = 280;
-    water.height = 220;
-    // 小水印画布大小
-
-    // 第一层
+    water.width = canvas.width
+    water.height = canvas.height
     const waterCtx = water.getContext('2d') as CanvasRenderingContext2D;
-    waterCtx.clearRect(0, 0, water.width, water.height);
-    // 小水印中文字偏转角度
-    waterCtx.drawImage(img, 80, 80);
-    const pat = ctx.createPattern(water, 'repeat');
-    ctx.fillStyle = pat;
-    ctx.fillRect(0, 0, canvas.width, canvas.height);
-    return canvas;
+    waterCtx.drawImage(canvas, 0, 0);
+    // 水印图片
+    const imgCanvas = document.createElement('canvas');
+    imgCanvas.width = 280
+    imgCanvas.height = 220;
+    const imgCtx = imgCanvas.getContext('2d') as CanvasRenderingContext2D;
+    imgCtx.drawImage(img, 80, 80);
+    // 添加水印
+    const pat = waterCtx.createPattern(imgCanvas, 'repeat')!;
+    waterCtx.fillStyle = pat;
+    waterCtx.fillRect(0, 0, water.width, water.height);
+    return water;
   } catch (e) {
     console.log(e);
   }

+ 4 - 4
src/views/hot-music-more/music-detail/index.module.less

@@ -25,10 +25,10 @@
     &.downContainer {
       display: block;
       height: auto;
-      min-height: 300px;
-      position: absolute;
-      top: 0;
-      z-index: -1;
+      // min-height: 300px;
+      // position: absolute;
+      // top: 0;
+      // z-index: -1;
     }
 
     .iframeSection {

+ 4 - 4
src/views/hot-music-more/music-detail/index.tsx

@@ -604,10 +604,7 @@ export default defineComponent({
           </div>
 
           
-          
-        </div>
-        
-        <div class={[styles.container, styles.downContainer]}  ref={downRef}>
+          <div class={[styles.container, styles.downContainer]}  ref={downRef}>
             <div
               class={[styles['right-musicName'], styles.downloadMusicName]}
               style={{
@@ -667,6 +664,9 @@ export default defineComponent({
                 )}
               </div>
           </div>
+        </div>
+        
+        
         <div class={styles.btnGroup}>
           <div class={styles.operation}>
             {isEnsemble.value && (