|
@@ -147,6 +147,34 @@
|
|
|
this.canvasHeight = rect.height;
|
|
|
/* 将canvas背景设置为 白底,不设置 导出的canvas的背景为透明 */
|
|
|
this.setCanvasBg('#fff');
|
|
|
+ this.$request.baseRequest('get', '/commonUser/getSignatureAddress', {
|
|
|
+ phone: this.userInfo.phone,
|
|
|
+ identification: 2
|
|
|
+ }).then(res => {
|
|
|
+ if (res.data) {
|
|
|
+ if (res.data.signImg) {
|
|
|
+ // 获取远程图片,canvas无法直接绘制远程图片
|
|
|
+ this.userInfo.signImg = res.data.signImg
|
|
|
+ uni.getImageInfo({
|
|
|
+ src: res.data.signImg,
|
|
|
+ success(res) {
|
|
|
+ var ctx = uni.createCanvasContext('handWriting')
|
|
|
+ ctx.drawImage(res.path, 0, 0, 330, 244)
|
|
|
+ ctx.save()
|
|
|
+ ctx.draw()
|
|
|
+ },
|
|
|
+ fail(res) {
|
|
|
+ console.log("fail -> res", res)
|
|
|
+ uni.showToast({
|
|
|
+ title: "图片下载异常",
|
|
|
+ duration: 2000,
|
|
|
+ icon: "none"
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
})
|
|
|
.exec();
|
|
|
});
|