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

restore-map

parent 3e397de3
...@@ -3,10 +3,10 @@ ...@@ -3,10 +3,10 @@
<view class="blackBackColor"> <view class="blackBackColor">
<camera device-position="back" flash="off" style='width:100%; height:100vh;'> <camera device-position="back" flash="off" style='width:100%; height:100vh;'>
<cover-view class="locationView"> <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-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="liveWatermarkNormal" mode="aspectFit" :src="liveWaterMarkImage"></cover-image>
</camera> </camera>
...@@ -28,6 +28,11 @@ ...@@ -28,6 +28,11 @@
</template> </template>
<script> <script>
let r = require("../../libs/bmap-wx.min.js");
let h = new r.BMapWX({
// ak: "rpVq5d3yxaRCoKzVwmFMo0o4iC524CAG",
ak: "lF1HoyXdiv4uZx6TrGQEZs48F5y8kEHI"
});
export default { export default {
data() { data() {
return { return {
...@@ -37,10 +42,10 @@ ...@@ -37,10 +42,10 @@
image: "", image: "",
showImage: false, showImage: false,
canvas: null, canvas: null,
longitude: '经度:正在获取中...', longitude: '正在获取中...',
latitude: '纬度:正在获取中...', latitude: '正在获取中...',
address: '地址:正在获取中...', address: '正在获取中...',
date: '时间:正在获取中...', date: '正在获取中...',
icon_location: 'https://qn-static.banshouhui.com/take_order/icon/location.png', icon_location: 'https://qn-static.banshouhui.com/take_order/icon/location.png',
scale: "4_3", scale: "4_3",
icon_take: 'https://qn-static.banshouhui.com/take.png', icon_take: 'https://qn-static.banshouhui.com/take.png',
...@@ -52,15 +57,15 @@ ...@@ -52,15 +57,15 @@
width: '', width: '',
height: '', height: '',
markPath: '', markPath: '',
canvasWidth:0, canvasWidth: 0,
canvasHeight:0, canvasHeight: 0,
restuleImage:'', restuleImage: '',
authSetting:[] authSetting: []
} }
}, },
onLoad(e) { onLoad(e) {
this.ctx = uni.createCameraContext(); this.ctx = uni.createCameraContext();
this.date = '时间:' + this.getTime() this.date = this.getTime()
this.getLocation() this.getLocation()
this.getMarkPath() this.getMarkPath()
this.getSystemInfo() this.getSystemInfo()
...@@ -70,7 +75,7 @@ ...@@ -70,7 +75,7 @@
}) })
//this.address = '' //this.address = ''
}, },
onShow(){ onShow() {
// uni.authorize({ // uni.authorize({
// scope: 'scope.writePhotosAlbum', // scope: 'scope.writePhotosAlbum',
// success() { // success() {
...@@ -80,14 +85,43 @@ ...@@ -80,14 +85,43 @@
// }) // })
}, },
methods: { 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 pages = getCurrentPages();
let prevPage = pages[pages.length - 2]; //上一个页面 let prevPage = pages[pages.length - 2]; //上一个页面
prevPage.$vm.done_count ++; prevPage.$vm.done_count++;
uni.navigateBack({ uni.navigateBack({
//delta: 2 //delta: 2
...@@ -97,8 +131,8 @@ ...@@ -97,8 +131,8 @@
// 获取设备信息 // 获取设备信息
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
} catch (e) { } catch (e) {
// error // error
} }
...@@ -116,8 +150,9 @@ ...@@ -116,8 +150,9 @@
uni.getLocation({ uni.getLocation({
type: 'wgs84', type: 'wgs84',
success: function(res) { success: function(res) {
that.longitude = '经度:' + res.longitude that.longitude = res.longitude
that.latitude = '纬度:' + res.latitude that.latitude = res.latitude
that.baiduLocation()
} }
}); });
}, },
...@@ -138,13 +173,13 @@ ...@@ -138,13 +173,13 @@
}) })
}, },
callback(res){ callback(res) {
console.log(res,'res-callback') console.log(res, 'res-callback')
}, },
openSetting(){ openSetting() {
wx.openSetting({ wx.openSetting({
success (res) { success(res) {
console.log(res.authSetting,'openSetting') console.log(res.authSetting, 'openSetting')
// res.authSetting = { // res.authSetting = {
// "scope.userInfo": true, // "scope.userInfo": true,
// "scope.userLocation": true // "scope.userLocation": true
...@@ -205,7 +240,7 @@ ...@@ -205,7 +240,7 @@
this.canvas.setFontSize(28) this.canvas.setFontSize(28)
this.canvas.setFillStyle('#f2f2f2') this.canvas.setFillStyle('#f2f2f2')
let h = 1 let h = 1
let txtHeight=36 let txtHeight = 36
// '经度' + // '经度' +
// '维度' + // '维度' +
// '地址' + // '地址' +
...@@ -215,7 +250,7 @@ ...@@ -215,7 +250,7 @@
this.canvas.fillText(this.address, 20, canvasHeight - txtHeight * h++); this.canvas.fillText(this.address, 20, canvasHeight - txtHeight * h++);
this.canvas.fillText(this.date, 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.canvasImage()
// this.canvas.draw() // this.canvas.draw()
...@@ -272,12 +307,12 @@ ...@@ -272,12 +307,12 @@
filePath: tempImagePath, filePath: tempImagePath,
success() { success() {
uni.showToast({ uni.showToast({
icon:'none', icon: 'none',
title:'已将照片保存到本地相册' title: '已将照片保存到本地相册'
}) })
let timer = setTimeout(()=>{ let timer = setTimeout(() => {
that.goBack() that.goBack()
},2000) }, 2000)
}, },
fail() { fail() {
...@@ -286,12 +321,12 @@ ...@@ -286,12 +321,12 @@
uni.getSetting({ uni.getSetting({
success(res) { success(res) {
let authSetting = res.authSetting let authSetting = res.authSetting
if(!authSetting['scope.writePhotosAlbum']){ if (!authSetting['scope.writePhotosAlbum']) {
txt = '请打开相册权限' txt = '请打开相册权限'
} }
uni.showToast({ uni.showToast({
icon:'none', icon: 'none',
title:txt title: txt
}) })
} }
}) })
...@@ -339,8 +374,7 @@ ...@@ -339,8 +374,7 @@
</script> </script>
<style> <style>
.blackBackColor {
.blackBackColor{
background-color: #000000; background-color: #000000;
} }
...@@ -423,7 +457,7 @@ ...@@ -423,7 +457,7 @@
position: fixed; position: fixed;
left: 60rpx; left: 60rpx;
bottom: 50rpx; bottom: 50rpx;
border:2rpx solid #aaa; border: 2rpx solid #aaa;
} }
.showCanvas { .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