Files
cardtest/app.js
zhangmanman 8f7cc986c2 [更新]
2021-08-13 13:30:35 +08:00

86 lines
2.0 KiB
JavaScript

/*
* 亿时代
*/
import api from "api/index"
var QQMapWX = require('utils/qqmap-wx-jssdk.min.js');
var qqmapsdk;
App({
onLaunch(e) {
// 获取打开场景值
this.globalData.scene = e.scene
// 沃支付是否开启
api.index.woPayment().then(res=>{
this.globalData.unicomPay = res.data.unicom_pay
})
// 获取系统信息
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: {
scene : '',
isUser : false,
userInfo : null,
token : "",
statusBarHeight : 0,
userCurrent : 0,
wechatUser : '',
city : "",
atcity : "",
adcode : '',
longitude : '',
latitude : '',
unicomPay : '',
shareObj : {
type : '',
goodsId : '',
userId : ''
}
}
})