Преглед на файлове

离线考试:下载答题纸

Michael Wang преди 4 години
родител
ревизия
329cf1eeb0
променени са 1 файла, в които са добавени 55 реда и са изтрити 0 реда
  1. 55 0
      src/features/OfflineExam/OfflineExamHome.vue

+ 55 - 0
src/features/OfflineExam/OfflineExamHome.vue

@@ -12,6 +12,44 @@
       当前所在位置:
       <BreadcrumbItem>{{ locationTitle }}</BreadcrumbItem>
     </Breadcrumb>
+    <div
+      v-if="answerCardUrl"
+      style="height: 60px; display: flex; justify-content: flex-end"
+    >
+      <div style="display: flex; align-items: center; margin-right: 20px">
+        <span style="font-size: 20px">答题纸模板:</span
+        ><a
+          href="#"
+          download
+          :disabled="downloadUrlDisabled"
+          ondragstart="return false;"
+          style="
+            height: 30px;
+            width: 50px;
+            display: inline-block;
+            height: 30px;
+            font-size: 14px;
+            color: #ffffff;
+            background-color: #13bb8a;
+            border-radius: 6px;
+            padding: 0 5px;
+            line-height: 30px;
+          "
+          @click="
+            () => {
+              logger({
+                page: '离线考试页面',
+                button: '下载答题卡按钮',
+                action: '点击',
+              });
+              tempDisableBtnAndDownloadPaper();
+            }
+          "
+        >
+          下载
+        </a>
+      </div>
+    </div>
 
     <div class="home">
       <ecs-offline-list
@@ -34,6 +72,8 @@ export default {
   data() {
     return {
       courses: [],
+      answerCardUrl: null,
+      downloadUrlDisabled: false,
     };
   },
   computed: {
@@ -61,6 +101,12 @@ export default {
   },
   methods: {
     async fetchData() {
+      const answerCardRes = await this.$http.get(
+        "/api/ecs_core/org/getAnswersUrl/" + this.$store.state.user.rootOrgId
+      );
+
+      this.answerCardUrl = answerCardRes.data;
+
       const res = await this.$http.get(
         "/api/branch_ecs_oe_admin/offlineExam/getOfflineCourse"
       );
@@ -78,6 +124,15 @@ export default {
         paperId: c.paperId,
       }));
     },
+    tempDisableBtnAndDownloadPaper() {
+      window._hmt.push(["_trackEvent", "离线考试页面", "下载答题纸"]);
+      this.downloadUrlDisabled = true;
+      setTimeout(() => {
+        this.downloadUrlDisabled = false;
+      }, 10 * 1000);
+
+      window.location.href = this.answerCardUrl;
+    },
   },
 };
 </script>