uu
This commit is contained in:
parent
2b533e7614
commit
4fde89e5af
@ -100,7 +100,7 @@ export default {
|
|||||||
resolve()
|
resolve()
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
getImageInfo(params = {}) {
|
getImageZip(params = {}) {
|
||||||
return new Promise((resolve, reject)=> {
|
return new Promise((resolve, reject)=> {
|
||||||
uni.canvasGetImageData({
|
uni.canvasGetImageData({
|
||||||
x: 0,
|
x: 0,
|
||||||
@ -113,8 +113,8 @@ export default {
|
|||||||
console.log("zip====", data);
|
console.log("zip====", data);
|
||||||
resolve(data);
|
resolve(data);
|
||||||
} else {
|
} else {
|
||||||
showToast('获取图片信息异常:getImageInfo')
|
showToast('获取图片信息异常:getImageZip')
|
||||||
reject('获取图片信息异常:getImageInfo')
|
reject('获取图片信息异常:getImageZip')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -130,10 +130,12 @@ export default {
|
|||||||
uni.getImageInfo({
|
uni.getImageInfo({
|
||||||
src: filePath,
|
src: filePath,
|
||||||
success(res) {
|
success(res) {
|
||||||
|
// 按原图比例算出 新的画图高度
|
||||||
|
that.canvas_height = parseInt(that.canvas_width * (res.height / res.width))
|
||||||
cxt.drawImage(filePath, 0, 0, that.canvas_width, that.canvas_height);
|
cxt.drawImage(filePath, 0, 0, that.canvas_width, that.canvas_height);
|
||||||
cxt.draw(true, ()=> {
|
cxt.draw(true, ()=> {
|
||||||
setTimeout( async ()=> {
|
setTimeout( async ()=> {
|
||||||
let data = await that.getImageInfo({ canvasId: that.canvasId, width: that.canvas_width, height: that.canvas_height, })
|
let data = await that.getImageZip({ canvasId: that.canvasId, width: that.canvas_width, height: that.canvas_height, })
|
||||||
resolve(data)
|
resolve(data)
|
||||||
}, 1000)
|
}, 1000)
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user