From 21193b3b25ae1528cb95ebe3d42a7b5fc0fc2a38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E5=8A=B2=E9=BE=99?= <2860996570@qq.com> Date: Thu, 21 Nov 2024 16:17:54 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=BF=87=E6=BB=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/store/getters.js | 1 + src/store/modules/user.js | 7 ++++++- src/views/unitPages/myTask/index.vue | 11 +++++------ 3 files changed, 12 insertions(+), 7 deletions(-) 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;