Commit 916f7a4b authored by 李俊赕's avatar 李俊赕

restore-map

parent 3e397de3
......@@ -3,10 +3,10 @@
<view class="blackBackColor">
<camera device-position="back" flash="off" style='width:100%; height:100vh;'>
<cover-view class="locationView">
<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">{{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-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">地址:{{address}}</cover-view>
<cover-view class="locationText u-m-l-20 u-m-t-10">时间:{{date}}</cover-view>
</cover-view>
<cover-image class="liveWatermarkNormal" mode="aspectFit" :src="liveWaterMarkImage"></cover-image>
</camera>
......@@ -14,7 +14,7 @@
<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='takeIcon' :src='icon_take' @click="takePhoto()"> </cover-image>
<!--cover-image class='flashIcon' :src='icon_light_on_white' @click="flashClick()"> </cover-image-->
</cover-view>
<button @click="openSetting">打开设置页</button>
......@@ -28,6 +28,11 @@
</template>
<script>
let r = require("../../libs/bmap-wx.min.js");
let h = new r.BMapWX({
// ak: "rpVq5d3yxaRCoKzVwmFMo0o4iC524CAG",
ak: "lF1HoyXdiv4uZx6TrGQEZs48F5y8kEHI"
});
export default {
data() {
return {
......@@ -37,10 +42,10 @@
image: "",
showImage: false,
canvas: null,
longitude: '经度:正在获取中...',
latitude: '纬度:正在获取中...',
address: '地址:正在获取中...',
date: '时间:正在获取中...',
longitude: '正在获取中...',
latitude: '正在获取中...',
address: '正在获取中...',
date: '正在获取中...',
icon_location: 'https://qn-static.banshouhui.com/take_order/icon/location.png',
scale: "4_3",
icon_take: 'https://qn-static.banshouhui.com/take.png',
......@@ -52,15 +57,15 @@
width: '',
height: '',
markPath: '',
canvasWidth:0,
canvasHeight:0,
restuleImage:'',
authSetting:[]
canvasWidth: 0,
canvasHeight: 0,
restuleImage: '',
authSetting: []
}
},
onLoad(e) {
this.ctx = uni.createCameraContext();
this.date = '时间:' + this.getTime()
this.date = this.getTime()
this.getLocation()
this.getMarkPath()
this.getSystemInfo()
......@@ -70,7 +75,7 @@
})
//this.address = ''
},
onShow(){
onShow() {
// uni.authorize({
// scope: 'scope.writePhotosAlbum',
// success() {
......@@ -80,15 +85,44 @@
// })
},
methods: {
goPage(){
baiduLocation() {
console.log('baiduLocation')
let a = this,
t = function() {
let t = {
success: function(res) {
let e = res.wxMarkerData[0];
console.log(e,e.address,'e.address')
let i = e.address;
a.address = i
// a.setData({
// addressValue: i
// }), o.globalData.addressValue = i, a.initWatermarkBoxHeightAndWidth();
},
fail: function(a) {
console.log(a, 'a')
// n.error(a), console.log(a);
}
};
if (a.latitude && a.longitude) {
let e = a.latitude + "," + a.longitude;
// let e = "113.88308" + ',' + "22.55329"
// let e = "22.55329" + ',' + "113.88308"
t.location = e;
}
h.regeocoding(t);
};
t()
},
goPage() {
// 进入图片预览页
},
goBack(){
goBack() {
let pages = getCurrentPages();
let prevPage = pages[pages.length - 2]; //上一个页面
prevPage.$vm.done_count ++;
prevPage.$vm.done_count++;
uni.navigateBack({
//delta: 2
});
......@@ -97,8 +131,8 @@
// 获取设备信息
try {
const res = uni.getSystemInfoSync();
this.canvasWidth = res.windowWidth*2
this.canvasHeight = res.windowHeight*2
this.canvasWidth = res.windowWidth * 2
this.canvasHeight = res.windowHeight * 2
} catch (e) {
// error
}
......@@ -116,8 +150,9 @@
uni.getLocation({
type: 'wgs84',
success: function(res) {
that.longitude = '经度:' + res.longitude
that.latitude = '纬度:' + res.latitude
that.longitude = res.longitude
that.latitude = res.latitude
that.baiduLocation()
}
});
},
......@@ -138,20 +173,20 @@
})
},
callback(res){
console.log(res,'res-callback')
callback(res) {
console.log(res, 'res-callback')
},
openSetting(){
openSetting() {
wx.openSetting({
success (res) {
console.log(res.authSetting,'openSetting')
// res.authSetting = {
// "scope.userInfo": true,
// "scope.userLocation": true
// }
}
success(res) {
console.log(res.authSetting, 'openSetting')
// res.authSetting = {
// "scope.userInfo": true,
// "scope.userLocation": true
// }
}
})
return
return
},
//第一步: 拍照
takePhoto() {
......@@ -163,7 +198,7 @@
console.log(res)
//this.imageChange(res)
this.getImageInfo(res.tempImagePath)
//this.saveToLocal(res.tempImagePath)
}
});
......@@ -205,7 +240,7 @@
this.canvas.setFontSize(28)
this.canvas.setFillStyle('#f2f2f2')
let h = 1
let txtHeight=36
let txtHeight = 36
// '经度' +
// '维度' +
// '地址' +
......@@ -215,7 +250,7 @@
this.canvas.fillText(this.address, 20, canvasHeight - txtHeight * h++);
this.canvas.fillText(this.date, 20, canvasHeight - txtHeight * h++);
//加入 水印图片
this.canvas.drawImage(this.markPath, canvasWidth/2-200, canvasHeight/2 - 50, 400, 100)
this.canvas.drawImage(this.markPath, canvasWidth / 2 - 200, canvasHeight / 2 - 50, 400, 100)
this.canvasImage()
// this.canvas.draw()
......@@ -242,10 +277,10 @@
canvasId: 'canvas',
success: (res) => {
self.saveToLocal(res.tempFilePath)
// this.$emit('canvasImage', res.tempFilePath);
// if (this.showPreview) {
// this.restultImage = res.tempFilePath
// this.restultImage = res.tempFilePath
// self.showPreviewFn(res.tempFilePath);
// }
},
......@@ -267,33 +302,33 @@
},
//第五步: 保存到本地相册
saveToLocal(tempImagePath) {
let that = this
let that = this
uni.saveImageToPhotosAlbum({
filePath: tempImagePath,
success() {
uni.showToast({
icon:'none',
title:'已将照片保存到本地相册'
icon: 'none',
title: '已将照片保存到本地相册'
})
let timer = setTimeout(()=>{
let timer = setTimeout(() => {
that.goBack()
},2000)
}, 2000)
},
fail() {
// console.log('保存本地相册 失败')
let txt = '保存本地相册失败'
uni.getSetting({
success(res) {
let authSetting = res.authSetting
if(!authSetting['scope.writePhotosAlbum']){
txt = '请打开相册权限'
}
uni.showToast({
icon:'none',
title:txt
})
}
success(res) {
let authSetting = res.authSetting
if (!authSetting['scope.writePhotosAlbum']) {
txt = '请打开相册权限'
}
uni.showToast({
icon: 'none',
title: txt
})
}
})
// wx.openSetting({
// success (res) {
......@@ -339,11 +374,10 @@
</script>
<style>
.blackBackColor{
.blackBackColor {
background-color: #000000;
}
.bottomView {
background-color: #000000;
z-index: 5;
......@@ -423,7 +457,7 @@
position: fixed;
left: 60rpx;
bottom: 50rpx;
border:2rpx solid #aaa;
border: 2rpx solid #aaa;
}
.showCanvas {
......
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