Files
JayuCloud/FM-Wechat-Fronted/app.js
T
2026-06-24 22:13:00 +08:00

33 lines
644 B
JavaScript

const auth = require('./utils/auth')
const { BRAND_CONFIG } = require('./utils/config')
App({
globalData: {
appName: BRAND_CONFIG.appName,
shopName: BRAND_CONFIG.defaultShopName,
userInfo: null
},
onLaunch() {
this.bootstrapSession()
},
bootstrapSession() {
const session = auth.getSession()
this.globalData.userInfo = session.userInfo || null
if (session.shopName) {
this.globalData.shopName = session.shopName
}
},
setSession(session) {
auth.setSession(session)
this.bootstrapSession()
},
clearSession() {
auth.clearSession()
this.globalData.userInfo = null
}
})