Commit 12674011 by doszhang

dos

parent 5a6881e0
...@@ -441,14 +441,18 @@ input[name=signature]::-webkit-input-placeholder { ...@@ -441,14 +441,18 @@ input[name=signature]::-webkit-input-placeholder {
} }
.poster-page .poster-list { .poster-page .poster-list {
background-image: url(../image2/posterlist-bg.png) left top repeat-y; background: url(../image2/posterlist-bg.png) left top repeat-y;
background-size: auto 100%; background-size: 100% auto;
height: auto;
min-height: 20.2rem;
padding: 1.75rem 4.45rem 3rem 3.5rem;
width: 24.05rem;
} }
.poster-page .flag-item { .poster-page .flag-item {
position: relative; position: relative;
display: flex; display: flex;
margin-top: 1rem; margin-top: 1.5rem;
} }
.poster-page .flag-no { .poster-page .flag-no {
......
...@@ -204,6 +204,10 @@ let agreeTimer; ...@@ -204,6 +204,10 @@ let agreeTimer;
let countDownCanvas; let countDownCanvas;
let countDownCtx; let countDownCtx;
//海报canvas
let posterCanvas;
let posterCtx;
//记录初始状态下fontsize //记录初始状态下fontsize
const fontSize = parseFloat($('html').css('fontSize')); const fontSize = parseFloat($('html').css('fontSize'));
...@@ -218,11 +222,12 @@ $('input[name=customize-flag]').attr('placeholder', '也能在这里写你的fla ...@@ -218,11 +222,12 @@ $('input[name=customize-flag]').attr('placeholder', '也能在这里写你的fla
$('input[name=signature]').attr('placeholder', '准备好了,就在此署名吧').attr('id', 'signature'); $('input[name=signature]').attr('placeholder', '准备好了,就在此署名吧').attr('id', 'signature');
//倒计时canvas定义 //倒计时canvas定义
let canvasinfo = initCanvas('.countdown-canvas', 'countDownCanvas', 254, 254, true); let canvasinfo = initCanvas('.countdown-canvas', 'countDownCanvas', 254, 254, true);
countDownCanvas = canvasinfo[0]; countDownCanvas = canvasinfo[0];
countDownCtx = canvasinfo[1]; countDownCtx = canvasinfo[1];
//初始化小装饰 //初始化小装饰
initDecorate(); initDecorate();
...@@ -333,6 +338,25 @@ function createPoster() { ...@@ -333,6 +338,25 @@ function createPoster() {
for (let i = 0; i < flagStack.length; i++) { for (let i = 0; i < flagStack.length; i++) {
createList('.poster-page .poster-list', flagStack[i], i + 1); createList('.poster-page .poster-list', flagStack[i], i + 1);
} }
const flagListHeight = $('.poster-page .poster-list').height();
let topHalfHeight = pxToRem(389);
let bottomHalfHeight = pxToRem(368);
let posterCanvasHeight = 0;
if (flagListHeight < pxToRem(383)) {
posterCanvasHeight = topHalfHeight + pxToRem(383) + bottomHalfHeight;
} else {
posterCanvasHeight = topHalfHeight + flagListHeight + bottomHalfHeight;
}
let canvasinfo = initCanvas('.poster-canvas-block', 'posterCanvas', 640, posterCanvasHeight, true);
posterCanvas = canvasinfo[0];
posterCtx = canvasinfo[1];
posterCtx.fillStyle = bgColor;
posterCtx.fillRect(0, 0, posterCanvas.width, posterCanvas.height);
} }
function showPosterPage() { function showPosterPage() {
...@@ -700,8 +724,8 @@ function fadeInTextUp(text, fadeTime, divName) { ...@@ -700,8 +724,8 @@ function fadeInTextUp(text, fadeTime, divName) {
function initCanvas(target, id, canvasWidth, canvasHeight, useRem = false) { function initCanvas(target, id, canvasWidth, canvasHeight, useRem = false) {
if (useRem) { if (useRem) {
canvasWidth = (canvasWidth / 20) * fontSize; canvasWidth = pxToRem(canvasWidth);
canvasHeight = (canvasHeight / 20) * fontSize; canvasHeight = pxToRem(canvasHeight);
} }
$(target).html('<canvas id="' + id + '" width="' + canvasWidth + '" height="' + canvasHeight + '"></canvas>'); $(target).html('<canvas id="' + id + '" width="' + canvasWidth + '" height="' + canvasHeight + '"></canvas>');
canvas = $('#' + id)[0]; canvas = $('#' + id)[0];
...@@ -781,4 +805,8 @@ function checkIt(bind, maxNum) { ...@@ -781,4 +805,8 @@ function checkIt(bind, maxNum) {
} else { } else {
$("#" + bind).val(''); $("#" + bind).val('');
} }
}
function pxToRem(px) {
return (px / 20) * fontSize;
} }
\ No newline at end of file
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 sign in to comment