Browse Source

规范代码

wuheng 1 year ago
parent
commit
8fc47fcf1c

+ 6 - 6
src/router/guard/permission.ts

@@ -30,12 +30,12 @@ export async function createPermissionGuard(
 
   const actions: Common.StrategyAction[] = [
     // 已登录状态跳转登录页,跳转至首页
-    [
-      isLogin && to.name === routeName('login'),
-      () => {
-        next({ name: routeName('root') });
-      }
-    ],
+    // [
+    //   isLogin && to.name === routeName('login'),
+    //   () => {
+    //     next({ name: routeName('root') });
+    //   }
+    // ],
     // 不需要登录权限的页面直接通行
     [
       !needLogin,

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

@@ -21,7 +21,7 @@ const archives: AuthRoute.Route = {
     i18nTitle: 'message.routes.archives._value',
     icon: 'vaadin:archives',
     permissions: ['admin', 'teacher', 'member'],
-    order: 9
+    order: 2
   }
 };
 

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

@@ -33,7 +33,8 @@ const lesson: AuthRoute.Route = {
         title: '课程签到',
         i18nTitle: 'message.routes.lesson.checkin',
         requiresAuth: true,
-        icon: 'mdi:sign'
+        icon: 'mdi:sign',
+        hide: true
       }
     },
     {

+ 4 - 4
src/router/modules/system.ts

@@ -40,8 +40,8 @@ const system: AuthRoute.Route = {
       }
     },
     {
-      name: 'system_sort',
-      path: '/system/sort',
+      name: 'system_category',
+      path: '/system/category',
       component: 'self',
       meta: {
         title: '课程分类',
@@ -52,8 +52,8 @@ const system: AuthRoute.Route = {
       }
     },
     {
-      name: 'system_route',
-      path: '/system/route',
+      name: 'system_subject',
+      path: '/system/subject',
       component: 'self',
       meta: {
         title: '系列分类',

+ 12 - 12
src/typings/page-route.d.ts

@@ -32,21 +32,21 @@ declare namespace PageRoute {
     | 'exception_404'
     | 'exception_500'
     | 'group'
+    | 'group_classroom'
+    | 'group_group'
+    | 'group_student'
     | 'lesson'
+    | 'lesson_attendance'
     | 'lesson_calendar'
     | 'lesson_checkin'
-    | 'group_classroom'
-    | 'group_group'
     | 'lesson_schedule'
     | 'lesson_score'
-    | 'group_student'
     | 'system'
-    | 'lesson_attendance'
     | 'system_auth'
+    | 'system_category'
     | 'system_role'
-    | 'system_route'
-    | 'system_sort'
     | 'system_student'
+    | 'system_subject'
     | 'system_user';
 
   /**
@@ -67,19 +67,19 @@ declare namespace PageRoute {
     | 'exception_403'
     | 'exception_404'
     | 'exception_500'
-    | 'lesson_calendar'
-    | 'lesson_checkin'
     | 'group_classroom'
     | 'group_group'
-    | 'lesson_schedule'
-    | 'lesson_score'
     | 'group_student'
     | 'lesson_attendance'
+    | 'lesson_calendar'
+    | 'lesson_checkin'
+    | 'lesson_schedule'
+    | 'lesson_score'
     | 'system_auth'
+    | 'system_category'
     | 'system_role'
-    | 'system_route'
-    | 'system_sort'
     | 'system_student'
+    | 'system_subject'
     | 'system_user'
   >;
 }

+ 1 - 1
src/views/_builtin/login/components/pwd-login/index.vue

@@ -53,7 +53,7 @@ const closeBox = () => {
 const loginType = ref<string>('admin');
 
 const model = reactive<AdminLoginParams>({
-  username: '武恒',
+  username: 'wangyan',
   passwd: '123456',
   captchaVerification: ''
 });

+ 3 - 1
src/views/archives/students/component/crud.ts

@@ -3,11 +3,13 @@ import type { FsUploaderFormRequestOptions } from '@fast-crud/fast-extends';
 import dayjs from 'dayjs';
 import { dict } from '@fast-crud/fast-crud';
 import axios from 'axios';
+import { usePermission } from '@/composables';
 import { getServiceEnvConfig } from '~/.env-config';
 import type { AddArchivesParams } from './api';
 import { getArchives, getFile, addArchives, deleteArchives, downloadArchives } from './api';
 const { url, proxyPattern } = getServiceEnvConfig(import.meta.env);
 const isHttpProxy = import.meta.env.VITE_HTTP_PROXY === 'Y';
+const { hasPermission } = usePermission();
 export default function createCrudOptions(crudOptionsProps: CreateCrudOptionsProps): CreateCrudOptionsRet {
   return {
     crudOptions: {
@@ -84,7 +86,7 @@ export default function createCrudOptions(crudOptionsProps: CreateCrudOptionsPro
         show: false
       },
       actionbar: {
-        show: true,
+        show: hasPermission('admin' as Auth.RoleType),
         buttons: {
           add: {
             text: '添加学员档案'

+ 0 - 4
src/views/group/student/crud.ts

@@ -57,10 +57,6 @@ function curd(): CreateCrudOptionsRet {
             }
           }
         },
-        avatar: {
-          title: '头像',
-          type: 'image'
-        },
         studentNumber: {
           title: '学生学号',
           type: 'text',

+ 2 - 2
src/views/index.ts

@@ -26,8 +26,8 @@ export const views: Record<
   lesson_attendance: () => import('./lesson/attendance/index.vue'),
   system_auth: () => import('./system/auth/index.vue'),
   system_role: () => import('./system/role/index.vue'),
-  system_route: () => import('./system/route/index.vue'),
-  system_sort: () => import('./system/sort/index.vue'),
+  system_subject: () => import('./system/subject/index.vue'),
+  system_category: () => import('./system/category/index.vue'),
   system_student: () => import('./system/student/index.vue'),
   system_user: () => import('./system/user/index.vue')
 };

+ 7 - 5
src/views/lesson/calendar/index.vue

@@ -42,9 +42,9 @@
         @update:value="handleUpdateValue"
       >
         {{ year }}年{{ month }}月{{ date }}日 <br />
-        <n-tag v-if="dataList[`${year}-${doubleMonth(month)}-${date}`]" type="success">
+        <n-tag v-if="dataList[`${year}-${doubleMonth(month)}-${doubleDay(date)}`]" type="success">
           共有课时:
-          {{ dataList[`${year}-${doubleMonth(month)}-${date}`] }}
+          {{ dataList[`${year}-${doubleMonth(month)}-${doubleDay(date)}`] }}
         </n-tag>
         <n-tag v-else> 共有课时:0 节 </n-tag>
@@ -131,8 +131,8 @@ const scheduleParamsOptions = ref<QueryScheduleParams>({
 });
 const dataList = reactive<{ [index: string]: any }>({});
 function handleUpdateValue(_: number, { year, month, date }: { year: number; month: number; date: number }) {
-  if (dataList[`${year}-${doubleMonth(month)}-${date}`]) {
-    list.value = allList[`${year}-${doubleMonth(month)}-${date}`];
+  if (dataList[`${year}-${doubleMonth(month)}-${doubleDay(date)}`]) {
+    list.value = allList[`${year}-${doubleMonth(month)}-${doubleDay(date)}`];
     showModal.value = true;
   }
 }
@@ -175,7 +175,9 @@ function studentOptionsSearch(keyword: string) {
 function doubleMonth(month: number) {
   return month < 10 ? `0${month}` : month;
 }
-
+function doubleDay(day: number) {
+  return day < 10 ? `0${day}` : day;
+}
 function handlePanelChange(event: { year: number; month: number }) {
   scheduleParamsOptions.value.startTime = formatDate(getFirstDayOfMonth(new Date(event.year, event.month - 1)));
   scheduleParamsOptions.value.endTime = formatDate(getLastDayOfMonth(new Date(event.year, event.month - 1)));

+ 0 - 0
src/views/system/sort/api.ts → src/views/system/category/api.ts


+ 0 - 0
src/views/system/sort/crud.ts → src/views/system/category/crud.ts


+ 0 - 0
src/views/system/sort/index.vue → src/views/system/category/index.vue


+ 23 - 9
src/views/system/student/crud.ts

@@ -82,6 +82,13 @@ function curd({ context }: CreateCrudOptionsProps): CreateCrudOptionsRet {
         }
       },
       columns: {
+        id: {
+          search: { show: false },
+          form: { show: false },
+          column: {
+            show: false
+          }
+        },
         studentName: {
           title: '姓名',
           type: 'text',
@@ -99,7 +106,6 @@ function curd({ context }: CreateCrudOptionsProps): CreateCrudOptionsRet {
           search: { show: true },
           column: {
             resizable: true,
-            width: 120,
             align: 'center',
             fixed: 'left'
           }
@@ -110,7 +116,6 @@ function curd({ context }: CreateCrudOptionsProps): CreateCrudOptionsRet {
           search: { show: true },
           column: {
             resizable: true,
-            width: 180,
             align: 'center',
             fixed: 'left'
           }
@@ -121,7 +126,6 @@ function curd({ context }: CreateCrudOptionsProps): CreateCrudOptionsRet {
           search: { show: true },
           column: {
             resizable: true,
-            width: 120,
             align: 'center',
             fixed: 'left'
           }
@@ -132,7 +136,6 @@ function curd({ context }: CreateCrudOptionsProps): CreateCrudOptionsRet {
           search: { show: true },
           column: {
             resizable: true,
-            width: 180,
             align: 'center',
             fixed: 'left'
           }
@@ -143,7 +146,6 @@ function curd({ context }: CreateCrudOptionsProps): CreateCrudOptionsRet {
           search: { show: true },
           column: {
             resizable: true,
-            width: 180,
             align: 'center',
             fixed: 'left'
           }
@@ -154,8 +156,7 @@ function curd({ context }: CreateCrudOptionsProps): CreateCrudOptionsRet {
           search: { show: true },
           column: {
             resizable: true,
-            align: 'center',
-            width: 120
+            align: 'center'
           }
         },
         studentNumber: {
@@ -164,8 +165,7 @@ function curd({ context }: CreateCrudOptionsProps): CreateCrudOptionsRet {
           search: { show: true },
           column: {
             resizable: true,
-            align: 'center',
-            width: 200
+            align: 'center'
           },
           form: {
             show: false
@@ -189,6 +189,20 @@ function curd({ context }: CreateCrudOptionsProps): CreateCrudOptionsRet {
             width: 100
           }
         },
+        graduation: {
+          title: '是否结业',
+          type: 'dict-select',
+          dict: dict({
+            data: [
+              { value: 'Y', label: '已结业' },
+              { value: 'N', label: '在学习' }
+            ]
+          }),
+          column: {
+            resizable: true,
+            width: 40
+          }
+        },
         gender: {
           title: '性别',
           type: 'dict-select',

+ 0 - 0
src/views/system/route/api.ts → src/views/system/subject/api.ts


+ 0 - 0
src/views/system/route/component/crud.ts → src/views/system/subject/component/crud.ts


+ 0 - 0
src/views/system/route/component/curd.ts → src/views/system/subject/component/curd.ts


+ 0 - 0
src/views/system/route/component/importScores.vue → src/views/system/subject/component/importScores.vue


+ 0 - 0
src/views/system/route/component/viewScores.vue → src/views/system/subject/component/viewScores.vue


+ 0 - 0
src/views/system/route/crud.ts → src/views/system/subject/crud.ts


+ 0 - 0
src/views/system/route/index.vue → src/views/system/subject/index.vue