chenken 6 yıl önce
ebeveyn
işleme
2c4bf3b711
1 değiştirilmiş dosya ile 31 ekleme ve 14 silme
  1. 31 14
      src/modules/oe/views/examScheduling.vue

+ 31 - 14
src/modules/oe/views/examScheduling.vue

@@ -366,20 +366,37 @@ export default {
             if (examRecordList && examRecordList.length > 0) {
               var basePaperId = examRecordList[0].basePaperId;
               var rootOrgName = currentUser.rootOrgName;
-              var token = currentUser.token;
-              var key = currentUser.key;
-              window.location.href =
-                "http://192.168.10.39:8868" +
-                "/api/ecs_ques/paper/export/" +
-                basePaperId +
-                "/PAPER/" +
-                rootOrgName +
-                "/" +
-                basePaperId +
-                "/offLine?$key=" +
-                key +
-                "&$token=" +
-                token;
+              this.$http
+                .get(
+                  "/api/ecs_ques/paper/export/" +
+                    basePaperId +
+                    "/PAPER/" +
+                    rootOrgName +
+                    "/" +
+                    basePaperId +
+                    "/offLine",
+                  {
+                    responseType: "arraybuffer",
+                    filename: "utf-8"
+                  }
+                )
+                .then(response => {
+                  if (response.data) {
+                    var blob = new Blob([response.data], {
+                      type: "application/zip"
+                    });
+                    var url = URL.createObjectURL(blob);
+                    var fileName = response.headers["content-disposition"]
+                      .split(";")[1]
+                      .replace("filename=", "");
+                    var a = document.createElement("a");
+                    a.href = url;
+                    a.download = decodeURI(fileName);
+                    a.target = "_blank";
+                    a.click();
+                    URL.revokeObjectURL(url);
+                  }
+                });
             } else {
               this.$message({
                 message: "该考生未参加考试",