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