手机型号:三星S10+
微信版本 :7.0.14
手机系统:android 10
小程序内部定时器每1秒调用wx.request向服务端上报一次数据, 退出微信到手机主屏幕并息屏30秒,在打开微信,wx.request无响应。请问有什么方式唤醒wx.request吗?
Page({
data: {
motto: 'Hello World',
userInfo: {},
hasUserInfo: false,
beacons: "",
canIUse: wx.canIUse('button.open-type.getUserInfo')
},
onLoad: function () {
__setTimeout();
}
});
function __setTimeout(){
__upload();
clearTimeout();
setTimeout(function(){
__setTimeout();
}, 1000);
}
function __upload(){
wx.request({
url: 'https://www.xxx.com/test/report',
data: {"K":"key","V":"value"},
method:"POST",
success(res) {
console.log(res);
},
fail:function(res1){
console.log(res1);
},
complete:function(res2){
console.log(res2);
}
});
}