Skip to content

Commit

Permalink
修复非管理员显示管理入口的bug
Browse files Browse the repository at this point in the history
  • Loading branch information
unify-z committed Aug 29, 2024
1 parent 7a33df1 commit 65d42e0
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<el-menu-item index="1" @click="router.push('/dashboard')">主页</el-menu-item>
<el-menu-item index="2" @click="router.push('/dashboard/rank')">排行榜</el-menu-item>
<el-menu-item index="3" @click="router.push('/dashboard/myclusters')">我的节点</el-menu-item>
<el-menu-item index="4" v-if="isAdmin.valueOf" @click="router.push('/dashboard/admin')">管理页</el-menu-item>
<el-menu-item index="4" v-if="isAdmin" @click="router.push('/dashboard/admin')">管理页</el-menu-item>
<el-menu-item>
<el-button @click="switchThemes()">
<el-icon>
Expand Down Expand Up @@ -41,16 +41,20 @@ import Cookies from 'js-cookie'
const activeIndex = ref('1')
const router = useRouter()
const isTokenPresent = (): boolean => {
const token = Cookies.get('token');
return !!token;
}
const isAdmin = ref(false)
let isAdmin = ref(false)
const userInfo = ref({
avatar_url: '',
login: '',
})
const isTokenPresent = (): boolean => {
const token = Cookies.get('token');
if (!token){
isAdmin.value = false
console.log(isAdmin.value)
}
return !!token;
}
const getuserinfo = async () => {
try {
const response = await axios.get('https://saltwood.top:9393/93AtHome/dashboard/user/profile', {
Expand Down

0 comments on commit 65d42e0

Please sign in to comment.