| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- var app = getApp()
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- lng: 116.403119,
- lat: 39.913828,
- address: '',
- name:'',
- rtuCode: '',
- includepoints: [],
- markers: [],
- loactionList: [],
- scale: 10,
- },
- onLoad: function (options) {
- var openid = wx.getStorageSync('openid');
- var rtuCode = options.rtuCode;
- this.setData({
- rtuCode: rtuCode,
- openId: openid
- })
- let that = this;
- wx.request({
- url: app.globalData.cloudBase + '/Wx/Project/Rtu/Data/NavigateInfo/' + rtuCode,
- method: 'GET',
- header: {
- "Content-Type": "json"
- },
- success: function (res) {
- console.info(res.data.data)
- that.setData({
- lat: res.data.data.lat,
- lng: res.data.data.lng,
- address: res.data.data.address,
- name: res.data.data.name
- });
- }
- })
- },
- submitData: function (event) {
- if (this.data.lng.length > 0 || this.data.lat.length > 0) {
- var that = this;
- const latitude = parseFloat(this.data.lat);
- const longitude = parseFloat(this.data.lng);
- const name=this.data.address;
- const address=this.data.address;
- wx.openLocation({
- latitude,
- longitude,
- name,
- address,
- scale: 12
- })
- } else {
- wx.showToast({
- title: '请检查经纬是否已经设置!',
- icon: 'none',
- duration: 3000
- })
- }
- },
- bindAddressKeyInput: function (e) {
- this.setData({
- address: e.detail.value
- })
- },
- error(e) {
- console.log(e.detail)
- }
- })
|