封装了几个方法

This commit is contained in:
2024-02-01 15:34:50 +08:00
parent 787a1f26b6
commit 719ee912a4
6 changed files with 77 additions and 75 deletions

18
app.js
View File

@@ -1,17 +1,13 @@
import { checkUpgrade, getConfigByEnv } from "./utils/index"
// app.js
App({
onShow() {
checkUpgrade();
},
onLaunch() {
// 展示本地存储能力
const logs = wx.getStorageSync('logs') || []
logs.unshift(Date.now())
wx.setStorageSync('logs', logs)
// 登录
wx.login({
success: res => {
// 发送 res.code 到后台换取 openId, sessionKey, unionId
}
})
const { api } = getConfigByEnv();
this.globalData = { ...this.globalData, api, }
},
globalData: {
userInfo: null