Commit 64ca950b authored by 李俊赕's avatar 李俊赕

take-init

parent dc9669ef
<template> <template>
<view> <view>
<image class="pic" :src="images[0]" mode="aspectFill"></image> <image class="pic" :src="images[0]" mode="aspectFill" @click="showPreviewFn"></image>
</view> </view>
</template> </template>
...@@ -8,7 +8,8 @@ ...@@ -8,7 +8,8 @@
export default { export default {
data() { data() {
return { return {
protocolContent:'' protocolContent:'',
images:[]
} }
}, },
onLoad(e) { onLoad(e) {
...@@ -16,7 +17,7 @@ ...@@ -16,7 +17,7 @@
if(e.img){ if(e.img){
this.images = [e.img] this.images = [e.img]
} }
console.log(this.images,'this.images')
}, },
methods: { methods: {
......
...@@ -11,9 +11,10 @@ ...@@ -11,9 +11,10 @@
<cover-image class="liveWatermarkNormal" mode="aspectFit" :src="liveWaterMarkImage"></cover-image> <cover-image class="liveWatermarkNormal" mode="aspectFit" :src="liveWaterMarkImage"></cover-image>
</camera> </camera>
<cover-view class="bottomView"> <cover-view class="bottomView">
<cover-image class="backIcon" :src="icon_arrow_down" mode="" @click="goBack"></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='takeIcon' :src='icon_take' @click="takePhoto()"> </cover-image>
<cover-image class="backIcon resultIcon" v-if="restultImage" :src="restultImage" mode="" @click="goPage"></cover-image>
<!--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>
<canvas v-show='showImage' canvas-id="canvas" :style="{'width':canvasWidth+'px','height': canvasHeight + 'px'}"></canvas> <canvas v-show='showImage' canvas-id="canvas" :style="{'width':canvasWidth+'px','height': canvasHeight + 'px'}"></canvas>
...@@ -70,13 +71,17 @@ ...@@ -70,13 +71,17 @@
goPage(){ goPage(){
// 进入图片预览页 // 进入图片预览页
}, },
goBack(){
uni.navigateBack({
delta: 2
});
},
getSystemInfo() { getSystemInfo() {
// 获取设备信息 // 获取设备信息
try { try {
const res = uni.getSystemInfoSync(); const res = uni.getSystemInfoSync();
this.canvasWidth = res.windowWidth*2 this.canvasWidth = res.windowWidth*2
this.canvasHeight = res.windowHeight*2 this.canvasHeight = res.windowHeight*2
console.log(res.windowWidth, 'res.windowWidth', res.windowHeight, 'res.windowHeight')
} catch (e) { } catch (e) {
// error // error
} }
...@@ -96,9 +101,6 @@ ...@@ -96,9 +101,6 @@
success: function(res) { success: function(res) {
that.longitude = '经度:' + res.longitude that.longitude = '经度:' + res.longitude
that.latitude = '纬度:' + res.latitude that.latitude = '纬度:' + res.latitude
console.log('当前位置的经度:' + res.longitude);
console.log('当前位置的纬度:' + res.latitude);
console.log('当前位置的地址:' + res.address);
} }
}); });
}, },
...@@ -110,13 +112,11 @@ ...@@ -110,13 +112,11 @@
url: this.icon_live_mark, //仅为示例,并非真实的资源 url: this.icon_live_mark, //仅为示例,并非真实的资源
success: (res) => { success: (res) => {
if (res.statusCode === 200) { if (res.statusCode === 200) {
console.log('水印图片 下载成功')
that.markPath = res.tempFilePath that.markPath = res.tempFilePath
console.log('markPath:' + that.markPath)
} }
}, },
fail() { fail() {
console.log('水印图片 下载失败') // console.log('水印图片 下载失败')
} }
}) })
...@@ -128,9 +128,7 @@ ...@@ -128,9 +128,7 @@
this.ctx.takePhoto({ this.ctx.takePhoto({
quality: 'high', quality: 'high',
success: (res) => { success: (res) => {
console.log('拍照成功')
console.log(res) console.log(res)
//this.imageChange(res) //this.imageChange(res)
this.getImageInfo(res.tempImagePath) this.getImageInfo(res.tempImagePath)
...@@ -148,7 +146,6 @@ ...@@ -148,7 +146,6 @@
uni.getImageInfo({ uni.getImageInfo({
src: tempImagePath, src: tempImagePath,
success(res) { success(res) {
console.log('获取图片信息成功')
that.width = res.width + 'px'; that.width = res.width + 'px';
that.height = res.height + 'px'; that.height = res.height + 'px';
...@@ -163,10 +160,8 @@ ...@@ -163,10 +160,8 @@
title: '数据处理中...', title: '数据处理中...',
icon: 'loading' icon: 'loading'
}) })
console.log('绘制画布')
let canvasWidth = this.canvasWidth let canvasWidth = this.canvasWidth
let canvasHeight = this.canvasHeight let canvasHeight = this.canvasHeight
console.log(canvasWidth,'canvasWidth',canvasHeight,'canvasHeight')
this.showImage = true this.showImage = true
//将原图画到canvas上面 //将原图画到canvas上面
this.canvas = uni.createCanvasContext("canvas", this) this.canvas = uni.createCanvasContext("canvas", this)
...@@ -211,11 +206,11 @@ ...@@ -211,11 +206,11 @@
canvasId: 'canvas', canvasId: 'canvas',
success: (res) => { success: (res) => {
self.saveToLocal(res.tempFilePath) self.saveToLocal(res.tempFilePath)
console.log(res.tempFilePath, 'res.tempFilePath-canvasImage')
// this.$emit('canvasImage', res.tempFilePath); // this.$emit('canvasImage', res.tempFilePath);
// if (this.showPreview) { // if (this.showPreview) {
this.restultImage = res.tempFilePath // this.restultImage = res.tempFilePath
self.showPreviewFn(res.tempFilePath); // self.showPreviewFn(res.tempFilePath);
// } // }
}, },
fail: (res) => { fail: (res) => {
...@@ -240,15 +235,17 @@ ...@@ -240,15 +235,17 @@
uni.saveImageToPhotosAlbum({ uni.saveImageToPhotosAlbum({
filePath: tempImagePath, filePath: tempImagePath,
success() { success() {
console.log('保存本地相册 成功')
uni.showToast({ uni.showToast({
icon:'none', icon:'none',
title:'已将照片保存到本地相册' title:'已将照片保存到本地相册'
}) })
let timer = setTimeout(()=>{
that.goBack()
},0)
}, },
fail() { fail() {
console.log('保存本地相册 失败') // console.log('保存本地相册 失败')
uni.showToast({ uni.showToast({
icon:'none', icon:'none',
title:'保存本地相册失败' title:'保存本地相册失败'
...@@ -348,7 +345,7 @@ ...@@ -348,7 +345,7 @@
z-index: 6; z-index: 6;
} }
.backIcon.resultIcon { .backIcon {
background-color: #FFFFFF; background-color: #FFFFFF;
width: 54rpx; width: 54rpx;
height: 54rpx; height: 54rpx;
......
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