1
1
<script setup lang="ts">
2
2
import { Button } from ' @/components/ui/button'
3
3
import { cn } from ' @/lib/utils'
4
+ import type { AllClubs } from ' ~/types/api/user/all_clubs'
4
5
5
6
const route = useRoute ()
7
+
8
+ const isPresident = ref (false )
9
+
10
+ const { data } = await useAsyncData <AllClubs >(' classroomStatuses' , () => {
11
+ return $fetch <AllClubs >(` /api/user/all_clubs ` , {
12
+ headers: useRequestHeaders (),
13
+ method: ' GET' ,
14
+ })
15
+ })
16
+
17
+ if (data .value ?.president .length !== 0 ) {
18
+ isPresident .value = true
19
+ }
6
20
</script >
7
21
8
22
<template >
@@ -55,14 +69,14 @@ const route = useRoute()
55
69
CAS管理
56
70
</h2 >
57
71
<div class =" mt-2" >
58
- <NuxtLink to =" /manage/reservation" >
72
+ <NuxtLink v-if = " isPresident " to =" /manage/reservation" >
59
73
<Button :variant =" route.name === 'manage-reservation' ? 'secondary' : 'ghost'" class =" w-full justify-start" >
60
74
<Icon class =" mr-2 h-4 w-4" name =" material-symbols:calendar-today-outline" />
61
75
预约教室
62
76
</Button >
63
77
</NuxtLink >
64
78
<NuxtLink to =" /manage/manage" >
65
- <Button :variant =" route.name === 'manage-manage' ? 'secondary' : 'ghost'" class =" w-full justify-start" >
79
+ <Button v-if = " isPresident " :variant =" route.name === 'manage-manage' ? 'secondary' : 'ghost'" class =" w-full justify-start" >
66
80
<Icon class =" mr-2 h-4 w-4" name =" material-symbols:calendar-today-outline" />
67
81
管理预约
68
82
</Button >
@@ -74,7 +88,7 @@ const route = useRoute()
74
88
</Button >
75
89
</NuxtLink >
76
90
<NuxtLink to =" /manage/record" >
77
- <Button :variant =" route.name === 'manage-record' ? 'secondary' : 'ghost'" class =" w-full justify-start mt-1" >
91
+ <Button v-if = " isPresident " :variant =" route.name === 'manage-record' ? 'secondary' : 'ghost'" class =" w-full justify-start mt-1" >
78
92
<Icon class =" mr-2 h-4 w-4" name =" charm:tick-double" />
79
93
活动记录
80
94
</Button >
0 commit comments