重构项目文件夹目录
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
const auth = require('./utils/auth')
|
||||
|
||||
App({
|
||||
globalData: {
|
||||
appName: '指尖管理师',
|
||||
shopName: 'Fingertip Designer',
|
||||
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
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user