Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
php
/
chinaamc-2020flag
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
40254922
authored
Jan 10, 2020
by
doszhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dos
parent
dd542148
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
16 deletions
+25
-16
Public/static/css/index.css
+3
-1
Public/static/js/common.js
+22
-15
No files found.
Public/static/css/index.css
View file @
40254922
...
@@ -454,7 +454,9 @@ input[name=signature]::-webkit-input-placeholder {
...
@@ -454,7 +454,9 @@ input[name=signature]::-webkit-input-placeholder {
z-index
:
1
;
z-index
:
1
;
}
}
.poster-page
canvas
{
width
:
32rem
;
}
.poster-tip
{
.poster-tip
{
z-index
:
1
;
z-index
:
1
;
...
...
Public/static/js/common.js
View file @
40254922
...
@@ -50,8 +50,13 @@ if ($('div').length > 0) {
...
@@ -50,8 +50,13 @@ if ($('div').length > 0) {
preloadimages
(
preloadImageList
,
function
()
{
preloadimages
(
preloadImageList
,
function
()
{
$
(
'.page1'
).
fadeIn
(
300
);
//
$('.page1').fadeIn(300);
// $('.poster-page').fadeIn(300);
// $('.poster-page').fadeIn(300);
createPoster
();
setTimeout
(()
=>
{
showPosterPage
();
},
1000
);
},
function
(
progress
)
{
},
function
(
progress
)
{
...
@@ -148,11 +153,11 @@ let decorateList = [
...
@@ -148,11 +153,11 @@ let decorateList = [
];
];
//用户选择的flag列表
//用户选择的flag列表
let
flagStack
=
[];
let
flagStack
=
flag
;
//debug
//用户选择的小装饰src
//用户选择的小装饰src
let
checkedDecorate
;
let
checkedDecorate
=
decorateList
[
0
];
//debug
//用户署名
//用户署名
let
signature
;
let
signature
=
"张三"
;
//debug
//用户选择的色条index
//用户选择的色条index
let
colorIndex
=
4
;
let
colorIndex
=
4
;
//用户选择的背景色
//用户选择的背景色
...
@@ -336,10 +341,12 @@ function createPoster() {
...
@@ -336,10 +341,12 @@ function createPoster() {
let
canvasinfo
=
initCanvas
(
'.poster-canvas-block'
,
'posterCanvas'
,
640
,
posterCanvasHeight
,
true
);
let
canvasinfo
=
initCanvas
(
'.poster-canvas-block'
,
'posterCanvas'
,
640
*
2
,
posterCanvasHeight
*
2
,
true
);
posterCanvas
=
canvasinfo
[
0
];
posterCanvas
=
canvasinfo
[
0
];
posterCtx
=
canvasinfo
[
1
];
posterCtx
=
canvasinfo
[
1
];
$
(
'#posterCanvas'
).
css
(
'height'
,
pxToRem
(
posterCanvasHeight
));
posterCtx
.
fillStyle
=
bgColor
;
posterCtx
.
fillStyle
=
bgColor
;
posterCtx
.
fillRect
(
0
,
0
,
posterCanvas
.
width
,
posterCanvas
.
height
);
posterCtx
.
fillRect
(
0
,
0
,
posterCanvas
.
width
,
posterCanvas
.
height
);
//45 107
//45 107
...
@@ -347,12 +354,12 @@ function createPoster() {
...
@@ -347,12 +354,12 @@ function createPoster() {
topHalf
.
src
=
picUrl
+
"poster-tophalf.png"
;
topHalf
.
src
=
picUrl
+
"poster-tophalf.png"
;
topHalf
.
onload
=
function
()
{
topHalf
.
onload
=
function
()
{
//画海报上半部分
//画海报上半部分
posterCtx
.
drawImage
(
topHalf
,
pxToRem
(
45
),
pxToRem
(
107
),
pxToRem
(
550
),
pxToRem
(
38
2
));
posterCtx
.
drawImage
(
topHalf
,
pxToRem
(
45
*
2
),
pxToRem
(
107
*
2
),
pxToRem
(
550
*
2
),
pxToRem
(
382
*
2
));
posterCtx
.
save
();
posterCtx
.
save
();
posterCtx
.
restore
();
posterCtx
.
restore
();
//画海报中部背景
//画海报中部背景
posterCtx
.
fillStyle
=
'#f4f4f4'
;
posterCtx
.
fillStyle
=
'#f4f4f4'
;
posterCtx
.
fillRect
(
pxToRem
(
4
4.5
),
pxToRem
(
489
),
pxToRem
(
551.5
),
pxToRem
(
flagListHeight
));
posterCtx
.
fillRect
(
pxToRem
(
4
5
*
2
),
pxToRem
(
489
*
2
),
pxToRem
(
550
*
2
),
pxToRem
(
flagListHeight
*
2
));
posterCtx
.
save
();
posterCtx
.
save
();
posterCtx
.
restore
();
posterCtx
.
restore
();
//画海报底部
//画海报底部
...
@@ -361,17 +368,17 @@ function createPoster() {
...
@@ -361,17 +368,17 @@ function createPoster() {
bottomHalf
.
onload
=
function
()
{
bottomHalf
.
onload
=
function
()
{
bottomHalfTop
=
pxToRem
(
487
)
+
pxToRem
(
flagListHeight
);
bottomHalfTop
=
pxToRem
(
487
)
+
pxToRem
(
flagListHeight
);
$
(
'.poster-tip'
).
css
(
'top'
,
bottomHalfTop
+
pxToRem
(
181
));
$
(
'.poster-tip'
).
css
(
'top'
,
bottomHalfTop
+
pxToRem
(
181
));
posterCtx
.
drawImage
(
bottomHalf
,
pxToRem
(
45
),
bottomHalfTop
,
pxToRem
(
550
),
pxToRem
(
238
));
posterCtx
.
drawImage
(
bottomHalf
,
pxToRem
(
45
*
2
),
bottomHalfTop
*
2
,
pxToRem
(
550
*
2
),
pxToRem
(
238
*
2
));
drawFlagItem
(
pxToRem
(
489
+
20
));
//
drawFlagItem(pxToRem(489 + 20));
let
decorate
=
new
Image
();
let
decorate
=
new
Image
();
decorate
.
src
=
checkedDecorate
;
decorate
.
src
=
checkedDecorate
;
decorate
.
onload
=
function
()
{
decorate
.
onload
=
function
()
{
posterCtx
.
drawImage
(
decorate
,
pxToRem
(
170
),
pxToRem
(
305
),
pxToRem
(
300
),
pxToRem
(
150
));
posterCtx
.
drawImage
(
decorate
,
pxToRem
(
170
*
2
),
pxToRem
(
305
*
2
),
pxToRem
(
300
*
2
),
pxToRem
(
150
*
2
));
flagTextDraw
(
posterCtx
,
signature
,
pxToRem
(
40
),
'#222222'
,
pxToRem
(
230
),
bottomHalfTop
+
pxToRem
(
103
));
//
flagTextDraw(posterCtx, signature, pxToRem(40), '#222222', pxToRem(230), bottomHalfTop + pxToRem(103));
flagTextDraw
(
posterCtx
,
getTime
(),
pxToRem
(
20
),
'#222222'
,
pxToRem
(
230
),
bottomHalfTop
+
pxToRem
(
136
));
//
flagTextDraw(posterCtx, getTime(), pxToRem(20), '#222222', pxToRem(230), bottomHalfTop + pxToRem(136));
setTimeout
(
function
()
{
//
setTimeout(function () {
$
(
'.posterImg'
).
attr
(
'src'
,
getManBase64
(
posterCanvas
)).
css
(
'height'
,
posterCanvas
.
height
);
//
$('.posterImg').attr('src', getManBase64(posterCanvas)).css('height', posterCanvas.height);
},
1000
);
//
}, 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