合并pingcode上的bug

This commit is contained in:
zhangsir
2024-08-05 17:56:54 +08:00
parent 94702ea288
commit b38f32f6dd
2 changed files with 140 additions and 133 deletions

View File

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

View File

@@ -1049,7 +1049,7 @@
this.cwareChange.curriculumData = deepClone(this.cware.curriculumData) this.cwareChange.curriculumData = deepClone(this.cware.curriculumData)
} }
}else if(index==2){ }else if(index==2){
this.homework.content.contentName = this.homework.info.name this.homework.content.contentName = this.homework.info.name || '作业'
postData.content=this.homework.content; postData.content=this.homework.content;
postData.homework=this.homework.info; postData.homework=this.homework.info;
this.homeworkChange = deepClone(this.homework) this.homeworkChange = deepClone(this.homework)