32 lines
573 B
JavaScript
32 lines
573 B
JavaScript
const auth = require('./utils/auth')
|
|||
|
|
|
||
|
|
App({
|
||
|
|
globalData: {
|
||
|
|
appName: '指尖管理师',
|
||
|
|
shopName: 'Yumi Nail',
|
||
|
|
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
|
||
|
|
}
|
||
|
|
})
|