行车三检水印地点undefined内容替换

dev
wangpeng 2024-05-17 15:47:00 +08:00
parent c7cd69ad26
commit 57a2833e51
1 changed files with 5 additions and 4 deletions

View File

@ -196,7 +196,8 @@
type: 'gcj02', type: 'gcj02',
geocode: true, geocode: true,
success: function (locationRes) { 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); const ctx = uni.createCanvasContext('watermarkCanvas', _this);
ctx.drawImage(tempFilePath, 0, 0, 300, 150); // ctx.drawImage(tempFilePath, 0, 0, 300, 150); //
@ -204,8 +205,8 @@
ctx.setFillStyle('red'); // ctx.setFillStyle('red'); //
ctx.setFontSize(10); // ctx.setFontSize(10); //
// //
ctx.fillText(`当前时间: ${_this.todayDate}`, 10, 120); // ctx.fillText(`当前时间: ${_this.todayDate}`, 10, 130); //
ctx.fillText(`当前位置: ${locationAddress}`, 10, 130); // ctx.fillText(`当前位置: ${locationAddress}`, 10, 140); //
ctx.draw(false, () => { ctx.draw(false, () => {
// //
uni.canvasToTempFilePath({ uni.canvasToTempFilePath({