From 57a2833e51232c27ed37c819470a941ee2834ebb Mon Sep 17 00:00:00 2001 From: wangpeng Date: Fri, 17 May 2024 15:47:00 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A1=8C=E8=BD=A6=E4=B8=89=E6=A3=80=E6=B0=B4?= =?UTF-8?q?=E5=8D=B0=E5=9C=B0=E7=82=B9undefined=E5=86=85=E5=AE=B9=E6=9B=BF?= =?UTF-8?q?=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../driving-inspections/driving-item-check-list.vue | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/pages/application/driving-inspections/driving-item-check-list.vue b/pages/application/driving-inspections/driving-item-check-list.vue index d304e17..e82eb46 100644 --- a/pages/application/driving-inspections/driving-item-check-list.vue +++ b/pages/application/driving-inspections/driving-item-check-list.vue @@ -196,16 +196,17 @@ type: 'gcj02', geocode: true, success: function (locationRes) { - const locationAddress = `${locationRes.address.province}${locationRes.address.city}${locationRes.address.district}${locationRes.address.street}${locationRes.address.streetNum}${locationRes.address.poiName}`; - // 创建画布 + let locationAddress = `${locationRes.address.province}${locationRes.address.city}${locationRes.address.district}${locationRes.address.street}${locationRes.address.streetNum}${locationRes.address.poiName}`; + locationAddress = locationAddress.replace(/undefined/g,'') + // 创建画布 const ctx = uni.createCanvasContext('watermarkCanvas', _this); ctx.drawImage(tempFilePath, 0, 0, 300, 150); // 图片大小 ctx.setFontSize(20); // 水印字体大小 ctx.setFillStyle('red'); // 水印字体颜色 ctx.setFontSize(10); // 调整字体大小,适应位置信息 // 绘制水印 - ctx.fillText(`当前时间: ${_this.todayDate}`, 10, 120); // 根据实际情况调整位置 - ctx.fillText(`当前位置: ${locationAddress}`, 10, 130); // 根据实际情况调整位置 + ctx.fillText(`当前时间: ${_this.todayDate}`, 10, 130); // 根据实际情况调整位置 + ctx.fillText(`当前位置: ${locationAddress}`, 10, 140); // 根据实际情况调整位置 ctx.draw(false, () => { // 将画布内容保存为图片 uni.canvasToTempFilePath({