uu
This commit is contained in:
parent
2b533e7614
commit
4fde89e5af
@ -100,7 +100,7 @@ export default {
|
||||
resolve()
|
||||
})
|
||||
},
|
||||
getImageInfo(params = {}) {
|
||||
getImageZip(params = {}) {
|
||||
return new Promise((resolve, reject)=> {
|
||||
uni.canvasGetImageData({
|
||||
x: 0,
|
||||
@ -113,8 +113,8 @@ export default {
|
||||
console.log("zip====", data);
|
||||
resolve(data);
|
||||
} else {
|
||||
showToast('获取图片信息异常:getImageInfo')
|
||||
reject('获取图片信息异常:getImageInfo')
|
||||
showToast('获取图片信息异常:getImageZip')
|
||||
reject('获取图片信息异常:getImageZip')
|
||||
}
|
||||
}
|
||||
})
|
||||
@ -130,10 +130,12 @@ export default {
|
||||
uni.getImageInfo({
|
||||
src: filePath,
|
||||
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.draw(true, ()=> {
|
||||
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)
|
||||
}, 1000)
|
||||
});
|
||||
|
||||
Loading…
Reference in New Issue
Block a user