补交回退导致丢失的文件

This commit is contained in:
nisen
2024-09-27 17:39:51 +08:00
parent 336d692ea9
commit 7d98bb4ddf
3 changed files with 284 additions and 222 deletions

View File

@@ -338,7 +338,7 @@ const myExamList = function(itemId) {
contentId:'' contentId:''
} }
*/ */
const myExamList2 = function(data) { const myExamList2 = function(data) {
return ajax.post('/xboe/school/study/exam/list-study',data); return ajax.post('/xboe/school/study/exam/list-study',data);
} }
@@ -389,7 +389,10 @@ const followIds=function (data){
const myStudysFromES=function (data){ const myStudysFromES=function (data){
return ajax.post('/xboe/school/study/es/search',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数组*/ /**根据id集合查询传入的是id数组*/
const findByIds=function (ids){ const findByIds=function (ids){
return ajax.postJson('/xboe/school/study/es/list-by-ids',ids); return ajax.postJson('/xboe/school/study/es/list-by-ids',ids);
@@ -425,6 +428,7 @@ export default {
myExamList2, myExamList2,
myCourseStudy, myCourseStudy,
myStudysFromES, myStudysFromES,
homeworkExport,
findByIds, findByIds,
deleteSignUp, deleteSignUp,
ids, ids,

View File

@@ -210,7 +210,7 @@ export default {
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.homework-div { .homework-div {
border: 1px solid #dadada; border: 1px solid #dadada;
min-height: 500px; min-height: 500px;
padding: 20px; padding: 20px;
@@ -232,5 +232,5 @@ export default {
} }
} }
} }
</style> </style>

View File

@@ -95,9 +95,9 @@
<el-col :offset="12" :span="4"> <el-col :offset="12" :span="4">
<div class="grid-content bg-purple"> <div class="grid-content bg-purple">
<el-select v-model="learningRecords.status" clearable placeholder="状态"> <el-select v-model="learningRecords.status" clearable placeholder="状态">
<el-option label="未开始" :value="1"></el-option>
<el-option label="进行中" :value="2"></el-option>
<el-option label="已完成" :value="9"></el-option> <el-option label="已完成" :value="9"></el-option>
<el-option label="未开始" :value="1"></el-option>
<el-option label="进行中" :value="8"></el-option>
</el-select> </el-select>
</div> </div>
</el-col> </el-col>
@@ -192,7 +192,7 @@
</el-table-column>--> </el-table-column>-->
<el-table-column label="学习人员" width="110"> <el-table-column label="学习人员" width="110">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button size="mini" type="info" @click="getCatalogue(scope.row,scope.row.contentName)" >学习人员</el-button> <el-button size="mini" type="info" @click="getCatalogue(scope.row,scope.row.contentType)" >学习人员</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@@ -290,8 +290,9 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" @click="studyContentRecordsSearch">搜索</el-button> <el-button type="primary" @click="studyContentRecords">搜索</el-button>
</el-form-item> </el-form-item>
<el-button v-if="isHomeWork" :disabled="isTrue" style="padding:10px 15px;margin-bottom: 10px;" type="primary" @click="downLoad">导出全部作业</el-button>
</el-form> </el-form>
<el-table max-height="500" border :data="learningSituation.list" style="width: 100%"> <el-table max-height="500" border :data="learningSituation.list" style="width: 100%">
<el-table-column prop="aname" label="姓名" width="180"></el-table-column> <el-table-column prop="aname" label="姓名" width="180"></el-table-column>
@@ -335,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: {
@@ -344,15 +347,14 @@ export default {
manageStudyData: { manageStudyData: {
type: Object, type: Object,
default: () => ({}) default: () => ({})
},
isShowDialog:{
type: Boolean,
default: false
} }
}, },
data() { data() {
return { return {
downParams: {},
typePress: false, typePress: false,
isHomeWork: false,
isTrue: false,
catalogRecordTree:[], catalogRecordTree:[],
catalogRecordList:[], catalogRecordList:[],
resOwnerListMap:[], resOwnerListMap:[],
@@ -376,9 +378,7 @@ export default {
pageSize: 10, // 每页多少条 pageSize: 10, // 每页多少条
count: 0, count: 0,
type: "", type: "",
list: [], list: []
name: '',
status: '',
}, },
learningRecords: { learningRecords: {
pageIndex: 1, //第几页 pageIndex: 1, //第几页
@@ -415,21 +415,6 @@ export default {
this.getDetail(); this.getDetail();
} }
} }
},
'study.catalogueShow'(val){
if(!val){
this.learningSituation.status = null
this.learningSituation.name = ''
}
},
isShowDialog(val){
if(!val){
this.signup.status = null
this.signup.name = ''
this.learningRecords.status = null
this.learningRecords.name = ''
this.value = ''
}
} }
}, },
mounted() { mounted() {
@@ -501,10 +486,6 @@ export default {
} }
}); });
}, },
studyContentRecordsSearch(){
this.learningSituation.pageIndex = 1;
this.studyContentRecords()
},
// 资源里的学习详情 // 资源里的学习详情
studyContentRecords() { studyContentRecords() {
let params = { let params = {
@@ -515,6 +496,7 @@ export default {
pageIndex: this.learningSituation.pageIndex, pageIndex: this.learningSituation.pageIndex,
pageSize: this.learningSituation.pageSize pageSize: this.learningSituation.pageSize
}; };
this.downParams = params;
apicourseStudy.studyContentRecords(params).then(res => { apicourseStudy.studyContentRecords(params).then(res => {
if (res.status === 200) { if (res.status === 200) {
this.learningSituation.list = res.result.list; this.learningSituation.list = res.result.list;
@@ -524,6 +506,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) { handleSizeChangeSituation(val) {
this.learningSituation.pageSize = val; this.learningSituation.pageSize = val;
this.learningSituation.pageIndex = 1; this.learningSituation.pageIndex = 1;
@@ -722,10 +775,15 @@ export default {
this.getSignupList(); this.getSignupList();
}, },
getCatalogue(row,type) { getCatalogue(row,type) {
if(type=='考试'){ if(type==61){
this.typePress = true this.typePress = true
}else{ }else{
this.typePress = true this.typePress = false
}
if(type == 60){
this.isHomeWork = true
}else{
this.isHomeWork = false
} }
this.contentId = row.id; this.contentId = row.id;
this.study.catalogueShow = true; this.study.catalogueShow = true;