App({
data: {
/**
* 参数
* author:Dong
*/
isIpx: false,
showBackHome: false,
baseUrl: 'https://test.zhaoshang800.com',
token: '',
appBindPhone: '',
appbindType: '',
cityCode: '440300',
//全局策略参数
isProjectListRefresh: false, //项目列表是否需要刷新
projectListSearchKey: '', //项目列表搜索关键字
projectListRentSaleType: 0, //项目列表租赁销售类型
isHouseTypeListRefresh: false, //户型列表是否需要刷新
houseTypeListSearchKey: '', //户型列表搜索关键字
houseTypeListRentSaleType: 0, //户型列表租赁销售类型
//进来时的页面
pathAndQuery: '/page/index/index'
},
onLaunch: function (e) {
let path = e.path;
let query = e.query;
let queryString = "";
for (var item in query) {
queryString += (`${ item}=${ e.query[item]}&`);
}
this.data.pathAndQuery = `/${ path}?${ queryString}`;
//监听网络变化
wx.onNetworkStatusChange(function (res) {
if (res.isConnected==false){
wx.showModal({
title: '提示',
content: '暂无网络',
success: function (res) {
}
})
}
})
//使用Promise获取字典信息,若失败,则后台重新获取,连续失败2次停止获取,待1分钟后重新拉取
const _this = this;
const dicArr = ['specialLabel', 'roleType', 'noticeType', 'photoType'];
_this.getDictsAll(dicArr)
.catch(err=>_this.getDictsAll(dicArr)) //失败重新拉取
.catch(err=>{
setTimeout(()=>{
_this.getDictsAll(dicArr) //再次失败隔一分钟拉取
}, 60000);
});
},
onShow: function (options) {
var _this = this;
wx.getSystemInfo({
success: function(res) {
if (res.model.indexOf("iPhone X") > -1) {
_this.data.isIpx = true;
}
}
});
if (wx.canIUse("getUpdateManager")) {
_this.getUpdateManager();
}
if ([1007, 1008, 1011, 1012, 1013, 1025, 1032, 1014, 1036, 1037,