diff --git a/src/api/modules/courseStudy.js b/src/api/modules/courseStudy.js
index 193420ab..e13a72c4 100644
--- a/src/api/modules/courseStudy.js
+++ b/src/api/modules/courseStudy.js
@@ -389,7 +389,10 @@ const followIds=function (data){
const myStudysFromES=function (data){
return ajax.post('/xboe/school/study/es/search',data);
}
-
+//导出作业
+const homeworkExport=function (data){
+ return ajax.get(`/xboe/m/course/portal/export?contentId=${data.contentId}&courseName=${data.courseName}`);
+}
/**根据id集合查询,传入的是id数组*/
const findByIds=function (ids){
return ajax.postJson('/xboe/school/study/es/list-by-ids',ids);
@@ -425,6 +428,7 @@ export default {
myExamList2,
myCourseStudy,
myStudysFromES,
+ homeworkExport,
findByIds,
deleteSignUp,
ids,
diff --git a/src/components/Study/manager.vue b/src/components/Study/manager.vue
index e68859b9..a9222092 100644
--- a/src/components/Study/manager.vue
+++ b/src/components/Study/manager.vue
@@ -192,7 +192,7 @@
-->
- 学习人员
+ 学习人员
@@ -292,6 +292,7 @@
搜索
+ 导出全部作业
@@ -335,6 +336,8 @@ import apiCoursePortal from "@/api/modules/coursePortal.js";
import { mapGetters,mapActions } from 'vuex';
import apiUser from '@/api/system/user.js';
import apiStudy from '@/api/modules/courseStudy.js';
+import { getToken } from '@/utils/token'
+import axios from 'axios'
export default {
components: {auditCourse1,auditCourse2},
computed: {
@@ -352,7 +355,10 @@ export default {
},
data() {
return {
+ downParams: {},
typePress: false,
+ isHomeWork: false,
+ isTrue: false,
catalogRecordTree:[],
catalogRecordList:[],
resOwnerListMap:[],
@@ -515,6 +521,7 @@ export default {
pageIndex: this.learningSituation.pageIndex,
pageSize: this.learningSituation.pageSize
};
+ this.downParams = params;
apicourseStudy.studyContentRecords(params).then(res => {
if (res.status === 200) {
this.learningSituation.list = res.result.list;
@@ -524,6 +531,77 @@ export default {
}
});
},
+ downLoad(){
+ if(this.learningSituation.list.length == 0){
+ this.$message.warning('暂无数据');
+ return
+ }
+ this.isTrue = true;
+ let params = {
+ courseName:this.manageStudyData.name,
+ courseId: this.manageStudyData.id,
+ status: this.downParams.status || '',
+ name: this.downParams.name || '',
+ contentId: this.contentId,
+ }
+ // window.open(`/systemapi/xboe/m/course/portal/export?contentId=${params.contentId}&courseName=${params.courseName}&courseId=${params.courseId}&status=${params.status}&name=${params.name}`)
+ const url = `/systemapi/xboe/m/course/portal/export?contentId=${params.contentId}&courseName=${params.courseName}&courseId=${params.courseId}&status=${params.status}&name=${params.name}`
+ axios({
+ method: 'get',
+ url: url,
+ // responseType: 'blob',
+ headers: { 'X-Access-Token': getToken() }
+ }).then((res) => {
+ this.isTrue = false;
+ if(res.data.status == 200){
+ if(res.data.result.includes('upload')){
+ window.open('/upload'+res.data.result.split('upload')[1])
+ }else{
+ this.$message.warning(res.data.result)
+ }
+ }
+ }).catch(err=>{
+ this.isTrue = false;
+ this.$message.error(err.data.message)
+ })
+ // axios({
+ // method: 'get',
+ // url: url,
+ // responseType: 'blob',
+ // headers: { 'X-Access-Token': getToken() }
+ // }).then((response) => {
+ // if (response.status === 200) {
+ // this.isTrue = false;
+ // if (!(response.headers['content-type']).startsWith('application/json')) {
+ // this.resolveBlob(response, 'application/zip', `${params.courseName}【作业】`);
+ // } else {
+ // console.log(response,'response')
+ // const reader = new FileReader();
+ // reader.onload = (e) => {
+ // const errorData = JSON.parse(e.target.result)
+ // this.$message.error(errorData.result)
+ // };
+ // reader.readAsText(response.data);
+ // }
+ // }
+ // }).catch((error) => {
+ // this.isTrue = false;
+ // // 错误处理
+ // console.log(error);
+ // this.$message.error(error.data ? error.data.message : error.toString());
+ // });
+ },
+ resolveBlob(res, mimeType,filename) {
+ const link = document.createElement('a');// 创建a标签
+ let blob = new Blob([res.data], { type: mimeType }); // 设置文件类型
+ 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) {
this.learningSituation.pageSize = val;
this.learningSituation.pageIndex = 1;
@@ -722,11 +800,16 @@ export default {
this.getSignupList();
},
getCatalogue(row,type) {
- if(type=='考试'){
+ if(type==61){
this.typePress = true
}else{
this.typePress = true
}
+ if(type == 60){
+ this.isHomeWork = true
+ }else{
+ this.isHomeWork = false
+ }
this.contentId = row.id;
this.study.catalogueShow = true;
this.learningSituation.pageIndex = 1;//重置为第一页