收藏
回答

无法获取位置

问题模块 框架类型 问题类型 API/组件名称 终端类型 微信版本 基础库版本
API和组件 小程序 Bug 获取位置 客户端 6.5.3 2.0

- 当前 Bug 的表现(可附上截图)


- 预期表现


- 复现路径


- 提供一个最简复现 Demo

没有反应

最后一次编辑于  07-11  (未经腾讯允许,不得转载)
邀请回答
复制链接收藏投诉关注问题回答

3 个回答

  • 小程序开发
    小程序开发
    07-11

    var a, t = require("../../components/wxSearch/wxSearch.js"), e = require("../../utils/qqmap-wx-jssdk.min.js"), i = getApp();


    Page({

    data: {

    list: [],

    banner: [],

    info: [],

    isShow: !1,

    uid: "",

    keys: ""

    },

    onLoad: function() {

    var t = this;

    t.seachTag(), t.vUpdate(), i.util.getUserInfo(function(a) {

    a.memberInfo ? (t.setData({

    uid: a.memberInfo.uid

    }), wx.setStorageSync("uid", a.memberInfo.uid)) : t.hideDialog();

    }), i.util.request({

    url: "entry/wxapp/Api",

    data: {

    m: "ox_master",

    r: "home.index"

    },

    success: function(i) {

    if (i.data.data) {

    wx.setNavigationBarTitle({

    title: i.data.data.info.name

    });

    a = new e({

    key: i.data.data.key

    }), wx.getLocation({

    type: "wgs84",

    success: function(a) {

    t.getCity(a.latitude, a.longitude);

    }

    }), t.setData({

    banner: i.data.data.banner,

    list: i.data.data.list,

    nav: i.data.data.nav,

    info: i.data.data.info

    });

    }

    }

    });

    },

    hideDialog: function() {

    this.setData({

    isShow: !this.data.isShow

    });

    },

    updateUserInfo: function(a) {

    var t = this;

    t.hideDialog(), i.util.getUserInfo(function(a) {

    t.setData({

    uid: res.memberInfo.uid

    }), wx.setStorageSync("uid", a.memberInfo.uid);

    }, a.detail);

    },

    onPullDownRefresh: function() {

    var a = this;

    i.util.request({

    url: "entry/wxapp/Api",

    data: {

    m: "ox_master",

    r: "home.index"

    },

    success: function(t) {

    t.data.data && (wx.setNavigationBarTitle({

    title: t.data.data.info.name

    }), a.setData({

    banner: t.data.data.banner,

    list: t.data.data.list,

    nav: t.data.data.nav,

    info: t.data.data.info

    })), wx.stopPullDownRefresh();

    }

    });

    },

    goType: function(a) {

    var t = this;

    i.util.request({

    url: "entry/wxapp/Api",

    data: {

    m: "ox_master",

    r: "me.add_formid",

    uid: t.data.uid,

    formid: a.detail.formId

    }

    }), wx.navigateTo({

    url: "/pages/index/serviceList/index?type=" + a.target.dataset.id

    });

    },

    onShareAppMessage: function() {},

    gofenlei: function(a) {

    var t = this;

    i.util.request({

    url: "entry/wxapp/Api",

    showLoading: !1,

    data: {

    m: "ox_master",

    r: "me.add_formid",

    uid: t.data.uid,

    formid: a.detail.formId

    }

    }), wx.navigateTo({

    url: "/pages/need/pages/home/index?type_value=" + a.target.dataset.name

    });

    },

    vUpdate: function() {

    var a = wx.getUpdateManager();

    a.onCheckForUpdate(function(a) {

    console.log(a.hasUpdate);

    }), a.onUpdateReady(function() {

    wx.showModal({

    title: "يىڭلىنىش ئەسكەرتمىسى",

    content: "نەشىرى يىڭلىنىپ بولدى قايتا قوزغىتامسىز؟",

    success: function(t) {

    t.confirm && a.applyUpdate();

    }

    });

    });

    },

    wxSearchFn: function(a) {},

    wxSearchInput: function(a) {

    var e = this;

    t.wxSearchInput(a, e);

    },

    wxSerchFocus: function(a) {

    var e = this;

    t.wxSearchFocus(a, e);

    },

    wxSearchBlur: function(a) {

    var e = this;

    t.wxSearchBlur(a, e);

    },

    wxSearchKeyTap: function(a) {

    wx.navigateTo({

    url: "/pages/need/pages/home/index?type_value=" + a.target.dataset.key

    });

    },

    wxSearchDeleteKey: function(a) {

    var e = this;

    t.wxSearchDeleteKey(a, e);

    },

    wxSearchDeleteAll: function(a) {

    var e = this;

    t.wxSearchDeleteAll(e);

    },

    wxSearchTap: function(a) {

    var e = this;

    t.wxSearchHiddenPancel(e);

    },

    seachTag: function(a) {

    var e = this;

    i.util.request({

    url: "entry/wxapp/Api",

    data: {

    m: "ox_master",

    r: "home.hotTag",

    uid: e.data.uid

    },

    success: function(a) {

    if (a.data.data) {

    var i = a.data.data.list, n = a.data.data.hot;

    t.init(e, 46, n), t.initMindKeys(i);

    }

    }

    });

    },

    getCity: function(t, e) {

    var i = this;

    a.reverseGeocoder({

    location: {

    latitude: t,

    longitude: e

    },

    success: function(a) {

    var a = a.result, t = [];

    t.push({

    title: a.address_component.city

    }), i.setData({

    title: t[0].title

    });

    },

    fail: function(a) {

    console.error(a);

    }

    });

    }

    });


    07-11
    赞同
    回复
  • 是柿子啊
    是柿子啊
    07-11

    麻烦提供出现问题的具体机型、微信版本号、系统版本号,以及能复现问题的代码片段https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html

    07-11
    赞同
    回复 1
    • 小程序开发
      小程序开发
      07-11
      怎么做帮我一下吗
      07-11
      赞同
      回复