大家帮我看下 ,小程序初始加载的数据,感觉这样写老是不妥,初始加载有获取权限的操作,有时候怎么会无法获取权限,请教下大神有没有什么可以优化的。


,onLaunch: function () {

that = this;

console.log("onLaunch: function ()");


try{

var houseCount = wx.getStorageSync('houseCount');

console.log("===============缓存houseCount=" + houseCount);

if (houseCount) {

that.globalData.houseCount = houseCount;

}


var houseXyzCount = wx.getStorageSync('houseXyzCount');

console.log("===============缓存houseXyzCount=" + houseXyzCount);

if (houseXyzCount) {

that.globalData.houseXyzCount = houseXyzCount;

}


var houseTgCount = wx.getStorageSync('houseTgCount');

console.log("===============houseTgCount=" + houseTgCount);

if (houseTgCount) {

that.globalData.houseTgCount = houseTgCount;

}


var houseGsCount = wx.getStorageSync('houseGsCount');

console.log("===============houseGsCount=" + houseGsCount);

if (houseGsCount) {

that.globalData.houseGsCount = houseGsCount;

}

var houseShopCount = wx.getStorageSync('houseShopCount');

console.log("===============houseShopCount=" + houseShopCount);

if (houseShopCount) {

that.globalData.houseShopCount = houseShopCount;

}


var houseDelCount = wx.getStorageSync('houseDelCount');

console.log("===============houseDelCount=" + houseDelCount);

if (houseDelCount) {

that.globalData.houseDelCount = houseDelCount;

}

} catch(e) {

wx.showModal({

title: '提示', showCancel: false,

content: '获取微信小程序房源数量缓存失败,请与管理员联系' + e

})


}


wx.getSystemInfo({

success: function (res) {

console.info("app获取高度返回=" + res.windowHeight);

that.globalData.height=res.windowHeight

}

})


var admin ="";

var adminTime = "";


try {

var wxUserInfo = wx.getStorageSync('wxUserInfo')

var wxUserInfoTime = wx.getStorageSync('wxUserInfoTime')



console.log("当前时间Time=" + new Date().getTime()+" wxUserInfoTime ="+wxUserInfoTime);

console.log("缓存wxUserInfo的天数 =" + (new Date().getTime() - wxUserInfoTime) / (24 * 3600 * 1000));


if (wxUserInfo ==

展开全部
收起
0回答
提交回答
  • 至过去的我

    2044人对此回答表示赞同

    我是未来的你,你现在是不是在年找寻小程序答案。你不要感觉诧异,给你来信原因,就是让你不在后悔。今天去学习如何推广小程序,相信......点击查看更多>
    发布于
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
咨询热线

13312967497

扫码添加业务即可随时咨询 还可领取小程序推广攻略

业务咨询: 13312967497
扫码咨询

扫码咨询套餐

回到顶部