zoukankan      html  css  js  c++  java
  • WX获取地理位置列表接口示例

    // 获取当前位置的经纬度
    getUserLocation: function () {
    const that = this;
    wx.getLocation({
    type: 'gcj02',
    success: function (res) {
    console.log(res)
    //纬度,范围为 -90~90,负数表示南纬
    const latitude = res.latitude
    //经度,范围为 -180~180,负数表示西经
    const longitude = res.longitude
    that.setData({
    lng: longitude,
    lat: latitude
    })
    // 获取平台下所有门店列表
    that.getAllStoreListForWap();
    },
    })
    },

    openLocation: function (e) {
    const that = this;
    let latitude = parseFloat(e.currentTarget.dataset.lat);
    let longitude = parseFloat(e.currentTarget.dataset.lng);
    // 使用微信内置地图查看位置
    wx.openLocation({
    latitude,
    longitude,
    scale: 18
    })
    },

    // 获取平台下所有门店列表
    getAllStoreListForWap: function () {
    const that = this;
    let postData = {
    'page_index': that.data.page_index,
    'page_size': that.data.page_size,
    'lng': that.data.lng,
    'lat': that.data.lat,
    }
    let datainfo = requestSign.requestSign(postData);
    header.sign = datainfo;
    re.request(api.get_getAllStoreListForWap, postData, header).then((res) => {
    if (res.data.code == 1) {
    that.setData({
    store_list: res.data.data.store_list
    })
    } else {
    wx.showModal({
    title: '提示',
    content: res.data.message,
    })
    }
    })
    },

  • 相关阅读:
    http简记
    socket简介
    iOS代理
    ai作图小技能
    按钮切换
    关于ie8背景图片的平铺
    关于文本省略
    关于html table样式
    阿里巴巴iconfont使用方法(超级详细)
    办公电脑安装虚拟机基本就绪
  • 原文地址:https://www.cnblogs.com/xiaoxiaoxun/p/12131978.html
Copyright © 2011-2022 走看看