Browse Source

用户信息更新方法

main
pixel 5 years ago
parent
commit
ceb48da849
  1. 6
      QMPlusVuePage/src/store/module/user.js
  2. 7
      QMPlusVuePage/src/view/person/person.vue

6
QMPlusVuePage/src/store/module/user.js

@ -30,8 +30,12 @@ export const user = {
state.token = "" state.token = ""
state.expiresAt = "" state.expiresAt = ""
router.push({ name: 'login', replace: true }) router.push({ name: 'login', replace: true })
},
ResetUserInfo(state, userInfo = {}) {
state.userInfo = {...state.userInfo,
...userInfo
}
} }
}, },
actions: { actions: {
async LoginIn({ commit }, loginInfo) { async LoginIn({ commit }, loginInfo) {

7
QMPlusVuePage/src/view/person/person.vue

@ -23,15 +23,16 @@
</div> </div>
</template> </template>
<script> <script>
import { mapGetters } from 'vuex'
import { mapGetters, mapMutations } from 'vuex'
export default { export default {
name: 'Person', name: 'Person',
computed: { computed: {
...mapGetters('user', ['userInfo', 'token']) ...mapGetters('user', ['userInfo', 'token'])
}, },
methods:{ methods:{
handleAvatarSuccess(){
//
...mapMutations('user',['ResetUserInfo']),
handleAvatarSuccess(res){
this.ResetUserInfo({headerImg:res.data.user.headerImg})
} }
} }
} }

Loading…
Cancel
Save