Explorar o código

[修改]成绩统计接口、课程细节

soleil %!s(int64=7) %!d(string=hai) anos
pai
achega
eb681748e4

+ 2 - 3
src/api/course.js

@@ -25,7 +25,6 @@ export const getStudentCourses = () => {
  * @throws {StatusException} "课程名重复" | "课程选课码重复"
  */
 export const postTeacherCourse = ({ name, code }) => {
-  console.log(`name${name} code ${code}`);
   return request(`${COURSE_MODULE}/teacher`, {
     method: "POST",
     body: {
@@ -42,10 +41,10 @@ export const postTeacherCourse = ({ name, code }) => {
  * @throws {StatusException} "选课码不存在" | "已经加入课程"
  */
 export const postStudentCourse = code => {
-  return request(`${COURSE_MODULE}/student`, {
+  return request(`${COURSE_MODULE}/register`, {
     method: "POST",
     body: {
-      code
+      code: code
     }
   });
 };

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 529 - 2
src/views/student/Home/index.vue


+ 0 - 9
src/views/teacher/Dashboard/index.vue

@@ -7,15 +7,6 @@
       <template slot="content">
         当前<strong>&nbsp;5&nbsp;</strong>份作业进行中
       </template>
-      <!--<template slot="extraContent">-->
-      <!--Here might be a page title-->
-      <!--</template>-->
-      <!--<template slot="logo">-->
-      <!--Here might-->
-      <!--</template>-->
-      <!--<template slot="action">-->
-      <!--Here might be a page title-->
-      <!--</template>-->
     </page-header>
     <page-body>
       <div class="data-table">

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 529 - 2
src/views/teacher/Home/index.vue


+ 23 - 5
src/views/teacher/Result/index.vue

@@ -208,6 +208,16 @@ export default {
       course: state => state.course.currentCourse
     })
   },
+  watch: {
+    course(val) {
+      //获取成绩信息
+      getStudentFinaleResult(val.id).then(res => {
+        console.log(res.data);
+        this.data = res.data;
+        this.isResultLoading = false;
+      });
+    }
+  },
   data() {
     return {
       name: "",
@@ -237,6 +247,9 @@ export default {
     },
     //计算平均成绩
     average(resultList) {
+      if (resultList.length < 1) {
+        return "--";
+      }
       let res = 0;
       for (let item of resultList) {
         res += item.score;
@@ -274,11 +287,16 @@ export default {
   },
   mounted() {
     //获取成绩信息
-    getStudentFinaleResult(this.courses.id).then(res => {
-      console.log(res.data);
-      this.data = res.data;
-      this.isResultLoading = false;
-    });
+    let getResultIntervel = setInterval(() => {
+      if (this.course.id) {
+        clearInterval(getResultIntervel);
+        getStudentFinaleResult(this.course.id).then(res => {
+          this.data = res.data;
+          this.isResultLoading = false;
+        });
+      }
+    }, 800);
+
     //绘制图表
     let resultChart = document.getElementById("result-chart");
     let myChart2 = new Chart(resultChart, {

Algúns arquivos non se mostraron porque demasiados arquivos cambiaron neste cambio