Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
php
/
pingan-promise
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
f9d5c56f
authored
Mar 10, 2020
by
doszhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dos
parent
6bf10bcc
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
14 deletions
+14
-14
Public/static/js/common.js
+14
-14
No files found.
Public/static/js/common.js
View file @
f9d5c56f
...
@@ -145,7 +145,7 @@ function createPoster(name, business) {
...
@@ -145,7 +145,7 @@ function createPoster(name, business) {
nowPosterIndex
=
RandomNumBoth
(
1
,
3
,
oldPosterIndex
);
nowPosterIndex
=
RandomNumBoth
(
1
,
3
,
oldPosterIndex
);
console
.
log
(
'nowPosterIndex:'
,
nowPosterIndex
);
console
.
log
(
'nowPosterIndex:'
,
nowPosterIndex
);
let
canvasinfo
=
initCanvas
(
'.poster-canvas'
,
'posterCanvas'
,
425
,
820
);
let
canvasinfo
=
initCanvas
(
'.poster-canvas'
,
'posterCanvas'
,
425
*
2
,
820
*
2
);
posterCanvas
=
canvasinfo
[
0
];
posterCanvas
=
canvasinfo
[
0
];
posterCtx
=
canvasinfo
[
1
];
posterCtx
=
canvasinfo
[
1
];
$
(
'.poster-canvas'
).
append
(
'<img class="posterimg" />'
);
$
(
'.poster-canvas'
).
append
(
'<img class="posterimg" />'
);
...
@@ -158,11 +158,11 @@ function createPoster(name, business) {
...
@@ -158,11 +158,11 @@ function createPoster(name, business) {
headimgObj
.
src
=
getManBase64
(
uploadCanvas
);
headimgObj
.
src
=
getManBase64
(
uploadCanvas
);
headimgObj
.
onload
=
function
()
{
headimgObj
.
onload
=
function
()
{
posterCtx
.
beginPath
();
posterCtx
.
beginPath
();
posterCtx
.
arc
(
214
,
446
,
46
,
0
,
2
*
Math
.
PI
);
posterCtx
.
arc
(
214
*
2
,
446
*
2
,
46
*
2
,
0
,
2
*
Math
.
PI
);
posterCtx
.
fillStyle
=
"#fff"
;
//填充颜色,默认是黑色
posterCtx
.
fillStyle
=
"#fff"
;
//填充颜色,默认是黑色
posterCtx
.
fill
();
//画实心圆
posterCtx
.
fill
();
//画实心圆
posterCtx
.
closePath
();
posterCtx
.
closePath
();
posterCtx
.
drawImage
(
headimgObj
,
170
,
402
,
88
,
88
);
posterCtx
.
drawImage
(
headimgObj
,
170
*
2
,
402
*
2
,
88
*
2
,
88
*
2
);
drawUserInfo
(
name
,
business
,
20
,
'bolder'
);
drawUserInfo
(
name
,
business
,
20
,
'bolder'
);
drawNum
();
drawNum
();
setTimeout
(
function
()
{
setTimeout
(
function
()
{
...
@@ -181,7 +181,7 @@ function confirmAvatar() {
...
@@ -181,7 +181,7 @@ function confirmAvatar() {
}
}
function
inputLength
()
{
function
inputLength
()
{
checkIt
(
'name'
,
4
);
checkIt
(
'name'
,
8
);
}
}
function
bindMc
(
mc
,
ctx
,
myCanvas
,
img
,
imgInfo
)
{
function
bindMc
(
mc
,
ctx
,
myCanvas
,
img
,
imgInfo
)
{
...
@@ -325,7 +325,7 @@ function drawNum() {
...
@@ -325,7 +325,7 @@ function drawNum() {
}
}
function
drawUserInfo
(
name
,
business
,
fontsize
,
fontweight
)
{
function
drawUserInfo
(
name
,
business
,
fontsize
,
fontweight
)
{
//
fontsize = fontsize * 2;
fontsize
=
fontsize
*
2
;
posterCtx
.
font
=
fontweight
+
' '
+
fontsize
+
'px normal'
;
posterCtx
.
font
=
fontweight
+
' '
+
fontsize
+
'px normal'
;
let
{
let
{
idX
,
idX
,
...
@@ -336,13 +336,13 @@ function drawUserInfo(name, business, fontsize, fontweight) {
...
@@ -336,13 +336,13 @@ function drawUserInfo(name, business, fontsize, fontweight) {
let
idObj
=
new
Image
();
let
idObj
=
new
Image
();
idObj
.
src
=
'/Public/static/image2/id.png'
;
idObj
.
src
=
'/Public/static/image2/id.png'
;
idObj
.
onload
=
function
()
{
idObj
.
onload
=
function
()
{
posterCtx
.
drawImage
(
idObj
,
idX
,
497
,
idInfo
.
width
,
idInfo
.
height
);
posterCtx
.
drawImage
(
idObj
,
idX
,
497
*
2
,
idInfo
.
width
*
2
,
idInfo
.
height
*
2
);
txtDraw
(
posterCtx
,
name
,
'#fff'
,
nameX
,
512
);
txtDraw
(
posterCtx
,
name
,
'#fff'
,
nameX
,
512
*
2
);
let
noObj
=
new
Image
();
let
noObj
=
new
Image
();
noObj
.
src
=
'/Public/static/image2/no.png'
;
noObj
.
src
=
'/Public/static/image2/no.png'
;
noObj
.
onload
=
function
()
{
noObj
.
onload
=
function
()
{
posterCtx
.
drawImage
(
noObj
,
noX
,
499
,
noInfo
.
width
,
noInfo
.
height
);
posterCtx
.
drawImage
(
noObj
,
noX
,
499
*
2
,
noInfo
.
width
*
2
,
noInfo
.
height
*
2
);
txtDraw
(
posterCtx
,
business
,
'#fff'
,
businessX
,
512
);
txtDraw
(
posterCtx
,
business
,
'#fff'
,
businessX
,
512
*
2
);
};
};
};
};
}
}
...
@@ -351,12 +351,12 @@ function getX(name, business) {
...
@@ -351,12 +351,12 @@ function getX(name, business) {
let
nameWidth
=
posterCtx
.
measureText
(
name
).
width
;
let
nameWidth
=
posterCtx
.
measureText
(
name
).
width
;
let
businessWidth
=
posterCtx
.
measureText
(
business
).
width
;
let
businessWidth
=
posterCtx
.
measureText
(
business
).
width
;
let
totalWidth
=
idInfo
.
width
+
6
+
nameWidth
+
21
+
noInfo
.
width
+
3
+
businessWidth
;
let
totalWidth
=
idInfo
.
width
*
2
+
6
*
2
+
nameWidth
+
21
*
2
+
noInfo
.
width
*
2
+
3
*
2
+
businessWidth
;
let
idX
=
212
-
totalWidth
/
2
;
let
idX
=
212
*
2
-
totalWidth
/
2
;
let
nameX
=
idX
+
idInfo
.
width
+
6
;
let
nameX
=
idX
+
(
idInfo
.
width
*
2
)
+
6
*
2
;
let
noX
=
nameX
+
nameWidth
+
21
;
let
noX
=
nameX
+
nameWidth
+
21
*
2
;
let
businessX
=
noX
+
noInfo
.
width
+
3
;
let
businessX
=
noX
+
noInfo
.
width
+
3
*
2
;
return
{
return
{
idX
,
idX
,
...
...
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