diff --git a/src/store/getters.js b/src/store/getters.js index 8adb1b6..ed5119c 100644 --- a/src/store/getters.js +++ b/src/store/getters.js @@ -8,6 +8,7 @@ const getters = { token: state => state.user.token, avatar: state => state.user.avatar, name: state => state.user.name, + useer: state => state.user.useer, introduction: state => state.user.introduction, roles: state => state.user.roles, permissions: state => state.user.permissions, diff --git a/src/store/modules/user.js b/src/store/modules/user.js index cdbab1e..dce69d5 100644 --- a/src/store/modules/user.js +++ b/src/store/modules/user.js @@ -8,7 +8,8 @@ const user = { name: '', avatar: '', roles: [], - permissions: [] + permissions: [], + useer: "" }, mutations: { @@ -21,6 +22,9 @@ const user = { SET_NAME: (state, name) => { state.name = name }, + SET_NAMEUSE: (state, name) => { + state.useer = name + }, SET_AVATAR: (state, avatar) => { state.avatar = avatar }, @@ -64,6 +68,7 @@ const user = { } commit('SET_ID', user.userId) commit('SET_NAME', user.userName) + commit('SET_NAMEUSE', user) commit('SET_AVATAR', avatar) resolve(res) }).catch(error => { diff --git a/src/views/unitPages/myTask/index.vue b/src/views/unitPages/myTask/index.vue index 99d8cbc..467b8b5 100644 --- a/src/views/unitPages/myTask/index.vue +++ b/src/views/unitPages/myTask/index.vue @@ -189,12 +189,8 @@ export default { }, mounted() { console.log(this.$store.state.user); - if(this.$store.state.user.roles[0] == "admin"){ - // this.pagination: { - // current: 1, - // size: 10, - // }, - } + console.log(this.$store.state.user.roles[0]); + this.getInfo(); this.cancalDebounce(); window.addEventListener('resize', this.cancalDebounce); @@ -246,6 +242,9 @@ export default { // 获取列表 getInfo() { this.loading = true; + if(this.$store.state.user.roles.includes("unit")){ + this.pagination.dwmc=this.$store.state.user.useer.nickName + } getassetTask(this.pagination).then(res => { this.loading = false; this.total = res.data.total;