|
|
@@ -1,47 +1,56 @@
|
|
|
<template>
|
|
|
<view class="menu-container">
|
|
|
- <view class="menu-item" v-for="menu in menus" :key="menu.label" @click="navigateTo(menu)">
|
|
|
- <ie-image :is-oss="true" :src="menu.icon" custom-class="w-98 h-110" />
|
|
|
- <view class="text-26 text-fore-title">{{ menu.label }}</view>
|
|
|
- </view>
|
|
|
+ <template v-for="menu in menus" :key="menu.label">
|
|
|
+ <view class="menu-item" v-if="menu.visible" @click="navigateTo(menu)">
|
|
|
+ <ie-image :is-oss="true" :src="menu.icon" custom-class="w-98 h-110" />
|
|
|
+ <view class="text-26 text-fore-title">{{ menu.label }}</view>
|
|
|
+ </view>
|
|
|
+ </template>
|
|
|
</view>
|
|
|
</template>
|
|
|
<script lang="ts" setup>
|
|
|
+import { useUserStore } from '@/store/userStore';
|
|
|
import { useTransferPage } from '@/hooks/useTransferPage';
|
|
|
const { transferTo } = useTransferPage();
|
|
|
+const userStore = useUserStore();
|
|
|
type MenuItem = {
|
|
|
label: string;
|
|
|
icon: string;
|
|
|
pageUrl: string;
|
|
|
}
|
|
|
-const menus = [
|
|
|
+const menus = computed(() => [
|
|
|
{
|
|
|
label: '课程学习',
|
|
|
icon: '/menu/menu-course.png',
|
|
|
- pageUrl: '/pagesOther/pages/video-center/index/index'
|
|
|
+ pageUrl: '/pagesOther/pages/video-center/index/index',
|
|
|
+ visible: true
|
|
|
},
|
|
|
{
|
|
|
label: '组卷作业',
|
|
|
icon: '/menu/menu-exam.png',
|
|
|
- pageUrl: '/pagesStudy/pages/homework/homework'
|
|
|
+ pageUrl: '/pagesStudy/pages/homework/homework',
|
|
|
+ visible: userStore.isStudent
|
|
|
},
|
|
|
{
|
|
|
label: '收藏夹',
|
|
|
icon: '/menu/menu-favorite.png',
|
|
|
// pageUrl: '/pagesOther/pages/personal-center/my-concerned/my-concerned'
|
|
|
- pageUrl: '/pagesOther/pages/topic-center/topic-collection/topic-collection'
|
|
|
+ pageUrl: '/pagesOther/pages/topic-center/topic-collection/topic-collection',
|
|
|
+ visible: true
|
|
|
},
|
|
|
{
|
|
|
label: '错题本',
|
|
|
icon: '/menu/menu-mistake.png',
|
|
|
- pageUrl: '/pagesOther/pages/topic-center/wrong-book/wrong-book'
|
|
|
+ pageUrl: '/pagesOther/pages/topic-center/wrong-book/wrong-book',
|
|
|
+ visible: true
|
|
|
},
|
|
|
{
|
|
|
label: '学习记录',
|
|
|
icon: '/menu/menu-record.png',
|
|
|
- pageUrl: '/pagesStudy/pages/study-history/study-history'
|
|
|
+ pageUrl: '/pagesStudy/pages/study-history/study-history',
|
|
|
+ visible: userStore.isStudent
|
|
|
}
|
|
|
-]
|
|
|
+])
|
|
|
const navigateTo = (menu: MenuItem) => {
|
|
|
if (menu.label === '错题本') {
|
|
|
transferTo('/pagesOther/pages/topic-center/wrong-book/wrong-book', {
|
|
|
@@ -54,10 +63,10 @@ const navigateTo = (menu: MenuItem) => {
|
|
|
</script>
|
|
|
<style lang="scss" scoped>
|
|
|
.menu-container {
|
|
|
- @apply mx-48 mt-32 flex items-center gap-x-20;
|
|
|
+ @apply mx-30 mt-32 grid grid-cols-5 items-center gap-x-20;
|
|
|
}
|
|
|
|
|
|
.menu-item {
|
|
|
- @apply flex-1 flex flex-col items-center justify-center;
|
|
|
+ @apply flex flex-col items-center justify-center;
|
|
|
}
|
|
|
</style>
|