补交回退导致丢失的文件

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

@@ -10,7 +10,7 @@ import ajax from '@/utils/xajax.js'
* 返回 检查报名状态
*/
const hasSignup = function(courseId) {
return ajax.get('/xboe/school/study/signup/has?cid='+courseId);
return ajax.get('/xboe/school/study/signup/has?cid='+courseId);
}
/**
@@ -25,7 +25,7 @@ const hasSignup = function(courseId) {
}
*/
const signup = function(data) {
return ajax.post('/xboe/school/study/signup/self', data);
return ajax.post('/xboe/school/study/signup/self', data);
}
/**
@@ -38,7 +38,7 @@ const signup = function(data) {
}
*/
const findSignup = function(data) {
return ajax.post('/xboe/school/study/signup/pagelist', data);
return ajax.post('/xboe/school/study/signup/pagelist', data);
}
/**
@@ -46,7 +46,7 @@ const findSignup = function(data) {
* @param {Object} id 报名的id
*/
const deleteSignup = function(id) {
return ajax.post('/xboe/school/study/signup/delete?id='+id);
return ajax.post('/xboe/school/study/signup/delete?id='+id);
}
/**
@@ -55,7 +55,7 @@ const deleteSignup = function(id) {
* Signup 对象集合, list
*/
const importSignup = function(data) {
return ajax.post('/xboe/school/study/signup/import',data);
return ajax.post('/xboe/school/study/signup/import',data);
}
/**
@@ -63,11 +63,11 @@ const importSignup = function(data) {
* @param {Object} courseId 课程 的id
*/
const countSignup = function(courseId) {
return ajax.post('/xboe/school/study/signup/count-by-course',{courseId});
return ajax.post('/xboe/school/study/signup/count-by-course',{courseId});
}
const studyIndex = function(courseId) {
return ajax.get('/xboe/school/study/course/studyIndex?cid='+courseId+'&addView=true');
return ajax.get('/xboe/school/study/course/studyIndex?cid='+courseId+'&addView=true');
}
/**
*
@@ -80,7 +80,7 @@ const studyIndex = function(courseId) {
* @returns
*/
const studyIndexPost = function(data) {
return ajax.post('/xboe/school/study/course/studyIndex',data);
return ajax.post('/xboe/school/study/course/studyIndex',data);
}
/**
@@ -88,7 +88,7 @@ const studyIndexPost = function(data) {
* @param {Object} courseId
*/
const studyInfo = function(courseId) {
return ajax.get('/xboe/school/study/course/info?cid='+courseId);
return ajax.get('/xboe/school/study/course/info?cid='+courseId);
}
@@ -98,7 +98,7 @@ const studyInfo = function(courseId) {
* @param {Object} contentId
*/
const getStudyContentItem = function(studyId,contentId) {
return ajax.post('/xboe/school/study/course/study-course-content',{studyId,contentId});
return ajax.post('/xboe/school/study/course/study-course-content',{studyId,contentId});
}
/**
@@ -111,7 +111,7 @@ const getStudyContentItem = function(studyId,contentId) {
* @returns
*/
const studyVideoTime = function(data) {
return ajax.post('/xboe/school/study/course/study-video-time',data);
return ajax.post('/xboe/school/study/course/study-video-time',data);
}
/**
@@ -119,7 +119,7 @@ const studyVideoTime = function(data) {
* @returns
*/
const lastStudy = function() {
return ajax.get('/xboe/school/study/course/last-study');
return ajax.get('/xboe/school/study/course/last-study');
}
/**
@@ -136,7 +136,7 @@ const lastStudy = function() {
*
*/
const studyContent = function(data) {
return ajax.postJson('/xboe/school/study/course/study',data);
return ajax.postJson('/xboe/school/study/course/study',data);
}
/**
@@ -150,7 +150,7 @@ const studyContent = function(data) {
*
*/
const appendStudyTime = function(data) {
return ajax.post('/xboe/school/study/course/appendtime',data);
return ajax.post('/xboe/school/study/course/appendtime',data);
}
/**
@@ -161,7 +161,7 @@ const appendStudyTime = function(data) {
* name: 学习人的姓名
*/
const studyRecords = function(data) {
return ajax.post('/xboe/school/study/course/pagelist',data);
return ajax.post('/xboe/school/study/course/pagelist',data);
}
/**
@@ -173,7 +173,7 @@ const studyRecords = function(data) {
* name: 学习人的姓名
*/
const studyContentRecords = function(data) {
return ajax.post('/xboe/school/study/course/contents',data);
return ajax.post('/xboe/school/study/course/contents',data);
}
/**
@@ -185,7 +185,7 @@ const studyContentRecords = function(data) {
}
*/
const studyExport = function(data) {
return ajax.post('/xboe/school/study/course/export',data);
return ajax.post('/xboe/school/study/course/export',data);
}
/**
@@ -200,7 +200,7 @@ const studyExport = function(data) {
}
*/
const myStudyList = function(query) {
return ajax.post('/xboe/school/study/course/mylist',query);
return ajax.post('/xboe/school/study/course/mylist',query);
}
/**
* 当前课程学习记录
@@ -216,7 +216,7 @@ const myStudyList = function(query) {
}
*/
const myCourseStudy = function(query) {
return ajax.post('/xboe/school/study/course/course-users',query);
return ajax.post('/xboe/school/study/course/course-users',query);
}
@@ -241,7 +241,7 @@ const myCourseStudy = function(query) {
* answerJson
*/
const saveExam = function(data) {
return ajax.postJson('/xboe/school/study/exam/save',data);
return ajax.postJson('/xboe/school/study/exam/save',data);
}
/**
@@ -261,7 +261,7 @@ const saveExam = function(data) {
* hwAnswer 文本提交的信息
*/
const saveHomework = function(data) {
return ajax.postJson('/xboe/school/study/homework/save',data);
return ajax.postJson('/xboe/school/study/homework/save',data);
}
/**
@@ -279,7 +279,7 @@ const saveHomework = function(data) {
* asScore评估得分
*/
const saveAssess = function(data) {
return ajax.postJson('/xboe/school/study/assess/save',data);
return ajax.postJson('/xboe/school/study/assess/save',data);
}
/**
@@ -288,7 +288,7 @@ const saveAssess = function(data) {
* id:记录的id
*/
const myHomework = function(id) {
return ajax.post('/xboe/school/study/homework/detail?id='+id);
return ajax.post('/xboe/school/study/homework/detail?id='+id);
}
/**
@@ -297,7 +297,7 @@ const myHomework = function(id) {
* id:记录的id
*/
const myExamPaper = function(id) {
return ajax.get('/xboe/school/study/exam/detail?id='+id);
return ajax.get('/xboe/school/study/exam/detail?id='+id);
}
/**
@@ -306,7 +306,7 @@ const myExamPaper = function(id) {
* id:记录的id
*/
const myAssess = function(id) {
return ajax.get('/xboe/school/study/assess/detail?id='+id);
return ajax.get('/xboe/school/study/assess/detail?id='+id);
}
/**
@@ -318,7 +318,7 @@ const myAssess = function(id) {
}
*/
const myHomeworkList = function(data) {
return ajax.post('/xboe/school/study/homework/list-study',data);
return ajax.post('/xboe/school/study/homework/list-study',data);
}
/**
@@ -327,7 +327,7 @@ const myHomeworkList = function(data) {
* 对应的提交记录的id
*/
const myExamList = function(itemId) {
return ajax.post('/xboe/school/study/exam/list',{itemId});
return ajax.post('/xboe/school/study/exam/list',{itemId});
}
/**
@@ -338,8 +338,8 @@ const myExamList = function(itemId) {
contentId:''
}
*/
const myExamList2 = function(data) {
return ajax.post('/xboe/school/study/exam/list-study',data);
const myExamList2 = function(data) {
return ajax.post('/xboe/school/study/exam/list-study',data);
}
/**
@@ -351,7 +351,7 @@ const myExamList = function(itemId) {
}
*/
const myAssessList = function(data) {
return ajax.post('/xboe/school/study/assess/list-study',data);
return ajax.post('/xboe/school/study/assess/list-study',data);
}
/*
@@ -360,7 +360,7 @@ const myAssessList = function(data) {
@param courseId 课程id 用于删除课程报名信息和修改课程学习人数
*/
const deleteSignUp=function(id,courseId){
return ajax.post(`/xboe/school/study/course/delete-signup?id=${id}&couserId=${courseId}`);
return ajax.post(`/xboe/school/study/course/delete-signup?id=${id}&couserId=${courseId}`);
}
/**
@@ -389,44 +389,48 @@ 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);
}
export default {
hasSignup,
signup,
findSignup,
deleteSignup,
importSignup,
countSignup,
studyIndex,
studyInfo,
studyVideoTime,
lastStudy,
studyContent,
appendStudyTime,
studyRecords,
studyContentRecords,
getStudyContentItem,
studyExport,
myStudyList,
saveHomework,
saveExam,
saveAssess,
myHomework,
myExamPaper,
myAssess,
myHomeworkList,
myExamList,
myAssessList,
myExamList2,
myCourseStudy,
hasSignup,
signup,
findSignup,
deleteSignup,
importSignup,
countSignup,
studyIndex,
studyInfo,
studyVideoTime,
lastStudy,
studyContent,
appendStudyTime,
studyRecords,
studyContentRecords,
getStudyContentItem,
studyExport,
myStudyList,
saveHomework,
saveExam,
saveAssess,
myHomework,
myExamPaper,
myAssess,
myHomeworkList,
myExamList,
myAssessList,
myExamList2,
myCourseStudy,
myStudysFromES,
homeworkExport,
findByIds,
deleteSignUp,
deleteSignUp,
ids,
followIds,
studyIndexPost

View File

@@ -1,61 +1,61 @@
<template>
<div>
<div v-if="has" class="homework-div">
<div>
<div class="homework-title">作业名称</div>
<div class="homework-content">{{info.name}}</div>
</div>
<div>
<div class="homework-title">内容</div>
<div class="homework-content">{{info.content}}</div>
</div>
<div v-if="info.file">
<div class="homework-title">附件</div>
<div class="homework-content" style="color: blue">
<a :href="fileBaseUrl+info.file" target="_blank">下载作业附件</a></div>
</div>
<div>
<div class="homework-title">截止时间</div>
<div class="homework-content" :style="{color:close? 'red':''}">{{info.deadTime}}</div>
</div>
<div v-show="!close && showSubmit">
<div v-if="info.submitMode>1">
<div class="homework-title">作业内容</div>
<div class="homework-content">
<el-input type="textarea" rows="5" show-word-limit maxlength="255" v-model="answer" placeholder="(限255个字)"></el-input>
<div>
<div v-if="has" class="homework-div">
<div>
<div class="homework-title">作业名称</div>
<div class="homework-content">{{info.name}}</div>
</div>
<div>
<div class="homework-title">内容</div>
<div class="homework-content">{{info.content}}</div>
</div>
<div v-if="info.file">
<div class="homework-title">附件</div>
<div class="homework-content" style="color: blue">
<a :href="fileBaseUrl+info.file" target="_blank">下载作业附件</a></div>
</div>
<div>
<div class="homework-title">截止时间</div>
<div class="homework-content" :style="{color:close? 'red':''}">{{info.deadTime}}</div>
</div>
<div v-show="!close && showSubmit">
<div v-if="info.submitMode>1">
<div class="homework-title">作业内容</div>
<div class="homework-content">
<el-input type="textarea" rows="5" show-word-limit maxlength="255" v-model="answer" placeholder="(限255个字)"></el-input>
</div>
</div>
<div v-if="info.submitMode==1 || info.submitMode==3">
<div class="homework-title">上传作业</div>
<div class="homework-content">
<div v-if="filePath!=''">
<el-tag closable type="success" @close="removeHomeworkFile">作业附件</el-tag><span style="margin-left: 10px;">请点击下面的提交</span>
</div>
<div v-else >
<file-upload dir="files" :isShowTip="false" @success="uploadHomeworkFile" @remove="removeHomeworkFile"></file-upload>
</div>
</div>
</div>
<div style="text-align: center;padding-bottom: 10px;">
<el-button type="primary" :disabled="isSubmit" @click="submitHomework()">{{records.length>0?'重新提交':'提交'}}</el-button>
</div>
</div>
<div v-show="showRecord"><!--作业提交记录-->
<el-table :data="records" style="width: 100%" border>
<el-table-column prop="endTime" label="提交时间" width="100" align="center"></el-table-column>
<el-table-column label="内容">
<template slot-scope="scope">
<div>{{scope.row.hwAnswer}}</div>
<div style="padding-top: 5px;" v-if="scope.row.filePath!=''">
<a :href="fileBaseUrl+scope.row.filePath" target="_blank">下载上传的作业文件</a>
</div>
</template>
</el-table-column>
</el-table>
</div>
</div>
<div v-else style="text-align: center;padding-top: 20px;color: red;">此课程无作业</div>
</div>
</div>
<div v-if="info.submitMode==1 || info.submitMode==3">
<div class="homework-title">上传作业</div>
<div class="homework-content">
<div v-if="filePath!=''">
<el-tag closable type="success" @close="removeHomeworkFile">作业附件</el-tag><span style="margin-left: 10px;">请点击下面的提交</span>
</div>
<div v-else >
<file-upload dir="files" :isShowTip="false" @success="uploadHomeworkFile" @remove="removeHomeworkFile"></file-upload>
</div>
</div>
</div>
<div style="text-align: center;padding-bottom: 10px;">
<el-button type="primary" :disabled="isSubmit" @click="submitHomework()">{{records.length>0?'重新提交':'提交'}}</el-button>
</div>
</div>
<div v-show="showRecord"><!--作业提交记录-->
<el-table :data="records" style="width: 100%" border>
<el-table-column prop="endTime" label="提交时间" width="100" align="center"></el-table-column>
<el-table-column label="内容">
<template slot-scope="scope">
<div>{{scope.row.hwAnswer}}</div>
<div style="padding-top: 5px;" v-if="scope.row.filePath!=''">
<a :href="fileBaseUrl+scope.row.filePath" target="_blank">下载上传的作业文件</a>
</div>
</template>
</el-table-column>
</el-table>
</div>
</div>
<div v-else style="text-align: center;padding-top: 20px;color: red;">此课程无作业</div>
</div>
</template>
<script>
@@ -65,21 +65,21 @@ import FileUpload from '@/components/FileUpload/index.vue';
export default {
components: { FileUpload },
props:{
studyId: {
type: String,
},
showRecord:{
type:Boolean,
default:true
},
showSubmit:{
type:Boolean,
default:true
},
content: {
type: Object,
default:()=>{}
}
studyId: {
type: String,
},
showRecord:{
type:Boolean,
default:true
},
showSubmit:{
type:Boolean,
default:true
},
content: {
type: Object,
default:()=>{}
}
},
data() {
return {
@@ -106,26 +106,26 @@ export default {
methods: {
loadHomeworkInfo(){
apiCourse.getHomework(this.content.id).then(res=>{
if(res.status==200){
this.info=res.result;
//检查是否过期
if(res.result.deadTime!=''){
var d = new Date(res.result.deadTime);
var now=new Date();
if(now.getTime() > d.getTime()){
this.close=true;
} else {
this.close=false;
if(res.status==200){
this.info=res.result;
//检查是否过期
if(res.result.deadTime!=''){
var d = new Date(res.result.deadTime);
var now=new Date();
if(now.getTime() > d.getTime()){
this.close=true;
} else {
this.close=false;
}
}
}
if(!this.showTest && this.showRecord){
this.loadRecord();
}
}else if(res.status==404){
//没有找到作业信息
}else{
this.$message.error(res.message);
}
if(!this.showTest && this.showRecord){
this.loadRecord();
}
}else if(res.status==404){
//没有找到作业信息
}else{
this.$message.error(res.message);
}
});
//
},
@@ -149,15 +149,15 @@ export default {
this.filePath = res.result.filePath;
},
removeHomeworkFile(){
this.$confirm('您确定要删除已上传的附件吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.filePath='';
//从服务器端删除
this.$message({ type: 'success', message: '删除成功!' });
})
this.$confirm('您确定要删除已上传的附件吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.filePath='';
//从服务器端删除
this.$message({ type: 'success', message: '删除成功!' });
})
},
submitHomework() {//提交作业
@@ -192,16 +192,16 @@ export default {
}
apiCourseStudy.saveHomework(pamars).then(res=>{
this.isSubmit = false
if(res.status==200){
this.$message.success("作业已提交");
this.filePath='';
this.answer='';
this.studyItemId=res.result.id;
this.records=[res.result];
this.$emit("submit", this.content);
}else {
this.$message.error(res.message);
}
if(res.status==200){
this.$message.success("作业已提交");
this.filePath='';
this.answer='';
this.studyItemId=res.result.id;
this.records=[res.result];
this.$emit("submit", this.content);
}else {
this.$message.error(res.message);
}
})
},
@@ -210,27 +210,27 @@ export default {
</script>
<style scoped lang="scss">
.homework-div {
border: 1px solid #dadada;
min-height: 500px;
padding: 20px;
font-size: 14px;
display: flex;
flex-direction: column;
align-items: flex-start;
>div{
width: 100%;
text-align: left;
.homework-title {
margin-bottom: 10px;
font-weight: 600;
}
.homework-content {
color: #666;
margin-bottom: 10px;
.homework-div {
border: 1px solid #dadada;
min-height: 500px;
padding: 20px;
font-size: 14px;
display: flex;
flex-direction: column;
align-items: flex-start;
>div{
width: 100%;
text-align: left;
.homework-title {
margin-bottom: 10px;
font-weight: 600;
}
.homework-content {
color: #666;
margin-bottom: 10px;
width: 100%;
}
}
}
}
}
</style>

View File

@@ -95,9 +95,9 @@
<el-col :offset="12" :span="4">
<div class="grid-content bg-purple">
<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="1"></el-option>
<el-option label="进行中" :value="8"></el-option>
</el-select>
</div>
</el-col>
@@ -192,7 +192,7 @@
</el-table-column>-->
<el-table-column label="学习人员" width="110">
<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>
</el-table-column>
</el-table>
@@ -290,8 +290,9 @@
</el-select>
</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-button v-if="isHomeWork" :disabled="isTrue" style="padding:10px 15px;margin-bottom: 10px;" type="primary" @click="downLoad">导出全部作业</el-button>
</el-form>
<el-table max-height="500" border :data="learningSituation.list" style="width: 100%">
<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 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: {
@@ -344,15 +347,14 @@ export default {
manageStudyData: {
type: Object,
default: () => ({})
},
isShowDialog:{
type: Boolean,
default: false
}
},
data() {
return {
downParams: {},
typePress: false,
isHomeWork: false,
isTrue: false,
catalogRecordTree:[],
catalogRecordList:[],
resOwnerListMap:[],
@@ -376,9 +378,7 @@ export default {
pageSize: 10, // 每页多少条
count: 0,
type: "",
list: [],
name: '',
status: '',
list: []
},
learningRecords: {
pageIndex: 1, //第几页
@@ -415,21 +415,6 @@ export default {
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() {
@@ -501,10 +486,6 @@ export default {
}
});
},
studyContentRecordsSearch(){
this.learningSituation.pageIndex = 1;
this.studyContentRecords()
},
// 资源里的学习详情
studyContentRecords() {
let params = {
@@ -515,6 +496,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 +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) {
this.learningSituation.pageSize = val;
this.learningSituation.pageIndex = 1;
@@ -722,10 +775,15 @@ export default {
this.getSignupList();
},
getCatalogue(row,type) {
if(type=='考试'){
if(type==61){
this.typePress = true
}else{
this.typePress = true
this.typePress = false
}
if(type == 60){
this.isHomeWork = true
}else{
this.isHomeWork = false
}
this.contentId = row.id;
this.study.catalogueShow = true;