yujialong 3 months ago
parent 1db6084af8
commit 24e44b22ca
  1. 3
      public/static/ueditorPlus/themes/iframe.css
  2. 8
      src/App.vue
  3. 120
      src/components/pdf/index.vue
  4. 12
      src/layouts/home/index.vue
  5. 10
      src/pages/knowledge/index.vue
  6. 52
      src/pages/ques/detail/index.vue
  7. 43
      src/pages/ques/list/index.vue
  8. 18
      src/pages/quesBank/index.vue
  9. 2
      src/pages/testPaper/detail/auto.vue
  10. 15
      src/pages/testPaper/detail/index.vue
  11. 72
      src/pages/testPaper/list/index.vue
  12. 42
      src/pages/testPaper/preview/index.vue
  13. 20
      src/pages/testPaperLibrary/index.vue
  14. 10
      src/plugins/requests/index.js
  15. 5
      src/router/modules/testPaper.js
  16. 5
      src/router/routes.js
  17. 17
      src/store/modules/testPaper.js
  18. 11
      src/store/modules/user.js

@ -7,4 +7,7 @@
.gapfilling-span{ .gapfilling-span{
margin:0 5px; margin:0 5px;
color:#919191; color:#919191;
user-select: none;
pointer-events: none;
-webkit-user-modify: read-only;
} }

