Browse Source

二维码1

Aslee 4 years ago
parent
commit
07b7ff6f6a

+ 18 - 1
src/main/webapp/WEB-INF/views/modules/zplm/cmBrandAuthProductList.jsp

@@ -217,7 +217,24 @@
 				ctx.font = 'bold ' + fontSize[i] + 'px Arial';
 				ctx.textAlign = 'center';
 				//绘制顶部文字描述
-				ctx.fillText(strHeader, w / 2, picHeight[i] / 3);
+                var chr = strHeader.split("");
+                var temp = "";
+                var row = [];
+                for(var a = 0; a < chr.length; a++){
+                    if( ctx.measureText(temp).width < w ){
+                        ;
+                    }
+                    else{
+                        row.push(temp);
+                        temp = "";
+                    }
+                    temp += chr[a];
+                }
+                row.push(temp);
+                for(var b = 0; b < row.length; b++){
+                    ctx.fillText(row[b],w / 2,picHeight[i] / 3-(row.length-b-1)*20);
+                }
+				// ctx.fillText(strHeader, w / 2, picHeight[i] / 3);
 				//绘制二维码
 				ctx.drawImage(img, picWidth[i] / 2, picHeight[i] / 2);
 				//绘制底部文字