wuheng 1 year ago
parent
commit
21f2a690b1

+ 5 - 2
src/views/dashboard/workbench/components/workbench-main/components/technology-card.vue

@@ -16,7 +16,7 @@
 
 <script setup lang="ts">
 defineOptions({ name: 'DashboardWorkbenchMainTechnologyCard' });
-
+import { useRouter } from 'vue-router';
 interface Props {
   /** 技术名称 */
   name: string;
@@ -33,9 +33,12 @@ interface Props {
 }
 
 const props = defineProps<Props>();
+const router = useRouter();
 
 function handleOpenSite() {
-  window.open(props.site, '_blank');
+  router.push({
+    path: props.site
+  });
 }
 </script>
 

+ 45 - 35
src/views/dashboard/workbench/components/workbench-main/index.vue

@@ -43,54 +43,64 @@ interface Technology {
 const technology: Technology[] = [
   {
     id: 0,
-    name: 'Vue',
-    description: '一套用于构建用户界面的渐进式框架',
-    author: '尤雨溪 - Evan You',
-    site: 'https://v3.cn.vuejs.org/',
-    icon: 'logos:vue'
+    name: '周排课',
+    description: '新增排课或者查询课程页面',
+    author: '课程周历',
+    site: '/lesson/schedule',
+    icon: 'radix-icons:calendar',
+    iconColor: getRandomColor()
   },
   {
     id: 1,
-    name: 'TypeScript',
-    description: 'JavaScript类型的超集,它可以编译成纯JavaScript',
-    author: '微软 - Microsoft',
-    site: 'https://www.typescriptlang.org/',
-    icon: 'logos:typescript-icon'
+    name: '月排课',
+    description: '已月为单位查看课程情况',
+    author: '课程日历',
+    site: '/lesson/calendar',
+    icon: 'healthicons:i-schedule-school-date-time',
+    iconColor: getRandomColor()
   },
   {
     id: 2,
-    name: 'Vite',
-    description: '下一代前端开发与构建工具',
-    author: '尤雨溪 - Evan You',
-    site: 'https://vitejs.cn/',
-    icon: 'logos:vitejs'
+    name: '查看考勤',
+    description: '查看学员考勤, 或者查看自己的考勤',
+    author: '考勤列表',
+    site: '/lesson/attendance',
+    icon: 'mdi:sign',
+    iconColor: getRandomColor()
   },
   {
     id: 3,
-    name: 'NaiveUI',
-    description: '一个 Vue 3 组件库',
-    author: '图森未来 - TuSimple',
-    site: 'https://www.naiveui.com/zh-CN/os-theme',
-    icon: 'logos:naiveui'
+    name: '学员考核',
+    description: '查看学员每个科目的成绩',
+    author: '科目考试',
+    site: '/lesson/score',
+    icon: 'healthicons:i-exam-qualification-outline',
+    iconColor: getRandomColor()
   },
   {
     id: 4,
-    name: 'UnoCSS',
-    description: '下一代实用优先的CSS框架',
-    author: 'Anthony Fu',
-    site: 'https://uno.antfu.me/?s=',
-    icon: 'logos:unocss'
+    name: '学生管理',
+    description: '查看当前系统所有学员',
+    author: '查看学员',
+    site: '/system/student',
+    icon: 'icons8:student',
+    iconColor: getRandomColor()
   },
   {
     id: 5,
-    name: 'Pinia',
-    description: 'vue状态管理框架,支持vue2、vue3',
-    author: 'Posva',
-    site: 'https://pinia.esm.dev/',
-    icon: 'noto:pineapple'
+    name: '科目管理',
+    description: '对当前系统内所有的科目进行管理',
+    author: '教学科目',
+    site: '/system/subject',
+    icon: 'material-symbols:route',
+    iconColor: getRandomColor()
   }
 ];
 
+function getRandomColor(): string {
+  return `#${Math.floor(Math.random() * 16777215).toString(16)}`;
+}
+
 interface Shortcuts {
   id: number;
   label: string;
@@ -100,11 +110,11 @@ interface Shortcuts {
 
 const shortcuts: Shortcuts[] = [
   { id: 0, label: '查档案', icon: 'icons8:student', iconColor: '#409eff' },
-  { id: 1, label: '系统管理', icon: 'ic:outline-settings', iconColor: '#7238d1' },
-  { id: 2, label: '权限管理', icon: 'mdi:family-tree', iconColor: '#f56c6c' },
-  { id: 3, label: '组件', icon: 'fluent:app-store-24-filled', iconColor: '#19a2f1' },
-  { id: 4, label: '表格', icon: 'mdi:table-large', iconColor: '#fab251' },
-  { id: 5, label: '图表', icon: 'mdi:chart-areaspline', iconColor: '#8aca6b' }
+  { id: 2, label: '看管理', icon: 'arcticons:classroom', iconColor: '#f56c6c' },
+  { id: 1, label: '个性化', icon: 'ic:outline-settings', iconColor: '#7238d1' },
+  { id: 3, label: '改密码', icon: 'teenyicons:password-solid', iconColor: '#19a2f1' },
+  { id: 4, label: '切主题', icon: 'icon-park-solid:theme', iconColor: '#fab251' },
+  { id: 5, label: '说明', icon: 'gg:readme', iconColor: '#8aca6b' }
 ];
 </script>
 

+ 4 - 0
src/views/lesson/schedule/api.ts

@@ -302,3 +302,7 @@ export interface EasSysStudentOptional {
 export function getStudentByKeyword(keyword: string): Promise<Service.RequestResult<EasSysStudentOptional[]>> {
   return request.get(`/student/getStudentByKeyword?keyword=${keyword}`);
 }
+
+export function deleteSchedule(id: number): Promise<Service.RequestResult<scheduleRes>> {
+  return request.delete(`/schedule/delete?id=${id}`);
+}

+ 46 - 3
src/views/lesson/schedule/index.vue

@@ -74,6 +74,7 @@
                     scheduleList[getDayOfTheWeekNow(weekStartTime, index)][key]['empty'] === false &&
                     scheduleList[getDayOfTheWeekNow(weekStartTime, index)][key]['break'] === false
                   "
+                  :style="{ backgroundColor: getRandomColor(), color: 'white' }"
                   :rowspan="scheduleList[getDayOfTheWeekNow(weekStartTime, index)][key]['colspan']"
                 >
                   时间:
@@ -83,7 +84,32 @@
                   授课: {{ scheduleList[getDayOfTheWeekNow(weekStartTime, index)][key]['category'] }}
                   {{ scheduleList[getDayOfTheWeekNow(weekStartTime, index)][key]['subjects'] }}<br />
                   教室: {{ scheduleList[getDayOfTheWeekNow(weekStartTime, index)][key]['classroom'] }}<br />
-                  班级: {{ scheduleList[getDayOfTheWeekNow(weekStartTime, index)][key]['className'] }}
+                  班级: {{ scheduleList[getDayOfTheWeekNow(weekStartTime, index)][key]['className'] }} <br />
+                  <n-space>
+                    <n-button
+                      text
+                      @click="
+                        () => {
+                          router.push({
+                            path: '/lesson/checkin',
+                            query: {
+                              scheduleId: scheduleList[getDayOfTheWeekNow(weekStartTime, index)][key]['id']
+                            }
+                          });
+                        }
+                      "
+                      >考勤管理</n-button
+                    >
+                    <n-button
+                      text
+                      @click="
+                        () => {
+                          deleteScheduleById(scheduleList[getDayOfTheWeekNow(weekStartTime, index)][key]['id']);
+                        }
+                      "
+                      >删除排课</n-button
+                    >
+                  </n-space>
                 </td>
                 <td
                   v-else-if="
@@ -165,7 +191,7 @@
 </template>
 <script setup lang="ts">
 import { ref, reactive } from 'vue';
-import { useRoute } from 'vue-router';
+import { useRoute, useRouter } from 'vue-router';
 import type { CascaderOption } from 'naive-ui';
 import { formatTimestamp } from '~/src/utils';
 import {
@@ -176,10 +202,12 @@ import {
   addSchedule,
   queryClassRoomList,
   querySchedule,
-  getStudentByKeyword
+  getStudentByKeyword,
+  deleteSchedule
 } from './api';
 import type { ScheduleParams, QueryScheduleParams } from './api';
 const route = useRoute();
+const router = useRouter();
 const model = reactive<ScheduleParams>({
   week: 0,
   startTime: 0,
@@ -415,6 +443,21 @@ function getDayOfTheWeekNow(theWeekStartTime: number, weekDate: number): number
   return week === 0 ? 7 : week;
 }
 
+async function deleteScheduleById(id: number) {
+  await deleteSchedule(id);
+  window.$message?.success('操作成功!');
+  loadData();
+}
+
+function getRandomColor(): string {
+  const e = '012345678956789abcabcdef';
+  let color = '';
+  for (let i = 0; i < 6; i += 1) {
+    color += e[Math.floor(Math.random() * 16)];
+  }
+  return `#${color}`;
+}
+
 function studentOptionsSearch(keyword: string) {
   if (!keyword.length) {
     studentOptions.value = [];