flx:优化水印遮挡

This commit is contained in:
Rain_ 2025-09-03 10:48:09 +08:00
parent c4f91645a7
commit fbff1bbab1
2 changed files with 32 additions and 25 deletions

View File

@ -54,6 +54,7 @@
</view> </view>
<view class="type flex" v-if="title == '整改'"> <view class="type flex" v-if="title == '整改'">
<view class="name"> <view class="name">
<text class="star">*</text>
违章人员: 违章人员:
</view> </view>
<!-- <picker mode="selector" :range="personList" range-key="workerName" @change="handleChangeRegion" <!-- <picker mode="selector" :range="personList" range-key="workerName" @change="handleChangeRegion"
@ -79,7 +80,7 @@
input-align="left" @confirm="handleChangeCharger"></g-picker> --> input-align="left" @confirm="handleChangeCharger"></g-picker> -->
</view> </view>
<view class="type flex3"> <view class="type flex3">
<view class="name"><text v-if="type != 3" class="star">*</text>补充说明</view> <view class="name"><text class="star">*</text>补充说明</view>
<textarea class="textarea" maxlength="-1" placeholder-class="cl" name="inspectContent" <textarea class="textarea" maxlength="-1" placeholder-class="cl" name="inspectContent"
@input='changeTextarea' :value="content" placeholder="请输入"></textarea> @input='changeTextarea' :value="content" placeholder="请输入"></textarea>
</view> </view>
@ -115,7 +116,7 @@
<tki-tree ref="changeIdTree" :search="true" :defaultList='violatorId' :multiple="false" <tki-tree ref="changeIdTree" :search="true" :defaultList='violatorId' :multiple="false"
@confirm="(val)=>checkPointBtn(val,1)" idKey='id' :range="personList" rangeKey="workerName" @confirm="(val)=>checkPointBtn(val,1)" idKey='id' :range="personList" rangeKey="workerName"
confirmColor="#4e8af7" :selectParent="true" /> confirmColor="#4e8af7" :selectParent="true" />
<canversCom style="opacity: 0;" v-if="openImg" @imgUrl="imgUrl" :imgList="imgList"></canversCom> <canversCom @imgUrl="imgUrl" :imgList="imgList"></canversCom>
</view> </view>
</template> </template>
@ -392,7 +393,7 @@
}, },
// //
formSubmit() { formSubmit() {
if (this.content == '' && this.type != 3) { if (this.content == '') {
uni.showToast({ uni.showToast({
title: "请输入回复内容", title: "请输入回复内容",
icon: "none" icon: "none"
@ -415,10 +416,10 @@
return return
} }
// if (this.violatorId.length == 0 && this.type == 1) { if (this.violatorId.length == 0 && this.type == 1) {
// this.$message.error(""); this.$message.error("请选择违章人员");
// return; return;
// } }
let time = this.getNewDate() let time = this.getNewDate()
let data = { let data = {

View File

@ -39,8 +39,8 @@
uni.getLocation({ uni.getLocation({
type: 'gcj02', type: 'gcj02',
geocode: true, geocode: true,
isHighAccuracy: "true", isHighAccuracy: "true",
accuracy: "best", // 20m accuracy: "best", // 20m
success: function(res) { success: function(res) {
console.log('当前位置的经度:' + res.longitude); console.log('当前位置的经度:' + res.longitude);
console.log('当前位置的纬度:' + res.latitude); console.log('当前位置的纬度:' + res.latitude);
@ -58,7 +58,8 @@
console.log("地址", res) console.log("地址", res)
if (res.data.status == "1") { if (res.data.status == "1") {
// //
var one = res.data.regeocode.formatted_address var one = res.data.regeocode.formatted_address;
that.locationInfo = one;
if (one) { if (one) {
that.adressDetail = one.substr(3, 3) + one.substr(9, 4) + one that.adressDetail = one.substr(3, 3) + one.substr(9, 4) + one
.substr(20, 7) .substr(20, 7)
@ -92,12 +93,18 @@
} }
}); });
}, },
drawMultilineText(ctx, text, x, y, lineHeight) {
const lines = text.split('\n');
lines.forEach((line, index) => {
ctx.fillText(line, x, y + index * lineHeight);
});
},
canversImg() { canversImg() {
uni.showLoading({ uni.showLoading({
title: '正在合成中' title: '正在合成中'
}) })
let that = this let that = this
console.log('我开始画啦 '+JSON.stringify(that.imgList)) console.log('我开始画啦 ' + JSON.stringify(that.imgList))
const ctx = uni.createCanvasContext('myCanvas', that); // const ctx = uni.createCanvasContext('myCanvas', that); //
ctx.drawImage(that.imgList.imgUrl, 0, 0, that.imgList.imgWidth, that.imgList ctx.drawImage(that.imgList.imgUrl, 0, 0, that.imgList.imgWidth, that.imgList
.imgHeight); // .imgHeight); //
@ -106,23 +113,22 @@
0.72, that.imgList.imgWidth * 0.50, that.imgList.imgHeight * 0.22); // 0.72, that.imgList.imgWidth * 0.50, that.imgList.imgHeight * 0.22); //
ctx.setFillStyle('#FFFFFF'); // ctx.setFillStyle('#FFFFFF'); //
ctx.setFontSize(25); // ctx.setFontSize(25); //
ctx.fillText('详情', that.imgList.imgWidth * 0.73, that.imgList.imgHeight * 0.755); //
ctx.setFillStyle('#000000'); // ctx.setFillStyle('#000000'); //
// ctx.fillText('' + (that.imgList.name ? that.imgList.name : ''), that.imgList.imgWidth *
// 0.56, that
// .imgList.imgHeight * 0.8); //
// ctx.fillText(' ' + (that.imgList.team ? that.imgList.team : ''), that.imgList.imgWidth *
// 0.56, that
// .imgList.imgHeight * 0.825); //
ctx.fillText('天 气:' + that.weatherInfo, that.imgList.imgWidth * 0.56, that.imgList ctx.fillText('天 气:' + that.weatherInfo, that.imgList.imgWidth * 0.56, that.imgList
.imgHeight * .imgHeight *
0.8); // 0.8); //
ctx.fillText('拍摄时间:' + that.date, that.imgList.imgWidth * 0.56, that.imgList.imgHeight * ctx.fillText('拍摄时间:' + that.date, that.imgList.imgWidth * 0.56, that.imgList.imgHeight *
0.84); // 0.83); //
ctx.fillText('地 点:' + that.adressDetail, that.imgList.imgWidth * 0.56, that.imgList // ctx.fillText('' + that.adressDetail, that.imgList.imgWidth * 0.56, that.imgList
.imgHeight * // .imgHeight *
0.88); // // 0.88); //
console.log('canvs画布返回的地址---',that.adressDetail); const insertIntervalString = (originStr, disNum = 10, insertStr = "\n") => originStr.replace(new RegExp("(.{" + disNum + "})", "g"), "$1" + insertStr);
that.drawMultilineText(ctx, insertIntervalString('地点:' + that.locationInfo, 18), that.imgList.imgWidth * 0.56, that.imgList.imgHeight *
0.86, 40);
// ctx.fillText('' + that.imgList.shooter, that.imgList.imgWidth * 0.56, that.imgList
// .imgHeight *
// 0.92); //
console.log('canvs画布返回的地址---', that.locationInfo);
ctx.draw(false, () => { ctx.draw(false, () => {
// canvas // canvas
uni.canvasToTempFilePath({ uni.canvasToTempFilePath({
@ -142,7 +148,7 @@
title: '绘制成功' title: '绘制成功'
}); });
uni.hideLoading() uni.hideLoading()
}, },
fail: err => { fail: err => {
uni.showToast({ uni.showToast({
@ -153,7 +159,7 @@
uni.hideLoading(); uni.hideLoading();
uni.hideToast(); uni.hideToast();
uni.hideLoading() uni.hideLoading()
} }
}, ); }, );
}); });