// index.js
const app = getApp()
const DB= wx.cloud.database()
Page({
data: {
latitude: 35.2457853400, //初始化
longitude: 113.2484514100,
},
onLoad: function (options) {
var dname = options.dname;
console.log('测试',dname)
var labelname=dname
DB.collection('map').where({
label:{"content":labelname}
})
.get()
.then(res=>{
console.log(res);
console.log("test 测试1",res.data)
console.log("test 测试1",res.data[0].latitude)
console.log("test 测试1",res.data[0].longitude)
var latitude=res.data[0].latitude
var latitude=parseInt(latitude)
var longitude=res.data[0].longitude
var longitude=parseInt(longitude)
var name=res.data[0].label.content1
wx.openLocation({
latitude:(latitude),
longitude: (longitude),
name: (name),
scale: 15
})
})
.catch(err=>{
console.log(err);
})
}
})