行车三检水印地点undefined内容替换
parent
c7cd69ad26
commit
57a2833e51
|
@ -196,7 +196,8 @@
|
|||
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); // 图片大小
|
||||
|
@ -204,8 +205,8 @@
|
|||
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({
|
||||
|
|
Loading…
Reference in New Issue