yujialong 3 months ago
parent 65af806e19
commit b32b3519a4
  1. 4
      src/api/index.js
  2. 2
      src/pages/ques/detail/index.vue
  3. 80
      src/pages/ques/list/index.vue
  4. 37
      src/pages/testPaper/detail/index.vue
  5. 18
      src/pages/testPaper/preview/index.vue
  6. 29
      src/styles/common.scss

@ -63,7 +63,6 @@ export default {
findQuestion: `/exam/exam/questions/findById`,
listQuestion: `/exam/exam/questions/pagingQuery`,
updateQuestion: `/exam/exam/questions/updateQuestion`,
batchImportQuestions: `${host}/exam/exam/questions/batchImportQuestions`,
checkQuestion: `/exam/exam/questions/checkQuestion`,
delQuestion: `/exam/exam/questions/batchDeletion`,
checkQuestionIsUse: `/exam/exam/questions/checkQuestionIsUse`,
@ -73,4 +72,7 @@ export default {
findAllByQuestionBank: `/exam/exam/questions/findAllByQuestionBank`,
selectQuestionsByTypeAndDifficulty: `/exam/exam/questions/selectQuestionsByTypeAndDifficulty`,
removeQuestionKnowledge: `/exam/exam/questions/removeQuestionKnowledge`,
batchImportQuestions: `${host}/exam/exam/questions/batchImportQuestions`,
downloadQuesExcel: `${host}/exam/exam/questions/downloadExcel`,
batchImportQuesFailure: `${host}/exam/exam/questions/exportFailure`,
}

@ -85,7 +85,7 @@
<el-radio v-else v-model="item.answerIsCorrect" :true-label="1" :label="1" @change="correctChange(i)">选项{{
numToLetter(i)
}}</el-radio>
<div v-if="!item.focus" class="opt-input" @click="optFocus(item)">
<div v-if="!item.focus" class="opt-input html-parse" @click="optFocus(item)">
<div v-if="item.optionText" v-html="item.optionText"></div>
<p v-else class="default">请输入</p>
</div>

@ -164,14 +164,11 @@
<el-dialog title="批量导入试题" :visible.sync="importVisible" width="520px" :close-on-click-modal="false"
:modal-append-to-body="false">
<el-form label-width="110px">
<el-form-item prop="userName" label="题库分类">
<el-select style="width: 100%" v-model="form.provinceId" placeholder="请选择题库分类">
<el-option v-for="(item, i) in types" :key="i" :label="item.provinceName"
:value="item.provinceId"></el-option>
</el-select>
<el-form-item label="题库分类">
<el-input v-model="questionBankCategory" disabled />
</el-form-item>
<el-form-item prop="userName" label="当前题库">
<el-input placeholder="请输入题库名称" v-model="form.name" disabled></el-input>
<el-form-item label="当前题库">
<el-input v-model="questionBankName" disabled />
</el-form-item>
<el-form-item prop="userName" label="模板文件">
<el-button type="primary" @click="download">模板下载<i class="el-icon-download el-icon--right"></i></el-button>
@ -180,9 +177,8 @@
<el-upload name="file" accept=".xls,.xlsx" ref="upload" class="import-file" drag :before-upload="beforeUpload"
:on-remove="handleRemove" :on-error="uploadError" :on-success="uploadSuccess" :before-remove="beforeRemove"
:limit="1" :data="{
// competitionId: id,
platformId: 2
}" :disabled="uploading" :on-exceed="handleExceed" :action="this.api.batchImportPersonalData"
questionBankId
}" :disabled="uploading" :on-exceed="handleExceed" :action="this.api.batchImportQuestions"
:file-list="uploadList" :headers="headers">
<i class="el-icon-upload"></i>
<div class="el-upload__text">将文件拖到此处<em>点击上传</em></div>
@ -193,12 +189,49 @@
<p>3.仅支持上传.xls .xlsx文件格式</p>
</div>
</el-upload>
<el-link v-if="uploadFaild" type="primary" @click="showFaild">部分数据导入失败查看失败原因</el-link>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="importVisible = false">关闭</el-button>
</span>
</el-dialog>
<!-- <el-dialog title="批量导入试题" :visible.sync="importResultVisible" width="520px" :close-on-click-modal="false"
:modal-append-to-body="false">
<el-form label-width="110px">
<el-form-item label="题库分类">
<el-input v-model="questionBankCategory" disabled />
</el-form-item>
<el-form-item label="当前题库">
<el-input v-model="questionBankName" disabled />
</el-form-item>
<el-form-item prop="userName" label="模板文件">
<el-button type="primary" @click="download">模板下载<i class="el-icon-download el-icon--right"></i></el-button>
</el-form-item>
<el-form-item prop="userName" label="选择文件上传">
<el-upload name="file" accept=".xls,.xlsx" ref="upload" class="import-file" drag :before-upload="beforeUpload"
:on-remove="handleRemove" :on-error="uploadError" :on-success="uploadSuccess" :before-remove="beforeRemove"
:limit="1" :data="{
questionBankId
}" :disabled="uploading" :on-exceed="handleExceed" :action="this.api.batchImportQuestions"
:file-list="uploadList" :headers="headers">
<i class="el-icon-upload"></i>
<div class="el-upload__text">将文件拖到此处<em>点击上传</em></div>
<div class="el-upload__tip" slot="tip" style="line-height: 1.8;">
<p>上传说明</p>
<p>1.请按照模板要求正确填写后上传</p>
<p>2.上传文件大小限制50M</p>
<p>3.仅支持上传.xls .xlsx文件格式</p>
</div>
</el-upload>
<el-link v-if="uploadFaild" type="primary" @click="showFaild">部分数据导入失败查看失败原因</el-link>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="importVisible = false">关闭</el-button>
</span>
</el-dialog> -->
</div>
</template>
@ -209,6 +242,7 @@ import Breadcrumb from '@/components/breadcrumb'
import Detail from '../detail'
import Const from '@/const/ques'
import Qs from 'qs'
import axios from 'axios'
export default {
components: { Breadcrumb, Detail },
data () {
@ -600,8 +634,12 @@ export default {
this.uploadFaild = false
},
//
download () {
location.href = this.api[this.info.completeCompetitionSetup.competitionType ? 'competionTeamTemplate' : 'competionPersonTemplate']
async download () {
const res = await axios.get(this.api.downloadQuesExcel, {
headers: this.headers,
responseType: 'blob'
})
Util.downloadFileDirect('批量导入试题模板.xlsx', new Blob([res.data]))
},
//
handleExceed (files, fileList) {
@ -611,31 +649,31 @@ export default {
},
//
showFaild () {
axios.get(`${this.api.TeamDataExportFailure}?exportCode=${this.exportCode}&platformId=2&type=${this.info.completeCompetitionSetup.competitionType ? 1 : 2}`, {
axios.get(`${this.api.batchImportQuesFailure}?exportCode=${this.exportCode}`, {
headers: this.headers,
responseType: 'blob'
}).then((res) => {
const name = res.headers['content-disposition']
Util.downloadFileDirect(name ? decodeURI(name) : '批量导入报名人员失败数据导出.xlsx', new Blob([res.data]))
Util.downloadFileDirect(name ? decodeURI(name) : '批量导入题目管理失败数据导出.xlsx', new Blob([res.data]))
}).catch(res => { })
},
uploadSuccess ({ data, status }) {
uploadSuccess ({ data, status, message }) {
this.uploading = false
this.uploadFaild = false
this.uploadTips = ''
if (status === 200) {
this.init()
const { tip } = data
// this.init()
// const { tip } = data
if (data.exportCode) {
this.exportCode = data.exportCode
this.uploadFaild = true
this.uploadTips = tip
// this.uploadTips = tip
} else {
Util[tip.includes('5000') ? 'errorMsg' : 'successMsg'](tip, 3000)
this.importVisible = false
// Util[tip.includes('5000') ? 'errorMsg' : 'successMsg'](tip, 3000)
// this.importVisible = false
}
} else {
Util.errorMsg(res.message || '上传失败,请检查数据', 3000)
Util.errorMsg(message || '上传失败,请检查数据', 3000)
}
},
uploadError (err, file, fileList) {

@ -236,7 +236,7 @@
<tr v-for="(item, i) in form.paperOutline" :key="i">
<td>{{ arabicToChinese(i + 1) }}大题</td>
<td>{{ item.examQuestions.length }}/{{ item.questionNum }}</td>
<td>{{ item.examQuestions.reduce((e, j) => (e += +j.score), 0) || 0 }}/{{ item.targetScore }}</td>
<td>{{ getQuesAlreadyScore(item) }}/{{ item.targetScore }}</td>
</tr>
<tr>
<td>总计</td>
@ -428,6 +428,7 @@ export default {
})
}
})
console.log("🚀 ~ overview ~ alreadyScore:", alreadyScore, totalScore)
return {
questionCount,
alreadyQuesCount,
@ -711,6 +712,14 @@ export default {
}
} catch (e) { }
},
getQuesAlreadyScore (item) {
let total = 0
item.examQuestions.forEach(e => {
total = Decimal(total).add(+e.score).toNumber()
})
item.curQuesTotalScore = total
return total
},
//
fillScoreChange (ques) {
let total = 0
@ -955,11 +964,13 @@ export default {
invalid = 1
break
}
} else if (+e.targetScore !== e.examQuestions.reduce((e, j) => (e += +j.score), 0)) {
//
Util.warningMsg(`${chineseNum}大题的小题总分跟目标分值不一致,请重新修改`)
invalid = 1
break
} else {
if (+e.targetScore !== e.curQuesTotalScore) {
//
Util.warningMsg(`${chineseNum}大题的小题总分跟目标分值不一致,请重新修改`)
invalid = 1
break
}
}
//
@ -1220,20 +1231,6 @@ export default {
border-radius: 2px;
}
/deep/.html-parse {
table {
display: table;
margin-bottom: 10px;
border-collapse: collapse;
th,
td {
padding: 5px 10px;
border: 1px solid #DDD;
}
}
}
.stem {
margin-bottom: 10px;
}

@ -24,7 +24,7 @@
</div>
<div v-if="form.paperOutline" class="type-wrap">
<div v-for="(item, i) in form.paperOutline" :key="i" class="type">
<h6 class="stem">{{ arabicToChinese(i + 1) }}{{ item.questionTypeName }}本题共{{ item.questionNum }}小题{{
<h6 class="stem">{{ arabicToChinese(i + 1) }}{{ item.outlineName }}本题共{{ item.questionNum }}小题{{
item.targetScore }}</h6>
<ul class="serials">
<template v-for="(ques, j) in item.examQuestions">
@ -51,7 +51,7 @@
<ul v-if="form.paperOutline" class="ques-wrap" id="quesWrap">
<li v-for="(item, i) in form.paperOutline" :key="i">
<div class="outline">
{{ arabicToChinese(i + 1) }}{{ item.questionTypeName }}本题共{{ item.questionNum }}小题{{
{{ arabicToChinese(i + 1) }}{{ item.outlineName }}本题共{{ item.questionNum }}小题{{
item.targetScore }}
<img :class="['shrink', { active: item.shrink }]" src="@/assets/images/shrink.svg" alt=""
@click="item.shrink = !item.shrink">
@ -63,7 +63,7 @@
<div class="stem-wrap">
<span class="label">{{ j + 1 }} / {{ item.questionNum }}</span>
<span class="label">{{ item.questionTypeName }}</span>
<div class="stem" :id="'stem' + ques.id" v-html="getQuesStem(ques)"></div>
<div class="stem html-parse" :id="'stem' + ques.id" v-html="getQuesStem(ques)"></div>
<p v-if="item.questionType !== 'fill_blank'">{{ ques.score }}</p>
<img class="tag" :src="require('@/assets/images/' + (ques.sign ? 'tag-active' : 'tag') + '.svg')" alt=""
@click="ques.sign = ques.sign ? 0 : 1">
@ -79,24 +79,24 @@
@change="singleChange(ques, j)"></el-radio>
<span>{{ numToLetter(j) }}.&nbsp;</span>
<div class="text" v-html="opt.optionText"></div>
<div class="text html-parse" v-html="opt.optionText"></div>
</div>
</template>
<!-- 简答题需要展示题干文件及富文本 -->
<template v-if="item.questionType === 'essay'">
<div v-if="ques.stemAttachment" class="m-b-20">
<el-link class="m-r-10" type="primary" @click="preview(ques.stemAttachment)">{{ ques.stemAttachment
<el-link class="m-r-10" type="primary" @click="preview(ques.stemAttachment)">{{ ques.fileName
|| ques.stemAttachment
}}</el-link>
<el-button type="primary" size="mini" round
@click="download(ques.fileName || ques.stemAttachment, ques.stemAttachment)">下载</el-button>
</div>
<UeditorPlus :ref="'essayAnswer' + ques.id" v-model="ques.answer"
@ready="editor => essayAnswerReady(editor, ques)" />
<!-- v-if="ques.allowAttachment" -->
<div class="m-t-20">
<div v-if="form.uploadInstructions" class="flex m-b-10 fs-12">
<div v-if="ques.allowAttachment" class="m-t-20">
<div v-if="ques.uploadInstructions" class="flex m-b-10 fs-12">
<span>上传要求说明</span>
<div v-html="form.uploadInstructions"></div>
<div class="html-parse" v-html="ques.uploadInstructions"></div>
</div>
<el-upload action="#">
<el-button size="small" type="primary">上传文件</el-button>

@ -458,3 +458,32 @@
}
}
}
.html-parse {
table {
display: table;
margin-bottom: 10px;
border-collapse: collapse;
th,
td {
padding: 5px 10px;
border: 1px solid #DDD;
}
}
ol {
padding-left: 30px;
li {
list-style-type: decimal;
}
}
ul {
padding-left: 30px;
li {
list-style-type: disc;
}
}
}
Loading…
Cancel
Save