|
@@ -130,6 +130,7 @@
|
|
|
import { mapState as globalMapState, mapGetters } from "vuex";
|
|
|
import { TK_SERVER_HTML_URL } from "@/constants/constants.js";
|
|
|
import OfflineExamModal from "./OfflineExamModal.vue";
|
|
|
+import { downloadFileURL } from "@/utils/util";
|
|
|
|
|
|
export default {
|
|
|
name: "EcsOfflineList",
|
|
@@ -218,7 +219,7 @@ export default {
|
|
|
window.location.href = url;
|
|
|
}
|
|
|
},
|
|
|
- tempDisableBtnAndDownloadPaper(course) {
|
|
|
+ async tempDisableBtnAndDownloadPaper(course) {
|
|
|
window._hmt.push(["_trackEvent", "离线考试页面", "下载试卷"]);
|
|
|
this.downloadIds.add(course.examStudentId);
|
|
|
this.downloadIds = new Set(this.downloadIds);
|
|
@@ -232,13 +233,29 @@ export default {
|
|
|
// this.$forceUpdate();
|
|
|
}, 10 * 1000);
|
|
|
|
|
|
- window.location.href =
|
|
|
+ // window.location.href =
|
|
|
+ // "/api/branch_ecs_ques/paper/export/" +
|
|
|
+ // course.paperId +
|
|
|
+ // "/PAPER/offLine?$key=" +
|
|
|
+ // this.user.key +
|
|
|
+ // "&$token=" +
|
|
|
+ // this.user.token;
|
|
|
+ const res = await this.$http.get(
|
|
|
"/api/branch_ecs_ques/paper/export/" +
|
|
|
- course.paperId +
|
|
|
- "/PAPER/offLine?$key=" +
|
|
|
- this.user.key +
|
|
|
- "&$token=" +
|
|
|
- this.user.token;
|
|
|
+ course.paperId +
|
|
|
+ "/PAPER/offLine",
|
|
|
+ { responseType: "blob" }
|
|
|
+ );
|
|
|
+ console.log(res);
|
|
|
+ console.log(
|
|
|
+ "离线考试,下载试卷:名称:",
|
|
|
+ res.headers["content-disposition"]
|
|
|
+ );
|
|
|
+ const fileName = decodeURI(
|
|
|
+ res.headers["content-disposition"].match(/attachment;filename=(.*)/)[1]
|
|
|
+ );
|
|
|
+ const fileUrl = URL.createObjectURL(new Blob([res.data]));
|
|
|
+ downloadFileURL(fileUrl, fileName);
|
|
|
},
|
|
|
downloadingCourse(course) {
|
|
|
return this.downloadIds.has(course.examStudentId);
|