Explorar el Código

[新增]作业空数据处理

soleil hace 7 años
padre
commit
6a95f9cfa8

+ 226 - 0
src/components/NoDataSvg.vue

@@ -0,0 +1,226 @@
+<template>
+  <!--当没有数据时页面展示-->
+  <div class="no-data">
+    <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>
+</template>
+<style lang="scss" scoped>
+.no-data {
+  display: flex;
+  align-items: center;
+  span {
+    font-size: 2rem;
+    font-weight: bold;
+    color: #6c63ff;
+  }
+}
+</style>

+ 10 - 1
src/views/student/Code/ProjectDetail/BuildDetail.vue

@@ -2,6 +2,14 @@
   <div>
     <div v-if="detailLoading"><page-section-loading show /></div>
     <div v-else>
+      <!--空数据处理-->
+      <div
+        class="page-section"
+        v-if="!(projectDetail.buildList && projectDetail.buildList.length > 0)"
+        style="height: 60vh;"
+      >
+        <no-data-svg></no-data-svg>
+      </div>
       <div
         v-for="(item, index) in projectDetail.buildList"
         :key="item.id"
@@ -47,9 +55,10 @@
 <script>
 import PageSectionLoading from "@/components/PageBody/PageSectionLoading/index";
 import BuildTag from "@/views/student/Code/ProjectDetail/components/BuildTag";
