Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
7
7-Eleven
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
高淑倩
7-Eleven
Commits
e6505421
Commit
e6505421
authored
Nov 04, 2019
by
谢中龙
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改商品保存海报时名字过长两行显示多余不显示
parent
61016ebc
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
6 deletions
+44
-6
sharePoster.js
src/component/sharePoster/sharePoster.js
+44
-6
No files found.
src/component/sharePoster/sharePoster.js
View file @
e6505421
...
...
@@ -163,7 +163,6 @@ Component({
var
right
=
rect
.
right
;
width
=
rect
.
width
;
var
left
=
rect
.
left
;
console
.
log
(
rect
)
ctx
.
setFillStyle
(
'#fff'
);
ctx
.
fillRect
(
0
,
0
,
rect
.
width
,
height
);
...
...
@@ -183,12 +182,51 @@ Component({
ctx
.
drawImage
(
that
.
data
.
userAvatar
,
12
,
290
,
40
,
40
);
}
// title
console
.
log
(
'productDesc'
,
that
.
data
.
productDesc
)
if
(
that
.
data
.
productDesc
){
ctx
.
setFontSize
(
12
);
ctx
.
setFillStyle
(
'#333333'
);
ctx
.
setTextAlign
(
'left'
);
ctx
.
fillText
(
that
.
data
.
productDesc
,
61
,
300
);
ctx
.
setFontSize
(
12
);
ctx
.
setFillStyle
(
'#333333'
);
ctx
.
setTextAlign
(
'left'
);
let
arr
=
that
.
data
.
productDesc
.
split
(
''
);
let
row
=
[];
let
tempStr
=
''
;
for
(
let
i
=
0
;
i
<
arr
.
length
;
i
++
){
if
(
ctx
.
measureText
(
tempStr
).
width
<
100
){
tempStr
+=
arr
[
i
];
}
else
{
i
--
;
row
.
push
(
tempStr
);
tempStr
=
''
;
}
}
console
.
log
(
row
)
if
(
row
.
length
>
2
){
var
rowCut
=
row
.
slice
(
0
,
2
);
var
rowPart
=
rowCut
[
1
];
var
test
=
""
;
var
empty
=
[];
for
(
var
a
=
0
;
a
<
rowPart
.
length
;
a
++
)
{
if
(
context
.
measureText
(
test
).
width
<
220
)
{
test
+=
rowPart
[
a
];
}
else
{
break
;
}
}
empty
.
push
(
test
);
var
group
=
empty
[
0
]
+
"..."
//
rowCut
.
splice
(
1
,
1
,
group
);
row
=
rowCut
;
}
for
(
var
b
=
0
;
b
<
row
.
length
;
b
++
)
{
ctx
.
fillText
(
row
[
b
],
61
,
300
+
b
*
20
);
}
// ctx.fillText(that.data.productDesc, 61, 300);
}
else
{
let
explain
=
JSON
.
parse
(
JSON
.
stringify
(
that
.
data
.
cardExplain
))
if
(
explain
[
0
]){
...
...
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