mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/learning-system-portal.git
synced 2025-12-11 20:06:44 +08:00
Merge branch 'zcwy_0726_download' into dev_master
# Conflicts: # src/components/Course/homework.vue
This commit is contained in:
@@ -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,
|
||||||
|
|||||||
@@ -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>
|
||||||
@@ -292,6 +292,7 @@
|
|||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button type="primary" @click="studyContentRecordsSearch">搜索</el-button>
|
<el-button type="primary" @click="studyContentRecordsSearch">搜索</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: {
|
||||||
@@ -352,7 +355,10 @@ export default {
|
|||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
downParams: {},
|
||||||
typePress: false,
|
typePress: false,
|
||||||
|
isHomeWork: false,
|
||||||
|
isTrue: false,
|
||||||
catalogRecordTree:[],
|
catalogRecordTree:[],
|
||||||
catalogRecordList:[],
|
catalogRecordList:[],
|
||||||
resOwnerListMap:[],
|
resOwnerListMap:[],
|
||||||
@@ -515,6 +521,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 +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) {
|
handleSizeChangeSituation(val) {
|
||||||
this.learningSituation.pageSize = val;
|
this.learningSituation.pageSize = val;
|
||||||
this.learningSituation.pageIndex = 1;
|
this.learningSituation.pageIndex = 1;
|
||||||
@@ -722,11 +800,16 @@ 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 = true
|
||||||
}
|
}
|
||||||
|
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;
|
||||||
this.learningSituation.pageIndex = 1;//重置为第一页
|
this.learningSituation.pageIndex = 1;//重置为第一页
|
||||||
|
|||||||
Reference in New Issue
Block a user