mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/learning-system-portal.git
synced 2025-12-16 22:36:43 +08:00
Merge branch 'zcwy_0726_download' into dev0515
This commit is contained in:
@@ -336,6 +336,8 @@ import apiCoursePortal from "@/api/modules/coursePortal.js";
|
|||||||
import { mapGetters,mapActions } from 'vuex';
|
import { mapGetters,mapActions } from 'vuex';
|
||||||
import apiUser from '@/api/system/user.js';
|
import apiUser from '@/api/system/user.js';
|
||||||
import apiStudy from '@/api/modules/courseStudy.js';
|
import apiStudy from '@/api/modules/courseStudy.js';
|
||||||
|
import { getToken } from '@/utils/token'
|
||||||
|
import axios from 'axios'
|
||||||
export default {
|
export default {
|
||||||
components: {auditCourse1,auditCourse2},
|
components: {auditCourse1,auditCourse2},
|
||||||
computed: {
|
computed: {
|
||||||
@@ -510,23 +512,28 @@ export default {
|
|||||||
courseName:this.manageStudyData.name,
|
courseName:this.manageStudyData.name,
|
||||||
contentId:this.contentId
|
contentId:this.contentId
|
||||||
}
|
}
|
||||||
window.open(`/systemapi/xboe/m/course/portal/export?contentId=${params.contentId}&courseName=${params.courseName}`)
|
// window.open(`/systemapi/xboe/m/course/portal/export?contentId=${params.contentId}&courseName=${params.courseName}`)
|
||||||
apicourseStudy.homeworkExport(params).then(res=>{
|
const url = `/systemapi/xboe/m/course/portal/export?contentId=${params.contentId}&courseName=${params.courseName}`
|
||||||
console.log(res,'res')
|
axios({
|
||||||
const link = document.createElement('a');// 创建a标签
|
method: 'get',
|
||||||
let blob = new Blob([res], { type: 'application/zip' }); // 设置文件类型
|
url: url,
|
||||||
link.style.display = "none";
|
responseType: 'blob',
|
||||||
link.href = URL.createObjectURL(blob); // 创建URL
|
headers: { 'X-Access-Token': getToken() }
|
||||||
console.log(link.href);
|
}).then(res => {
|
||||||
link.setAttribute("download", "作业.zip");
|
console.log(res,'res')
|
||||||
document.body.appendChild(link);
|
this.resolveBlob(res, 'application/zip',`${params.courseName}【作业】`)
|
||||||
link.click();
|
})
|
||||||
URL.revokeObjectURL(link.href)
|
},
|
||||||
document.body.removeChild(link);
|
resolveBlob(res, mimeType,filename) {
|
||||||
}).catch(err=>{
|
const link = document.createElement('a');// 创建a标签
|
||||||
console.log(err,'err')
|
let blob = new Blob([res.data], { type: mimeType }); // 设置文件类型
|
||||||
this.$message.warning(err.data.msg);
|
link.style.display = "none";
|
||||||
})
|
link.href = URL.createObjectURL(blob); // 创建URL
|
||||||
|
link.setAttribute("download", `${filename}`);
|
||||||
|
document.body.appendChild(link);
|
||||||
|
link.click();
|
||||||
|
URL.revokeObjectURL(link.href);
|
||||||
|
document.body.removeChild(link);
|
||||||
},
|
},
|
||||||
handleSizeChangeSituation(val) {
|
handleSizeChangeSituation(val) {
|
||||||
this.learningSituation.pageSize = val;
|
this.learningSituation.pageSize = val;
|
||||||
|
|||||||
Reference in New Issue
Block a user