Commit e7785d60 authored by 李俊赕's avatar 李俊赕

edit-take-page

parent c9401807
......@@ -137,15 +137,17 @@
// photo.currentItem.
// 当前项的图片显示
// 拍照项张数目增加 等于10张
if(photo.currentItemLength<10){
uni.navigateBack({
delta:1
})
}else{
uni.redirectTo({
url:"pages/photo/list"
})
}
let timer = setTimeout(()=>{
if(photo.currentItemLength<10){
uni.navigateBack({
delta:1
})
}else{
uni.redirectTo({
url:"pages/photo/list"
})
}
},2000)
} else {
uni.showToast({
title:'图片上传失败'
......
......@@ -13,10 +13,11 @@
<camera class="camera-box" v-if="cameraChange&&!standardShow" :device-position="cameraInfo.devicePosition"
:flash="cameraInfo.flash" :style="{'height':cameraHeight + 'rpx'}" @error="cameraError">
<cover-view class="mark-box">
<cover-view class="txt u-m-t-30">经度:{{waterInfo.longitude || '正在获取中...'}}</cover-view>
<cover-view class="txt u-m-t-10">维度:{{waterInfo.latitude || '正在获取中...'}}</cover-view>
<cover-view class="txt big u-m-t-20" >{{titleTxt}}</cover-view>
<cover-view class="txt u-m-t-20" v-for="(txt,index) in settingTxtArr" :key="index">{{txt}}</cover-view>
<!-- <cover-view class="txt u-m-t-10">维度:{{waterInfo.latitude || '正在获取中...'}}</cover-view>
<cover-view class="txt u-m-t-10">地址:{{waterInfo.address || '正在获取中...'}}</cover-view>
<cover-view class="txt u-m-t-10">时间:{{waterInfo.date || '正在获取中...'}}</cover-view>
<cover-view class="txt u-m-t-10">时间:{{waterInfo.date || '正在获取中...'}}</cover-view> -->
</cover-view>
<cover-image class="mark-water" mode="aspectFit" :src="waterInfo.markImage"></cover-image>
</camera>
......@@ -95,13 +96,48 @@
this.getMarkPath()
this.currentItem = photo.currentItem
},
compute: {
computed: {
waterSetting() {
// photo.waterSetting
const photo = getApp().globalData.photo
console.log(photo.waterSetting,'photo.waterSetting')
console.log(photo.waterSetting, 'photo.waterSetting')
return photo.waterSetting || null
},
titleTxt(){
const waterSetting = this.waterSetting
let txt = ''
txt = waterSetting.lower_right && waterSetting.lower_right.title_text || ''
console.log(txt,'title_text','waterSetting',waterSetting)
return txt
},
settingTxtArr(){
let arr = []
// 包含经纬度
const waterInfo = this.waterInfo
arr = ['经度: ' + waterInfo.longitude, '纬度: ' + waterInfo.latitude, '地址: ' + waterInfo.address, '时间: ' +
waterInfo.date
]
let settingTxtArr = []
const typeArr = ['经度', '纬度', '地址', '时间']
const waterSetting = this.waterSetting
if (!waterSetting || !waterSetting.lower_right || !waterSetting.lower_right.body) {
return arr
}
const settingArr = waterSetting.lower_right.body
settingArr.map(item => {
const idx = typeArr.indexOf(item.watemark_type)
if (item.enable && (idx > -1 || (item.watemark_value && item.watemark_text))) {
if (idx > -1) {
settingTxtArr.push(arr[idx])
} else {
settingTxtArr.push(item.watemark_text + ': ' + item.watemark_value)
}
}
})
console.log(settingTxtArr,'settingTxtArr')
return settingTxtArr
}
},
watch: {
'authSetting.camera'(val) {
......@@ -126,7 +162,7 @@
methods: {
goBack() {
uni.navigateBack({
delta:2
delta: 2
})
// uni.redirectTo({
// url: '/pages/photo/list'
......@@ -141,10 +177,10 @@
},
updateTime() {
this.waterInfo.date = this.getTime()
let timer = setTimeout(() => {
clearTimeout(timer);
this.updateTime()
}, 1000)
// let timer = setTimeout(() => {
// clearTimeout(timer);
// this.updateTime()
// }, 1000)
},
setCameraInfo(type) {
// 设置相机前置后置、闪关灯等
......@@ -291,16 +327,6 @@
})
},
getDrawTxtArr() {
// 获取绘制数组
let arr = []
// 包含经纬度
const waterInfo = this.waterInfo
arr = ['经度: ' + waterInfo.longitude, '维度: ' + waterInfo.latitude, '地址: ' + waterInfo.address, '时间: ' +
waterInfo.date
]
return arr
},
/* ---------------------- 拍照流程 ---------------------- */
// 第一步:拍照
takePhoto() {
......@@ -317,34 +343,42 @@
title: '数据处理中...',
icon: 'loading'
})
const waterSetting = this.waterSetting
const globalTempPath = getApp().globalData.photo.tempPath
const ratio = this.ratio
let canvasWidth = this.cameraWidth * ratio
let canvasHeight = this.cameraHeight * ratio
const waterInfo = this.waterInfo
this.showImage = true
const drawTxtArr = this.getDrawTxtArr()
const settingTxtArr = this.settingTxtArr
//将原图画到canvas上面
let canvas = uni.createCanvasContext("canvas", this)
canvas.rect(0, 0, canvasWidth, canvasHeight)
canvas.drawImage(tempPath, 0, 0, canvasWidth, canvasHeight)
// this.canvas.draw()
//加入 水印文字
canvas.setFontSize(14)
canvas.setFillStyle('#f2f2f2')
let h = 1
let txtHeight = 18
for (let i = 0; i < drawTxtArr.length; i++) {
const txt = drawTxtArr[i]
let txtHeight = 20
const title = this.titleTxt
if(title){
canvas.setFontSize(20)
canvas.setFillStyle('#f2f2f2')
canvas.fillText(title, 10, canvasHeight - txtHeight * h++);
}
//加入 水印文字
txtHeight = 18
for (let i = 0; i < settingTxtArr.length; i++) {
canvas.setFontSize(14)
canvas.setFillStyle('#f2f2f2')
const txt = settingTxtArr[i]
canvas.fillText(txt, 10, canvasHeight - txtHeight * h++);
}
// canvas.fillText('经度: ' + waterInfo.longitude, 10, canvasHeight - txtHeight * h++);
// canvas.fillText('维度: ' + waterInfo.latitude, 10, canvasHeight - txtHeight * h++);
// canvas.fillText('地址: ' + waterInfo.address, 10, canvasHeight - txtHeight * h++);
// canvas.fillText('时间: ' + waterInfo.date, 10, canvasHeight - txtHeight * h++);
//加入 水印图片
canvas.drawImage(this.tempImgs.markImage, canvasWidth / 2 - 100, canvasHeight / 2 - 25, 200, 50)
if(this.waterSetting && this.waterSetting.mid_text){
//加入 水印图片
canvas.drawImage(this.tempImgs.markImage, canvasWidth / 2 - 100, canvasHeight / 2 - 25, 200, 50)
}
// canvas.drawImage(this.tempImgs.markImage, canvasWidth / 2 - 100, canvasHeight / 2 - 25, 200, 50)
canvas.draw(false,
setTimeout(() => {
uni.canvasToTempFilePath({
......@@ -455,11 +489,15 @@
.mark-box {
position: absolute;
left: 0;
bottom: 20rpx;
bottom: 0;
padding: 20rpx;
.txt {
font-size: 28rpx;
color: #fff;
.big{
font-size: 32rpx;
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment