// pages/repair/repair.js Page({ /** * 页面的初始数据 */ data: { deviceInfo: {}, deviceDetail: {}, marker: [] }, /** * 生命周期函数--监听页面加载 */ onLoad(options) { this.setData({ deviceDetail:JSON.parse(options.address) }) console.log(this.data.deviceDetail); var marker = [{ id:0, latitude: this.data.deviceDetail.lat, longitude: this.data.deviceDetail.lng, iconPath: '../../images/ProRep/weizhi.png', width: '50rpx', height: "50rpx", callout: { color: '#000000', content: this.data.deviceDetail.name, fontSize: 12, borderRadius: 5, bgColor: '#ffffff', padding: 10, textAlign: 'center', display: "ALWAYS" // anchorY:-18 } }] this.setData({ marker: marker }) // let address = JSON.parse(options.address) // console.log(address); // this.setData({ // deviceInfo: deviceInfo // }) // wx.setNavigationBarTitle({ // title: deviceInfo.deviceName //页面切换,更换页面标题 // }) // this.getDeviceInfo() }, goMap() { let plugin = requirePlugin('routePlan'); let key = 'SRGBZ-FLCKU-2TIVH-BFHUM-D5CTO-LFBHQ'; //使用在腾讯位置服务申请的key let referer = '高德地图'; //调用插件的app的名称 let endPoint = JSON.stringify({ //终点 'name': this.data.deviceDetail.address, 'latitude': this.data.deviceDetail.lat, 'longitude': this.data.deviceDetail.lng }); console.log(endPoint); wx.navigateTo({ url: 'plugin://routePlan/index?key=' + key + '&referer=' + referer + '&endPoint=' + endPoint }); }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady() { }, /** * 生命周期函数--监听页面显示 */ onShow() { }, /** * 生命周期函数--监听页面隐藏 */ onHide() { }, /** * 生命周期函数--监听页面卸载 */ onUnload() { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh() { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom() { }, /** * 用户点击右上角分享 */ onShareAppMessage() { } })