Commit 550dfe9c authored by Facius's avatar Facius

Merge branch 'dev-photo-v2' of https://git.banshouhui.com/heyinchen/take_order into dev-photo-v2

parents f6897dca 5dfaa271
...@@ -101,6 +101,7 @@ export default { ...@@ -101,6 +101,7 @@ export default {
settleRecommend: '', settleRecommend: '',
navHeight: 0, //导航栏高度 navHeight: 0, //导航栏高度
rpxScreenHeight: 0,// 照相视框高度 rpxScreenHeight: 0,// 照相视框高度
safeHeight:0, // 安全高度
//拍照相关数据 //拍照相关数据
photo: { photo: {
product: { product: {
...@@ -165,6 +166,8 @@ export default { ...@@ -165,6 +166,8 @@ export default {
this.globalData.navHeight = a.statusBarHeight / a.screenWidth * 750 + 90 this.globalData.navHeight = a.statusBarHeight / a.screenWidth * 750 + 90
this.globalData.rpxScreenHeight = a.screenHeight / a.screenWidth * 750 this.globalData.rpxScreenHeight = a.screenHeight / a.screenWidth * 750
this.globalData.screenHeight = a.screenHeight this.globalData.screenHeight = a.screenHeight
this.globalData.safeHeight = a.safeArea.bottom
console.log(a,'a')
} catch (a) { } catch (a) {
} }
}, },
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
</view> </view>
</swiper-item> </swiper-item>
<swiper-item class="swiper-item" v-for="(src, index) in swiperList" :key="index"> <swiper-item class="swiper-item" v-for="(src, index) in swiperList" :key="index">
<cover-image @click="previewImage(index)" class="icon" mode="aspectFit" :src="src"></cover-image> <image @click="previewImage(index)" class="icon" mode="aspectFit" :src="src"></image>
</swiper-item> </swiper-item>
</swiper> </swiper>
...@@ -171,6 +171,10 @@ ...@@ -171,6 +171,10 @@
color:#333; color:#333;
font-size: 36rpx; font-size: 36rpx;
} }
&>image{
width:630rpx;
min-height: 630rpx;
}
.txt-box{ .txt-box{
max-height: 560rpx; max-height: 560rpx;
overflow: auto; overflow: auto;
......
...@@ -121,10 +121,13 @@ ...@@ -121,10 +121,13 @@
}) })
}, },
finishPhoto(){ finishPhoto(){
const photo = getApp().globalData.photo
photo.currentItemLength = 10
this.continuePhoto()
// 完成本项 // 完成本项
uni.navigateBack({ // uni.navigateBack({
delta:2 // delta:2
}) // })
}, },
// 确认图片 // 确认图片
continuePhoto() { continuePhoto() {
...@@ -149,7 +152,7 @@ ...@@ -149,7 +152,7 @@
// TODO 参数是否要来回传递 // TODO 参数是否要来回传递
self.saveTempToLocal() self.saveTempToLocal()
const photo = getApp().globalData.photo const photo = getApp().globalData.photo
photo.currentItemLength++ photo.currentItemLength = photo.currentItemLength + 1
// photo.currentItem. // photo.currentItem.
// 当前项的图片显示 // 当前项的图片显示
// 拍照项张数目增加 等于10张 // 拍照项张数目增加 等于10张
...@@ -159,8 +162,8 @@ ...@@ -159,8 +162,8 @@
delta:1 delta:1
}) })
}else{ }else{
uni.redirectTo({ uni.navigateBack({
url:"pages/photo/list" delta:2
}) })
} }
},2000) },2000)
......
<template> <template>
<view class="camera-container"> <view class="camera-container">
<cover-view class="header-box" :style="{'height':navHeight + 'rpx'}"> <cover-view class="header-box" :style="{'height':navHeight/2 + 'px'}">
<cover-view class="inner"> <cover-view class="inner">
<cover-image @click="setCameraInfo('devicePosition')" class="icon" mode="aspectFit" <cover-image @click="setCameraInfo('devicePosition')" class="icon" mode="aspectFit"
src="/static/photo/icon-switch.png"></cover-image> src="/static/photo/icon-switch.png"></cover-image>
...@@ -10,10 +10,11 @@ ...@@ -10,10 +10,11 @@
src="/static/photo/icon-setting.png"></cover-image> src="/static/photo/icon-setting.png"></cover-image>
</cover-view> </cover-view>
</cover-view> </cover-view>
<camera class="camera-box" v-if="cameraChange&&!standardShow" :device-position="cameraInfo.devicePosition" <camera class="camera-box" v-if="cameraChange&&!standardShow" v-show="" :device-position="cameraInfo.devicePosition"
:flash="cameraInfo.flash" :style="{'height':cameraHeight + 'rpx'}" @error="cameraError"> :flash="cameraInfo.flash" :style="{'height':cameraHeight/2 + 'px','top':parseInt(navHeight/2) + 'px'}"
@error="cameraError">
<cover-view class="mark-box"> <cover-view class="mark-box">
<cover-view class="txt big" >{{titleTxt}}</cover-view> <cover-view class="txt big" v-if="titleTxt">{{titleTxt}}</cover-view>
<cover-view class="txt" v-for="(txt,index) in settingTxtArr" :key="index">{{txt || '获取中'}}</cover-view> <cover-view class="txt" 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.latitude || '正在获取中...'}}</cover-view>
<cover-view class="txt u-m-t-10">地址:{{waterInfo.address || '正在获取中...'}}</cover-view> <cover-view class="txt u-m-t-10">地址:{{waterInfo.address || '正在获取中...'}}</cover-view>
...@@ -58,7 +59,7 @@ ...@@ -58,7 +59,7 @@
'https://qn-static.banshouhui.com/live_mark.png' 'https://qn-static.banshouhui.com/live_mark.png'
], ],
}, },
standardShow: false, standardShow: true,
cameraInfo: { cameraInfo: {
devicePosition: 'back', devicePosition: 'back',
flash: 'auto' flash: 'auto'
...@@ -83,9 +84,9 @@ ...@@ -83,9 +84,9 @@
cameraWidth: 750, cameraWidth: 750,
cameraHeight: 1000, // (4 / 3 * 750) 图片比例4:3 cameraHeight: 1000, // (4 / 3 * 750) 图片比例4:3
ratio: 0, ratio: 0,
cameraChange: true, cameraChange: false,
waterSetting:null, waterSetting: null,
shadowInitShow:true, // 第一次进入页面需显示弹窗 shadowInitShow: true, // 第一次进入页面需显示弹窗
} }
}, },
onLoad(e) { onLoad(e) {
...@@ -96,19 +97,21 @@ ...@@ -96,19 +97,21 @@
this.updateTime() this.updateTime()
this.getLocation() this.getLocation()
this.getMarkPath() this.getMarkPath()
this.initData()
this.currentItem = photo.currentItem this.currentItem = photo.currentItem
}, },
computed: { computed: {
titleTxt(){ titleTxt() {
const waterSetting = this.waterSetting const waterSetting = this.waterSetting
let txt = '' let txt = ''
if(!waterSetting || !waterSetting.lower_right){ if (!waterSetting || !waterSetting.lower_right) {
return '' return ''
} }
txt = waterSetting.lower_right && waterSetting.lower_right.title_text || '' txt = waterSetting.lower_right && waterSetting.lower_right.title_text || ''
return txt return txt
}, },
settingTxtArr(){ settingTxtArr() {
let arr = [] let arr = []
// 包含经纬度 // 包含经纬度
const waterInfo = this.waterInfo const waterInfo = this.waterInfo
...@@ -134,24 +137,18 @@ ...@@ -134,24 +137,18 @@
}) })
return settingTxtArr return settingTxtArr
} }
}, },
watch: {}, watch: {},
onShow() { onShow() {
this.initData() // 默认开启弹窗
// this.standardShow = true const photo = getApp().globalData.photo
this.waterSetting = photo.waterSetting
// this.cameraHeight = globalData.rpxScreenHeight this.standardShow = this.shadowInitShow
// uni.authorize({ // this.initData()
// scope: 'scope.writePhotosAlbum',
// success() {
// console.log('userLocation')
// // uni.getLocation()
// }
// })
}, },
methods: { methods: {
closeShadow(){ closeShadow() {
this.shadowInitShow = false this.shadowInitShow = false
this.standardShow = false this.standardShow = false
}, },
...@@ -195,13 +192,15 @@ ...@@ -195,13 +192,15 @@
}, },
initData() { initData() {
const globalData = getApp().globalData const globalData = getApp().globalData
// this.navHeight = parseInt(globalData.navHeight) this.navHeight = globalData.navHeight
this.cameraHeight = parseInt(globalData.safeHeight*2 - globalData.navHeight - 200) ;
console.log(globalData.safeHeight,'globalData.safeHeight')
console.log(this.cameraHeight,'this.cameraHeight')
console.log(globalData.navHeight,'globalData.navHeight') console.log(globalData.navHeight,'globalData.navHeight')
this.ratio = globalData.screenHeight / globalData.rpxScreenHeight this.ratio = globalData.screenHeight / globalData.rpxScreenHeight
console.log(globalData.screenHeight,globalData.rpxScreenHeight,this.ratio)
this.cameraChange = true
this.waterSetting = globalData.photo.waterSetting this.waterSetting = globalData.photo.waterSetting
if(this.shadowInitShow){
this.standardShow = true
}
// this.cameraHeight = globalData.rpxScreenHeight // this.cameraHeight = globalData.rpxScreenHeight
}, },
baiduLocation() { baiduLocation() {
...@@ -342,6 +341,8 @@ ...@@ -342,6 +341,8 @@
const waterSetting = this.waterSetting const waterSetting = this.waterSetting
const globalTempPath = getApp().globalData.photo.tempPath const globalTempPath = getApp().globalData.photo.tempPath
const ratio = this.ratio const ratio = this.ratio
console.log(this.ratio,'this.ratio')
// const ratio = 0.5
let canvasWidth = this.cameraWidth * ratio let canvasWidth = this.cameraWidth * ratio
let canvasHeight = this.cameraHeight * ratio let canvasHeight = this.cameraHeight * ratio
const waterInfo = this.waterInfo const waterInfo = this.waterInfo
...@@ -356,7 +357,7 @@ ...@@ -356,7 +357,7 @@
let h = 1 let h = 1
//加入 水印文字 //加入 水印文字
for (let i = settingTxtArr.length-1; i >=0; i--) { for (let i = settingTxtArr.length - 1; i >= 0; i--) {
txtHeight = 20 txtHeight = 20
canvas.setFontSize(16) canvas.setFontSize(16)
canvas.setFillStyle('#f2f2f2') canvas.setFillStyle('#f2f2f2')
...@@ -371,21 +372,22 @@ ...@@ -371,21 +372,22 @@
// canvas.fillText(txt, 10, canvasHeight - txtHeight * h++); // canvas.fillText(txt, 10, canvasHeight - txtHeight * h++);
} }
const title = this.titleTxt const title = this.titleTxt
if(title){ if (title) {
canvas.save() canvas.save()
let titleHeight = title.length>14 ? 60 : 30 let titleHeight = title.length > 14 ? 60 : 30
let rectWidth = title.length > 14 ? 215 : title.length*10
canvas.setFillStyle('rgba(34, 114, 255, 0.6)') canvas.setFillStyle('rgba(34, 114, 255, 0.6)')
canvas.fillRect(10, canvasHeight - txtHeight * h - titleHeight,215, titleHeight) canvas.fillRect(10, canvasHeight - txtHeight * h - titleHeight, 215, titleHeight)
canvas.restore() canvas.restore()
canvas.setFontSize(20) canvas.setFontSize(20)
canvas.setFillStyle('#f2f2f2') canvas.setFillStyle('#f2f2f2')
// canvas.setTextAlign('center') // canvas.setTextAlign('center')
if(title.length>14){ if (title.length > 14) {
canvas.fillText(title.substr(14,14), 10, canvasHeight - txtHeight * h++ + 20); canvas.fillText(title.substr(14, 14), 10, canvasHeight - txtHeight * h++ + 20);
} }
canvas.fillText(title.substr(0,14), 10, canvasHeight - txtHeight * h++ - titleHeight/2 + 10); canvas.fillText(title.substr(0, 14), 10, canvasHeight - txtHeight * h++ - titleHeight / 2 + 10);
} }
if(this.waterSetting && this.waterSetting.mid_text){ 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)
} }
...@@ -445,7 +447,7 @@ ...@@ -445,7 +447,7 @@
let hour = (d.getHours() < 10) ? ("0" + d.getHours()) : d.getHours(); let hour = (d.getHours() < 10) ? ("0" + d.getHours()) : d.getHours();
let min = (d.getMinutes() < 10) ? ("0" + d.getMinutes()) : d.getMinutes(); let min = (d.getMinutes() < 10) ? ("0" + d.getMinutes()) : d.getMinutes();
let sec = (d.getSeconds() < 10) ? ("0" + d.getSeconds()) : d.getSeconds(); let sec = (d.getSeconds() < 10) ? ("0" + d.getSeconds()) : d.getSeconds();
let now = year + "年" + month + "月" + date + "日 " + hour + ":" + min + ":" + sec ; let now = year + "年" + month + "月" + date + "日 " + hour + ":" + min + ":" + sec;
return now return now
}, },
...@@ -480,7 +482,8 @@ ...@@ -480,7 +482,8 @@
} }
.camera-box { .camera-box {
position: relative; position: absolute;
left:0;
width: 100%; width: 100%;
// height: 100vh; // height: 100vh;
z-index: 1; z-index: 1;
...@@ -503,15 +506,16 @@ ...@@ -503,15 +506,16 @@
padding: 20rpx; padding: 20rpx;
.txt { .txt {
margin-top:5rpx; margin-top: 5rpx;
line-height: 40rpx; line-height: 40rpx;
white-space: normal; white-space: normal;
font-size: 28rpx; font-size: 28rpx;
color: #fff; color: #fff;
&.big{
padding:10rpx; &.big {
padding: 10rpx;
margin-bottom: 10rpx; margin-bottom: 10rpx;
width:430rpx; width: 430rpx;
line-height: 40rpx; line-height: 40rpx;
font-size: 32rpx; font-size: 32rpx;
background-color: rgba(34, 114, 255, 0.6); background-color: rgba(34, 114, 255, 0.6);
...@@ -523,9 +527,11 @@ ...@@ -523,9 +527,11 @@
position: absolute; position: absolute;
left: 0; left: 0;
right: 0; right: 0;
bottom: 0; bottom: constant(safe-area-inset-bottom);
bottom: env(safe-area-inset-bottom);
z-index: 5; z-index: 5;
height: 160rpx; box-sizing: border-box;
height: 200rpx;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
padding: 20rpx 78rpx; padding: 20rpx 78rpx;
...@@ -559,6 +565,8 @@ ...@@ -559,6 +565,8 @@
.page-mask { .page-mask {
position: fixed; position: fixed;
bottom: 0; bottom: 0;
bottom: constant(safe-area-inset-bottom);
bottom: env(safe-area-inset-bottom);
z-index: 1000; z-index: 1000;
width: 750rpx; width: 750rpx;
height: 100vh; height: 100vh;
...@@ -574,6 +582,8 @@ ...@@ -574,6 +582,8 @@
.btn-close { .btn-close {
position: absolute; position: absolute;
bottom: 0; bottom: 0;
bottom: constant(safe-area-inset-bottom);
bottom: env(safe-area-inset-bottom);
left: 0; left: 0;
right: 0; right: 0;
height: 200rpx; height: 200rpx;
......
async function getUserId(token) { async function getUserId(token) {
const res = await uniCloud.httpclient.request("https://system.banshouhui.com/wxh-worker-rest/rest/" + token + const res = await uniCloud.httpclient.request("https://system.dev.banshouhui.com/wxh-worker-rest/rest/" +
token +
"/myinfo/id", { "/myinfo/id", {
method: 'GET' method: 'GET',
dataType: 'text'
}) })
console.log(res.data) return res && res.status === 200 ? res.data : token
return res && res.status === '200' ? res.data : token
} }
module.exports = { module.exports = {
......
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
// 配置教程参考:https://uniapp.dcloud.net.cn/uniCloud/quickstart?id=runparam // 配置教程参考:https://uniapp.dcloud.net.cn/uniCloud/quickstart?id=runparam
{ {
"token": "", "token": "RTOKENeb70458c5502c48838d5e4cf84900767fa010f00",
"classify_id": "79550af260555cc20afb34146966a2c4", "classify_id": "79550af260555cc20afb34146966a2c4",
"system_id": "79550af260555cc20afb34156c94b32c", "system_id": "79550af260555cc20afb34156c94b32c",
"brand_id": "79550af260555cc20afb3417731a827c" "brand_id": "28ee4e3e6063f2880d8956a013293a7f"
} }
...@@ -25,7 +25,7 @@ exports.main = async (event, context) => { ...@@ -25,7 +25,7 @@ exports.main = async (event, context) => {
}) })
.done(), .done(),
as: 'imageList' as: 'imageList'
}).match({"classify_id": event.classify_id, "system_id": event.system_id, "brand_id": event.brand_id}).end() }).match({"classify_id": event.classify_id, "system_id": event.system_id, "brand_id": event.brand_id}).limit(100).end()
const watermarkC = uniCloud.database().collection("user_watermark").field({'_id': false}) const watermarkC = uniCloud.database().collection("user_watermark").field({'_id': false})
let userWatermark = await watermarkC.where({ let userWatermark = await watermarkC.where({
user_id: user_id, user_id: user_id,
......
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