切换角色

This commit is contained in:
qsh
2024-05-27 12:07:13 +08:00
parent 8adaf72682
commit 34b4f84293
17 changed files with 333 additions and 42 deletions

View File

@@ -29,14 +29,19 @@ const goMyList = () => {
}
// ========== 初始化 =========
const msgInterval = ref<any>(null)
onMounted(() => {
// 首次加载小红点
getUnreadCount()
// 轮询刷新小红点
setInterval(() => {
msgInterval.value = setInterval(() => {
getUnreadCount()
}, 1000 * 60 * 2)
})
onUnmounted(() => {
clearInterval(msgInterval.value)
})
</script>
<template>
<div class="message">

View File

@@ -13,10 +13,12 @@ const userStore = useUserStore()
const options = computed(() => {
return userStore.getRoles
})
const roleId = ref(1)
const roleId = ref(userStore.getUser.currentRole)
function handleChangeRole(val) {
getInfo({ params: { roleId: val } })
getInfo({ roleId: val }).then(() => {
userStore.refresh()
})
}
</script>

View File

@@ -52,13 +52,7 @@ const toProfile = async () => {
<ElDropdown :class="prefixCls" trigger="click">
<div class="flex items-center">
<img :src="avatar" alt="" class="w-[calc(var(--logo-height)-25px)] rounded-[50%]" />
<span
v-if="userName"
class="<lg:hidden text-14px pl-[5px] text-[var(--top-header-text-color)]"
>
莳松科技管理员
</span>
<span v-else class="<lg:hidden text-14px pl-[5px] text-[var(--top-header-text-color)]">
<span class="<lg:hidden text-14px pl-[5px] text-[var(--top-header-text-color)]">
{{ userName }}
</span>
</div>