+import NoDataSvg from "@/components/NoDataSvg";
 export default {
   name: "BuildDetail",
-  components: { BuildTag, PageSectionLoading },
+  components: { BuildTag, PageSectionLoading, NoDataSvg },
   props: {
     projectDetail: {
       type: Object,

+ 2 - 2
src/views/student/Code/ProjectDetail/DeployDetail.vue

@@ -46,7 +46,7 @@
       </b-message>
     </section>
     <!--部署记录-->
-    <div class="deploy-list">
+    <div class="deploy-list" v-if="deployInfo">
       <div class="subtitle">
         {{ isRunning ? "当前部署情况" : "上次部署结果" }}
       </div>
@@ -74,7 +74,7 @@
           {{ unfoldDeployLogInfo ? "收起部署详细信息" : "查看部署详细信息" }}</a
         >
         <div class="code-section" v-show="unfoldDeployLogInfo">
-          <div class="code-content">{{ deployLog }}</div>
+          <div class="code-content" v-html="deployLog"></div>
         </div>
       </div>
     </div>

+ 2 - 2
src/views/student/Code/ProjectDetail/Test/FunctionalTestDetail.vue

@@ -35,12 +35,12 @@
         >
           <div class="page-section">
             <div>
-              <pass-tag :pass="item.isPass" />
+              <pass-tag :pass="item.pass" />
               <strong style="padding-left: 10px">
                 页面测试用例 : #{{ item.id }}
               </strong>
             </div>
-            <div v-if="!item.isPass" class="code-section">
+            <div v-if="!item.pass" class="code-section">
               {{ item.message }} <br />
               <br />
               {{ item.trace }}

+ 2 - 2
src/views/student/Code/ProjectDetail/Test/UnitTestDetail.vue

@@ -35,12 +35,12 @@
         >
           <div class="page-section">
             <div>
-              <pass-tag :pass="item.isPass" />
+              <pass-tag :pass="item.pass" />
               <strong style="padding-left: 10px">
                 页面测试用例 : #{{ item.id }}
               </strong>
             </div>
-            <div v-if="!item.isPass" class="code-section">
+            <div v-if="!item.pass" class="code-section">
               {{ item.message }} <br />
               <br />
               {{ item.trace }}

+ 7 - 1
src/views/student/Code/ProjectDetail/TestDetail.vue

@@ -4,6 +4,9 @@
       <div v-if="detailLoading"><page-section-loading show /></div>
       <div v-else class="page-section">
         <h5 class="title is-5">单元测试:</h5>
+        <div v-if="!(unitTestList && unitTestList.length > 0)">
+          <strong>当前暂无单元测试数据</strong>
+        </div>
         <router-link
           class="test-item"
           :key="item.id"
@@ -25,14 +28,17 @@
         <h5 class="test-title title is-5">
           页面测试:
           <div
-            v-if="functionTestList && functionTestList.length > 0"
             :class="{ 'is-loading': testing }"
             @click="makeTest"
+            :disabled="!(functionTestList && functionTestList.length > 0)"
             class="button is-primary test-title__action"
           >
             触发测试
           </div>
         </h5>
+        <div v-if="!(functionTestList && functionTestList.length > 0)">
+          <strong>当前暂无页面测试数据</strong>
+        </div>
         <router-link
           class="test-item"
           :key="item.id"

+ 11 - 1
src/views/student/Code/index.vue

@@ -26,6 +26,14 @@
             <card hoverable>{{ item.name }}</card>
           </router-link>
         </div>
+        <!--当没有代码作业时的处理-->
+        <no-data-svg
+          style="margin-top: 20px;"
+          v-if="
+            !codeHomeworkListLoading &&
+              !(codeHomeworkList && codeHomeworkList.length > 0)
+          "
+        ></no-data-svg>
       </div>
     </page-body>
   </div>
@@ -37,11 +45,13 @@ import Card from "@/components/Card";
 import PageHeader from "@/components/PageHeader";
 import PageBody from "@/components/PageBody/index";
 import { getCodeAssignmentListByStu } from "@/api/assignment";
+import noDataSvg from "@/components/NoDataSvg";
 export default {
   components: {
     PageBody,
     PageHeader,
-    Card
+    Card,
+    noDataSvg
   },
   computed: {
     ...mapState({

+ 7 - 1
src/views/student/Document/index.vue

@@ -31,6 +31,10 @@
             </card>
           </router-link>
         </div>
+        <no-data-svg
+          style="margin-top: 20px;"
+          v-if="!loadingDocList && !(docList && docList.length > 0)"
+        ></no-data-svg>
       </div>
     </page-body>
   </div>
@@ -43,12 +47,14 @@ import { getDocAssignmentListByCrs } from "@/api/assignment";
 import timeMixins from "@/mixins/time";
 import Card from "@/components/Card";
 import DocumentStateTag from "@/components/DocumentStateTag";
+import NoDataSvg from "@/components/NoDataSvg";
 export default {
   components: {
     PageBody,
     PageHeader,
     Card,
-    DocumentStateTag
+    DocumentStateTag,
+    NoDataSvg
   },
   mixins: [timeMixins],
   mounted() {

+ 7 - 1
src/views/student/Review/index.vue

@@ -29,6 +29,10 @@
             </card>
           </router-link>
         </div>
+        <no-data-svg
+          style="margin-top: 20px;"
+          v-if="!loadingReviewList && !(review && review.length > 0)"
+        ></no-data-svg>
       </div>
     </page-body>
   </div>
@@ -40,12 +44,14 @@ import Card from "@/components/Card";
 import PageHeader from "@/components/PageHeader";
 import PageBody from "@/components/PageBody/index";
 import ReviewStateTag from "@/components/ReviewStateTag/index";
+import NoDataSvg from "@/components/NoDataSvg";
 export default {
   components: {
     ReviewStateTag,
     PageBody,
     PageHeader,
-    Card
+    Card,
+    NoDataSvg
   },
   data() {
     return {

+ 5 - 256
src/views/teacher/Question/index.vue

@@ -173,261 +173,8 @@
               </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 v-if="data.length <= 0"><no-data-svg></no-data-svg></div>
         </div>
       </div>
     </page-body>
@@ -444,6 +191,7 @@ import {
 import PageHeader from "@/components/PageHeader";
 import PageBody from "@/components/PageBody/index";
 import PageSectionLoading from "@/components/PageBody/PageSectionLoading/index";
+import NoDataSvg from "@/components/NoDataSvg";
 
 const pageLimit = 10;
 
@@ -451,7 +199,8 @@ export default {
   components: {
     PageHeader,
     PageBody,
-    PageSectionLoading
+    PageSectionLoading,
+    NoDataSvg
   },
   computed: {
     ...mapState({

+ 32 - 29
src/views/teacher/Result/index.vue

@@ -15,19 +15,23 @@
         <!--下拉框&搜索框-->
         <div class="form-group">
           <!--下拉框-->
-          <b-field> <a class="button is-link">导出作业成绩</a> </b-field>
           <b-field>
-            <a class="button is-link" @click="isCardModalActive = true"
-              >成绩比例调控</a
-            >
+            <a class="button is-link" :disabled="isNoResult">导出作业成绩</a>
+          </b-field>
+          <b-field>
+            <a
+              class="button is-link"
+              @click="isCardModalActive = true"
+              :disabled="isNoResult"
+              >成绩比例调控
+            </a>
           </b-field>
         </div>
         <!--成绩图表-->
         <div class="chart">
           <canvas id="result-chart" style="width: 100% !important;"></canvas>
         </div>
-        <!--题目table-->
-        <div class="question-list">
+        <div class="result-list">
           <b-table
             :data="studentFinalResultList"
             paginated
@@ -198,20 +202,12 @@ export default {
   },
   data() {
     return {
-      name: "",
-      courses: [],
-      review: [],
+      isNoResult: true,
       data: [],
       isCardModalActive: false,
       myChart2: {},
-      percent: [],
-      finalResultPercentage: [20, 20, 20, 10, 10, 10, 10],
       submitting: false,
-      isServerError: false,
-      errorMessage: "服务器错误,请稍后重试",
       isResultLoading: true,
-      finalResult: [],
-      homeworkNum: 0,
       resultPercentList: [],
       studentFinalResultList: [],
       studentResultChartData: [],
@@ -420,19 +416,26 @@ export default {
     );
     this.isResultLoading = false;
     this.data = resultData.data;
-    console.log(this.data);
-    //初始化默认成绩比例
-    // this.initialResultPercent(this.data);
-    //初始化各作业比例
-    this.createResultPercentList();
-    //统计学生总评
-    this.getFinalResult(resultData.data);
-    //统计学生分数
-    this.studenResultStatistics(this.data);
-    //绘制图表
-    let resultChart = document.getElementById("result-chart");
-    this.resultChart = resultChart;
-    this.drawResultChart();
+    if (resultData.data && resultData.data.length > 0) {
+      this.isNoResult = false;
+      // console.log(this.data);
+      //初始化默认成绩比例
+      // this.initialResultPercent(this.data);
+      //初始化各作业比例
+      this.createResultPercentList();
+      //统计学生总评
+      this.getFinalResult(resultData.data);
+      //统计学生分数
+      this.studenResultStatistics(this.data);
+      //绘制图表
+      let resultChart = document.getElementById("result-chart");
+      this.resultChart = resultChart;
+      this.drawResultChart();
+    } else {
+      let resultChart = document.getElementById("result-chart");
+      this.resultChart = resultChart;
+      this.drawResultChart();
+    }
   }
 };
 </script>
@@ -444,7 +447,7 @@ export default {
 .chart {
   margin-top: 1.5rem;
 }
-.question-list {
+.result-list {
   margin-top: 3rem;
 }
 .form-group {