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

edit-take-photo

parent 1092ea9e
...@@ -132,6 +132,7 @@ ...@@ -132,6 +132,7 @@
{ {
"path": "pages/photo/take", "path": "pages/photo/take",
"style": { "style": {
"navigationStyle":"custom",
"navigationBarTitleText": "拍照", "navigationBarTitleText": "拍照",
"navigationBarBackgroundColor": "#333333", "navigationBarBackgroundColor": "#333333",
"navigationBarTextStyle": "#FFFFFF", "navigationBarTextStyle": "#FFFFFF",
......
<template> <template>
<view class="blackBackColor"> <view class="camera-container">
<cover-view class="header-box">
<cover-image bindtap="changeScale" class="icon" mode="aspectFit" src="/static/photo/icon-switch.png"></cover-image>
<cover-image bindtap="changeScale" class="icon" mode="aspectFit" src="/static/photo/icon-light.png"></cover-image>
<cover-image bindtap="changeScale" class="icon" mode="aspectFit" src="/static/photo/icon-setting.png"></cover-image>
</cover-view>
<camera device-position="front" flash="on" style='width:100%; height:100vh; overflow: hidden;' @error="cameraRefuse"> <camera device-position="front" flash="on" style='width:100%; height:100vh; overflow: hidden;' @error="cameraRefuse">
<cover-view class="locationView"> <cover-view class="mark-box">
<cover-view class="locationText u-m-l-20 u-m-t-30">经度:{{longitude}}</cover-view> <cover-view class="locationText u-m-l-20 u-m-t-30">经度:{{longitude}}</cover-view>
<cover-view class="locationText u-m-l-20 u-m-t-10">维度:{{latitude}}</cover-view> <cover-view class="locationText u-m-l-20 u-m-t-10">维度:{{latitude}}</cover-view>
<cover-view class="locationText u-m-l-20 u-m-t-10">地址:{{address}}</cover-view> <cover-view class="locationText u-m-l-20 u-m-t-10">地址:{{address}}</cover-view>
<cover-view class="locationText u-m-l-20 u-m-t-10">时间:{{date}}</cover-view> <cover-view class="locationText u-m-l-20 u-m-t-10">时间:{{date}}</cover-view>
</cover-view> </cover-view>
<cover-image class="liveWatermarkNormal" mode="aspectFit" :src="liveWaterMarkImage"></cover-image> <cover-image class="mark-water liveWatermarkNormal" mode="aspectFit" :src="liveWaterMarkImage"></cover-image>
</camera> </camera>
<cover-view class="bottomView"> <cover-view class="bottom-box">
<cover-image class="backIcon" :src="icon_arrow_down" mode="" @click="simpleBack"></cover-image> <cover-image class="icon" :src="icon_arrow_down" mode="" @click="simpleBack"></cover-image>
<!--cover-image class='switchIcon' :src='icon_switch_white' @click="switchClick()"> </cover-image--> <!--cover-image class='switchIcon' :src='icon_switch_white' @click="switchClick()"> </cover-image-->
<cover-image class='takeIcon' :src='icon_take' @click="takePhoto()"> </cover-image> <cover-image class='icon-take icon' src='/static/photo/icon-take.png' @click="takePhoto()"> </cover-image>
<cover-view class="txt">拍照要求</cover-view>
<!--cover-image class='flashIcon' :src='icon_light_on_white' @click="flashClick()"> </cover-image--> <!--cover-image class='flashIcon' :src='icon_light_on_white' @click="flashClick()"> </cover-image-->
</cover-view> </cover-view>
<!--button @click="openSetting">打开设置页</button--> <!--button @click="openSetting">打开设置页</button-->
...@@ -344,9 +349,7 @@ ...@@ -344,9 +349,7 @@
//第一步: 拍照 //第一步: 拍照
takePhoto() { takePhoto() {
this.getLocation() console.log((new Date).getTime(),'开始渲染')
return
let that = this
this.ctx.takePhoto({ this.ctx.takePhoto({
quality: 'high', quality: 'high',
success: (res) => { success: (res) => {
...@@ -419,8 +422,10 @@ ...@@ -419,8 +422,10 @@
}, },
canvasImage() { canvasImage() {
let self = this let self = this
this.canvas.draw(false, setTimeout(() => { this.canvas.draw(false,
setTimeout(() => { setTimeout(() => {
console.log((new Date).getTime(),'结束渲染')
uni.canvasToTempFilePath({ uni.canvasToTempFilePath({
// x: 0, // x: 0,
// y: 0, // y: 0,
...@@ -428,6 +433,7 @@ ...@@ -428,6 +433,7 @@
height: Number(this.canvasHeight), height: Number(this.canvasHeight),
canvasId: 'canvas', canvasId: 'canvas',
success: (res) => { success: (res) => {
self.saveToLocal(res.tempFilePath) self.saveToLocal(res.tempFilePath)
const FileSystemManager = wx.getFileSystemManager() const FileSystemManager = wx.getFileSystemManager()
FileSystemManager.saveFile({ FileSystemManager.saveFile({
...@@ -449,8 +455,7 @@ ...@@ -449,8 +455,7 @@
uni.hideLoading(); uni.hideLoading();
} }
}, this); }, this);
}, 500); }, 500));
}));
}, },
showPreviewFn(img) { showPreviewFn(img) {
uni.previewImage({ uni.previewImage({
...@@ -622,74 +627,21 @@ ...@@ -622,74 +627,21 @@
} }
</script> </script>
<style> <style scoped lang="scss">
.blackBackColor { .camera-container{
background-color: #000000; padding-top:var(--status-bar-height);
overflow: hidden; background-color: black;
} }
.header-box{
.bottomView { padding:10rpx 20rpx;
background-color: #333333;
z-index: 5;
width: 100%;
height: 200rpx;
position: absolute;
bottom: 0;
display: flex; display: flex;
flex-direction: row; .icon{
align-items: center; display: block;
justify-content: center; width:50rpx;
height:50rpx;
} }
.switchIcon {
background-color: #000000;
width: 50rpx;
height: 50rpx;
} }
.mark-water{
.takeIcon {
background-color: #333333;
width: 150rpx;
height: 150rpx;
}
.flashIcon {
background-color: #000000;
width: 50rpx;
height: 50rpx;
margin-left: 100rpx;
}
.locationView {
/* z-index: 5;
width: 300rpx;
position: absolute;
left: 0;
bottom: 200rpx;
display: flex;
flex-direction: column;
padding-bottom: 20rpx;
padding-right: 20rpx; */
bottom: 200rpx;
padding-bottom: 20rpx;
padding-right: 20rpx;
z-index: 4;
position: absolute;
font-size: 14px;
line-height: 18px;
color: #fff;
}
.locationText {
/* font-size: 24rpx;
color: #999999;
width: 260rpx; */
margin: 2px 0;
}
.liveWatermarkNormal {
z-index: 3;
position: absolute; position: absolute;
left: 50%; left: 50%;
top: 50%; top: 50%;
...@@ -698,17 +650,124 @@ ...@@ -698,17 +650,124 @@
height: 90rpx; height: 90rpx;
z-index: 6; z-index: 6;
} }
.mark-box{
.backIcon { position: absolute;
background-color: #FFFFFF; left:0;
width: 54rpx; bottom:240rpx;
height: 54rpx; padding:20rpx;
border-radius: 27rpx;
position: fixed;
left: 60rpx;
bottom: 50rpx;
border: 2rpx solid #aaa;
} }
.bottom-box{
position: absolute;
left:0;right:0;
bottom: 0;
z-index: 5;
height: 160rpx;
display: flex;
justify-content: space-between;
padding:20rpx;
align-items: center;
background-color: black;
.txt{
line-height:60rpx;
color:#fff;
}
.icon{
display: block;
width:60rpx;
height:60rpx;
&.icon-take{
width:150rpx;
height:150rpx;
}
}
}
// .blackBackColor {
// background-color: #000000;
// overflow: hidden;
// }
// .bottomView {
// background-color: #333333;
// z-index: 5;
// width: 100%;
// height: 200rpx;
// position: absolute;
// bottom: 0;
// display: flex;
// flex-direction: row;
// align-items: center;
// justify-content: center;
// }
// .switchIcon {
// background-color: #000000;
// width: 50rpx;
// height: 50rpx;
// }
// .takeIcon {
// background-color: #333333;
// width: 150rpx;
// height: 150rpx;
// }
// .flashIcon {
// background-color: #000000;
// width: 50rpx;
// height: 50rpx;
// margin-left: 100rpx;
// }
// .locationView {
// /* z-index: 5;
// width: 300rpx;
// position: absolute;
// left: 0;
// bottom: 200rpx;
// display: flex;
// flex-direction: column;
// padding-bottom: 20rpx;
// padding-right: 20rpx; */
// bottom: 200rpx;
// padding-bottom: 20rpx;
// padding-right: 20rpx;
// z-index: 4;
// position: absolute;
// font-size: 14px;
// line-height: 18px;
// color: #fff;
// }
// .locationText {
// /* font-size: 24rpx;
// color: #999999;
// width: 260rpx; */
// margin: 2px 0;
// }
// .liveWatermarkNormal {
// z-index: 3;
// position: absolute;
// left: 50%;
// top: 50%;
// transform: translate(-50%, -50%);
// width: 360rpx;
// height: 90rpx;
// z-index: 6;
// }
// // .backIcon {
// // background-color: #FFFFFF;
// // width: 54rpx;
// // height: 54rpx;
// // border-radius: 27rpx;
// // position: fixed;
// // left: 60rpx;
// // bottom: 50rpx;
// // border: 2rpx solid #aaa;
// // }
.showCanvas { .showCanvas {
background-color: #007AFF; background-color: #007AFF;
......
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