|
|
@@ -1,7 +1,7 @@
|
|
|
<template>
|
|
|
<div class="practice_answer">
|
|
|
<el-container style="height: 100%">
|
|
|
- <el-aside width="260px" class="hide_scrollbar">
|
|
|
+ <el-aside width="260px" class="aside_left hide_scrollbar">
|
|
|
<div class="side_list">
|
|
|
<div class="side_title">待练习知识点</div>
|
|
|
<div
|
|
|
@@ -28,6 +28,7 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
+ <div v-if="waitList.length==0" class="side_empty_text">暂无数据</div>
|
|
|
</div>
|
|
|
</el-aside>
|
|
|
<el-main class="main_body">
|
|
|
@@ -35,9 +36,9 @@
|
|
|
<div class="content_title">
|
|
|
<div class="title_name">{{ knowledgeName }}</div>
|
|
|
<div class="button">
|
|
|
- <el-button plain class="download_btn" @click="downloadPaper"
|
|
|
- >下载试卷</el-button
|
|
|
- >
|
|
|
+ <el-button plain class="download_btn" @click="DownloadPaper">
|
|
|
+ 下载试卷
|
|
|
+ </el-button>
|
|
|
<el-button type="primary" @click="SubmitAnswer">提交作答</el-button>
|
|
|
</div>
|
|
|
</div>
|
|
|
@@ -117,10 +118,10 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
- </div>
|
|
|
- <div class="question_no_data" v-if="questionList.length==0">
|
|
|
- <div class="no_data_content">
|
|
|
- <div class="no_data_text">暂无数据</div>
|
|
|
+ <div class="question_no_data" v-if="questionList.length==0">
|
|
|
+ <div class="no_data_content">
|
|
|
+ <div class="no_data_text">暂无数据</div>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
@@ -144,14 +145,14 @@
|
|
|
<div class="dialog_paper_item">
|
|
|
<span class="dialog_paper_title">试卷名称:</span>
|
|
|
<el-radio-group class="radio_group" v-model="paperName">
|
|
|
- <!-- <el-radio label="a4">A4</el-radio> -->
|
|
|
+ <el-radio label="a4" disabled>A4</el-radio>
|
|
|
<el-radio label="a3">A3</el-radio>
|
|
|
</el-radio-group>
|
|
|
</div>
|
|
|
<div class="dialog_paper_item">
|
|
|
<span class="dialog_paper_title">下载格式:</span>
|
|
|
<el-radio-group class="radio_group" v-model="format">
|
|
|
- <!-- <el-radio label="pdf">PDF</el-radio> -->
|
|
|
+ <el-radio label="pdf" disabled>PDF</el-radio>
|
|
|
<el-radio label="word">Word</el-radio>
|
|
|
</el-radio-group>
|
|
|
</div>
|
|
|
@@ -159,7 +160,7 @@
|
|
|
</div>
|
|
|
<div slot="footer" class="dialog-footer">
|
|
|
<el-button @click="dialogPaperVisible = false">取 消</el-button>
|
|
|
- <el-button type="primary" @click="ConfirmDownloadPaper"
|
|
|
+ <el-button type="primary" :loading="exportLoading" @click="ConfirmDownloadPaper"
|
|
|
>确 定</el-button
|
|
|
>
|
|
|
</div>
|
|
|
@@ -221,6 +222,7 @@ export default {
|
|
|
dialogPaperVisible: false, //下载试卷
|
|
|
paperName: "a3", //下载试卷
|
|
|
format: "word", //下载格式
|
|
|
+ exportLoading: false, //导出loading状态
|
|
|
};
|
|
|
},
|
|
|
watch: {
|
|
|
@@ -356,6 +358,9 @@ export default {
|
|
|
},
|
|
|
//提交作答
|
|
|
SubmitAnswer(){
|
|
|
+ if(this.questionList.length == 0){
|
|
|
+ return;
|
|
|
+ }
|
|
|
const studentAnswers = this.questionList.map(item=>item.studentAnswer);
|
|
|
const hasInvalid = studentAnswers.some(item => {
|
|
|
// 判断 null 或 undefined
|
|
|
@@ -385,12 +390,37 @@ export default {
|
|
|
this.dialogVisible = true;
|
|
|
},
|
|
|
//下载试卷
|
|
|
- downloadPaper() {
|
|
|
+ DownloadPaper() {
|
|
|
+ if(this.questionList.length == 0){
|
|
|
+ this.$message.warning('请先加入练习!');
|
|
|
+ return;
|
|
|
+ }
|
|
|
this.dialogPaperVisible = true;
|
|
|
},
|
|
|
//确定下载
|
|
|
ConfirmDownloadPaper() {
|
|
|
- this.dialogPaperVisible = false;
|
|
|
+ this.exportLoading = true;
|
|
|
+ this.$api.target.downloadExercise({
|
|
|
+ exerciseId: this.exerciseId, // 练习id
|
|
|
+ }).then(res=>{
|
|
|
+ if (res.status == 200) {
|
|
|
+ let blob = new Blob([res.data],{
|
|
|
+ type: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' // .docx 格式
|
|
|
+ // 如果是 .doc 旧格式,用 type: 'application/msword'
|
|
|
+ });
|
|
|
+ let a = document.createElement("a");
|
|
|
+ a.href = URL.createObjectURL(blob);
|
|
|
+ a.download = decodeURIComponent(res.headers["content-disposition"]?.split("filename=")?.[1] || "");
|
|
|
+ a.click();
|
|
|
+ URL.revokeObjectURL(a.href);
|
|
|
+ a.remove();
|
|
|
+ }else {
|
|
|
+ this.$message.error('下载失败!')
|
|
|
+ }
|
|
|
+ }).finally(()=>{
|
|
|
+ this.exportLoading = false;
|
|
|
+ this.dialogPaperVisible = false;
|
|
|
+ })
|
|
|
},
|
|
|
},
|
|
|
};
|
|
|
@@ -400,7 +430,11 @@ export default {
|
|
|
flex: 1;
|
|
|
width: 100%;
|
|
|
overflow: hidden;
|
|
|
-
|
|
|
+ .aside_left{
|
|
|
+ height: 100%;
|
|
|
+ background-color: #ffffff;
|
|
|
+ border-radius: 10px;
|
|
|
+ }
|
|
|
.side_list {
|
|
|
width: 100%;
|
|
|
display: flex;
|
|
|
@@ -483,6 +517,15 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ .side_empty_text{
|
|
|
+ min-height: 120px;
|
|
|
+ width: 100%;
|
|
|
+ text-align: center;
|
|
|
+ line-height: 120px;
|
|
|
+ font-weight: 400;
|
|
|
+ color: #909399;
|
|
|
+ font-size: 14px;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
.main_body {
|