city_card/app.js

54 lines
1.7 KiB
JavaScript
Raw Permalink Normal View History

2023-07-15 14:25:28 +08:00
// app.js
var restAjax = require('./utils/restAjax.js');
var request = require('./utils/request.js');
App({
2023-07-18 16:54:17 +08:00
restAjax: restAjax,
http: request,
apis: restAjax.apis,
urls: request.apis,
baseUrls: restAjax.baseUrl,
onLaunch() {
var _self = this;
this.globalData.windowHeight = wx.getSystemInfoSync().windowHeight
//设置状态栏
wx.getSystemInfo({
success: e => {
this.globalData.StatusBar = e.statusBarHeight;
let capsule = wx.getMenuButtonBoundingClientRect();
if (capsule) {
this.globalData.Custom = capsule;
this.globalData.CustomBar = capsule.bottom + capsule.top - e.statusBarHeight;
} else {
this.globalData.CustomBar = e.statusBarHeight + 50;
}
}
})
//获取手机屏幕高度、宽度
_self.globalData.windowHeight = wx.getSystemInfoSync().windowHeight
_self.globalData.windowWidth = wx.getSystemInfoSync().windowWidth
},
2023-07-15 14:25:28 +08:00
2023-07-18 16:54:17 +08:00
// 获取用户信息
getUserInfo: function () {
var self = this
app.restAjax.get(app.restAjax.path('{loginUrl}app/user/get-app-user', [app.personIntroUrl]), {}, {
headers: {
token: app.globalData.token
}
}, function (code, data) {
app.globalData.userInfo = data
}, function (code, data) {
app.dialog.msg(data.msg);
});
2023-07-15 14:25:28 +08:00
},
2023-07-18 16:54:17 +08:00
globalData: {
userIcon: '',
userInfo: {},
currentCommunity: {
communityId: '',
communityName: '切换社区'
},
token: ''
}
2023-07-15 14:25:28 +08:00
})