切换角色
This commit is contained in:
@@ -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">
|
||||
|
||||
@@ -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>
|
||||
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user