2127关注6619浏览
大家帮我看下 ,小程序初始加载的数据,感觉这样写老是不妥,初始加载有获取权限的操作,有时候怎么会无法获取权限,请教下大神有没有什么可以优化的。
,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 ==
-
至过去的我
2044人对此回答表示赞同
我是未来的你,你现在是不是在年找寻小程序答案。你不要感觉诧异,给你来信原因,就是让你不在后悔。今天去学习如何推广小程序,相信......点击查看更多>