Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
glsx
/
scrm-wx-merchant-activity
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 22a5beca
authored
Aug 15, 2022
by
李伟康
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
修复BUG
1 parent
f66b741f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
8 deletions
src/utils/draw.js
src/views/crowdfunding/components/createOrderImg.vue
src/utils/draw.js
View file @
22a5bec
...
@@ -55,8 +55,10 @@ class Draw {
...
@@ -55,8 +55,10 @@ class Draw {
toRpx
(
val
)
{
toRpx
(
val
)
{
return
this
[
_pixelRatio_
]
*
val
return
this
[
_pixelRatio_
]
*
val
}
}
getTextWidth
(
text
,
fontSize
=
12
)
{
getTextWidth
(
text
,
fontSize
)
{
return
this
[
_ctx_
].
measureText
(
text
).
width
*
fontSize
/
12
let
font
=
this
[
_ctx_
].
font
.
split
(
'px'
)[
1
]
if
(
fontSize
)
this
[
_ctx_
].
font
=
`400
${
fontSize
}
px
${
font
}
`
return
this
[
_ctx_
].
measureText
(
text
).
width
}
}
drawFill
(
x
,
y
,
width
,
height
,
color
)
{
drawFill
(
x
,
y
,
width
,
height
,
color
)
{
this
[
_ctx_
].
beginPath
()
this
[
_ctx_
].
beginPath
()
...
@@ -84,7 +86,7 @@ class Draw {
...
@@ -84,7 +86,7 @@ class Draw {
x
,
x
,
y
,
y
,
}
=
textParams
}
=
textParams
let
text_width
=
this
.
getTextWidth
(
text
,
12
),
let
text_width
=
this
.
getTextWidth
(
text
),
font
=
this
[
_ctx_
].
font
.
split
(
'px'
)[
1
]
font
=
this
[
_ctx_
].
font
.
split
(
'px'
)[
1
]
textAlign
=
textAlign
||
'left'
textAlign
=
textAlign
||
'left'
textBaseline
=
textBaseline
||
'normal'
textBaseline
=
textBaseline
||
'normal'
...
...
src/views/crowdfunding/components/createOrderImg.vue
View file @
22a5bec
...
@@ -66,7 +66,8 @@ export default {
...
@@ -66,7 +66,8 @@ export default {
labelEndX
=
88
labelEndX
=
88
const
draw
=
new
Draw
(
this
,
{
const
draw
=
new
Draw
(
this
,
{
width
:
canvasWidth
,
width
:
canvasWidth
,
height
:
canvasHeight
height
:
canvasHeight
,
// pixelRatio: 1
})
})
let
valueList
=
[
let
valueList
=
[
userName
,
userName
,
...
@@ -95,11 +96,9 @@ export default {
...
@@ -95,11 +96,9 @@ export default {
}
}
labelList
.
push
(
'支付定金'
)
labelList
.
push
(
'支付定金'
)
valueList
.
push
(
`
${
payPrice
}
元`
)
valueList
.
push
(
`
${
payPrice
}
元`
)
console
.
log
(
carText
,
draw
.
getTextWidth
(
carText
,
fontSize
)
+
valueX
,
valueEndX
)
labelList
.
map
((
e
,
index
)
=>
{
labelList
.
map
((
e
,
index
)
=>
{
if
(
e
==
'商品名称:'
&&
draw
.
getTextWidth
(
carText
,
fontSize
)
+
valueX
>
valueEndX
-
valueX
)
spacing
=
24
if
(
e
==
'商品名称:'
&&
draw
.
getTextWidth
(
carText
,
fontSize
)
>
valueEndX
-
valueX
)
spacing
=
24
if
(
e
==
formDescribeSecond
&&
draw
.
getTextWidth
(
formContentFirst
,
fontSize
)
+
valueX
>
valueEndX
-
valueX
)
spacing
=
48
if
((
e
==
formDescribeSecond
&&
draw
.
getTextWidth
(
formContentFirst
,
fontSize
)
>
valueEndX
-
valueX
)
||
e
===
formDescribeSecond
&&
(
draw
.
getTextWidth
(
formDescribeFirst
,
fontSize
)
>
labelEndX
-
labelX
))
spacing
=
48
if
(
e
===
formDescribeSecond
&&
(
draw
.
getTextWidth
(
formDescribeFirst
,
fontSize
)
+
labelX
>
labelEndX
-
labelX
))
spacing
=
48
if
(
index
==
labelList
.
length
-
1
)
textYList
.
push
(
452
)
if
(
index
==
labelList
.
length
-
1
)
textYList
.
push
(
452
)
else
textYList
.
push
(
index
*
32
+
109
+
spacing
)
else
textYList
.
push
(
index
*
32
+
109
+
spacing
)
})
})
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment