浏览代码

build: 班级名称字段调整

chaooo 2 年之前
父节点
当前提交
131aea1374

+ 2 - 2
src/api/school/index.ts

@@ -1,6 +1,6 @@
 import request from "@/utils/request";
 import { AxiosPromise } from "axios";
-import { SchoolList, ClassList } from "./types";
+import { SchoolList, GradeList } from "./types";
 
 /**
  * 获取学校列表
@@ -14,7 +14,7 @@ export function getSchoolList(): AxiosPromise<SchoolList[]> {
 /**
  * 获取班级列表
  */
-export function getClassList(id: number): AxiosPromise<ClassList[]> {
+export function getGradeList(id: number): AxiosPromise<GradeList[]> {
   return request({
     url: "/board/v1/grade",
     method: "get",

+ 1 - 1
src/api/school/types.ts

@@ -12,7 +12,7 @@ export interface SchoolList {
 /**
  * 班级列表
  */
-export interface ClassList {
+export interface GradeList {
   /** 班级id */
   id: number;
   /** 学校id */

+ 0 - 0
src/assets/index/classes.png → src/assets/index/grade.png


+ 3 - 3
src/store/modules/permission.ts

@@ -73,14 +73,14 @@ const schoolRoutes: RouteRecordRaw[] = JSON.parse(
       ],
     },
     {
-      path: "/class",
+      path: "/grade",
       component: "SchoolIndex",
-      redirect: "/class/index",
+      redirect: "/grade/index",
       meta: { title: "班级管理", name: "ClassManage" },
       children: [
         {
           path: "index",
-          component: "class/index",
+          component: "grade/index",
           meta: {
             title: "班级管理",
             name: "ClassIndex",

+ 1 - 1
src/views/dashboard/components/DataCard.vue

@@ -119,7 +119,7 @@ watchEffect(() => {
     background-size: 100% auto;
     background-repeat: no-repeat;
     &.c1 {
-      background-image: url("../../../assets/index/classes.png");
+      background-image: url("../../../assets/index/grade.png");
     }
     &.c2 {
       background-image: url("../../../assets/index/teachers.png");

+ 15 - 15
src/views/dashboard/index.vue

@@ -8,12 +8,12 @@ defineOptions({
   name: "DashboardIndex",
   inheritAttrs: false,
 });
-// import { getClassList, getSchoolList } from "@/api/school";
-import { ClassList, SchoolList } from "@/api/school/types";
+// import { getGradeList, getSchoolList } from "@/api/school";
+import { GradeList, SchoolList } from "@/api/school/types";
 import { watch } from "vue";
 import { useUserStore } from "@/store/modules/user";
 import { CaretBottom } from "@element-plus/icons-vue";
-import { getClassList } from "@/api/school";
+import { getGradeList } from "@/api/school";
 import { getDashboardData, getDashboardTop } from "@/api/dashboard";
 import { DashboardCard, DashboardData } from "@/api/dashboard/types";
 const userStore = useUserStore();
@@ -49,15 +49,15 @@ async function getDataCard(schoolId) {
 /**
  * 班级数据
  */
-const classData = ref<ClassList[]>();
+const gradeData = ref<GradeList[]>();
 // 班级编号
-let classId = ref(0);
-async function getClassData(schoolId) {
-  getClassList(schoolId)
+let gradeId = ref(0);
+async function getGradeData(schoolId) {
+  getGradeList(schoolId)
     .then(({ data }) => {
       data.unshift({ id: 0, name: "全部班级" });
-      classData.value = data;
-      //console.log(classData.value)
+      gradeData.value = data;
+      //console.log(gradeData.value)
     })
     .catch((error) => {
       console.log(error);
@@ -81,8 +81,8 @@ const chartData: DashboardData = reactive({
   // // 近期分期占比分析
   // afterProportion: Proportion;
 });
-async function getChartData(classId) {
-  getDashboardData(classId)
+async function getChartData(gradeId) {
+  getDashboardData(gradeId)
     .then(({ data }) => {
       // 初期专注力估值
       chartData.frontAverage = data.frontAverage;
@@ -106,11 +106,11 @@ async function getChartData(classId) {
 
 onMounted(() => {
   // 获取班级
-  getClassData(userStore.schoolId);
+  getGradeData(userStore.schoolId);
   // 数据卡片
   getDataCard(userStore.schoolId);
   // 图表数据
-  getChartData(classId.value);
+  getChartData(gradeId.value);
 });
 
 // 数据状态:1正常,2训练次数小于3,3过期,4缺省
@@ -135,13 +135,13 @@ const percentNumber = [1, 2, 13, 2, 2];
     <!-- 班级选择 及 案例展示 -->
     <div class="class-select clear">
       <el-select
-        v-model="classId"
+        v-model="gradeId"
         placeholder="全部班级"
         size="large"
         :suffix-icon="CaretBottom"
       >
         <el-option
-          v-for="item in classData"
+          v-for="item in gradeData"
           :key="item.id"
           :label="item.name"
           :value="item.id"

+ 2 - 2
src/views/equipment/index.vue

@@ -5,7 +5,7 @@ defineOptions({
 });
 import { watch } from "vue";
 import { useUserStore } from "@/store/modules/user";
-import { ClassList } from "@/api/school/types";
+import { GradeList } from "@/api/school/types";
 import { CaretBottom } from "@element-plus/icons-vue";
 const userStore = useUserStore();
 watch(
@@ -17,7 +17,7 @@ watch(
 let equipmentInfo = ref("");
 // 教师编号
 let teacherNumber = ref(0);
-const teacherData = ref<ClassList[]>([
+const teacherData = ref<GradeList[]>([
   {
     id: 0,
     school_id: 0,

+ 13 - 13
src/views/class/index.vue → src/views/grade/index.vue

@@ -1,5 +1,5 @@
 <script setup lang="ts">
-import { ClassList } from "@/api/school/types";
+import { GradeList } from "@/api/school/types";
 
 defineOptions({
   name: "ClassIndex",
@@ -8,27 +8,27 @@ defineOptions({
 import { watch } from "vue";
 import { useUserStore } from "@/store/modules/user";
 import { CaretBottom } from "@element-plus/icons-vue";
-import { getClassList } from "@/api/school";
+import { getGradeList } from "@/api/school";
 const userStore = useUserStore();
 watch(
   () => userStore.schoolId,
   (newValue, oldValue) => {
     //console.log(newValue, oldValue);
-    getClassData(newValue);
+    getGradeData(newValue);
   }
 );
 /**
  * 班级数据
  */
-const classData = ref<ClassList[]>();
+const gradeData = ref<GradeList[]>();
 // 班级编号
-let classId = ref(0);
-async function getClassData(schoolId) {
-  getClassList(schoolId)
+let gradeId = ref(0);
+async function getGradeData(schoolId) {
+  getGradeList(schoolId)
     .then(({ data }) => {
-      classData.value = data;
-      if (classId.value == 0) {
-        classId.value = data[0].id;
+      gradeData.value = data;
+      if (gradeId.value == 0) {
+        gradeId.value = data[0].id;
       }
     })
     .catch((error) => {
@@ -36,7 +36,7 @@ async function getClassData(schoolId) {
     });
 }
 onMounted(() => {
-  getClassData(userStore.schoolId);
+  getGradeData(userStore.schoolId);
 });
 // 折叠面板active
 const activeItem = ref();
@@ -139,13 +139,13 @@ const tableData = ref<any>([
     <!-- 班级选择 -->
     <div class="class-select">
       <el-select
-        v-model="classId"
+        v-model="gradeId"
         placeholder="全部班级"
         size="large"
         :suffix-icon="CaretBottom"
       >
         <el-option
-          v-for="item in classData"
+          v-for="item in gradeData"
           :key="item.id"
           :label="item.name"
           :value="item.id"

+ 3 - 3
src/views/student/index.vue

@@ -7,7 +7,7 @@ defineOptions({
 });
 import { watch } from "vue";
 import { useUserStore } from "@/store/modules/user";
-import { ClassList } from "@/api/school/types";
+import { GradeList } from "@/api/school/types";
 const userStore = useUserStore();
 watch(
   () => userStore.schoolId,
@@ -18,7 +18,7 @@ watch(
 let studentInfo = ref("");
 // 班级编号
 let classNumber = ref(0);
-const classData = ref<ClassList[]>([
+const gradeData = ref<GradeList[]>([
   {
     id: 0,
     school_id: 0,
@@ -48,7 +48,7 @@ const tableData = ref<any>([
         :suffix-icon="CaretBottom"
       >
         <el-option
-          v-for="item in classData"
+          v-for="item in gradeData"
           :key="item.id"
           :label="item.name"
           :value="item.id"

+ 1 - 1
src/views/teacher/index.vue

@@ -1,5 +1,5 @@
 <script setup lang="ts">
-import { ClassList } from "@/api/school/types";
+import { GradeList } from "@/api/school/types";
 
 defineOptions({
   name: "TeacherIndex",

+ 3 - 3
src/views/training/index.vue

@@ -8,7 +8,7 @@ defineOptions({
 import { CaretBottom } from "@element-plus/icons-vue";
 import { watch } from "vue";
 import { useUserStore } from "@/store/modules/user";
-import { ClassList } from "@/api/school/types";
+import { GradeList } from "@/api/school/types";
 const userStore = useUserStore();
 watch(
   () => userStore.schoolId,
@@ -19,7 +19,7 @@ watch(
 let studentType = ref("");
 let classNumber = ref("");
 let trainingType = ref("");
-const classData = ref<ClassList[]>([
+const gradeData = ref<GradeList[]>([
   {
     id: 0,
     school_id: 0,
@@ -60,7 +60,7 @@ let dialogVisible = ref(false);
         :suffix-icon="CaretBottom"
       >
         <el-option
-          v-for="item in classData"
+          v-for="item in gradeData"
           :key="item.id"
           :label="item.name"
           :value="item.id"