优化
This commit is contained in:
parent
39a6a0dc0d
commit
6e536c90b4
@ -5,7 +5,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapState, mapActions } from 'vuex'
|
||||
import { mapState, mapActions, mapMutations } from 'vuex'
|
||||
import * as dd from 'dingtalk-jsapi'
|
||||
import { apiDingtalkLogin, apiUserInfo } from '@/api/login'
|
||||
export default {
|
||||
@ -37,7 +37,8 @@ export default {
|
||||
onCancel () {
|
||||
|
||||
},
|
||||
...mapActions(['GET_DEPLIST', 'SET_USER_INFO']),
|
||||
...mapActions(['GET_DEPLIST']),
|
||||
...mapMutations(['SET_USER_INFO']),
|
||||
// 获取钉钉鉴权码
|
||||
handleGetDingtalkCode () {
|
||||
return new Promise((resolve, reject) => {
|
||||
@ -77,9 +78,7 @@ export default {
|
||||
let res = await apiUserInfo()
|
||||
console.log('获取用户信息res: ', res)
|
||||
if (res.code === 200) {
|
||||
console.log('this.SET_USER_INFO: ', this.SET_USER_INFO)
|
||||
// this.SET_USER_INFO(res.user)
|
||||
this.$store.commit('SET_USER_INFO', res.user)
|
||||
this.SET_USER_INFO(res.user)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -14,8 +14,8 @@
|
||||
<nav-header v-if="!isNav"/>
|
||||
</transition>
|
||||
<div class="navBar-right" v-if="isNav">
|
||||
<span>{{this.info.realName}}</span>
|
||||
<img :src="this.info || ''" alt="">
|
||||
<span>{{this.userInfo.realName}}</span>
|
||||
<img :src="this.userInfo.avatar || ''" alt="">
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@ -23,7 +23,7 @@
|
||||
<script>
|
||||
import routeList from '@/router/kpi_route'
|
||||
import NavHeader from './NavHeader'
|
||||
import { mapState } from 'vuex'
|
||||
import { mapGetters } from 'vuex'
|
||||
export default {
|
||||
name: 'NavBar',
|
||||
data () {
|
||||
@ -37,7 +37,7 @@ export default {
|
||||
NavHeader
|
||||
},
|
||||
computed: {
|
||||
...mapState({ info: state => state.user.info }),
|
||||
...mapGetters(['userInfo']),
|
||||
isNav () {
|
||||
return !!this.$route.meta.isNav
|
||||
},
|
||||
|
||||
@ -56,13 +56,11 @@ export default {
|
||||
this.token = res.token
|
||||
this.$cookies.set('token', res.token, res.expire)
|
||||
let ress = await apiUserInfo()
|
||||
console.log('ress.user: ', ress.user)
|
||||
if (ress.code === 200) {
|
||||
// this.SET_USER_INFO(ress.user)
|
||||
this.$store.commit('SET_USER_INFO', ress.user)
|
||||
this.SET_USER_INFO(ress.user)
|
||||
}
|
||||
console.log('ress: ', ress)
|
||||
// location.reload()
|
||||
location.reload()
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user