Browse Source

home over !

wuheng 1 year ago
parent
commit
0e93c1133d

+ 1 - 1
src/router/modules/lesson.ts

@@ -66,7 +66,7 @@ const lesson: AuthRoute.Route = {
       component: 'self',
       meta: {
         title: '学员出勤',
-        permissions: ['admin', 'teacher'],
+        permissions: ['admin', 'teacher', 'member'],
         i18nTitle: 'message.routes.lesson.attendance',
         requiresAuth: true,
         icon: 'emojione:kiss-mark'

+ 11 - 0
src/views/dashboard/workbench/components/workbench-main/components/shortcuts-card.vue

@@ -1,5 +1,6 @@
 <template>
   <div
+    :style="{ filter: isDisable ? 'grayscale(100%)' : 'grayscale(0%)' }"
     class="flex-col-center h-120px p-12px border-1px border-#efeff5 dark:border-#ffffff17 rounded-4px hover:shadow-sm cursor-pointer"
     @click="handClick"
   >
@@ -11,6 +12,7 @@
 <script setup lang="ts">
 defineOptions({ name: 'DashboardWorkbenchMainShortcutsCard' });
 import { useRouter } from 'vue-router';
+import { useAuthStore } from '@/store';
 type callback = () => void;
 
 interface Props {
@@ -21,13 +23,22 @@ interface Props {
   /** 图标颜色 */
   iconColor: string;
   siteOrfunc: string | callback;
+  manager: boolean;
 }
 
 const props = defineProps<Props>();
 
 const router = useRouter();
+const auth = useAuthStore();
+const { userType } = auth.userInfo;
+const isStudent = userType === 'member';
+
+const isDisable = isStudent && props.manager;
 
 function handClick() {
+  if (isDisable) {
+    return;
+  }
   if (typeof props.siteOrfunc === 'function') {
     props.siteOrfunc();
   } else {

+ 10 - 0
src/views/dashboard/workbench/components/workbench-main/components/technology-card.vue

@@ -1,5 +1,6 @@
 <template>
   <div
+    :style="{ filter: isDisable ? 'grayscale(100%)' : 'grayscale(0%)' }"
     class="h-120px p-4px border-1px border-#efeff5 dark:border-#ffffff17 rounded-4px hover:shadow-sm cursor-pointer"
     @click="handleOpenSite"
   >
@@ -17,6 +18,7 @@
 <script setup lang="ts">
 defineOptions({ name: 'DashboardWorkbenchMainTechnologyCard' });
 import { useRouter } from 'vue-router';
+import { useAuthStore } from '@/store';
 interface Props {
   /** 技术名称 */
   name: string;
@@ -30,12 +32,20 @@ interface Props {
   icon: string;
   /** 图标颜色 */
   iconColor?: string;
+
+  manager?: boolean;
 }
 
 const props = defineProps<Props>();
 const router = useRouter();
+const auth = useAuthStore();
+const { userType } = auth.userInfo;
+const isStudent = userType === 'member';
+
+const isDisable = isStudent && props.manager;
 
 function handleOpenSite() {
+  if (isDisable) return;
   router.push({
     path: props.site
   });

+ 43 - 12
src/views/dashboard/workbench/components/workbench-main/index.vue

@@ -38,6 +38,7 @@ interface Technology {
   site: string;
   icon: string;
   iconColor?: string;
+  manager?: boolean;
 }
 const app = useAppStore();
 const theme = useThemeStore();
@@ -49,7 +50,8 @@ const technology: Technology[] = [
     author: '课程周历',
     site: '/lesson/schedule',
     icon: 'radix-icons:calendar',
-    iconColor: getRandomColor()
+    iconColor: getRandomColor(),
+    manager: false
   },
   {
     id: 1,
@@ -58,7 +60,8 @@ const technology: Technology[] = [
     author: '课程日历',
     site: '/lesson/calendar',
     icon: 'healthicons:i-schedule-school-date-time',
-    iconColor: getRandomColor()
+    iconColor: getRandomColor(),
+    manager: false
   },
   {
     id: 2,
@@ -67,7 +70,8 @@ const technology: Technology[] = [
     author: '考勤列表',
     site: '/lesson/attendance',
     icon: 'mdi:sign',
-    iconColor: getRandomColor()
+    iconColor: getRandomColor(),
+    manager: false
   },
   {
     id: 3,
@@ -76,7 +80,8 @@ const technology: Technology[] = [
     author: '科目考试',
     site: '/lesson/score',
     icon: 'healthicons:i-exam-qualification-outline',
-    iconColor: getRandomColor()
+    iconColor: getRandomColor(),
+    manager: false
   },
   {
     id: 4,
@@ -85,7 +90,8 @@ const technology: Technology[] = [
     author: '查看学员',
     site: '/system/student',
     icon: 'icons8:student',
-    iconColor: getRandomColor()
+    iconColor: getRandomColor(),
+    manager: true
   },
   {
     id: 5,
@@ -94,7 +100,8 @@ const technology: Technology[] = [
     author: '教学科目',
     site: '/system/subject',
     icon: 'material-symbols:route',
-    iconColor: getRandomColor()
+    iconColor: getRandomColor(),
+    manager: true
   }
 ];
 
@@ -110,11 +117,26 @@ interface Shortcuts {
   icon: string;
   iconColor: string;
   siteOrfunc: string | callback;
+  manager: boolean;
 }
 
 const shortcuts: Shortcuts[] = [
-  { id: 0, label: '查档案', icon: 'icons8:student', iconColor: '#409eff', siteOrfunc: '/archives/students' },
-  { id: 2, label: '查班级', icon: 'arcticons:classroom', iconColor: '#f56c6c', siteOrfunc: '/group/group' },
+  {
+    id: 0,
+    label: '查档案',
+    icon: 'icons8:student',
+    iconColor: '#409eff',
+    siteOrfunc: '/archives/students',
+    manager: false
+  },
+  {
+    id: 2,
+    label: '查班级',
+    icon: 'arcticons:classroom',
+    iconColor: '#f56c6c',
+    siteOrfunc: '/group/group',
+    manager: true
+  },
   {
     id: 1,
     label: '个性化',
@@ -122,9 +144,17 @@ const shortcuts: Shortcuts[] = [
     iconColor: '#7238d1',
     siteOrfunc: () => {
       app.toggleSettingDrawerVisible();
-    }
+    },
+    manager: false
+  },
+  {
+    id: 3,
+    label: '改密码',
+    icon: 'teenyicons:password-solid',
+    iconColor: '#19a2f1',
+    siteOrfunc: '/system/profile',
+    manager: false
   },
-  { id: 3, label: '改密码', icon: 'teenyicons:password-solid', iconColor: '#19a2f1', siteOrfunc: '/system/profile' },
   {
     id: 4,
     label: '切主题',
@@ -132,9 +162,10 @@ const shortcuts: Shortcuts[] = [
     iconColor: '#fab251',
     siteOrfunc: () => {
       theme.setDarkMode(!theme.darkMode);
-    }
+    },
+    manager: false
   },
-  { id: 5, label: '说明', icon: 'gg:readme', iconColor: '#8aca6b', siteOrfunc: '/about' }
+  { id: 5, label: '说明', icon: 'gg:readme', iconColor: '#8aca6b', siteOrfunc: '/about', manager: true }
 ];
 </script>