beefast-mini-merchant/app.js
2025-03-26 20:06:10 +08:00

33 lines
751 B
JavaScript

import commonApi from './api/common';
const token = wx.getStorageSync('accessToken');
App({
onLaunch() {
// 展示本地存储能力
const logs = wx.getStorageSync('logs') || []
logs.unshift(Date.now())
wx.setStorageSync('logs', logs)
// 登录
wx.login({
success: res => {
// 发送 res.code 到后台换取 openId, sessionKey, unionId
}
})
},
async getAppConfig(){
if(!this.globalData.appConfig){
const data = await commonApi.getConfig();
this.globalData.appConfig = {};
data.map((item)=>{
this.globalData.appConfig[item.key] = item.value;
})
}
return this.globalData.appConfig;
},
globalData: {
userInfo: null,
accessToken:token
}
})