统一甲屿云命名体系
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
const auth = require('./utils/auth')
|
||||
const { BRAND_CONFIG } = require('./utils/config')
|
||||
|
||||
App({
|
||||
globalData: {
|
||||
appName: BRAND_CONFIG.appName,
|
||||
shopName: BRAND_CONFIG.defaultShopName,
|
||||
userInfo: null,
|
||||
planningNeedRefresh: false
|
||||
},
|
||||
|
||||
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
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user