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

add-map-ak

parent 64ca950b
......@@ -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>
<canvas v-show='showImage' canvas-id="canvas" :style="{'width':canvasWidth+'px','height': canvasHeight + 'px'}"></canvas>
......@@ -26,7 +26,13 @@
</template>
<script>
let r = require("../../libs/bmap-wx.min.js");
let h = new r.BMapWX({
// ak: "rpVq5d3yxaRCoKzVwmFMo0o4iC524CAG",
ak:"lF1HoyXdiv4uZx6TrGQEZs48F5y8kEHI"
});
export default {
data() {
return {
title: '',
......@@ -50,9 +56,9 @@
width: '',
height: '',
markPath: '',
canvasWidth:0,
canvasHeight:0,
restuleImage:'',
canvasWidth: 0,
canvasHeight: 0,
restuleImage: '',
}
},
onLoad(e) {
......@@ -61,6 +67,7 @@
this.getLocation()
this.getMarkPath()
this.getSystemInfo()
this.baiduLocation()
uni.setNavigationBarColor({
frontColor: '#FFFFFF',
backgroundColor: '#333333',
......@@ -68,10 +75,37 @@
//this.address = ''
},
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({
delta: 2
});
......@@ -80,8 +114,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
}
......@@ -131,7 +165,7 @@
console.log(res)
//this.imageChange(res)
this.getImageInfo(res.tempImagePath)
//this.saveToLocal(res.tempImagePath)
}
});
......@@ -173,13 +207,13 @@
this.canvas.setFontSize(28)
this.canvas.setFillStyle('#f2f2f2')
let h = 1
let txtHeight=36
let txtHeight = 36
this.canvas.fillText('经度' + this.longitude, 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.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()
......@@ -206,10 +240,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);
// }
},
......@@ -231,24 +265,24 @@
},
//第五步: 保存到本地相册
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()
},0)
}, 0)
},
fail() {
// console.log('保存本地相册 失败')
uni.showToast({
icon:'none',
title:'保存本地相册失败'
icon: 'none',
title: '保存本地相册失败'
})
}
})
......@@ -353,7 +387,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