yujialong 2 weeks ago
parent 3329db2a05
commit e7867763ec
  1. 34
      src/pages/testPaper/detail/index.vue
  2. 5
      src/router/routes.js

@ -1,8 +1,9 @@
<template> <template>
<div class="page"> <div class="page">
<Breadcrumb :data="crumbs" /> <Breadcrumb v-if="!readonly" :data="crumbs" />
<div v-loading="loading"> <div v-loading="loading">
<el-form :model="form" :rules="rules" class="input-form model" ref="form" label-width="140px"> <el-form :model="form" :rules="rules" :disabled="readonly" :class="['input-form model', { disabled: readonly }]"
ref="form" label-width="140px">
<p class="page-name mb">试卷基础信息</p> <p class="page-name mb">试卷基础信息</p>
<el-form-item prop="name" label="试卷名称"> <el-form-item prop="name" label="试卷名称">
<el-input style="width: 940px" placeholder="请输入试卷名称" v-model="form.name" clearable maxlength="100" /> <el-input style="width: 940px" placeholder="请输入试卷名称" v-model="form.name" clearable maxlength="100" />
@ -96,7 +97,7 @@
<el-input placeholder="请输入目标分值" v-model="scope.row.targetScore" /> <el-input placeholder="请输入目标分值" v-model="scope.row.targetScore" />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作" align="center" width="120"> <el-table-column v-if="!readonly" label="操作" align="center" width="120">
<template slot-scope="scope"> <template slot-scope="scope">
<i class="el-icon-circle-plus-outline action-icon m-r-10" @click="addLine(scope.$index)"></i> <i class="el-icon-circle-plus-outline action-icon m-r-10" @click="addLine(scope.$index)"></i>
<i v-if="form.paperOutline.length > 1" class="el-icon-remove-outline action-icon" <i v-if="form.paperOutline.length > 1" class="el-icon-remove-outline action-icon"
@ -137,7 +138,7 @@
<div :class="['ques-wrap', { hide: item.shrink }]"> <div :class="['ques-wrap', { hide: item.shrink }]">
<draggable v-model="item.examQuestions" :group="dragGroup" chosenClass="chosen" animation="1000" <draggable v-model="item.examQuestions" :group="dragGroup" chosenClass="chosen" animation="1000"
@update="e => updateSort(e, item)"> :disabled="readonly" @update="e => updateSort(e, item)">
<div v-for="(ques, j) in item.examQuestions" :key="j" class="ques-item"> <div v-for="(ques, j) in item.examQuestions" :key="j" class="ques-item">
<el-checkbox v-model="ques.check"></el-checkbox> <el-checkbox v-model="ques.check"></el-checkbox>
<div :class="['ques-info', { disabled: !ques.status, del: ques.isDel, repeat: ques.repeat }]"> <div :class="['ques-info', { disabled: !ques.status, del: ques.isDel, repeat: ques.repeat }]">
@ -216,10 +217,12 @@
</ul> </ul>
</el-form> </el-form>
<div class="btns"> <div class="btns">
<el-button @click="submit(0)">保存草稿</el-button> <template v-if="!readonly">
<el-button type="primary" @click="submit(1)">发布</el-button> <el-button @click="submit(0)">保存草稿</el-button>
<el-button type="primary" @click="submit(1)">发布</el-button>
</template>
<el-button v-if="paperId" @click="preview">预览</el-button> <el-button v-if="paperId" @click="preview">预览</el-button>
<el-button @click="back">取消</el-button> <el-button v-if="!readonly" @click="back">取消</el-button>
</div> </div>
</div> </div>
@ -288,7 +291,8 @@ export default {
numToLetter: Util.numToLetter, numToLetter: Util.numToLetter,
paperId: this.$route.query.paperId, paperId: this.$route.query.paperId,
libraryId: this.$route.query.libraryId, libraryId: this.$route.query.libraryId,
isCopy: this.$route.query.isCopy, isCopy: this.$route.query.isCopy, //
readonly: !!this.$route.query.readonly, //
loading: false, loading: false,
headers: { headers: {
token: Util.local.get(Setting.tokenKey) token: Util.local.get(Setting.tokenKey)
@ -444,7 +448,7 @@ export default {
route: referrer2 || 'list', route: referrer2 || 'list',
}, },
{ {
name: '创建试卷' name: `${this.isCopy ? '复制' : this.readonly ? '查看' : this.paperId ? '编辑' : '创建'}试卷`
}, },
] ]
@ -519,6 +523,7 @@ export default {
}, },
// //
remarksReady (editor) { remarksReady (editor) {
this.readonly && editor.setDisabled()
this.form.remarks && editor.setContent(this.form.remarks) this.form.remarks && editor.setContent(this.form.remarks)
}, },
// //
@ -1057,7 +1062,7 @@ export default {
}, },
// //
preview () { preview () {
window.open(this.$router.resolve(`preview?id=${this.paperId}`).href) window.open(this.$router.resolve(`/testPaper/preview?id=${this.paperId}`).href)
}, },
// //
back () { back () {
@ -1098,6 +1103,15 @@ export default {
<style lang="scss" scoped> <style lang="scss" scoped>
.input-form.model { .input-form.model {
height: calc(100vh - 130px); height: calc(100vh - 130px);
&.disabled {
height: calc(100vh - 50px);
padding-bottom: 40px;
}
}
.btns {
z-index: 100;
} }
.tem-btn { .tem-btn {

@ -25,6 +25,11 @@ const frameIn = [
component: () => import('@/pages/testPaper/preview'), component: () => import('@/pages/testPaper/preview'),
meta: { title: '试卷预览' } meta: { title: '试卷预览' }
}, },
{
path: '/testPaperDetail',
component: () => import('@/pages/testPaper/detail'),
meta: { title: '试卷管理' }
},
...modules ...modules
]; ];

Loading…
Cancel
Save