@ -11,7 +11,7 @@
<script> <script>
import Setting from '@/setting' import Setting from '@/setting'
import util from '@/libs/util' import Util from '@/libs/util'
export default { export default {
name: "App", name: "App",
@ -23,13 +23,13 @@ export default {
}, },
created () { created () {
//localStorage //localStorage
if (util.local.get(Setting.storeKey)) { if (Util.local.get(Setting.storeKey)) {
this.$store.replaceState(Object.assign({}, this.$store.state, util.local.get(Setting.storeKey))); this.$store.replaceState(Object.assign({}, this.$store.state, Util.local.get(Setting.storeKey)));
} }
//vuexlocalStorage //vuexlocalStorage
window.addEventListener("beforeunload", () => { window.addEventListener("beforeunload", () => {
util.local.get(Setting.tokenKey) && util.local.set(Setting.storeKey, this.$store.state); Util.local.get(Setting.tokenKey) && Util.local.set(Setting.storeKey, this.$store.state);
}); });
}, },
methods: { methods: {

@ -0,0 +1,120 @@
<template>
<div>
<el-dialog custom-class="pdf-dia" :close-on-click-modal="false" :visible.sync="visible" @close="closePdf"
:fullscreen="true" :modal="false" :append-to-body="true">
<div>
<button type="button" aria-label="Close" class="el-dialog__headerbtn" @click="closePdf"><i
class="el-dialog__close el-icon el-icon-close"></i></button>
<div class="pdf">
<p class="arrow">
<span @click="changePdfPage(0)" class="turn el-icon-arrow-left" :class="{ grey: currentPage == 1 }"></span>
{{ currentPage }} / {{ pageCount }}
<span @click="changePdfPage(1)" class="turn el-icon-arrow-right"
:class="{ grey: currentPage == pageCount }"></span>
</p>
<pdf class="pdf-wrap" :src="src" :page="currentPage" @num-pages="pageCount = $event"
@page-loaded="currentPage = $event" @loaded="loadPdfHandler">
</pdf>
</div>
</div>
</el-dialog>
</div>
</template>
<script>
import pdf from "vue-pdf";
export default {
props: ["visible", "src"],
data () {
return {
pdfVisible: false,
pdfSrc: "",
currentPage: 0,
pageCount: 0,
fileType: "pdf"
};
},
components: { pdf },
mounted () {
this.addEvent();
},
methods: {
closePdf () {
this.$emit("update:visible", false);
// this.$emit("update:src", "");
this.currentPage = 1;
},
changePdfPage (val) {
if (val === 0 && this.currentPage > 1) {
this.currentPage--;
}
if (val === 1 && this.currentPage < this.pageCount) {
this.currentPage++;
}
},
loadPdfHandler (e) {
this.currentPage = 1;
},
addEvent () {
document.onkeydown = e => {
let key = window.event.keyCode;
if (key == 37) {
this.changePdfPage(0);
} else if (key == 39) {
this.changePdfPage(1);
}
};
this.$once("hook:beforeDestroy", () => {
document.onkeydown = null;
});
}
}
};
</script>
<style lang="scss" scoped>
/deep/ .pdf-dia {
border-radius: 0 !important;
.el-dialog__header {
display: none;
}
.el-dialog__body {
padding: 0;
}
.el-dialog__headerbtn {
top: 10px;
.el-dialog__close {
color: #fff;
font-size: 16px;
}
}
.pdf {
.arrow {
display: flex;
justify-content: center;
align-items: center;
width: 100%;
padding: 10px 0;
font-size: 16px;
color: #fff;
background-color: #333;
.turn {
margin: 0 10px;
font-size: 18px;
cursor: pointer;
}
}
.pdf-wrap {
height: calc(100vh - 45px);
margin: 0 auto;
overflow: auto;
}
}
}
</style>

@ -1,7 +1,7 @@
<template> <template>
<div class="main"> <div class="main">
<v-navbar v-if="!hideNav" class="nav" /> <v-navbar class="nav" />
<div :class="['layout', { full: hideNav }]"> <div class="layout">
<div class="content"> <div class="content">
<transition name="move" mode="out-in"> <transition name="move" mode="out-in">
<router-view class="view"></router-view> <router-view class="view"></router-view>
@ -21,8 +21,7 @@ import vFooter from '../footer'
export default { export default {
data () { data () {
return { return {
hideNavPath: ['/testPaper/preview'],
hideNav: true,
}; };
}, },
components: { components: {
@ -32,10 +31,7 @@ export default {
}, },
mounted () { mounted () {
const { token } = this.$route.query const { token } = this.$route.query
token && Util.local.set(Setting.tokenKey, token, Setting.tokenExpires) Setting.isDev && token && localStorage.setItem('exam_token', token)
const { path } = this.$route
this.hideNav = this.hideNavPath.includes(path)
}, },
}; };
</script> </script>

@ -212,19 +212,15 @@ export default {
}, },
mounted () { mounted () {
const { query } = this.$route const { query } = this.$route
const { referrer1, referrer2 } = this.$store.state.user
this.crumbs = [ this.crumbs = [
{ {
name: query.questionBankName || '题库管理', name: query.questionBankName || '题库管理',
route: '/quesBank' route: referrer1 || '/quesBank'
}, },
{ {
name: '试题列表', name: '试题列表',
route: '/ques', route: referrer2 || '/ques',
query: {
questionBankId: query.questionBankId,
questionBankName: query.questionBankName,
questionBankCategory: query.questionBankCategory
}
}, },
{ {
name: '知识点列表' name: '知识点列表'

@ -108,10 +108,11 @@
<div class="fills"> <div class="fills">
<span>填空{{ i + 1 }}</span> <span>填空{{ i + 1 }}</span>
<div v-if="item.fills" class="fill-items"> <div v-if="item.fills" class="fill-items">
<div v-for="(fill, j) in item.fills" :key="j" class="fill-item"> <div v-for="(fill, j) in item.fills" :key="j" :class="['fill-item', { isDisabled }]">
<el-input type="textarea" autosize resize="none" placeholder="请输入" v-model="fill.val" /> <el-input type="textarea" autosize resize="none" placeholder="请输入" v-model="fill.val" />
<span v-if="j !== item.fills.length - 1" class="m-r-8"></span> <span v-if="j !== item.fills.length - 1" class="m-r-8"></span>
<i v-if="j" class="action-icon el-icon-remove-outline" @click="item.fills.splice(j, 1)"></i> <i v-if="j && !isDisabled" class="action-icon el-icon-remove-outline"
@click="item.fills.splice(j, 1)"></i>
</div> </div>
</div> </div>
@ -286,6 +287,7 @@ export default {
specialtyIds: [1], specialtyIds: [1],
stem: '', stem: '',
allowAttachment: 0, allowAttachment: 0,
fileName: '',
stemAttachment: '', stemAttachment: '',
uploadInstructions: '', uploadInstructions: '',
}, },
@ -341,15 +343,11 @@ export default {
mounted () { mounted () {
const { query } = this.$route const { query } = this.$route
if (!this.paperType) { if (!this.paperType) {
const { referrer2 } = this.$store.state.user
this.crumbs = [ this.crumbs = [
{ {
name: '试题管理', name: '试题管理',
route: 'list', route: referrer2 || 'list',
query: {
questionBankId: query.questionBankId,
questionBankName: query.questionBankName,
questionBankCategory: query.questionBankCategory,
}
}, },
{ {
name: this.diaTitle name: this.diaTitle
@ -437,6 +435,7 @@ export default {
}) : [], }) : [],
specialtyIds: r.professionalList ? r.professionalList.map(e => e.specialtyId) : [], specialtyIds: r.professionalList ? r.professionalList.map(e => e.specialtyId) : [],
allowAttachment: r.allowAttachment, allowAttachment: r.allowAttachment,
fileName: r.fileName,
stemAttachment: r.stemAttachment, stemAttachment: r.stemAttachment,
uploadInstructions: r.uploadInstructions, uploadInstructions: r.uploadInstructions,
questionAnswerVersions: opts, questionAnswerVersions: opts,
@ -446,10 +445,10 @@ export default {
this.fillBlanks = opts[0].answerData ? JSON.parse(opts[0].answerData) : [] this.fillBlanks = opts[0].answerData ? JSON.parse(opts[0].answerData) : []
// //
const file = r.allowAttachment const file = r.stemAttachment
if (file) { if (file) {
this.uploadList = [{ this.uploadList = [{
name: file, name: r.fileName || file,
url: file url: file
}] }]
} }
@ -553,6 +552,7 @@ export default {
}, },
// //
questionTypeChange (val) { questionTypeChange (val) {
const { form } = this
// //
if (val === 'judgement') { if (val === 'judgement') {
const opts = [] const opts = []
@ -564,21 +564,22 @@ export default {
opts[0].answerIsCorrect = 1 opts[0].answerIsCorrect = 1
opts[0].optionText = '正确' opts[0].optionText = '正确'
opts[1].optionText = '错误' opts[1].optionText = '错误'
this.form.questionAnswerVersions = opts form.questionAnswerVersions = opts
} else if (val === 'fill_blank') { } else if (val === 'fill_blank') {
// //
const opt = _.cloneDeep(this.originOpt) const opt = _.cloneDeep(this.originOpt)
opt.gradingStandard = 'exact_match' opt.gradingStandard = 'exact_match'
this.form.questionAnswerVersions = [opt] form.questionAnswerVersions = [opt]
} else if (val === 'essay') { } else if (val === 'essay') {
// //
const opt = _.cloneDeep(this.originOpt) const opt = _.cloneDeep(this.originOpt)
opt.gradingStandard = 'manual' opt.gradingStandard = 'manual'
opt.referenceAnswer = '' opt.referenceAnswer = ''
this.form.allowAttachment = 0 form.allowAttachment = 0
this.form.stemAttachment = '' form.fileName = ''
this.form.uploadInstructions = '' form.stemAttachment = ''
this.form.questionAnswerVersions = [opt] form.uploadInstructions = ''
form.questionAnswerVersions = [opt]
} else { } else {
this.handleSingleMultiple() this.handleSingleMultiple()
} }
@ -645,6 +646,7 @@ export default {
let spanRegex = new RegExp('<span class="gapfilling-span" (.*?)>(.*?)______(.*?)<\\/span>', 'g') let spanRegex = new RegExp('<span class="gapfilling-span" (.*?)>(.*?)______(.*?)<\\/span>', 'g')
let newFormItem = [] let newFormItem = []
let gapfillingItems = content.match(spanRegex) let gapfillingItems = content.match(spanRegex)
console.log("🚀 ~ questionItemReset ~ gapfillingItems:", gapfillingItems)
if (gapfillingItems !== null) { if (gapfillingItems !== null) {
gapfillingItems.forEach(function (span, index) { gapfillingItems.forEach(function (span, index) {
let pairRegex = /<span class="gapfilling-span" data-id="(.*?)">(.*?)______(.*?)<\/span>/ let pairRegex = /<span class="gapfilling-span" data-id="(.*?)">(.*?)______(.*?)<\/span>/
@ -669,9 +671,11 @@ export default {
}, },
handleRemove () { handleRemove () {
Oss.del(this.form.stemAttachment) Oss.del(this.form.stemAttachment)
this.form.fileName = ''
this.form.stemAttachment = '' this.form.stemAttachment = ''
}, },
uploadSuccess (file) { uploadSuccess (file) {
this.form.fileName = file.name
this.form.stemAttachment = file.url this.form.stemAttachment = file.url
}, },
handleSelectionChange (val) { handleSelectionChange (val) {
@ -706,7 +710,8 @@ export default {
if (invalid) return false if (invalid) return false
if (!opt.find(e => e.answerIsCorrect)) return Util.warningMsg('请设置正确答案') if (!opt.find(e => e.answerIsCorrect)) return Util.warningMsg('请设置正确答案')
} else if (form.questionType === 'fill_blank') { } else if (form.questionType === 'fill_blank') {
let scorePro = 0 let scorePro = 0 //
let filledPro = 0 //
for (const e of blanks) { for (const e of blanks) {
if (e.fills.every(n => !n.val)) { if (e.fills.every(n => !n.val)) {
Util.warningMsg('请输入填空项正确答案') Util.warningMsg('请输入填空项正确答案')
@ -714,9 +719,13 @@ export default {
break break
} }
const pro = e.scoreProportion const pro = e.scoreProportion
if (pro && !isNaN(pro)) scorePro = Decimal(scorePro).add(pro || 0).toNumber() if (pro && !isNaN(pro)) {
filledPro++
scorePro = Decimal(scorePro).add(pro || 0).toNumber()
}
} }
if (scorePro && scorePro !== 100) return Util.warningMsg('分值占比不满100,请重新调整') if (filledPro && blanks.length !== filledPro) return Util.warningMsg('分值占比未填写完成')
if (scorePro && scorePro !== 100) return Util.warningMsg('分值占比总和需等于100,请重新调整')
} }
this.submiting = true this.submiting = true
@ -798,7 +807,7 @@ export default {
// //
this.$emit('closeAdd') this.$emit('closeAdd')
} else { } else {
this.$router.back() this.questionId ? this.$router.push(this.$store.state.user.referrer2 || 'list') : this.$router.back()
} }
}, },
} }
@ -864,7 +873,8 @@ export default {
} }
&:first-child, &:first-child,
&:last-child { &:last-child,
&.isDisabled {
.el-textarea { .el-textarea {
width: calc(100% - 52px); width: calc(100% - 52px);
} }

@ -208,6 +208,7 @@ import Setting from '@/setting'
import Breadcrumb from '@/components/breadcrumb' import Breadcrumb from '@/components/breadcrumb'
import Detail from '../detail' import Detail from '../detail'
import Const from '@/const/ques' import Const from '@/const/ques'
import Qs from 'qs'
export default { export default {
components: { Breadcrumb, Detail }, components: { Breadcrumb, Detail },
data () { data () {
@ -254,7 +255,7 @@ export default {
referenceCountSort: '', referenceCountSort: '',
}, },
list: [], list: [],
page: 1, page: +this.$route.query.page || 1,
pageSize: 10, pageSize: 10,
total: 0, total: 0,
multipleSelection: [], multipleSelection: [],
@ -296,15 +297,42 @@ export default {
}, },
}, },
mounted () { mounted () {
const { referrer1 } = this.$store.state.user
console.log("🚀 ~ mounted ~ referrer1:", this.$route.query.questionTypes)
this.crumbs = [ this.crumbs = [
{ {
name: this.questionBankName || '题库管理', name: this.questionBankName || '题库管理',
route: '/quesBank' route: referrer1 || '/quesBank'
}, },
{ {
name: '试题管理' name: '试题管理'
}, },
] ]
const { query } = this.$route
if (query.page) {
const { questionTypes, correctRateEnd, correctRateStart, difficultys, specialtyIds, status, keyword, questionTypeSort, givenYearSort, difficultySort, correctRateSort, updateTimeSort, referenceCountSort, givenYears, knowledgePointIds, questionBankId, questionBankName, questionBankCategory } = query
this.filter = {
questionTypes: questionTypes ? questionTypes.split(',') : [],
correctRateEnd: correctRateEnd || '',
correctRateStart: correctRateStart || '',
difficultys: difficultys ? difficultys.split(',') : [],
specialtyIds: specialtyIds ? specialtyIds.split(',').map(e => +e) : [],
status: status ? +status : '',
keyword: keyword || '',
questionTypeSort: questionTypeSort || '',
givenYearSort: givenYearSort || '',
difficultySort: difficultySort || '',
correctRateSort: correctRateSort || '',
updateTimeSort: updateTimeSort || '',
referenceCountSort: referenceCountSort || '',
}
this.givenYears = givenYears || ''
this.knowledgePointIds = knowledgePointIds ? JSON.parse(knowledgePointIds) : []
this.$router.push(`/ques?questionBankId=${questionBankId}&questionBankName=${questionBankName}&questionBankCategory=${questionBankCategory}`).catch(() => { })
}
this.getType() this.getType()
this.getProfessional() this.getProfessional()
this.getKnowledge() this.getKnowledge()
@ -327,11 +355,20 @@ export default {
}, },
// //
toSet () { toSet () {
this.setReferrer()
this.$router.push({ this.$router.push({
path: '/knowledge', path: '/knowledge',
query: this.$route.query query: this.$route.query
}) })
}, },
// url
setReferrer () {
const { filter } = this
this.$store.commit('user/setReferrer', {
i: 2,
url: `${this.$route.path}?${Qs.stringify(filter)}&${Qs.stringify(this.$route.query)}&questionTypes=${filter.questionTypes}&difficultys=${filter.difficultys}&specialtyIds=${filter.specialtyIds}&givenYears=${this.givenYears}&knowledgePointIds=${JSON.stringify(this.knowledgePointIds)}&page=${this.page}`
})
},
// //
typeChange () { typeChange () {
this.$refs.typeTree.setCurrentKey(null) this.$refs.typeTree.setCurrentKey(null)
@ -429,6 +466,7 @@ export default {
// //
add () { add () {
this.setReferrer()
const knowledgeCheck = this.$refs.typeTree.getCurrentNode() const knowledgeCheck = this.$refs.typeTree.getCurrentNode()
this.$router.push({ this.$router.push({
path: 'detail', path: 'detail',
@ -440,6 +478,7 @@ export default {
}, },
// / type: 123 // / type: 123
toDetail (row, type) { toDetail (row, type) {
this.setReferrer()
this.$router.push({ this.$router.push({
path: 'detail', path: 'detail',
query: { query: {

@ -101,6 +101,7 @@
<script> <script>
import Setting from '@/setting' import Setting from '@/setting'
import Util from '@/libs/util' import Util from '@/libs/util'
import Qs from 'qs'
import _ from 'lodash' import _ from 'lodash'
export default { export default {
data () { data () {
@ -127,7 +128,7 @@ export default {
}, },
listLoading: false, listLoading: false,
list: [], list: [],
page: 1, page: +this.$route.query.page || 1,
pageSize: 10, pageSize: 10,
total: 0, total: 0,
multipleSelection: [], multipleSelection: [],
@ -159,6 +160,17 @@ export default {
} }
}, },
mounted () { mounted () {
const { query } = this.$route
if (query.page) {
const { questionNumOrderBy, timeOrderBy, status, name } = query
this.filter = {
questionNumOrderBy: questionNumOrderBy ? +questionNumOrderBy : '',
timeOrderBy: timeOrderBy ? +timeOrderBy : '',
name: name || '',
status: status ? +status : '',
}
}
this.getType() this.getType()
}, },
methods: { methods: {
@ -269,6 +281,10 @@ export default {
}, },
// //
toQues (row) { toQues (row) {
this.$store.commit('user/setReferrer', {
i: 1,
url: `${this.$route.path}?${Qs.stringify(this.filter)}&page=${this.page}`
})
this.$router.push(`/ques?questionBankId=${row.id}&questionBankName=${row.questionBankName}&questionBankCategory=${row.questionBankCategory}`) this.$router.push(`/ques?questionBankId=${row.id}&questionBankName=${row.questionBankName}&questionBankCategory=${row.questionBankCategory}`)
}, },
// / // /

@ -571,7 +571,7 @@ export default {
} }
list.map((e, i) => { list.map((e, i) => {
res.list[i].questions.map((e, i) => { res.list[i].questions.map((e, i) => {
// e.questionVersionId = e.id e.questionId = e.id
e.serialNumber = i + 1 e.serialNumber = i + 1
e.originSort = i + 1 e.originSort = i + 1
this.$parent.handleQuesInfo(e) this.$parent.handleQuesInfo(e)

@ -437,13 +437,11 @@ export default {
}, },
}, },
mounted () { mounted () {
const { referrer2 } = this.$store.state.user
this.crumbs = [ this.crumbs = [
{ {
name: '试卷管理', name: '试卷管理',
route: 'list', route: referrer2 || 'list',
query: {
id: this.libraryId
}
}, },
{ {
name: '创建试卷' name: '创建试卷'
@ -869,7 +867,7 @@ export default {
try { try {
await this.$post(this.api.saveExamPaper, this.tempForm) await this.$post(this.api.saveExamPaper, this.tempForm)
Util.successMsg('保存成功') Util.successMsg('保存成功')
this.back() this.tempForm.paperId ? this.back() : this.$router.back()
} finally { } finally {
this.submiting = false this.submiting = false
} }
@ -1031,7 +1029,7 @@ export default {
}, },
// //
back () { back () {
this.$router.back() this.$router.push(this.$store.state.user.referrer || 'list')
}, },
// //
drag () { drag () {
@ -1317,6 +1315,10 @@ export default {
font-size: 13px; font-size: 13px;
color: #fff; color: #fff;
background-color: #2bbb61; background-color: #2bbb61;
&:first-child {
white-space: nowrap;
}
} }
td { td {
@ -1325,6 +1327,7 @@ export default {
color: #333; color: #333;
&:first-child { &:first-child {
white-space: nowrap;
background-color: #f1f1f1; background-color: #f1f1f1;
} }
} }

@ -162,8 +162,9 @@
</el-table-column> </el-table-column>
</el-table> </el-table>
<div class="pagination"> <div class="pagination">
<el-pagination background @current-change="currentChange" :current-page="page" <el-pagination background layout="total, prev, pager, next" :total="total" @current-change="currentChange"
layout="total, prev, pager, next" :total="total"></el-pagination> :current-page="page">
</el-pagination>
</div> </div>
</div> </div>
</div> </div>
@ -191,23 +192,17 @@ import _ from 'lodash'
import Breadcrumb from '@/components/breadcrumb' import Breadcrumb from '@/components/breadcrumb'
import QuesConst from '@/const/ques' import QuesConst from '@/const/ques'
import TestPaperConst from '@/const/testPaper' import TestPaperConst from '@/const/testPaper'
import Qs from 'qs'
export default { export default {
components: { Breadcrumb }, components: { Breadcrumb },
data () { data () {
return { return {
crumbs: [ crumbs: [],
{
name: this.$route.query.name || '中台试卷库',
route: '/testPaperLibrary'
},
{
name: '试卷管理'
},
],
questionTypes: QuesConst.questionTypes, questionTypes: QuesConst.questionTypes,
difficults: TestPaperConst.difficults, difficults: TestPaperConst.difficults,
paperTypes: TestPaperConst.paperTypes, paperTypes: TestPaperConst.paperTypes,
typeId: this.$route.query.id, libraryId: this.$route.query.id,
name: this.$route.query.name,
createSource: 1, createSource: 1,
loading: false, loading: false,
types: [], types: [],
@ -259,7 +254,7 @@ export default {
}, },
listLoading: false, listLoading: false,
list: [], list: [],
page: 1, page: +this.$route.query.page || 1,
pageSize: 10, pageSize: 10,
total: 0, total: 0,
multipleSelection: [], multipleSelection: [],
@ -280,6 +275,37 @@ export default {
}, },
}, },
mounted () { mounted () {
const { referrer1 } = this.$store.state.user
this.crumbs = [
{
name: this.name || '中台试卷库',
route: referrer1 || '/testPaperLibrary'
},
{
name: '试卷管理'
},
]
const { query } = this.$route
if (query.page) {
const { difficult, professionalId, paperType, updateTimeOrder, crateTimeOrder, yearOrder, keyWord, difficultOrder, particularYear, questionType, status, id, name } = query
this.filter = {
difficult: difficult ? difficult.split(',').map(e => +e) : [],
professionalId: professionalId ? professionalId.split(',').map(e => +e) : [],
paperType: paperType ? +paperType : '',
updateTimeOrder: updateTimeOrder ? +updateTimeOrder : '',
crateTimeOrder: crateTimeOrder ? +crateTimeOrder : 2,
yearOrder: yearOrder ? +yearOrder : '',
keyWord: keyWord || '',
difficultOrder: difficultOrder ? +difficultOrder : '',
}
this.particularYear = particularYear || ''
this.questionType = questionType ? questionType.split(',') : []
this.status = status ? +status : ''
this.$router.push(`/testPaper?id=${id}&name=${name}`).catch(() => { })
}
this.getType() this.getType()
this.getProfessional() this.getProfessional()
}, },
@ -290,7 +316,7 @@ export default {
this.loading = true this.loading = true
const res = await this.$post(this.api.examClassificationList, { const res = await this.$post(this.api.examClassificationList, {
createSource: this.createSource, createSource: this.createSource,
libraryId: this.typeId, libraryId: this.libraryId,
}) })
const data = res.treeList const data = res.treeList
this.handleType(data) this.handleType(data)
@ -377,7 +403,7 @@ export default {
form.level = 1 form.level = 1
} }
form.createSource = this.createSource form.createSource = this.createSource
form.libraryId = this.typeId form.libraryId = this.libraryId
await this.$post(this.api[form.classificationId ? 'examClassificationUpdate' : 'examClassificationSave'], form) await this.$post(this.api[form.classificationId ? 'examClassificationUpdate' : 'examClassificationSave'], form)
Util.successMsg('保存成功') Util.successMsg('保存成功')
this.closeType() this.closeType()
@ -419,7 +445,7 @@ export default {
type: this.isNotJoin, type: this.isNotJoin,
pageNum: this.page, pageNum: this.page,
pageSize: this.pageSize, pageSize: this.pageSize,
libraryId: this.typeId, libraryId: this.libraryId,
classificationId: type ? type.getCurrentKey() || '' : '', classificationId: type ? type.getCurrentKey() || '' : '',
}) })
this.list = res.pageList.records this.list = res.pageList.records
@ -473,13 +499,23 @@ export default {
}) })
this.getList() this.getList()
}, },
// url
setReferrer () {
const { filter } = this
this.$store.commit('user/setReferrer', {
i: 2,
url: `${this.$route.path}?${Qs.stringify(filter)}&difficult=${filter.difficult}&professionalId=${filter.professionalId}&particularYear=${this.particularYear}&questionType=${this.questionType}&status=${this.status}&id=${this.libraryId}&name=${this.name}&page=${this.page}`
})
},
// //
add () { add () {
this.$router.push(`/testPaper/detail?libraryId=${this.typeId}&classificationId=${this.$refs.typeTree.getCurrentKey() || ''}`) this.setReferrer()
this.$router.push(`/testPaper/detail?libraryId=${this.libraryId}&classificationId=${this.$refs.typeTree.getCurrentKey() || ''}`)
}, },
// //
async toDetail (row, isCopy = '') { async toDetail (row, isCopy = '') {
this.$router.push(`/testPaper/detail?paperId=${row.paperId}&libraryId=${this.typeId}&classificationId=${this.$refs.typeTree.getCurrentKey() || ''}&isCopy=${isCopy}`) this.setReferrer()
this.$router.push(`/testPaper/detail?paperId=${row.paperId}&libraryId=${this.libraryId}&classificationId=${this.$refs.typeTree.getCurrentKey() || ''}&isCopy=${isCopy}`)
}, },
// //
preview (row) { preview (row) {

@ -85,15 +85,17 @@
<!-- 简答题需要展示题干文件及富文本 --> <!-- 简答题需要展示题干文件及富文本 -->
<template v-if="item.questionType === 'essay'"> <template v-if="item.questionType === 'essay'">
<div v-if="ques.stemAttachment" class="m-b-20"> <div v-if="ques.stemAttachment" class="m-b-20">
<el-link class="m-r-10" type="primary">{{ ques.stemAttachment }}</el-link> <el-link class="m-r-10" type="primary" @click="preview(ques.stemAttachment)">{{ ques.stemAttachment
<el-button type="primary" size="mini" round @click="download(ques.stemAttachment)">下载</el-button> }}</el-link>
<el-button type="primary" size="mini" round
@click="download(ques.fileName || ques.stemAttachment, ques.stemAttachment)">下载</el-button>
</div> </div>
<UeditorPlus :ref="'essayAnswer' + ques.id" v-model="ques.answer" <UeditorPlus :ref="'essayAnswer' + ques.id" v-model="ques.answer"
@ready="editor => essayAnswerReady(editor, ques)" /> @ready="editor => essayAnswerReady(editor, ques)" />
<!-- v-if="ques.allowAttachment" --> <!-- v-if="ques.allowAttachment" -->
<div class="m-t-20"> <div class="m-t-20">
<div v-if="form.uploadInstructions" class="flex m-b-10 fs-12"> <div v-if="form.uploadInstructions" class="flex m-b-10 fs-12">
<span>上传附件</span> <span>上传要求说明</span>
<div v-html="form.uploadInstructions"></div> <div v-html="form.uploadInstructions"></div>
</div> </div>
<el-upload action="#"> <el-upload action="#">
@ -106,6 +108,12 @@
</li> </li>
</ul> </ul>
</div> </div>
<el-dialog title="图片预览" :visible.sync="previewImgVisible" width="800px" :close-on-click-modal="false">
<el-image style="max-width: 100px; max-height: 100px" :src="previewImg" :preview-src-list="[previewImg]">
</el-image>
</el-dialog>
<PdfDia :key="pdfVisible" :visible.sync="pdfVisible" :src.sync="pdfSrc" />
</div> </div>
</template> </template>
@ -118,10 +126,11 @@ import _ from 'lodash'
import Oss from '@/components/upload/upload.js' import Oss from '@/components/upload/upload.js'
import Upload from '@/components/upload' import Upload from '@/components/upload'
import UeditorPlus from '@/components/ueditorPlus' import UeditorPlus from '@/components/ueditorPlus'
import PdfDia from '@/components/pdf'
export default { export default {
components: { components: {
Upload, UeditorPlus Upload, UeditorPlus, PdfDia
}, },
data () { data () {
return { return {
@ -145,6 +154,10 @@ export default {
form: { form: {
questionCount: 0, questionCount: 0,
}, },
previewImgVisible: false,
previewImg: '',
pdfVisible: false,
pdfSrc: '',
}; };
}, },
mounted () { mounted () {
@ -332,9 +345,22 @@ export default {
}) })
ques.answer && editor.setContent(ques.answer) ques.answer && editor.setContent(ques.answer)
}, },
//
preview (url) {
const ext = url.split('.').pop()
if (Util.isDoc(ext)) {
window.open('https://view.officeapps.live.com/op/view.aspx?src=' + url)
} else if (Util.isImg(ext)) {
this.previewImgVisible = true
this.previewImg = url
} else if (ext === 'pdf') {
this.pdfVisible = true
this.pdfSrc = url
}
},
// //
download (url) { download (name, url) {
Util.downloadFile(url, url) Util.downloadFile(name, url)
}, },
handleRemove (ques) { handleRemove (ques) {
Oss.del(ques.attachmentUrl) Oss.del(ques.attachmentUrl)
@ -630,6 +656,10 @@ export default {
max-width: calc(100% - 191px); max-width: calc(100% - 191px);
} }
img {
max-width: 100%;
}
.fill-input { .fill-input {
width: 100px; width: 100px;
height: 28px; height: 28px;

@ -104,10 +104,9 @@
<script> <script>
import Util from '@/libs/util' import Util from '@/libs/util'
import Setting from '@/setting' import Setting from '@/setting'
// import UeditorPlus from '@/components/ueditorPlus' import Qs from 'qs'
import _ from 'lodash' import _ from 'lodash'
export default { export default {
// components: { UeditorPlus },
data () { data () {
return { return {
loading: false, loading: false,
@ -131,7 +130,7 @@ export default {
keyWord: '', keyWord: '',
}, },
list: [], list: [],
page: 1, page: +this.$route.query.page || 1,
pageSize: 10, pageSize: 10,
total: 0, total: 0,
multipleSelection: [], multipleSelection: [],
@ -163,6 +162,17 @@ export default {
} }
}, },
mounted () { mounted () {
const { query } = this.$route
if (query.page) {
const { numOrder, timeOrder, isDisable, keyWord } = query
this.filter = {
crateTimeOrder: numOrder ? +crateTimeOrder : '',
timeOrder: timeOrder ? +timeOrder : 2,
keyWord: keyWord || '',
isDisable: isDisable ? +isDisable : '',
}
}
this.getType() this.getType()
}, },
methods: { methods: {
@ -288,6 +298,10 @@ export default {
}, },
// //
toTestPaper (row) { toTestPaper (row) {
this.$store.commit('user/setReferrer', {
i: 1,
url: `${this.$route.path}?${Qs.stringify(this.filter)}&page=${this.page}`
})
this.$router.push(`/testPaper?id=${row.libraryId}&name=${row.libraryName}`) this.$router.push(`/testPaper?id=${row.libraryId}&name=${row.libraryName}`)
}, },
// / // /

@ -13,9 +13,9 @@ service.defaults.headers.post["Content-Type"] = "application/json;charset=UTF-8"
// 请求拦截器 // 请求拦截器
service.interceptors.request.use(config => { service.interceptors.request.use(config => {
let token = Util.local.get(Setting.tokenKey); let token = localStorage.getItem('exam_token')
if (token) config.headers.token = token; if (token) config.headers.token = token
return config; return config
}, err => { }, err => {
Util.errorMsg({ Util.errorMsg({
message: "退出登陆", message: "退出登陆",
@ -37,7 +37,7 @@ service.interceptors.response.use(
// 账号互踢 // 账号互踢
if (!logouted) { if (!logouted) {
Util.local.remove(Setting.storeKey) Util.local.remove(Setting.storeKey)
Util.local.remove(Setting.tokenKey) localStorage.removeItem('exam_token')
window.top.exitSystem && window.top.exitSystem() window.top.exitSystem && window.top.exitSystem()
Util.errorMsg(res.msg.includes('顶') ? '您的账号已在其他设备登录,您已被迫下线!' : '登录过期,请重新登录!') Util.errorMsg(res.msg.includes('顶') ? '您的账号已在其他设备登录,您已被迫下线!' : '登录过期,请重新登录!')
localStorage.removeItem('examPath') localStorage.removeItem('examPath')
@ -50,7 +50,7 @@ service.interceptors.response.use(
} else if (!res.status) { } else if (!res.status) {
return Promise.resolve(res).catch(e => { }); return Promise.resolve(res).catch(e => { });
} else { } else {
Util.errorMsg(res.message); res.message && Util.errorMsg(res.message);
return Promise.reject(res) return Promise.reject(res)
// return Promise.resolve(res).catch(e => {}); // return Promise.resolve(res).catch(e => {});
} }

@ -20,10 +20,5 @@ export default {
component: () => import('@/pages/testPaper/detail'), component: () => import('@/pages/testPaper/detail'),
meta: { title: '试卷管理' } meta: { title: '试卷管理' }
}, },
{
path: 'preview',
component: () => import('@/pages/testPaper/preview'),
meta: { title: '试卷预览' }
},
] ]
}; };

@ -20,6 +20,11 @@ const frameIn = [
meta: { title: "首页" }, meta: { title: "首页" },
children: [] children: []
}, },
{
path: '/testPaper/preview',
component: () => import('@/pages/testPaper/preview'),
meta: { title: '试卷预览' }
},
...modules ...modules
]; ];

@ -1,17 +0,0 @@
/**
* 试卷
* */
export default {
namespaced: true,
state: {
form: {},
},
mutations: {
setForm: (state, val) => {
state.form = val
},
},
actions: {
}
};

@ -11,7 +11,9 @@ export default {
avatar: "https://cube.elemecdn.com/3/7c/3ea6beec64369c2642b92c6726f1epng.png", avatar: "https://cube.elemecdn.com/3/7c/3ea6beec64369c2642b92c6726f1epng.png",
userId: '', userId: '',
userName: '', userName: '',
crumbs: '' crumbs: '',
referrer1: '',
referrer2: '',
}, },
mutations: { mutations: {
setAvatar: (state, avatar) => { setAvatar: (state, avatar) => {
@ -25,10 +27,13 @@ export default {
}, },
setCrumbs: (state, crumbs) => { setCrumbs: (state, crumbs) => {
state.crumbs = crumbs state.crumbs = crumbs
} },
setReferrer: (state, o) => {
state['referrer' + o.i] = o.url
},
}, },
actions: { actions: {
logout({ commit, state, dispatch }) { logout ({ commit, state, dispatch }) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
util.local.remove(Setting.storeKey) util.local.remove(Setting.storeKey)
util.local.remove(Setting.tokenKey) util.local.remove(Setting.tokenKey)

Loading…
Cancel
Save