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({