Selaa lähdekoodia

feat: 图片白边问题处理

zhangyuhan 3 vuotta sitten
vanhempi
commit
7b1b0a011e

+ 3 - 3
src/jfw/modules/app/src/web/templates/active/yearEndReport/result.html

@@ -20,7 +20,7 @@
   <link rel="stylesheet" href="https://cdn-common.jianyu360.com/cdn/lib/reset-css/5.0.1/reset.min.css" />
   <link rel="stylesheet" href="//cdn-common.jianyu360.com/cdn/lib/vant/2.12.24/lib/index.css">
   <link rel="stylesheet" href='{{Cdns .Host "seo" "cdn"|SafeUrl}}/common-module/yearEndReport/css/music.css'>
-  <link rel="stylesheet" href='{{Cdns .Host "seo" "cdn"|SafeUrl}}/common-module/yearEndReport/css/result.css'>
+  <link rel="stylesheet" href='{{Cdns .Host "seo" "cdn"|SafeUrl}}/common-module/yearEndReport/css/result.css?v={{Msg "seo" "version"}}'>
 </head>
 
 <body>
@@ -149,8 +149,8 @@
   <script src="https://cdn-common.jianyu360.com/cdn/lib/jquery/3.6.0/jquery.min.js"></script>
   <script src="https://cdn-common.jianyu360.com/cdn/lib/html2canvas/1.1.2/dist/html2canvas.min.js"></script>
   <script src="{{Cdns .Host "seo" "cdn"|SafeUrl}}/jyapp/js/common.js?v={{Msg "seo" "version"}}"></script>
-  <script src='{{Cdns .Host "seo" "cdn"|SafeUrl}}/common-module/yearEndReport/js/common.js'></script>
-  <script src='{{Cdns .Host "seo" "cdn"|SafeUrl}}/common-module/yearEndReport/js/result.js'></script>
+  <script src='{{Cdns .Host "seo" "cdn"|SafeUrl}}/common-module/yearEndReport/js/common.js?v={{Msg "seo" "version"}}'></script>
+  <script src='{{Cdns .Host "seo" "cdn"|SafeUrl}}/common-module/yearEndReport/js/result.js?v={{Msg "seo" "version"}}'></script>
   <!-- 使用html2canvas 生成图片dom层不能使用背景图 否则生成的图片会模糊 且无法修复 -->
   {{include "/common/baiducc.html"}}
 </body>

+ 3 - 3
src/web/staticres/common-module/yearEndReport/js/result.js

@@ -108,8 +108,6 @@ var result = new Vue({
     },
     // html2canvas方法
     covertToImage: function (container, options = {}) {
-      // 设置放大倍数
-      var scale = window.devicePixelRatio
       // 传入节点原始宽高
       var _width = container.offsetWidth
       var _height = container.offsetHeight
@@ -118,7 +116,9 @@ var result = new Vue({
       height = height || _height
       var ops = {
         dpi: 300,
-        scale,
+        scale: 3,
+        width: width - 2,
+        height: height - 2,
         async: false,
         useCORS: true,
         allowTaint: false,

+ 4 - 4
src/web/templates/active/yearEndReport/result.html

@@ -20,7 +20,7 @@
   <link rel="stylesheet" href="https://cdn-common.jianyu360.com/cdn/lib/reset-css/5.0.1/reset.min.css" />
   <link rel="stylesheet" href='//cdn-common.jianyu360.com/cdn/lib/vant/2.12.24/lib/index.css'>
   <link rel="stylesheet" href='{{Msg "seo" "cdn"}}/common-module/yearEndReport/css/music.css'>
-  <link rel="stylesheet" href='{{Msg "seo" "cdn"}}/common-module/yearEndReport/css/result.css'>
+  <link rel="stylesheet" href='{{Msg "seo" "cdn"}}/common-module/yearEndReport/css/result.css?v={{Msg "seo" "version"}}'>
 </head>
 
 <body>
@@ -149,9 +149,9 @@
   <script src="https://cdn-common.jianyu360.com/cdn/lib/jquery/3.6.0/jquery.min.js"></script>
   <script src="https://cdn-common.jianyu360.com/cdn/lib/html2canvas/1.1.2/dist/html2canvas.min.js"></script>
   <script src=//res2.wx.qq.com/open/js/jweixin-1.6.0.js></script>
-  <script src='{{Msg "seo" "cdn"}}/common-module/yearEndReport/js/common.js'></script>
-  <script src='{{Msg "seo" "cdn"}}/common-module/yearEndReport/js/share.js'></script>
-  <script src='{{Msg "seo" "cdn"}}/common-module/yearEndReport/js/result.js'></script>
+  <script src='{{Msg "seo" "cdn"}}/common-module/yearEndReport/js/common.js?v={{Msg "seo" "version"}}'></script>
+  <script src='{{Msg "seo" "cdn"}}/common-module/yearEndReport/js/share.js?v={{Msg "seo" "version"}}'></script>
+  <script src='{{Msg "seo" "cdn"}}/common-module/yearEndReport/js/result.js?v={{Msg "seo" "version"}}'></script>
   <!-- 使用html2canvas 生成图片dom层不能使用背景图 否则生成的图片会模糊 且无法修复 -->
   {{include "/common/baiducc.html"}}
 </body>