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. 61
      src/store/modules/user.js

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

@ -11,7 +11,7 @@
<script>
import Setting from '@/setting'
import util from '@/libs/util'
import Util from '@/libs/util'
export default {
name: "App",
@ -23,13 +23,13 @@ export default {
},
created () {
//localStorage
if (util.local.get(Setting.storeKey)) {
this.$store.replaceState(Object.assign({}, this.$store.state, util.local.get(Setting.storeKey)));
if (Util.local.get(Setting.storeKey)) {
this.$store.replaceState(Object.assign({}, this.$store.state, Util.local.get(Setting.storeKey)));
}
//vuexlocalStorage
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: {

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

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

@ -108,10 +108,11 @@
<div class="fills">
<span>填空{{ i + 1 }}</span>
<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" />
<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>
@ -286,6 +287,7 @@ export default {
specialtyIds: [1],
stem: '',
allowAttachment: 0,
fileName: '',
stemAttachment: '',
uploadInstructions: '',
},
@ -341,15 +343,11 @@ export default {
mounted () {
const { query } = this.$route
if (!this.paperType) {
const { referrer2 } = this.$store.state.user
this.crumbs = [
{
name: '试题管理',
route: 'list',
query: {
questionBankId: query.questionBankId,
questionBankName: query.questionBankName,
questionBankCategory: query.questionBankCategory,
}
route: referrer2 || 'list',
},
{
name: this.diaTitle
@ -437,6 +435,7 @@ export default {
}) : [],
specialtyIds: r.professionalList ? r.professionalList.map(e => e.specialtyId) : [],
allowAttachment: r.allowAttachment,
fileName: r.fileName,
stemAttachment: r.stemAttachment,
uploadInstructions: r.uploadInstructions,
questionAnswerVersions: opts,
@ -446,10 +445,10 @@ export default {
this.fillBlanks = opts[0].answerData ? JSON.parse(opts[0].answerData) : []
//
const file = r.allowAttachment
const file = r.stemAttachment
if (file) {
this.uploadList = [{
name: file,
name: r.fileName || file,
url: file
}]
}
@ -553,6 +552,7 @@ export default {
},
//
questionTypeChange (val) {
const { form } = this
//
if (val === 'judgement') {
const opts = []
@ -564,21 +564,22 @@ export default {
opts[0].answerIsCorrect = 1
opts[0].optionText = '正确'
opts[1].optionText = '错误'
this.form.questionAnswerVersions = opts
form.questionAnswerVersions = opts
} else if (val === 'fill_blank') {
//
const opt = _.cloneDeep(this.originOpt)
opt.gradingStandard = 'exact_match'
this.form.questionAnswerVersions = [opt]
form.questionAnswerVersions = [opt]
} else if (val === 'essay') {
//
const opt = _.cloneDeep(this.originOpt)
opt.gradingStandard = 'manual'
opt.referenceAnswer = ''
this.form.allowAttachment = 0
this.form.stemAttachment = ''
this.form.uploadInstructions = ''
this.form.questionAnswerVersions = [opt]
form.allowAttachment = 0
form.fileName = ''
form.stemAttachment = ''
form.uploadInstructions = ''
form.questionAnswerVersions = [opt]
} else {
this.handleSingleMultiple()
}
@ -645,6 +646,7 @@ export default {
let spanRegex = new RegExp('<span class="gapfilling-span" (.*?)>(.*?)______(.*?)<\\/span>', 'g')
let newFormItem = []
let gapfillingItems = content.match(spanRegex)
console.log("🚀 ~ questionItemReset ~ gapfillingItems:", gapfillingItems)
if (gapfillingItems !== null) {
gapfillingItems.forEach(function (span, index) {
let pairRegex = /<span class="gapfilling-span" data-id="(.*?)">(.*?)______(.*?)<\/span>/
@ -669,9 +671,11 @@ export default {
},
handleRemove () {
Oss.del(this.form.stemAttachment)
this.form.fileName = ''
this.form.stemAttachment = ''
},
uploadSuccess (file) {
this.form.fileName = file.name
this.form.stemAttachment = file.url
},
handleSelectionChange (val) {
@ -706,7 +710,8 @@ export default {
if (invalid) return false
if (!opt.find(e => e.answerIsCorrect)) return Util.warningMsg('请设置正确答案')
} else if (form.questionType === 'fill_blank') {
let scorePro = 0
let scorePro = 0 //
let filledPro = 0 //
for (const e of blanks) {
if (e.fills.every(n => !n.val)) {
Util.warningMsg('请输入填空项正确答案')
@ -714,9 +719,13 @@ export default {
break
}
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
@ -798,7 +807,7 @@ export default {
//
this.$emit('closeAdd')
} 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,
&:last-child {
&:last-child,
&.isDisabled {
.el-textarea {
width: calc(100% - 52px);
}

@ -208,6 +208,7 @@ import Setting from '@/setting'
import Breadcrumb from '@/components/breadcrumb'
import Detail from '../detail'
import Const from '@/const/ques'
import Qs from 'qs'
export default {
components: { Breadcrumb, Detail },
data () {
@ -254,7 +255,7 @@ export default {
referenceCountSort: '',
},
list: [],
page: 1,
page: +this.$route.query.page || 1,
pageSize: 10,
total: 0,
multipleSelection: [],
@ -296,15 +297,42 @@ export default {
},
},
mounted () {
const { referrer1 } = this.$store.state.user
console.log("🚀 ~ mounted ~ referrer1:", this.$route.query.questionTypes)
this.crumbs = [
{
name: this.questionBankName || '题库管理',
route: '/quesBank'
route: referrer1 || '/quesBank'
},
{
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.getProfessional()
this.getKnowledge()
@ -327,11 +355,20 @@ export default {
},
//
toSet () {
this.setReferrer()
this.$router.push({
path: '/knowledge',
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 () {
this.$refs.typeTree.setCurrentKey(null)
@ -429,6 +466,7 @@ export default {
//
add () {
this.setReferrer()
const knowledgeCheck = this.$refs.typeTree.getCurrentNode()
this.$router.push({
path: 'detail',
@ -440,6 +478,7 @@ export default {
},
// / type: 123
toDetail (row, type) {
this.setReferrer()
this.$router.push({
path: 'detail',
query: {

@ -101,6 +101,7 @@
<script>
import Setting from '@/setting'
import Util from '@/libs/util'
import Qs from 'qs'
import _ from 'lodash'
export default {
data () {
@ -127,7 +128,7 @@ export default {
},
listLoading: false,
list: [],
page: 1,
page: +this.$route.query.page || 1,
pageSize: 10,
total: 0,
multipleSelection: [],
@ -159,6 +160,17 @@ export default {
}
},
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()
},
methods: {
@ -269,6 +281,10 @@ export default {
},
//
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}`)
},
// /

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

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

@ -162,8 +162,9 @@
</el-table-column>
</el-table>
<div class="pagination">
<el-pagination background @current-change="currentChange" :current-page="page"
layout="total, prev, pager, next" :total="total"></el-pagination>
<el-pagination background layout="total, prev, pager, next" :total="total" @current-change="currentChange"
:current-page="page">
</el-pagination>
</div>
</div>
</div>
@ -191,23 +192,17 @@ import _ from 'lodash'
import Breadcrumb from '@/components/breadcrumb'
import QuesConst from '@/const/ques'
import TestPaperConst from '@/const/testPaper'
import Qs from 'qs'
export default {
components: { Breadcrumb },
data () {
return {
crumbs: [
{
name: this.$route.query.name || '中台试卷库',
route: '/testPaperLibrary'
},
{
name: '试卷管理'
},
],
crumbs: [],
questionTypes: QuesConst.questionTypes,
difficults: TestPaperConst.difficults,
paperTypes: TestPaperConst.paperTypes,
typeId: this.$route.query.id,
libraryId: this.$route.query.id,
name: this.$route.query.name,
createSource: 1,
loading: false,
types: [],
@ -259,7 +254,7 @@ export default {
},
listLoading: false,
list: [],
page: 1,
page: +this.$route.query.page || 1,
pageSize: 10,
total: 0,
multipleSelection: [],
@ -280,6 +275,37 @@ export default {
},
},
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.getProfessional()
},
@ -290,7 +316,7 @@ export default {
this.loading = true
const res = await this.$post(this.api.examClassificationList, {
createSource: this.createSource,
libraryId: this.typeId,
libraryId: this.libraryId,
})
const data = res.treeList
this.handleType(data)
@ -377,7 +403,7 @@ export default {
form.level = 1
}
form.createSource = this.createSource
form.libraryId = this.typeId
form.libraryId = this.libraryId
await this.$post(this.api[form.classificationId ? 'examClassificationUpdate' : 'examClassificationSave'], form)
Util.successMsg('保存成功')
this.closeType()
@ -419,7 +445,7 @@ export default {
type: this.isNotJoin,
pageNum: this.page,
pageSize: this.pageSize,
libraryId: this.typeId,
libraryId: this.libraryId,
classificationId: type ? type.getCurrentKey() || '' : '',
})
this.list = res.pageList.records
@ -473,13 +499,23 @@ export default {
})
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 () {
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 = '') {
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) {

@ -85,15 +85,17 @@
<!-- 简答题需要展示题干文件及富文本 -->
<template v-if="item.questionType === 'essay'">
<div v-if="ques.stemAttachment" class="m-b-20">
<el-link class="m-r-10" type="primary">{{ ques.stemAttachment }}</el-link>
<el-button type="primary" size="mini" round @click="download(ques.stemAttachment)">下载</el-button>
<el-link class="m-r-10" type="primary" @click="preview(ques.stemAttachment)">{{ 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">
<span>上传附件</span>
<span>上传要求说明</span>
<div v-html="form.uploadInstructions"></div>
</div>
<el-upload action="#">
@ -106,6 +108,12 @@
</li>
</ul>
</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>
</template>
@ -118,10 +126,11 @@ import _ from 'lodash'
import Oss from '@/components/upload/upload.js'
import Upload from '@/components/upload'
import UeditorPlus from '@/components/ueditorPlus'
import PdfDia from '@/components/pdf'
export default {
components: {
Upload, UeditorPlus
Upload, UeditorPlus, PdfDia
},
data () {
return {
@ -145,6 +154,10 @@ export default {
form: {
questionCount: 0,
},
previewImgVisible: false,
previewImg: '',
pdfVisible: false,
pdfSrc: '',
};
},
mounted () {
@ -332,9 +345,22 @@ export default {
})
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) {
Util.downloadFile(url, url)
download (name, url) {
Util.downloadFile(name, url)
},
handleRemove (ques) {
Oss.del(ques.attachmentUrl)
@ -630,6 +656,10 @@ export default {
max-width: calc(100% - 191px);
}
img {
max-width: 100%;
}
.fill-input {
width: 100px;
height: 28px;

@ -104,10 +104,9 @@
<script>
import Util from '@/libs/util'
import Setting from '@/setting'
// import UeditorPlus from '@/components/ueditorPlus'
import Qs from 'qs'
import _ from 'lodash'
export default {
// components: { UeditorPlus },
data () {
return {
loading: false,
@ -131,7 +130,7 @@ export default {
keyWord: '',
},
list: [],
page: 1,
page: +this.$route.query.page || 1,
pageSize: 10,
total: 0,
multipleSelection: [],
@ -163,6 +162,17 @@ export default {
}
},
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()
},
methods: {
@ -288,6 +298,10 @@ export default {
},
//
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}`)
},
// /

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

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

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

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

@ -6,35 +6,40 @@ import addRoutes from '@/libs/route/addRoutes'
* 用户信息
* */
export default {
namespaced: true,
state: {
avatar: "https://cube.elemecdn.com/3/7c/3ea6beec64369c2642b92c6726f1epng.png",
userId: '',
userName: '',
crumbs: ''
namespaced: true,
state: {
avatar: "https://cube.elemecdn.com/3/7c/3ea6beec64369c2642b92c6726f1epng.png",
userId: '',
userName: '',
crumbs: '',
referrer1: '',
referrer2: '',
},
mutations: {
setAvatar: (state, avatar) => {
state.avatar = avatar
},
mutations: {
setAvatar: (state, avatar) => {
state.avatar = avatar
},
setUserId: (state, userId) => {
state.userId = userId
},
setUserName: (state, userName) => {
state.userName = userName
},
setCrumbs: (state, crumbs) => {
state.crumbs = crumbs
}
setUserId: (state, userId) => {
state.userId = userId
},
actions: {
logout({ commit, state, dispatch }) {
return new Promise((resolve, reject) => {
util.local.remove(Setting.storeKey)
util.local.remove(Setting.tokenKey)
location.reload()
resolve()
})
}
setUserName: (state, userName) => {
state.userName = userName
},
setCrumbs: (state, crumbs) => {
state.crumbs = crumbs
},
setReferrer: (state, o) => {
state['referrer' + o.i] = o.url
},
},
actions: {
logout ({ commit, state, dispatch }) {
return new Promise((resolve, reject) => {
util.local.remove(Setting.storeKey)
util.local.remove(Setting.tokenKey)
location.reload()
resolve()
})
}
}
};
Loading…
Cancel
Save