uni-canvas-image 1.0.1 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/common/index.js +1 -1
- package/src/util/houseImage.js +1 -1
- package/src/util/noteImage.js +4 -4
package/package.json
CHANGED
package/src/common/index.js
CHANGED
|
@@ -131,7 +131,7 @@ export function handleParagraph(text, lineLength = 25, line = 2) {
|
|
|
131
131
|
for (let i = 0; i < line; i++) {
|
|
132
132
|
let str = text.slice(i * lineLength, (i + 1) * lineLength)
|
|
133
133
|
if (i === line - 1 && text.length > (i + 1) * lineLength) str = str.slice(0, -1) + '...'
|
|
134
|
-
if (str.trim()) textArray.push(str)
|
|
134
|
+
if (str && str.trim()) textArray.push(str)
|
|
135
135
|
}
|
|
136
136
|
return textArray
|
|
137
137
|
}
|
package/src/util/houseImage.js
CHANGED
|
@@ -81,7 +81,7 @@ function handleItems(arr, canvasId, api) {
|
|
|
81
81
|
}
|
|
82
82
|
})
|
|
83
83
|
// 标签
|
|
84
|
-
const tagsInfos = hanleTagsInfo(obj.tags, 160, 60 + i * 152)
|
|
84
|
+
const tagsInfos = hanleTagsInfo(obj.tags, 160, (titleInfos.length > 1 ? 60 : 54) + i * 152)
|
|
85
85
|
// 分类信息
|
|
86
86
|
const category = [
|
|
87
87
|
{ text: '单价', x: 160, y: 90 + i * 152, fontSize: 14, color: '#9B9B9B' },
|
package/src/util/noteImage.js
CHANGED
|
@@ -13,7 +13,7 @@ async function noteImage(params = {}) {
|
|
|
13
13
|
: await handleItem(items[0], canvasId, api) // 单个房源
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
function handleItem(obj, canvasId) {
|
|
16
|
+
function handleItem(obj, canvasId, api) {
|
|
17
17
|
return new Promise(async (resolve, reject) => {
|
|
18
18
|
const imgInfo = await getImageInfo(obj.imageUrl, 750 / 340)
|
|
19
19
|
const newImgInfo = {
|
|
@@ -40,7 +40,7 @@ function handleItem(obj, canvasId) {
|
|
|
40
40
|
type: 'text',
|
|
41
41
|
text,
|
|
42
42
|
x: 10,
|
|
43
|
-
y: 230 + index * 18,
|
|
43
|
+
y: (titleInfos.length > 1 ? 230 : 220) + index * 18,
|
|
44
44
|
fontSize: 12,
|
|
45
45
|
color: '#9B9B9B',
|
|
46
46
|
}
|
|
@@ -50,7 +50,7 @@ function handleItem(obj, canvasId) {
|
|
|
50
50
|
resolve(url)
|
|
51
51
|
})
|
|
52
52
|
}
|
|
53
|
-
function handleItems(arr, canvasId) {
|
|
53
|
+
function handleItems(arr, canvasId, api) {
|
|
54
54
|
return new Promise(async (resolve, reject) => {
|
|
55
55
|
const newObj = []
|
|
56
56
|
const newArr = arr.slice(0, 2)
|
|
@@ -82,7 +82,7 @@ function handleItems(arr, canvasId) {
|
|
|
82
82
|
type: 'text',
|
|
83
83
|
text,
|
|
84
84
|
x: 144,
|
|
85
|
-
y: 60 + i * 140 + index * 18,
|
|
85
|
+
y: (titleInfos.length > 1 ? 60 : 50) + i * 140 + index * 18,
|
|
86
86
|
fontSize: 10,
|
|
87
87
|
color: '#9B9B9B',
|
|
88
88
|
}
|