Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
php
/
pingan-marathon
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
97f41592
authored
Nov 10, 2019
by
doszhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dos
parent
c69e776c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
74 additions
and
34 deletions
+74
-34
Public/static/js/common.js
+74
-34
No files found.
Public/static/js/common.js
View file @
97f41592
...
...
@@ -216,36 +216,78 @@ function hideShare() {
}
function
creatPoster
()
{
var
canvasinfo
=
initCanvas
(
'#posterCanvas'
,
1050
,
1698
);
posterCanvas
=
canvasinfo
[
0
];
posterctx
=
canvasinfo
[
1
];
if
(
nowTemplate
==
5
)
{
if
(
$
(
'[name=customize]'
).
val
()
==
''
)
{
my_notify
(
'请填写自定义文字'
);
return
false
;
}
else
{
var
canvasinfo
=
initCanvas
(
'#posterCanvas'
,
1050
,
1698
);
posterCanvas
=
canvasinfo
[
0
];
posterctx
=
canvasinfo
[
1
];
var
posterObj
=
new
Image
();
posterObj
.
src
=
'/Public/static/image2/poster.png'
;
var
posterObj
=
new
Image
();
posterObj
.
src
=
'/Public/static/image2/poster.png'
;
posterObj
.
onload
=
function
()
{
posterctx
.
drawImage
(
posterObj
,
0
,
0
,
posterCanvas
.
width
,
posterCanvas
.
height
);
var
headimgObj
=
new
Image
();
headimgObj
.
src
=
getManBase64
(
uploadCanvas
);
posterObj
.
onload
=
function
()
{
posterctx
.
drawImage
(
posterObj
,
0
,
0
,
posterCanvas
.
width
,
posterCanvas
.
height
);
var
headimgObj
=
new
Image
();
headimgObj
.
src
=
getManBase64
(
uploadCanvas
);
headimgObj
.
onload
=
function
()
{
posterctx
.
drawImage
(
headimgObj
,
51
*
2
,
184
*
2
,
387
*
2
,
387
*
2
);
headimgObj
.
onload
=
function
()
{
posterctx
.
drawImage
(
headimgObj
,
51
*
2
,
184
*
2
,
387
*
2
,
387
*
2
);
var
frameimg
=
new
Image
();
frameimg
.
src
=
'/Public/static/image2/frame'
+
nowTemplate
+
'.png'
;
var
frameimg
=
new
Image
();
frameimg
.
src
=
'/Public/static/image2/frame'
+
nowTemplate
+
'.png'
;
frameimg
.
onload
=
function
()
{
posterctx
.
drawImage
(
frameimg
,
51
*
2
,
184
*
2
,
387
*
2
,
387
*
2
);
frameimg
.
onload
=
function
()
{
posterctx
.
drawImage
(
frameimg
,
51
*
2
,
184
*
2
,
387
*
2
,
387
*
2
);
$
(
'#poster'
).
attr
(
'src'
,
getManBase64
(
posterCanvas
));
$
(
'#poster'
).
attr
(
'src'
,
getManBase64
(
posterCanvas
));
$
(
'.upload-page'
).
fadeOut
(
300
);
$
(
'.poster-page'
).
fadeIn
(
300
);
$
(
'.upload-page'
).
fadeOut
(
300
);
$
(
'.poster-page'
).
fadeIn
(
300
);
}
}
}
}
}
else
{
var
canvasinfo
=
initCanvas
(
'#posterCanvas'
,
1050
,
1698
);
posterCanvas
=
canvasinfo
[
0
];
posterctx
=
canvasinfo
[
1
];
var
posterObj
=
new
Image
();
posterObj
.
src
=
'/Public/static/image2/poster.png'
;
posterObj
.
onload
=
function
()
{
posterctx
.
drawImage
(
posterObj
,
0
,
0
,
posterCanvas
.
width
,
posterCanvas
.
height
);
var
headimgObj
=
new
Image
();
headimgObj
.
src
=
getManBase64
(
uploadCanvas
);
headimgObj
.
onload
=
function
()
{
posterctx
.
drawImage
(
headimgObj
,
51
*
2
,
184
*
2
,
387
*
2
,
387
*
2
);
var
frameimg
=
new
Image
();
frameimg
.
src
=
'/Public/static/image2/frame'
+
nowTemplate
+
'.png'
;
frameimg
.
onload
=
function
()
{
posterctx
.
drawImage
(
frameimg
,
51
*
2
,
184
*
2
,
387
*
2
,
387
*
2
);
txtDraw
(
posterctx
,
$
(
'[name=customize]'
).
val
(),
41
,
'normal'
,
'#fff'
,
51
,
184
);
$
(
'#poster'
).
attr
(
'src'
,
getManBase64
(
posterCanvas
));
$
(
'.upload-page'
).
fadeOut
(
300
);
$
(
'.poster-page'
).
fadeIn
(
300
);
}
}
}
}
}
function
backToUpload
()
{
...
...
@@ -393,14 +435,12 @@ function initGame() {
$
(
'.customize'
).
hide
();
}
function
txtDraw
(
ctx
,
content
,
fontsize
,
fontweight
,
color
)
{
function
txtDraw
(
ctx
,
content
,
fontsize
,
fontweight
,
color
,
cx
=
0
,
cy
=
0
)
{
var
contentArr
=
content
.
split
(
''
);
if
(
contentArr
.
length
==
1
)
{
x
=
255
;
y
=
276
;
x
=
x
*
2
;
y
=
y
*
2
;
x
=
(
255
+
cx
)
*
2
;
y
=
(
276
+
cy
)
*
2
;
fontsize
=
fontsize
*
2
;
ctx
.
font
=
fontweight
+
' '
+
fontsize
+
'px zkkh'
;
...
...
@@ -410,8 +450,8 @@ function txtDraw(ctx, content, fontsize, fontweight, color) {
}
else
if
(
contentArr
.
length
==
2
)
{
x
=
236
;
y
=
276
;
x
=
236
+
cx
;
y
=
276
+
cy
+
cx
;
x
=
x
*
2
;
y
=
y
*
2
;
fontsize
=
fontsize
*
2
;
...
...
@@ -423,8 +463,8 @@ function txtDraw(ctx, content, fontsize, fontweight, color) {
}
else
if
(
contentArr
.
length
==
3
)
{
x
=
236
;
y
=
25
9
;
x
=
236
+
cx
;
y
=
25
5
+
cy
;
x
=
x
*
2
;
y
=
y
*
2
;
fontsize
=
fontsize
*
2
;
...
...
@@ -433,16 +473,16 @@ function txtDraw(ctx, content, fontsize, fontweight, color) {
ctx
.
fillStyle
=
color
;
ctx
.
fillText
(
contentArr
[
0
]
+
contentArr
[
1
],
x
,
y
);
x
=
255
;
y
=
302
;
x
=
255
+
cx
;
y
=
295
+
cy
;
x
=
x
*
2
;
y
=
y
*
2
;
ctx
.
fillText
(
contentArr
[
2
],
x
,
y
);
}
else
if
(
contentArr
.
length
==
4
)
{
x
=
236
;
y
=
255
;
x
=
236
+
cx
;
y
=
255
+
cy
;
x
=
x
*
2
;
y
=
y
*
2
;
fontsize
=
fontsize
*
2
;
...
...
@@ -451,8 +491,8 @@ function txtDraw(ctx, content, fontsize, fontweight, color) {
ctx
.
fillStyle
=
color
;
ctx
.
fillText
(
contentArr
[
0
]
+
contentArr
[
1
],
x
,
y
);
x
=
236
;
y
=
295
;
x
=
236
+
cx
;
y
=
295
+
cy
;
x
=
x
*
2
;
y
=
y
*
2
;
ctx
.
fillText
(
contentArr
[
2
]
+
contentArr
[
3
],
x
,
y
);
...
...
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