From 2df4dc053543e83ba3d2acb360364827789d641d Mon Sep 17 00:00:00 2001 From: Aqr-K <95741669+Aqr-K@users.noreply.github.com> Date: Thu, 17 Oct 2024 01:47:18 +0800 Subject: [PATCH] fix(user): bug --- src/components/dialog/UserAddEditDialog.vue | 46 +++++++++++++++++---- 1 file changed, 37 insertions(+), 9 deletions(-) diff --git a/src/components/dialog/UserAddEditDialog.vue b/src/components/dialog/UserAddEditDialog.vue index f2ad9d11..c0ec2e1b 100644 --- a/src/components/dialog/UserAddEditDialog.vue +++ b/src/components/dialog/UserAddEditDialog.vue @@ -22,9 +22,12 @@ const props = defineProps({ oper: String, }) -// 当前用户名称 +// 当前登录用户名称 const currentUser = store.state.auth.userName +// 用户名 +const userName = ref('') + // 当前头像缓存 const nowAvatar = ref(avatar1) @@ -93,6 +96,7 @@ async function fetchUserInfo() { if (userForm.value) { userForm.value.avatar = userForm.value.avatar || avatar1 nowAvatar.value = userForm.value.avatar + userName.value = userForm.value.name } } catch (error) { console.error(error) @@ -170,7 +174,7 @@ const canControl = computed(() => { return true } else { // 调用isCurrentUser函数判断是否为当前用户 - return isCurrentUser.value + return !(isCurrentUser.value) } }) @@ -194,7 +198,7 @@ watch(() => store.state.auth.avatar, () => {