70 lines
1.7 KiB
JavaScript
70 lines
1.7 KiB
JavaScript
|
|
/*
|
|
* 亿时代
|
|
*/
|
|
|
|
import api from "api/index"
|
|
|
|
var QQMapWX = require('utils/qqmap-wx-jssdk.min.js');
|
|
var qqmapsdk;
|
|
|
|
App({
|
|
onLaunch() {
|
|
// 获取系统信息
|
|
this.globalData.statusBarHeight = wx.getSystemInfoSync().statusBarHeight
|
|
|
|
// 检查用户登录状态
|
|
const token = wx.getStorageSync("token")
|
|
if (token) {
|
|
this.globalData.isUser = true
|
|
}
|
|
|
|
this.qqmapsdk = new QQMapWX({
|
|
key: '4KYBZ-LCAKF-QWOJN-NIDNZ-FZHLZ-2XFW7'
|
|
})
|
|
|
|
// 版本更新提示
|
|
const updateManager = wx.getUpdateManager()
|
|
|
|
updateManager.onUpdateReady(function () {
|
|
wx.showModal({
|
|
title : "更新提示",
|
|
content : "新版本已经准备好,是否重启应用?",
|
|
confirmText : "重启",
|
|
cancelColor : "#555",
|
|
confirmColor: "#26589f",
|
|
success: res => {
|
|
if (res.confirm) {
|
|
updateManager.applyUpdate()
|
|
}
|
|
}
|
|
})
|
|
})
|
|
|
|
|
|
// 获取系统信息
|
|
wx.getSystemInfo({
|
|
success: res=>{
|
|
this.globalData.systInfo = {
|
|
statusBarHeight: res.statusBarHeight,
|
|
safeArea : res.safeArea
|
|
}
|
|
}
|
|
})
|
|
// 挂载api
|
|
wx.$api = api
|
|
},
|
|
globalData: {
|
|
isUser : false,
|
|
userInfo : null,
|
|
token : "",
|
|
statusBarHeight : 0,
|
|
userCurrent : 0,
|
|
wechatUser : '',
|
|
city : "",
|
|
atcity : "",
|
|
adcode : '',
|
|
longitude : '',
|
|
latitude : ''
|
|
}
|
|
}) |