手机上边找了好几个手机测试都调用成功,使用编辑器调用一直返回"getLocation:fail timeout"
weixinapi(id) {
var id = id;
var that = this;
let data = {
id: id,
askUrl: window.location.href
}
axios({
method: 'POST',
url: "weixin/get_sign",
data: data,
dataType: "json",
}).then(function(res) {
if (res.data.status == 200) {
wx.config({
debug: false,
appId: res.data.resuit.appId, // 必填,公众号的唯一标识
timestamp: res.data.resuit.timestamp, // 必填,生成签名的时间戳
nonceStr: res.data.resuit.nonceStr, // 必填,生成签名的随机串
signature: res.data.resuit.signature, // 必填,签名,见附录1
jsApiList: [
'getLocation', 'checkJsApi', 'chooseWXPay'
]
});
wx.ready(function() {
wx.getLocation({
type: "gcj02",
success: function(res) {
app.latitude = res.latitude;
app.longitude = res.longitude;
that.details();
},
cancel: function(res) {
alert("定位失败,权限不足")
},
});
});
} else if (res.data.status == 400) {
layer.msg(res.data.msg, {
time: 1500
});
}
})
},
