Commit f46871a8 by 李伟康

提交代码

1 parent 707d3dc0
......@@ -54,8 +54,8 @@ export default {
this.ctx = document.getElementById(this.canvasId)
let valueX = 95,
labelX = 17,
valueEndX = 320 - 7,
fontSize = 14,
valueEndX = 320 - fontSize / 2,
textBaseline = 'top',
canvasWidth = 337,
canvasHeight = 521,
......@@ -63,7 +63,9 @@ export default {
labelList = ['姓名:', '手机:'],
spacing = 0,
textYList = [],
labelEndX = 80
labelEndX = 80,
lineNum = 2,
lineHeight = 24
const draw = new Draw(this, {
width: canvasWidth,
height: canvasHeight,
......@@ -95,8 +97,8 @@ export default {
labelList.push('支付定金')
valueList.push(`${payPrice}元`)
labelList.map((e, index) => {
if (e == '商品名称:' && draw.getTextWidth(carText, fontSize) > valueEndX - valueX) spacing = 24
if ((e == formDescribeSecond && draw.getTextWidth(formContentFirst, fontSize) > valueEndX - valueX) || e === formDescribeSecond && (draw.getTextWidth(formDescribeFirst, fontSize) > labelEndX - labelX)) spacing = 48
if (e == '商品名称:' && draw.getTextWidth(carText, fontSize) > valueEndX - valueX) spacing = lineHeight
if ((e == formDescribeSecond && draw.getTextWidth(formContentFirst, fontSize) > valueEndX - valueX) || e === formDescribeSecond && (draw.getTextWidth(formDescribeFirst, fontSize) > labelEndX - labelX)) spacing = lineHeight * 2
if (index == labelList.length - 1) textYList.push(452)
else textYList.push(index * 32 + 109 + spacing)
})
......@@ -108,7 +110,7 @@ export default {
height: canvasHeight,
}, () => {
labelList && labelList.length > 0 && (labelList.map((e, index) => {
let y = textYList[index] + 7
let y = textYList[index] + fontSize / 2
let label = {
text: e,
x: labelX,
......@@ -132,11 +134,11 @@ export default {
// value.background = '#FFF9F7'
}
if ((formDescribeFirst && e === formDescribeFirst) || (formDescribeSecond && e === formDescribeSecond) || (e === '品牌车型:')) {
value.lineNum = 2
value.lineHeight = 24
value.lineNum = lineNum
value.lineHeight = lineHeight
if ((formDescribeFirst && e === formDescribeFirst) || (formDescribeSecond && e === formDescribeSecond)) {
label.lineNum = 2
label.lineHeight = 24
label.lineNum = lineNum
label.lineHeight = lineHeight
label.width = labelEndX
label.lastFont = ':'
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!