Skip to content

Commit 5476764

Browse files
committed
fix(sidebar): also allow vice presidents to view restricted pages
1 parent 6bb328c commit 5476764

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

components/custom/sidebar.vue

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import type { AllClubs } from '~/types/api/user/all_clubs'
55
66
const route = useRoute()
77
8-
const isPresident = ref(false)
8+
const isPresidentOrVicePresident = ref(false)
99
1010
const { data } = await useAsyncData<AllClubs>('classroomStatuses', () => {
1111
return $fetch<AllClubs>(`/api/user/all_clubs`, {
@@ -14,8 +14,8 @@ const { data } = await useAsyncData<AllClubs>('classroomStatuses', () => {
1414
})
1515
})
1616
17-
if (data.value?.president.length !== 0) {
18-
isPresident.value = true
17+
if (data.value?.president.length !== 0 || data.value?.vice.length !== 0) {
18+
isPresidentOrVicePresident.value = true
1919
}
2020
</script>
2121

@@ -69,14 +69,14 @@ if (data.value?.president.length !== 0) {
6969
CAS管理
7070
</h2>
7171
<div class="mt-2">
72-
<NuxtLink v-if="isPresident" to="/manage/reservation">
72+
<NuxtLink v-if="isPresidentOrVicePresident" to="/manage/reservation">
7373
<Button :variant="route.name === 'manage-reservation' ? 'secondary' : 'ghost'" class="w-full justify-start">
7474
<Icon class="mr-2 h-4 w-4" name="material-symbols:calendar-today-outline" />
7575
预约教室
7676
</Button>
7777
</NuxtLink>
7878
<NuxtLink to="/manage/manage">
79-
<Button v-if="isPresident" :variant="route.name === 'manage-manage' ? 'secondary' : 'ghost'" class="w-full justify-start">
79+
<Button v-if="isPresidentOrVicePresident" :variant="route.name === 'manage-manage' ? 'secondary' : 'ghost'" class="w-full justify-start">
8080
<Icon class="mr-2 h-4 w-4" name="material-symbols:calendar-today-outline" />
8181
管理预约
8282
</Button>
@@ -88,7 +88,7 @@ if (data.value?.president.length !== 0) {
8888
</Button>
8989
</NuxtLink>
9090
<NuxtLink to="/manage/record">
91-
<Button v-if="isPresident" :variant="route.name === 'manage-record' ? 'secondary' : 'ghost'" class="w-full justify-start mt-1">
91+
<Button v-if="isPresidentOrVicePresident" :variant="route.name === 'manage-record' ? 'secondary' : 'ghost'" class="w-full justify-start mt-1">
9292
<Icon class="mr-2 h-4 w-4" name="charm:tick-double" />
9393
活动记录
9494
</Button>

0 commit comments

Comments
 (0)