Parcourir la source

只有学生端才显示组卷作业和学习记录

shmily1213 il y a 1 mois
Parent
commit
1aeef63202

+ 22 - 13
src/pagesStudy/pages/index/compoentns/index-menu.vue

@@ -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>

+ 5 - 5
src/pagesSystem/pages/login/login.vue

@@ -5,13 +5,13 @@
     <ie-image :is-oss="true" src="/login-title.png" custom-class="w-auto h-96 mx-auto mt-240" mode="heightFix" />
     <view class="relative z-2 mx-46 mt-178">
       <view class="ml-18 flex items-center">
-        <view class="text-32" :class="{ 'is-active': loginType === 'phone' }" @click="changeLoginType('phone')">
-          手机号登录
-        </view>
-        <view class="w-1 h-30 mx-24 bg-fore-light"></view>
         <view class="text-32" :class="{ 'is-active': loginType === 'card' }" @click="changeLoginType('card')">
           会员卡登录
         </view>
+        <view class="w-1 h-30 mx-24 bg-fore-light"></view>
+        <view class="text-32" :class="{ 'is-active': loginType === 'phone' }" @click="changeLoginType('phone')">
+          手机号登录
+        </view>
       </view>
       <view class="mt-46">
         <view v-show="loginType === 'phone'">
@@ -69,7 +69,7 @@ const { transferBack, transferTo } = useTransferPage();
 const userStore = useUserStore();
 const { isSmsCaptchaEnable } = useAppConfig();
 
-const loginType = ref('phone');
+const loginType = ref('card');
 const phone = ref('');
 const password = ref('');
 const cardNo = ref('');