Explorar o código

Merge branch 'develop' into feature/assignment-zhangyasen

Johnson %!s(int64=7) %!d(string=hai) anos
pai
achega
7d6338829a

+ 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
     }
   });
 };

+ 3 - 2
src/api/question.js

@@ -25,8 +25,9 @@ export const getQuestionsByAssignType = ({ type, page, limit }) => {
  */
 export const getQuestionByQuesType = ({ type, page, limit }) => {
   return request(
-    `${QUESTION_MODULE}/teacher/questions/type?type=${type || ""}&page=${page ||
-      1}&limit=${limit || 10}`
+    `${QUESTION_MODULE}/teacher/questions/type?type=${type || ""}&page=${
+      page >= 0 ? page : 0
+    }&limit=${limit || 10}`
   );
 };
 /**

+ 0 - 3
src/layouts/LoginLayout.vue

@@ -11,9 +11,6 @@
         </div>
       </div>
     </section>
-    <!--<footer class="footer is-transparent" style="background: #f4f7fb">-->
-    <!--<div class="content has-text-centered">@nju software</div>-->
-    <!--</footer>-->
   </section>
 </template>
 

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


+ 395 - 12
src/views/teacher/Question/index.vue

@@ -16,7 +16,7 @@
         <div class="form-group">
           <!--下拉框-->
           <b-field>
-            <b-select placeholder="选择题目类型">
+            <b-select v-model="selectedType">
               <option
                 v-for="(option, index) in questionType"
                 :value="option"
@@ -45,7 +45,12 @@
         </div>
         <!--题目table-->
         <div class="question-list">
-          <b-table :data="data" detailed detail-key="id">
+          <b-table
+            :data="data"
+            detailed
+            detail-key="id"
+            v-if="data && data.length > 0"
+          >
             <template slot-scope="props">
               <b-table-column field="id" label="ID" width="40" numeric sortable>
                 {{ props.row.id }}
@@ -60,6 +65,7 @@
                       questionId: props.row.id
                     }
                   }"
+                  target="_blank"
                   >{{ props.row.name }}</router-link
                 >
               </b-table-column>
@@ -87,7 +93,7 @@
                 sortable
                 centered
               >
-                {{ props.row.expect_time }}分钟
+                {{ props.row.expectTime }}分钟
               </b-table-column>
             </template>
 
@@ -126,6 +132,302 @@
               </article>
             </template>
           </b-table>
+          <!--表格页标-->
+          <div
+            class="level-item"
+            v-if="paginationInfo.display && data && data.length > 0"
+          >
+            <div class="pagination">
+              <a
+                role="button"
+                href="#"
+                :disabled="{ disabled: paginationInfo.currentPage == 0 }"
+                class="pagination-previous"
+                ><span class="icon"
+                  ><i class="mdi mdi-chevron-left mdi-24px"></i></span
+              ></a>
+              <a
+                role="button"
+                href="#"
+                :disabled="{
+                  disabled:
+                    paginationInfo.currentPage == paginationInfo.totalPage
+                }"
+                class="pagination-next"
+                ><span class="icon"
+                  ><i class="mdi mdi-chevron-right mdi-24px"></i></span
+              ></a>
+              <!--页数较少的显示情况-->
+              <ul class="pagination-list" v-if="paginationInfo.totalPage < 6">
+                <li v-for="index in paginationInfo.pageList" :key="index">
+                  <a
+                    role="button"
+                    href="#"
+                    :class="[
+                      'pagination-link',
+                      { 'is-current': paginationInfo.currentPage == index }
+                    ]"
+                    >1</a
+                  >
+                </li>
+              </ul>
+            </div>
+          </div>
+          <!--当没有数据时页面展示-->
+          <div class="no-data" v-if="data.length <= 0">
+            <svg
+              id="f20e0c25-d928-42cc-98d1-13cc230663ea"
+              data-name="Layer 1"
+              xmlns="http://www.w3.org/2000/svg"
+              xmlns:xlink="http://www.w3.org/1999/xlink"
+              width="620.16"
+              height="500.81"
+              viewBox="0 0 820.16 780.81"
+            >
+              <defs>
+                <linearGradient
+                  id="07332201-7176-49c2-9908-6dc4a39c4716"
+                  x1="539.63"
+                  y1="734.6"
+                  x2="539.63"
+                  y2="151.19"
+                  gradientTransform="translate(-3.62 1.57)"
+                  gradientUnits="userSpaceOnUse"
+                >
+                  <stop offset="0" stop-color="gray" stop-opacity="0.25" />
+                  <stop offset="0.54" stop-color="gray" stop-opacity="0.12" />
+                  <stop offset="1" stop-color="gray" stop-opacity="0.1" />
+                </linearGradient>
+                <linearGradient
+                  id="0ee1ab3f-7ba2-4205-9d4a-9606ad702253"
+                  x1="540.17"
+                  y1="180.2"
+                  x2="540.17"
+                  y2="130.75"
+                  gradientTransform="translate(-63.92 7.85)"
+                  xlink:href="#07332201-7176-49c2-9908-6dc4a39c4716"
+                />
+                <linearGradient
+                  id="abca9755-bed1-4a97-b027-7f02ee3ffa09"
+                  x1="540.17"
+                  y1="140.86"
+                  x2="540.17"
+                  y2="82.43"
+                  gradientTransform="translate(-84.51 124.6) rotate(-12.11)"
+                  xlink:href="#07332201-7176-49c2-9908-6dc4a39c4716"
+                />
+                <linearGradient
+                  id="2632d424-e666-4ee4-9508-a494957e14ab"
+                  x1="476.4"
+                  y1="710.53"
+                  x2="476.4"
+                  y2="127.12"
+                  gradientTransform="matrix(1, 0, 0, 1, 0, 0)"
+                  xlink:href="#07332201-7176-49c2-9908-6dc4a39c4716"
+                />
+                <linearGradient
+                  id="97571ef7-1c83-4e06-b701-c2e47e77dca3"
+                  x1="476.94"
+                  y1="156.13"
+                  x2="476.94"
+                  y2="106.68"
+                  gradientTransform="matrix(1, 0, 0, 1, 0, 0)"
+                  xlink:href="#07332201-7176-49c2-9908-6dc4a39c4716"
+                />
+                <linearGradient
+                  id="7d32e13e-a0c7-49c4-af0e-066a2f8cb76e"
+                  x1="666.86"
+                  y1="176.39"
+                  x2="666.86"
+                  y2="117.95"
+                  gradientTransform="matrix(1, 0, 0, 1, 0, 0)"
+                  xlink:href="#07332201-7176-49c2-9908-6dc4a39c4716"
+                />
+              </defs>
+              <title>no data</title>
+              <rect
+                x="317.5"
+                y="142.55"
+                width="437.02"
+                height="603.82"
+                transform="translate(-271.22 62.72) rotate(-12.11)"
+                fill="#e0e0e0"
+              />
+              <g opacity="0.5">
+                <rect
+                  x="324.89"
+                  y="152.76"
+                  width="422.25"
+                  height="583.41"
+                  transform="translate(-271.22 62.72) rotate(-12.11)"
+                  fill="url(#07332201-7176-49c2-9908-6dc4a39c4716)"
+                />
+              </g>
+              <rect
+                x="329.81"
+                y="157.1"
+                width="411.5"
+                height="570.52"
+                transform="translate(-270.79 62.58) rotate(-12.11)"
+                fill="#fafafa"
+              />
+              <rect
+                x="374.18"
+                y="138.6"
+                width="204.14"
+                height="49.45"
+                transform="translate(-213.58 43.93) rotate(-12.11)"
+                fill="url(#0ee1ab3f-7ba2-4205-9d4a-9606ad702253)"
+              />
+              <path
+                d="M460.93,91.9c-15.41,3.31-25.16,18.78-21.77,34.55s18.62,25.89,34,22.58,25.16-18.78,21.77-34.55S476.34,88.59,460.93,91.9ZM470.6,137A16.86,16.86,0,1,1,483.16,117,16.66,16.66,0,0,1,470.6,137Z"
+                transform="translate(-189.92 -59.59)"
+                fill="url(#abca9755-bed1-4a97-b027-7f02ee3ffa09)"
+              />
+              <rect
+                x="375.66"
+                y="136.55"
+                width="199.84"
+                height="47.27"
+                transform="translate(-212.94 43.72) rotate(-12.11)"
+                fill="#6c63ff"
+              />
+              <path
+                d="M460.93,91.9a27.93,27.93,0,1,0,33.17,21.45A27.93,27.93,0,0,0,460.93,91.9ZM470.17,135a16.12,16.12,0,1,1,12.38-19.14A16.12,16.12,0,0,1,470.17,135Z"
+                transform="translate(-189.92 -59.59)"
+                fill="#6c63ff"
+              />
+              <rect
+                x="257.89"
+                y="116.91"
+                width="437.02"
+                height="603.82"
+                fill="#e0e0e0"
+              />
+              <g opacity="0.5">
+                <rect
+                  x="265.28"
+                  y="127.12"
+                  width="422.25"
+                  height="583.41"
+                  fill="url(#2632d424-e666-4ee4-9508-a494957e14ab)"
+                />
+              </g>
+              <rect
+                x="270.65"
+                y="131.42"
+                width="411.5"
+                height="570.52"
+                fill="#fff"
+              />
+              <rect
+                x="374.87"
+                y="106.68"
+                width="204.14"
+                height="49.45"
+                fill="url(#97571ef7-1c83-4e06-b701-c2e47e77dca3)"
+              />
+              <path
+                d="M666.86,118c-15.76,0-28.54,13.08-28.54,29.22s12.78,29.22,28.54,29.22,28.54-13.08,28.54-29.22S682.62,118,666.86,118Zm0,46.08a16.86,16.86,0,1,1,16.46-16.86A16.66,16.66,0,0,1,666.86,164Z"
+                transform="translate(-189.92 -59.59)"
+                fill="url(#7d32e13e-a0c7-49c4-af0e-066a2f8cb76e)"
+              />
+              <rect
+                x="377.02"
+                y="104.56"
+                width="199.84"
+                height="47.27"
+                fill="#6c63ff"
+              />
+              <path
+                d="M666.86,118a27.93,27.93,0,1,0,27.93,27.93A27.93,27.93,0,0,0,666.86,118Zm0,44.05A16.12,16.12,0,1,1,683,145.89,16.12,16.12,0,0,1,666.86,162Z"
+                transform="translate(-189.92 -59.59)"
+                fill="#6c63ff"
+              />
+              <g opacity="0.5">
+                <rect
+                  x="15.27"
+                  y="737.05"
+                  width="3.76"
+                  height="21.33"
+                  fill="#47e6b1"
+                />
+                <rect
+                  x="205.19"
+                  y="796.65"
+                  width="3.76"
+                  height="21.33"
+                  transform="translate(824.47 540.65) rotate(90)"
+                  fill="#47e6b1"
+                />
+              </g>
+              <g opacity="0.5">
+                <rect x="451.49" width="3.76" height="21.33" fill="#47e6b1" />
+                <rect
+                  x="641.4"
+                  y="59.59"
+                  width="3.76"
+                  height="21.33"
+                  transform="translate(523.63 -632.62) rotate(90)"
+                  fill="#47e6b1"
+                />
+              </g>
+              <path
+                d="M961,832.15a4.61,4.61,0,0,1-2.57-5.57,2.22,2.22,0,0,0,.1-.51h0a2.31,2.31,0,0,0-4.15-1.53h0a2.22,2.22,0,0,0-.26.45,4.61,4.61,0,0,1-5.57,2.57,2.22,2.22,0,0,0-.51-.1h0a2.31,2.31,0,0,0-1.53,4.15h0a2.22,2.22,0,0,0,.45.26,4.61,4.61,0,0,1,2.57,5.57,2.22,2.22,0,0,0-.1.51h0a2.31,2.31,0,0,0,4.15,1.53h0a2.22,2.22,0,0,0,.26-.45,4.61,4.61,0,0,1,5.57-2.57,2.22,2.22,0,0,0,.51.1h0a2.31,2.31,0,0,0,1.53-4.15h0A2.22,2.22,0,0,0,961,832.15Z"
+                transform="translate(-189.92 -59.59)"
+                fill="#4d8af0"
+                opacity="0.5"
+              />
+              <path
+                d="M326.59,627.09a4.61,4.61,0,0,1-2.57-5.57,2.22,2.22,0,0,0,.1-.51h0a2.31,2.31,0,0,0-4.15-1.53h0a2.22,2.22,0,0,0-.26.45,4.61,4.61,0,0,1-5.57,2.57,2.22,2.22,0,0,0-.51-.1h0a2.31,2.31,0,0,0-1.53,4.15h0a2.22,2.22,0,0,0,.45.26,4.61,4.61,0,0,1,2.57,5.57,2.22,2.22,0,0,0-.1.51h0a2.31,2.31,0,0,0,4.15,1.53h0a2.22,2.22,0,0,0,.26-.45A4.61,4.61,0,0,1,325,631.4a2.22,2.22,0,0,0,.51.1h0a2.31,2.31,0,0,0,1.53-4.15h0A2.22,2.22,0,0,0,326.59,627.09Z"
+                transform="translate(-189.92 -59.59)"
+                fill="#fdd835"
+                opacity="0.5"
+              />
+              <path
+                d="M855,127.77a4.61,4.61,0,0,1-2.57-5.57,2.22,2.22,0,0,0,.1-.51h0a2.31,2.31,0,0,0-4.15-1.53h0a2.22,2.22,0,0,0-.26.45,4.61,4.61,0,0,1-5.57,2.57,2.22,2.22,0,0,0-.51-.1h0a2.31,2.31,0,0,0-1.53,4.15h0a2.22,2.22,0,0,0,.45.26,4.61,4.61,0,0,1,2.57,5.57,2.22,2.22,0,0,0-.1.51h0a2.31,2.31,0,0,0,4.15,1.53h0a2.22,2.22,0,0,0,.26-.45,4.61,4.61,0,0,1,5.57-2.57,2.22,2.22,0,0,0,.51.1h0a2.31,2.31,0,0,0,1.53-4.15h0A2.22,2.22,0,0,0,855,127.77Z"
+                transform="translate(-189.92 -59.59)"
+                fill="#fdd835"
+                opacity="0.5"
+              />
+              <circle
+                cx="812.64"
+                cy="314.47"
+                r="7.53"
+                fill="#f55f44"
+                opacity="0.5"
+              />
+              <circle
+                cx="230.73"
+                cy="746.65"
+                r="7.53"
+                fill="#f55f44"
+                opacity="0.5"
+              />
+              <circle
+                cx="735.31"
+                cy="477.23"
+                r="7.53"
+                fill="#f55f44"
+                opacity="0.5"
+              />
+              <circle
+                cx="87.14"
+                cy="96.35"
+                r="7.53"
+                fill="#4d8af0"
+                opacity="0.5"
+              />
+              <circle
+                cx="7.53"
+                cy="301.76"
+                r="7.53"
+                fill="#47e6b1"
+                opacity="0.5"
+              />
+            </svg>
+            <span>暂无符合要求的题目</span>
+          </div>
         </div>
       </div>
     </page-body>
@@ -136,12 +438,15 @@ import { mapState } from "vuex";
 import {
   getQuestionsByAssignType,
   getTeacherQuestionType,
-  getTeacherKeywordQuestions
+  getTeacherKeywordQuestions,
+  getQuestionByQuesType
 } from "@/api/question";
 import PageHeader from "@/components/PageHeader";
 import PageBody from "@/components/PageBody/index";
 import PageSectionLoading from "@/components/PageBody/PageSectionLoading/index";
 
+const pageLimit = 10;
+
 export default {
   components: {
     PageHeader,
@@ -161,23 +466,62 @@ export default {
       data: [],
       keyWord: "",
       errorMessage: "服务器错误,请稍后再试",
-      loadingQuestionList: true
+      loadingQuestionList: true,
+      selectedType: "全部类型",
+      paginationInfo: {
+        display: true,
+        totalPage: 0,
+        currentPage: 0,
+        pageList: []
+      }
     };
   },
+  watch: {
+    selectedType(val) {
+      let type = val;
+      type == "全部类型" ? "" : type;
+      this.getQuestionsByQType(type, 0, pageLimit);
+    }
+  },
   mounted() {
     //获取全部题目分类
     this.getQuestionType();
     //获取全部题目
-    this.getQuestions();
+    this.getQuestions("", 0, pageLimit);
 
     this.loadingQuestionList = false;
   },
   methods: {
+    //分页信息处理
+    pagnationHandler(total, current, elements) {
+      if (elements == 0) {
+        this.paginationInfo = {
+          display: false,
+          totalPage: 0,
+          currentPage: 0,
+          pageList: []
+        };
+      } else {
+        let paginationInfo = {};
+        let pageList = [];
+        paginationInfo.totalPage = total;
+        paginationInfo.currentPage = current;
+        for (let i = 0; i < total; i++) {
+          pageList.push(i);
+        }
+        paginationInfo.pageList = pageList;
+        paginationInfo.display = true;
+        this.paginationInfo = paginationInfo;
+      }
+    },
     //获取全部题目分类
     getQuestionType() {
       getTeacherQuestionType()
         .then(value => {
-          this.questionType = value.data;
+          // this.questionType = value.data;
+          let questionType = value.res;
+          questionType.unshift("全部类型");
+          this.questionType = questionType;
         })
         .catch(e => {
           this.$toast.open({
@@ -186,12 +530,42 @@ export default {
           });
         });
     },
-    //获取全部题目
-    getQuestions() {
-      getQuestionsByAssignType({ type: "DOCUMENT", page: 0, limit: 10 })
+    //获取指定题目类型的题目
+    getQuestionsByQType(questionType, pageNum, pageLimit) {
+      getQuestionByQuesType({
+        type: questionType,
+        page: pageNum,
+        limit: pageLimit
+      })
         .then(value => {
-          // this.data = value.res.content;
-          this.data = value.data;
+          this.data = value.data.content;
+          this.pagnationHandler(
+            value.data.totalPages,
+            pageNum,
+            value.data.umberOfElements
+          );
+        })
+        .catch(e => {
+          this.$toast.open({
+            message: e.message,
+            type: "is-danger"
+          });
+        });
+    },
+    //获取指定作业类型的题目
+    getQuestions(questionType, pageNum, pageLimit) {
+      getQuestionsByAssignType({
+        type: questionType,
+        page: pageNum,
+        limit: pageLimit
+      })
+        .then(value => {
+          this.data = value.data.content;
+          this.pagnationHandler(
+            value.data.totalPages,
+            pageNum,
+            value.data.umberOfElements
+          );
         })
         .catch(e => {
           this.$toast.open({
@@ -245,6 +619,15 @@ export default {
   /*color: #7957d5;*/
   font-weight: bold;
 }
+.no-data {
+  display: flex;
+  align-items: center;
+  span {
+    font-size: 2rem;
+    font-weight: bold;
+    color: #6c63ff;
+  }
+}
 /*.data-table {*/
 /*width: 100%;*/
 /*padding: 30px;*/

+ 8 - 2
src/views/teacher/Question/questionDetail.vue

@@ -12,10 +12,10 @@
       </template>
       <template slot="content">
         <b-tag class="tag" type="is-link" rounded>{{
-          questionInfo.assignmentType ? questionInfo.assignmentType.value : ""
+          questionInfo.assignmentType || ""
         }}</b-tag>
         <b-tag class="tag" type="is-link" rounded>{{
-          questionInfo.type ? questionInfo.type.value : ""
+          questionInfo.questionType || ""
         }}</b-tag>
       </template>
     </page-header>
@@ -50,6 +50,12 @@
                 <a>{{ item.filename }}</a>
               </div>
             </div>
+            <div
+              class="empty"
+              v-if="!(questionInfo.file && questionInfo.file.length > 0)"
+            >
+              当前题目暂无文件信息
+            </div>
           </div>
         </div>
       </div>

+ 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