Commit 81b50f21 authored by 李俊赕's avatar 李俊赕

add-map-ak

parent 64ca950b
...@@ -26,7 +26,13 @@ ...@@ -26,7 +26,13 @@
</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 {
title: '', title: '',
...@@ -50,9 +56,9 @@ ...@@ -50,9 +56,9 @@
width: '', width: '',
height: '', height: '',
markPath: '', markPath: '',
canvasWidth:0, canvasWidth: 0,
canvasHeight:0, canvasHeight: 0,
restuleImage:'', restuleImage: '',
} }
}, },
onLoad(e) { onLoad(e) {
...@@ -61,6 +67,7 @@ ...@@ -61,6 +67,7 @@
this.getLocation() this.getLocation()
this.getMarkPath() this.getMarkPath()
this.getSystemInfo() this.getSystemInfo()
this.baiduLocation()
uni.setNavigationBarColor({ uni.setNavigationBarColor({
frontColor: '#FFFFFF', frontColor: '#FFFFFF',
backgroundColor: '#333333', backgroundColor: '#333333',
...@@ -68,10 +75,37 @@ ...@@ -68,10 +75,37 @@
//this.address = '' //this.address = ''
}, },
methods: { methods: {
goPage(){ baiduLocation() {
let a = this,
t = function() {
let t = {
success: function(res) {
var e = res.wxMarkerData[0];
console.log("当前定位", e);
var i = e.address;
this.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.longitude + "," + a.latitude;
let e = '113.88308' + ',' + '22.55329'
t.location = e;
}
h.regeocoding(t);
};
t()
},
goPage() {
// 进入图片预览页 // 进入图片预览页
}, },
goBack(){ goBack() {
uni.navigateBack({ uni.navigateBack({
delta: 2 delta: 2
}); });
...@@ -80,8 +114,8 @@ ...@@ -80,8 +114,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
} }
...@@ -173,13 +207,13 @@ ...@@ -173,13 +207,13 @@
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
this.canvas.fillText('经度' + this.longitude, 20, canvasHeight - txtHeight * h++); this.canvas.fillText('经度' + this.longitude, 20, canvasHeight - txtHeight * h++);
this.canvas.fillText('维度' + this.latitude, 20, canvasHeight - txtHeight * h++); this.canvas.fillText('维度' + this.latitude, 20, canvasHeight - txtHeight * h++);
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()
...@@ -236,19 +270,19 @@ ...@@ -236,19 +270,19 @@
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()
},0) }, 0)
}, },
fail() { fail() {
// console.log('保存本地相册 失败') // console.log('保存本地相册 失败')
uni.showToast({ uni.showToast({
icon:'none', icon: 'none',
title:'保存本地相册失败' title: '保存本地相册失败'
}) })
} }
}) })
...@@ -353,7 +387,7 @@ ...@@ -353,7 +387,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