Commit 83388edb authored by 俞嘉婷's avatar 俞嘉婷

海报合成

parent bf7fae2b
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
}; };
s(), e.addEventListener && i.addEventListener(m, s, !1); s(), e.addEventListener && i.addEventListener(m, s, !1);
})(document, window); })(document, window);
})</script><style></style><script type="module" crossorigin src="./assets/index-355aa970.js"></script><link rel="modulepreload" crossorigin href="./assets/api-c914b43f.js"><link rel="stylesheet" href="./assets/api-5a972db1.css"><link rel="stylesheet" href="./assets/index-4682e55f.css"><script type="module">import.meta.url;import("_").catch(()=>1);async function* g(){};if(location.protocol!="file:"){window.__vite_is_modern_browser=true}</script><script type="module">!function(){if(window.__vite_is_modern_browser)return;console.warn("vite: loading legacy chunks, syntax error above and the same error below should be ignored");var e=document.getElementById("vite-legacy-polyfill"),n=document.createElement("script");n.src=e.src,n.onload=function(){System.import(document.getElementById('vite-legacy-entry').getAttribute('data-src'))},document.body.appendChild(n)}();</script></head><body><div id="root"></div><script src="//res.wx.qq.com/open/js/jweixin-1.6.0.js"></script><script src="./assets/js/duiba.js"></script><script>var CFG = {} })</script><style></style><script type="module" crossorigin src="./assets/index-0bdd71d8.js"></script><link rel="modulepreload" crossorigin href="./assets/api-c914b43f.js"><link rel="stylesheet" href="./assets/api-5a972db1.css"><link rel="stylesheet" href="./assets/index-4682e55f.css"><script type="module">import.meta.url;import("_").catch(()=>1);async function* g(){};if(location.protocol!="file:"){window.__vite_is_modern_browser=true}</script><script type="module">!function(){if(window.__vite_is_modern_browser)return;console.warn("vite: loading legacy chunks, syntax error above and the same error below should be ignored");var e=document.getElementById("vite-legacy-polyfill"),n=document.createElement("script");n.src=e.src,n.onload=function(){System.import(document.getElementById('vite-legacy-entry').getAttribute('data-src'))},document.body.appendChild(n)}();</script></head><body><div id="root"></div><script src="//res.wx.qq.com/open/js/jweixin-1.6.0.js"></script><script src="./assets/js/duiba.js"></script><script>var CFG = {}
function getUrlParam(name) { function getUrlParam(name) {
var search = window.location.search; var search = window.location.search;
...@@ -52,12 +52,8 @@ ...@@ -52,12 +52,8 @@
// 生产 // 生产
CFG.sensorUrl = 'https://xnjkfx.cpic.com.cn:8006/sa?project=SXGW'; CFG.sensorUrl = 'https://xnjkfx.cpic.com.cn:8006/sa?project=SXGW';
// 海报二维码
CFG.qrCodeImg = 'https://yun.duiba.com.cn/aurora/assets/86edddb7cb2ab51fc7234a3e62279b2c6bfbc2ff.png'; // TODO
if(location.href.indexOf("duibatest") > -1) { if(location.href.indexOf("duibatest") > -1) {
var vConsole = new VConsole(); var vConsole = new VConsole();
CFG.sensorUrl = 'https://xnjkfxsit.cpic.com.cn/sa?project=SXGW'; CFG.sensorUrl = 'https://xnjkfxsit.cpic.com.cn/sa?project=SXGW';
// 海报二维码 }</script><script nomodule>!function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",(function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()}),!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();</script><script nomodule crossorigin id="vite-legacy-polyfill" src="./assets/polyfills-legacy-014252d2.js"></script><script nomodule crossorigin id="vite-legacy-entry" data-src="./assets/index-legacy-66036bef.js">System.import(document.getElementById('vite-legacy-entry').getAttribute('data-src'))</script></body></html>
CFG.qrCodeImg = 'https://yun.duiba.com.cn/aurora/assets/86edddb7cb2ab51fc7234a3e62279b2c6bfbc2ff.png'; \ No newline at end of file
}</script><script nomodule>!function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",(function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()}),!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();</script><script nomodule crossorigin id="vite-legacy-polyfill" src="./assets/polyfills-legacy-014252d2.js"></script><script nomodule crossorigin id="vite-legacy-entry" data-src="./assets/index-legacy-8b9aacdd.js">System.import(document.getElementById('vite-legacy-entry').getAttribute('data-src'))</script></body></html>
\ No newline at end of file
{"preLoadImg":[],"asyncLoadImg":["./assets/common/back.png","./assets/common/close.png","./assets/common/sub_page_bg.png","./assets/common/sub_page_bg_cover.png","./assets/futurePage/btn.png","./assets/futurePage/item_bg.png","./assets/futurePage/prize_img_bg.png","./assets/futurePage/title.png","./assets/homePage/arrow_left.png","./assets/homePage/bg_type1.png","./assets/homePage/bg_type2.png","./assets/homePage/btn_future.png","./assets/homePage/btn_prize.png","./assets/homePage/btn_rule.png","./assets/homePage/btn_share.png","./assets/homePage/mainbtn.png","./assets/homePage/mainbtn_bg.png","./assets/homePage/mainbtn_popover.png","./assets/homePage/tab1.png","./assets/homePage/tab2.png","./assets/homePage/title.png","./assets/lightEndPop/bg.png","./assets/lightEndPop/know_btn.png","./assets/lightGreyPop/bg.png","./assets/lightGreyPop/deng.png","./assets/lightGreyPop/join_btn.png","./assets/lightNewPop/bg.png","./assets/lightNewPop/draw_btn.png","./assets/lightNewPop/prize_box.png","./assets/lightedPop/bg.png","./assets/lightedPop/deng.png","./assets/lightedPop/know_btn.png","./assets/posterPop/bg.png","./assets/prizePage/item_bg.png","./assets/prizePage/prize_img_bg.png","./assets/prizePage/tab_active_bg.png","./assets/prizePage/title.png","./assets/rulePop/bg.png","./assets/svga/4输出徽章紫色.svga","./assets/svga/6输出徽章绿色.svga","./assets/svga/box.svga","./assets/svga/home.svga","./assets/svga/huadong.svga","./assets/svga/light.svga","./assets/svga/pop.svga","./assets/svga/saoguang.svga"]} {"preLoadImg":[],"asyncLoadImg":["./assets/common/back.png","./assets/common/close.png","./assets/common/sub_page_bg.png","./assets/common/sub_page_bg_cover.png","./assets/futurePage/btn.png","./assets/futurePage/item_bg.png","./assets/futurePage/prize_img_bg.png","./assets/futurePage/title.png","./assets/homePage/arrow_left.png","./assets/homePage/bg_type1.png","./assets/homePage/bg_type2.png","./assets/homePage/btn_future.png","./assets/homePage/btn_prize.png","./assets/homePage/btn_rule.png","./assets/homePage/btn_share.png","./assets/homePage/mainbtn.png","./assets/homePage/mainbtn_bg.png","./assets/homePage/mainbtn_popover.png","./assets/homePage/tab1.png","./assets/homePage/tab2.png","./assets/homePage/title.png","./assets/lightEndPop/bg.png","./assets/lightEndPop/know_btn.png","./assets/lightGreyPop/bg.png","./assets/lightGreyPop/deng.png","./assets/lightGreyPop/join_btn.png","./assets/lightNewPop/bg.png","./assets/lightNewPop/draw_btn.png","./assets/lightNewPop/prize_box.png","./assets/lightedPop/bg.png","./assets/lightedPop/deng.png","./assets/lightedPop/know_btn.png","./assets/posterPop/bg.png","./assets/posterPop/code_img_test.png","./assets/prizePage/item_bg.png","./assets/prizePage/prize_img_bg.png","./assets/prizePage/tab_active_bg.png","./assets/prizePage/title.png","./assets/rulePop/bg.png","./assets/svga/box.svga","./assets/svga/home.svga","./assets/svga/huadong.svga","./assets/svga/light.svga","./assets/svga/pop.svga","./assets/svga/saoguang.svga"]}
\ No newline at end of file \ No newline at end of file
...@@ -20,7 +20,19 @@ class LongImgPop extends Component { ...@@ -20,7 +20,19 @@ class LongImgPop extends Component {
async componentDidMount() { async componentDidMount() {
await waitTime(300) await waitTime(300)
// 开始截图 // 开始截图
html2canvas(document.querySelector("#posetBox"), { const shareContent = document.querySelector("#posetBox"); // 需要截图的包裹的(原生的)DOM 对象
const width = shareContent.offsetWidth; // 获取dom 宽度
const height = shareContent.offsetHeight; // 获取dom 高度
const canvas = document.createElement("canvas"); // 创建一个canvas节点
const scale = 2; // 定义任意放大倍数 支持小数
const scaleW = width * scale;
const scaleH = height * scale;
canvas.width = scaleW; // 定义canvas 宽度 * 缩放
canvas.height = scaleH; // 定义canvas高度 *缩放
canvas.style.width = scaleW + "px";
canvas.style.height = scaleH + "px";
canvas.getContext("2d").scale(scale, scale); // 获取context,设置scale
html2canvas(shareContent, {
backgroundColor: "transparent", backgroundColor: "transparent",
allowTaint: true, allowTaint: true,
scale: 1, // 添加的scale 参数 scale: 1, // 添加的scale 参数
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment