wzj-boot/mini-app/src/appManager.js

37 lines
565 B
JavaScript
Raw Normal View History

2021-01-12 18:04:14 +08:00
import store from '@/store'
import eventHub from './common/eventHub'
2021-01-12 18:04:14 +08:00
2021-01-15 12:00:20 +08:00
class AppManager {
2021-01-12 18:04:14 +08:00
saveOpenid(openid) {
2021-01-12 18:04:14 +08:00
store.dispatch('setOpenidAction', openid)
}
getOpenid() {
return wx.getStorageSync('openid')
}
navigateTo(url) {
if (!store.state.user.token) {
eventHub.$emit('onShowDialogUserInfo')
return
}
if (!url) {
this.showToast('建设中')
return
}
2021-01-12 18:04:14 +08:00
wx.navigateTo({
url: url
})
}
showToast(msg) {
wx.showToast({title: msg, icon: 'none'})
}
}
2021-01-15 12:00:20 +08:00
export default new AppManager()