Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
php
/
ccb-lantern
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
905c1f70
authored
Jan 28, 2020
by
doszhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dos
parent
a89097c5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
58 additions
and
56 deletions
+58
-56
Public/static/js/common.js
+58
-56
No files found.
Public/static/js/common.js
View file @
905c1f70
...
...
@@ -458,66 +458,68 @@ function createPoster() {
createList
(
'.poster-list-page .poster-list'
,
flagStack
[
i
],
i
+
1
,
wrapNum
);
}
// let flagListHeight = $('.poster-list-page .poster-list').height();
// flagListHeight = (flagListHeight / fontSize) * 20;
// flagListHeight = flagListHeight + 20;
// let topHalfHeight = 489;
// let bottomHalfHeight = 368;
// let posterCanvasHeight = 0;
// flagListHeight = flagListHeight + 60;
// if (flagListHeight < 383) {
// posterCanvasHeight = topHalfHeight + 383 + bottomHalfHeight;
// flagListHeight = 383;
// } else {
// posterCanvasHeight = topHalfHeight + flagListHeight + bottomHalfHeight;
// }
// $('#posterCanvas').remove();
// canvasinfo = initCanvas('.poster-canvas-block', 'posterCanvas', 640 * 2, posterCanvasHeight * 2, true);
// posterCanvas = canvasinfo[0];
// posterCtx = canvasinfo[1];
//计算海报中部高度
let
flagListHeight
=
$
(
'.poster-list-page .poster-list'
).
height
();
flagListHeight
=
(
flagListHeight
/
fontSize
)
*
20
;
flagListHeight
=
flagListHeight
+
20
;
let
topHalfHeight
=
390
;
let
bottomHalfHeight
=
207
;
let
posterCanvasHeight
=
0
;
flagListHeight
=
flagListHeight
+
60
;
//计算海报总高度
if
(
flagListHeight
<
400
)
{
posterCanvasHeight
=
topHalfHeight
+
400
+
bottomHalfHeight
;
flagListHeight
=
400
;
}
else
{
posterCanvasHeight
=
topHalfHeight
+
flagListHeight
+
bottomHalfHeight
;
}
// $('#posterCanvas').css('height', pxToRem(posterCanvasHeight));
//创建海报canvas
$
(
'#posterCanvas'
).
remove
();
canvasinfo
=
initCanvas
(
'.poster-canvas-block'
,
'posterCanvas'
,
640
*
2
,
posterCanvasHeight
*
2
,
true
);
posterCanvas
=
canvasinfo
[
0
];
posterCtx
=
canvasinfo
[
1
];
$
(
'#posterCanvas'
).
css
(
'height'
,
pxToRem
(
posterCanvasHeight
));
// posterCtx.fillStyle = bgColor;
// posterCtx.fillRect(0, 0, posterCanvas.width, posterCanvas.height);
//画海报背景色
posterCtx
.
fillStyle
=
bgColor
;
posterCtx
.
fillRect
(
0
,
0
,
posterCanvas
.
width
,
posterCanvas
.
height
);
// //45 107
//
let topHalf = new Image();
//
topHalf.src = "/Public/static/image2/poster-tophalf.png";
//
topHalf.onload = function () {
//
//画海报上半部分
//
posterCtx.drawImage(topHalf, pxToRem(45 * 2), pxToRem(107 * 2), pxToRem(550 * 2), pxToRem(350 * 2));
//
posterCtx.save();
//
posterCtx.restore();
//
//画海报中部背景
//
posterCtx.fillStyle = '#ffffff';
//
posterCtx.fillRect(pxToRem(45 * 2), pxToRem(488 * 2), pxToRem(550 * 2), pxToRem(flagListHeight * 2));
//
posterCtx.save();
//
posterCtx.restore();
//
//画海报底部
//
let bottomHalf = new Image();
//
bottomHalf.src = "/Public/static/image2/poster-bottomhalf.png";
//
bottomHalf.onload = function () {
//
bottomHalfTop = pxToRem(487) + pxToRem(flagListHeight);
//
$('.poster-tip').css('top', bottomHalfTop + pxToRem(181));
//
posterCtx.drawImage(bottomHalf, pxToRem(45 * 2), bottomHalfTop * 2, pxToRem(550 * 2), pxToRem(207 * 2));
//
drawFlagItem(pxToRem(489 + 20));
//
let decorate = new Image();
//
decorate.src = checkedDecorate;
//
decorate.onload = function () {
//
posterCtx.drawImage(decorate, pxToRem(170 * 2), pxToRem(305 * 2), pxToRem(300 * 2), pxToRem(150 * 2));
//
flagTextDraw(posterCtx, signature, pxToRem(40 * 2), '#222222', pxToRem(230 * 2), (bottomHalfTop + pxToRem(103)) * 2, 'font');
//
flagTextDraw(posterCtx, getTime(), pxToRem(20 * 2), '#222222', pxToRem(230 * 2), (bottomHalfTop + pxToRem(136)) * 2);
//
setTimeout(function () {
//
$('.posterImg').attr('src', getManBase64(posterCanvas)).css('height', pxToRem(posterCanvasHeight));
//
}, 1000);
//
}
//
}
//
}
let
topHalf
=
new
Image
();
topHalf
.
src
=
"/Public/static/image2/poster-tophalf.png"
;
topHalf
.
onload
=
function
()
{
//画海报上半部分
posterCtx
.
drawImage
(
topHalf
,
pxToRem
(
45
*
2
),
pxToRem
(
107
*
2
),
pxToRem
(
550
*
2
),
pxToRem
(
350
*
2
));
posterCtx
.
save
();
posterCtx
.
restore
();
//画海报中部背景
posterCtx
.
fillStyle
=
'#ffffff'
;
posterCtx
.
fillRect
(
pxToRem
(
45
*
2
),
pxToRem
(
488
*
2
),
pxToRem
(
550
*
2
),
pxToRem
(
flagListHeight
*
2
));
posterCtx
.
save
();
posterCtx
.
restore
();
//画海报底部
let
bottomHalf
=
new
Image
();
bottomHalf
.
src
=
"/Public/static/image2/poster-bottomhalf.png"
;
bottomHalf
.
onload
=
function
()
{
bottomHalfTop
=
pxToRem
(
487
)
+
pxToRem
(
flagListHeight
);
$
(
'.poster-tip'
).
css
(
'top'
,
bottomHalfTop
+
pxToRem
(
181
));
posterCtx
.
drawImage
(
bottomHalf
,
pxToRem
(
45
*
2
),
bottomHalfTop
*
2
,
pxToRem
(
550
*
2
),
pxToRem
(
207
*
2
));
//
drawFlagItem(pxToRem(489 + 20));
//
let decorate = new Image();
//
decorate.src = checkedDecorate;
//
decorate.onload = function () {
//
posterCtx.drawImage(decorate, pxToRem(170 * 2), pxToRem(305 * 2), pxToRem(300 * 2), pxToRem(150 * 2));
//
flagTextDraw(posterCtx, signature, pxToRem(40 * 2), '#222222', pxToRem(230 * 2), (bottomHalfTop + pxToRem(103)) * 2, 'font');
//
flagTextDraw(posterCtx, getTime(), pxToRem(20 * 2), '#222222', pxToRem(230 * 2), (bottomHalfTop + pxToRem(136)) * 2);
//
setTimeout(function () {
//
$('.posterImg').attr('src', getManBase64(posterCanvas)).css('height', pxToRem(posterCanvasHeight));
//
}, 1000);
//
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment