- 用户store新增fetchUserInfo action,调用/userInfo接口获取完整用户信息 - 登录页修复:LoginResponse只有token和userId,登录成功后调用fetchUserInfo获取资料 - App.vue启动时若已登录自动刷新用户信息 - 我的页面onShow时刷新用户信息,新增下拉刷新支持 - pages.json为我的页面启用enablePullDownRefresh
33 lines
659 B
Vue
33 lines
659 B
Vue
<script>
|
|
import { useUserStore } from './store/user.js'
|
|
import { useAppStore } from './store/app.js'
|
|
|
|
export default {
|
|
onLaunch: function() {
|
|
console.log('App Launch')
|
|
// 初始化系统信息
|
|
const appStore = useAppStore()
|
|
appStore.initSystemInfo()
|
|
|
|
// 恢复用户状态
|
|
const userStore = useUserStore()
|
|
userStore.restoreFromStorage()
|
|
|
|
// 已登录时从服务器刷新用户信息
|
|
if (userStore.isLoggedIn) {
|
|
userStore.fetchUserInfo()
|
|
}
|
|
},
|
|
onShow: function() {
|
|
console.log('App Show')
|
|
},
|
|
onHide: function() {
|
|
console.log('App Hide')
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style>
|
|
/*每个页面公共css */
|
|
</style>
|