提交 e527f099 authored 作者: 王鹏飞's avatar 王鹏飞

updates

上级 15bafdeb
$--color-primary: #c01c40;
$--color-info: #3c4043;
// border
$--border-radius-small: 8px !default;
// checkbox
$--checkbox-border-radius: 2px !default;
// dialog
$--message-close-size: 20px !default;
......
......@@ -143,7 +143,7 @@ export default {
return
}
// 参数设置
let params = this.params
let params = { ...this.params }
// 翻页参数设置
if (this.hasPagination) {
params.page = this.page.currentPage.toString()
......
......@@ -13,17 +13,20 @@ import { getQuestionCategory } from '@/api/base.js'
export default {
data() {
return {
options: [],
defaultProps: {
label: 'category_name',
value: 'id',
checkStrictly: true
}
options: []
}
},
computed: {
activeProject() {
return this.$store.state.activeProject || {}
},
defaultProps() {
return {
label: 'category_name',
value: 'id',
checkStrictly: true,
multiple: this.$attrs.multiple || false
}
}
},
beforeMount() {
......
......@@ -57,16 +57,22 @@ export function updatePaperRules(data) {
return httpRequest.post(`/api/qbs/admin/v1/question-paper/rules/${data.id}`, data)
}
/**
* 搜索试题数量--自动组卷
*/
export function getQuestionCount(params) {
return httpRequest.get('/api/qbs/admin/v1/question/search/count', { params })
}
/**
* 获取试卷分类
*/
export function getPaperCategory(params) {
return httpRequest.get(`/api/qbs/admin/v1/question-category/tree/${params.project_prefix}`, { params })
}
/**
* 获取知识点/标签
*/
export function getKnowledge(params) {
return httpRequest.get('/admin/v1/knowledge-point/search/x1', { params })
return httpRequest.get('/api/admin/v1/knowledge-point/search/x1', { params })
}
......@@ -3,8 +3,10 @@
<div style="margin: 0 20px">
<!-- 选题组卷添加试卷第一步 -->
<div v-show="step === 1">
<app-list v-bind="tableOptions" ref="list" @selection-change="handleSelectionChange"></app-list>
<el-button type="primary" class="nextStep" @click="nextStep">下一步</el-button>
<question-select @selection-change="handleSelectionChange"></question-select>
<div class="buttons">
<el-button type="primary" @click="nextStep">下一步</el-button>
</div>
</div>
<!-- 选题组卷添加试卷第二步 -->
<div v-show="step === 2">
......@@ -19,136 +21,65 @@
<el-form-item label="此次试卷总分:">{{ data.paper_total_score }}</el-form-item>
<el-form-item label="已设置试题总分:">{{ addedQuestionsScore }}</el-form-item>
<el-divider></el-divider>
<el-form-item
:label="item.question_type_name + ':'"
v-for="(item, index) in questionTypeGroups"
:key="index"
>
<span>数量:{{ item.total }}</span>
<span style="margin-left: 20px"
>分值: <el-input v-model="item.score" style="width: 100px"></el-input>{{ item.score }}</span
<template v-if="setMethod === 1">
<el-form-item
:label="item.question_type_name + ':'"
:key="index"
v-for="(item, index) in questionTypeGroups"
>
<!-- <template v-if="canBatchSetting(item.question_type)">
<el-button type="primary" class="settingScore" @click="batchSetting">批量设置分数</el-button>
</template>
<template v-else>
<span class="settingScore">此题型只能在试卷详情页面逐一设置</span>
</template> -->
</el-form-item>
<el-button type="primary" @click="prevStep">上一步</el-button>
<el-button type="primary" style="margin-left: 20px" @click="handleSubmit">保存</el-button>
<ul>
<li>数量:{{ item.total }}</li>
<li>分值: {{ item.score }}</li>
<li>
<template v-if="canBatchSetting(item.question_type)">
<el-button type="primary" class="settingScore" @click="showBatchSetting(item)"
>批量设置分数</el-button
>
</template>
<template v-else>
<span class="settingScore">此题型只能在试卷详情页面逐一设置</span>
</template>
</li>
</ul>
</el-form-item>
</template>
</el-form>
<div class="buttons">
<el-button type="primary" @click="prevStep">上一步</el-button>
<el-button type="primary" style="margin-left: 20px" @click="handleSave">保存</el-button>
</div>
</div>
<BatchSetting :visible.sync="visible" />
<BatchSetting
:visible.sync="visible"
:data="questionTypeGroups[batchSettingQuestionType]"
@update="handleUpdateScore"
v-if="visible"
/>
</div>
</el-drawer>
</template>
<script>
import QuestionSelect from './QuestionSelect.vue'
import BatchSetting from './BatchSetting.vue'
import { getQuestionList, batchGetQuestionList, updatePaperRules } from '../api.js'
import { batchGetQuestionList, updatePaperRules } from '../api.js'
export default {
props: {
data: { type: Object, default: () => ({}) }
},
components: { BatchSetting },
components: { QuestionSelect, BatchSetting },
data() {
return {
visible: false,
multipleSelection: [], // 选择项
multipleSelection: [], // 选择的试题,不包含子题
setMethod: 1, // 设置方式
step: 1,
questions: [], // 试题列表
questionTypeGroups: {} // 试题类型组
questions: [], // 选择的完整试题列表
questionTypeGroups: {}, // 试题类型组
visible: false,
batchSettingQuestionType: null // 批量设置试题类型
}
},
computed: {
tableOptions() {
return {
remote: {
httpRequest: getQuestionList,
params: { question_type: '', question_title: '', question_difficulty: '', question_category: '' }
},
filters: [
{
type: 'select',
prop: 'question_type',
placeholder: '请选择题目类型',
options: [
{ label: '单选题', value: '1' },
{ label: '多选题', value: '2' },
{ label: '问答题', value: '3' },
{ label: '案例题', value: '5' },
{ label: '判断题', value: '6' },
{ label: '实操题', value: '7' },
{ label: '情景题', value: '8' }
],
label: '题目类型'
},
{
type: 'select',
prop: 'question_difficulty',
placeholder: '请选择题目难度等级',
options: [
{ label: '易', value: '1' },
{ label: '中', value: '2' },
{ label: '难', value: '3' }
],
label: '难度等级'
},
{
type: 'input',
prop: 'question_category',
placeholder: '请选择试题分类',
options: this.staffList,
label: '试题分类'
},
{
type: 'input',
prop: 'question_title',
label: '题目标题',
placeholder: '请输入题目标题'
},
{
type: 'input',
prop: 'name4',
label: '题干内容',
placeholder: '请输入题干内容'
},
{
type: 'input',
prop: 'name5',
label: '知识点',
placeholder: '请输入知识点'
}
],
columns: [
{ type: 'selection' },
{ type: 'index', label: '序号' },
{
label: '题目类型',
prop: 'question_type',
computed: ({ row }) => {
const map = { 1: '单选题', 2: '多选题', 3: '问答题', 5: '案例题', 6: '判断题', 7: '实操题', 8: '情景题' }
return map[row.question_type] || row.question_type
}
},
{ label: '试卷分类', prop: 'question_category.category_name' },
{ label: '题目标题', prop: 'question_title' },
{ label: '知识点', prop: 'knowledge_point.title' },
{
label: '难度等级',
prop: 'question_difficulty',
computed: ({ row }) => {
const map = { 1: '易', 2: '中', 3: '难' }
return map[row.question_difficulty] || row.question_difficulty
}
},
{ label: '更新人', prop: 'operator.realname' }
]
}
},
// 已添加的试题
addedQuestions() {
return this.data.questions || []
......@@ -161,8 +92,8 @@ export default {
}
},
methods: {
handleSelectionChange(val) {
this.multipleSelection = val
handleSelectionChange(value) {
this.multipleSelection = value
},
// 下一步
nextStep() {
......@@ -193,7 +124,7 @@ export default {
total: 1,
question_type: item.question_type,
question_type_name: map[item.question_type],
score: '',
score: '0',
questions: [item]
}
}
......@@ -205,18 +136,44 @@ export default {
canBatchSetting(value) {
return [1, 2, 6].includes(value)
},
batchSetting() {
// 批量设置分数
showBatchSetting(data) {
this.visible = true
this.batchSettingQuestionType = data.question_type
},
handleUpdateScore(data) {
const { question_type: questionType, score } = data
this.questionTypeGroups[questionType].score = score
},
// 保存
handleSave() {
// 批量设置分数
if (this.setMethod === 1) {
this.questions = this.questions.map(item => {
return { ...item, score: this.questionTypeGroups[item.question_type].score }
})
}
// 合并已添加和选择的试题,新的替换旧的
const questionList = this.addedQuestions.reduce((result, item) => {
if (!result.find(item2 => item2.id === item.id)) {
result.unshift(item)
}
return result
}, this.questions)
// 更新详情页的试题
this.$emit('update', questionList)
// 关闭弹框
this.$emit('update:visible', false)
},
// 保存,更新试卷规则
handleSubmit() {
const rules = []
Object.values(this.questionTypeGroups).forEach(item => {
item.questions.forEach(question => {
rules.push({ id: question.id, score: item.score || 0 })
rules.push({ id: question.id, score: item.score })
if (item.children && item.children.length) {
item.children.forEach(question => {
rules.push({ id: question.id, score: item.score || 0 })
rules.push({ id: question.id, score: item.score })
})
}
})
......@@ -232,13 +189,20 @@ export default {
}
</script>
<style lang="scss" scoped>
.nextStep {
.buttons {
position: absolute;
left: 50%;
bottom: 10px;
bottom: 30px;
transform: translateX(-50%);
text-align: center;
}
.settingScore {
margin-left: 120px;
ul {
display: flex;
li {
margin-right: 20px;
min-width: 140px;
line-height: 32px;
color: #606266;
}
}
</style>
<template>
<el-dialog title="批量设置分数" v-bind="$attrs" v-on="$listeners" append-to-body width="400px">
<el-form>
<el-form-item>单选题</el-form-item>
<el-form-item>数量:8</el-form-item>
<el-form-item label="每道试题分值"> <el-input></el-input></el-form-item>
<el-dialog
title="批量设置分数"
v-bind="$attrs"
v-on="$listeners"
append-to-body
:close-on-click-modal="false"
width="400px"
>
<el-form :model="form" :rules="rules" ref="form">
<el-form-item label="单选题"></el-form-item>
<el-form-item label="数量">8</el-form-item>
<el-form-item label="每道试题分值" prop="score"><el-input v-model="form.score"></el-input></el-form-item>
<el-form-item>
<el-button type="primary" @click="saveSetting">保存</el-button>
<el-button type="primary" @click="handleSubmit">保存</el-button>
</el-form-item>
</el-form>
</el-dialog>
......@@ -13,12 +20,24 @@
<script>
export default {
props: {
data: { type: Object, default: () => ({}) }
},
data() {
return {
form: { score: '0' },
rules: {
score: [{ required: true, message: '请输入试题分值', trigger: 'blur' }]
}
}
},
methods: {
saveSetting() {
this.$emit('update:visible', false)
handleSubmit() {
this.$refs.form.validate().then(() => {
this.$emit('update', Object.assign({}, this.data, this.form))
this.$emit('update:visible', false)
})
}
}
}
</script>
<style></style>
......@@ -5,20 +5,27 @@
<el-col :span="18">
<app-card title="试题列表">
<template #header-aside>
<el-button type="primary" @click="handleAdd">添加试题</el-button>
<el-button type="primary" @click="handleRemove">删除选中试题</el-button>
<template v-if="data.paper_type === 1">
<el-button type="primary" @click="showSelectQuestion">添加试题</el-button>
<el-button type="primary" :disabled="!multipleSelection.length" @click="handleRemove"
>删除选中试题</el-button
>
</template>
<template v-if="data.paper_type === 2">
<el-button type="primary" @click="showSelectQuestion">自动组卷</el-button>
</template>
</template>
<question-list :list="questions">
<template v-slot:selection="item">
<question-list :list="questions" :disableScore="data.paper_type === 2" style="margin-top: 20px">
<template v-slot:selection="item" v-if="data.paper_type === 1">
<el-checkbox @change="handleSelectionChange(arguments[0], item)"></el-checkbox>
</template>
</question-list>
</app-card>
</el-col>
<!-- 试题序号 -->
<el-col :span="6">
<question-num :list="questions">
<template #footer>
<el-col :span="6" ref="questionNumWrapper">
<question-num :list="questions" ref="questionNum" :style="`position:relative;top:${top}px`">
<template #footer v-if="data.paper_type === 1">
<el-button type="primary" @click="handleSubmit">保存试卷</el-button>
</template>
</question-num>
......@@ -26,11 +33,11 @@
</el-row>
<!-- 选题组卷 -->
<template v-if="data.paper_type === 1">
<addPaper :visible.sync="visible" :data="data" @update="handelUpdate" v-if="visible" />
<addPaper :visible.sync="visible" :data="data" @update="handleUpdate" v-if="visible" />
</template>
<!-- 自动组卷 -->
<template v-if="data.paper_type === 2">
<AutomaticPaper :visible.sync="visible" :data="data" @update="handelUpdate" v-if="visible" />
<AutomaticPaper :visible.sync="visible" :data="data" @update="$emit('update')" v-if="visible" />
</template>
</div>
</template>
......@@ -50,7 +57,8 @@ export default {
return {
visible: false,
questions: [],
multipleSelection: [] // 选择项
multipleSelection: [], // 选择项
top: 0
}
},
watch: {
......@@ -59,12 +67,29 @@ export default {
handler(data) {
this.questions = data.questions || []
}
},
'$route.query.select': {
immediate: true,
handler(value) {
value && this.showSelectQuestion()
}
}
},
computed: {},
mounted() {
const questionNumWrapper = this.$refs.questionNumWrapper.$el
const parentTop = questionNumWrapper.getBoundingClientRect().top
document.addEventListener('scroll', () => {
const scrollTop = document.documentElement.scrollTop || document.body.scrollTop
if (scrollTop > parentTop) {
this.top = scrollTop - parentTop + 84
} else {
this.top = 0
}
})
},
methods: {
// 增加试题
handleAdd() {
showSelectQuestion() {
this.visible = true
},
handleSelectionChange(checked, data) {
......@@ -95,9 +120,19 @@ export default {
})
},
// 更新详情数据
handelUpdate() {
this.$emit('update')
handleUpdate(list) {
this.questions = list
// this.$emit('update')
}
}
}
</script>
<style lang="scss" scoped>
.fixed {
position: relative;
top: 64px;
right: 0;
z-index: 100;
}
</style>
<template>
<div class="question-list">
<template v-for="(item, index) in list">
<question-list-item :data="item" :index="index + 1" :key="item.id" v-on="$listeners">
<question-list-item :data="item" :index="index + 1" :key="item.id" v-bind="$attrs" v-on="$listeners">
<template v-if="item.children && item.children.length">
<question-list :list="item.children" :key="item.id" v-on="$listeners">
<question-list :list="item.children" :key="item.id" v-bind="$attrs" v-on="$listeners">
<template #selection>
<slot name="selection" v-bind="item"></slot>
</template>
......
<template>
<el-card style="margin-bottom: 20px" shadow="hover">
<div class="question-item">
<div class="question-item-hd">
<div class="question-item-hd-top">
<slot name="selection"></slot>
<div class="question-index">{{ index }}</div>
<div class="question-type">{{ questionTypeText }}</div>
<div class="question-score">
<p>分数:</p>
<el-input v-model="data.score" style="width: 100px"></el-input>
<div class="question-item-selection">
<slot name="selection"></slot>
</div>
<div class="question-item-main">
<div class="question-item-hd">
<div class="question-item-hd-top">
<div class="question-index">{{ index }}</div>
<div class="question-type">{{ questionTypeText }}</div>
<div class="question-score">
<p>分数:</p>
<el-input v-model="data.score" :disabled="disableScore" style="width: 100px"></el-input>
</div>
</div>
<!-- 题干 -->
<div class="question-title" v-html="data.question_content"></div>
</div>
<!-- 题干 -->
<div class="question-title" v-html="data.question_content"></div>
<slot>
<div class="question-item-bd">
<!-- 单选题 -->
<template v-if="questionType === 1">
<el-radio-group :disabled="disabled" :value="data.question_answer">
<div class="question-item-option" v-for="item in data.question_options" :key="item.id">
<el-radio :label="item.id">{{ item.option }}</el-radio>
</div>
</el-radio-group>
</template>
<!-- 多选题 -->
<template v-if="questionType === 2">
<el-checkbox-group :disabled="disabled" :value="data.question_answer">
<div class="question-item-option" v-for="item in data.question_options" :key="item.id">
<el-checkbox :label="item.id"> {{ item.option }} </el-checkbox>
</div>
</el-checkbox-group>
</template>
<!-- 问答题 -->
<template v-if="questionType === 3">
<v-editor></v-editor>
</template>
<!-- 判断题 -->
<template v-if="questionType === 6">
<el-radio-group :disabled="disabled" :value="data.question_answer">
<div class="question-item-option" v-for="item in data.question_options" :key="item.id">
<el-radio :label="item.id">{{ item.option }}</el-radio>
</div>
</el-radio-group>
</template>
</div>
</slot>
<div class="question-item-ft"></div>
</div>
<slot>
<div class="question-item-bd">
<!-- 单选题 -->
<template v-if="questionType === 1">
<el-radio-group :disabled="disabled" :value="data.question_answer[0]">
<div class="question-item-option" v-for="item in data.question_options" :key="item.id">
<el-radio :label="item.id">{{ item.option }}</el-radio>
</div>
</el-radio-group>
</template>
<!-- 多选题 -->
<template v-if="questionType === 2">
<el-checkbox-group :disabled="disabled" :value="data.question_answer">
<div class="question-item-option" v-for="item in data.question_options" :key="item.id">
<el-checkbox :label="item.id"> {{ item.option }} </el-checkbox>
</div>
</el-checkbox-group>
</template>
<!-- 问答题 -->
<template v-if="questionType === 3">
<v-editor></v-editor>
</template>
<!-- 判断题 -->
<template v-if="questionType === 6">
<el-radio-group :disabled="disabled" :value="data.question_answer">
<div class="question-item-option" v-for="item in data.question_options" :key="item.id">
<el-radio :label="item.id">{{ item.option }}</el-radio>
</div>
</el-radio-group>
</template>
</div>
</slot>
<div class="question-item-ft"></div>
</div>
</el-card>
</template>
......@@ -57,7 +61,8 @@ export default {
props: {
index: { type: Number, default: 1 },
disabled: { type: Boolean, default: false },
data: { type: Object, default: () => ({}) }
data: { type: Object, default: () => ({}) },
disableScore: { type: Boolean, default: false }
},
components: { VEditor },
data() {
......@@ -69,7 +74,7 @@ export default {
data: {
immediate: true,
handler(data) {
this.question = this.genQuestion(data)
// this.question = this.genQuestion(data)
}
}
},
......@@ -100,10 +105,23 @@ export default {
</script>
<style lang="scss" scoped>
.question-item {
display: flex;
}
.question-item-selection {
margin-right: 10px;
padding-top: 3px;
}
.question-item-selection:empty {
margin: 0;
}
.question-item-main {
flex: 1;
}
.question-item-hd-top {
display: flex;
align-items: center;
.question-index {
margin-left: 10px;
color: #c01c40;
}
.question-type {
......
<template>
<app-card class="fixed">
<app-card>
<div class="question-num">
<div class="question-num-bd">
<ul>
......@@ -43,10 +43,6 @@ export default {
</script>
<style lang="scss" scoped>
.fixed {
position: sticky;
top: 0;
}
.question-num {
ul {
display: flex;
......
<template>
<app-list v-bind="tableOptions" ref="list" style="padding-left: 30px"> </app-list>
<app-list v-bind="tableOptions" ref="list" v-on="$listeners">
<template v-slot:filter-permission="{ params }">
<el-radio-group v-model="params.permission" @change="refetchList">
<el-radio label="1">我的题库</el-radio>
<el-radio label="2">公共题库</el-radio>
</el-radio-group>
</template>
<template v-slot:filter-category="{ params }">
<question-type-cascader v-model="params.question_category" @change="refetchList"></question-type-cascader>
</template>
</app-list>
</template>
<script>
import { getQuestionList } from '../api.js'
import QuestionTypeCascader from '@/components/base/QuestionTypeCascader.vue'
export default {
props: { data: { type: Object, default: () => ({}) } },
components: { QuestionTypeCascader },
data() {
return {}
},
computed: {
tableOptions() {
return {
limit: 10,
remote: {
httpRequest: getQuestionList,
params: {
permission: '1',
question_type: '',
question_title: '',
question_difficulty: '',
question_category: ''
}
},
filters: [
{
prop: 'permission',
label: '题库范围',
slots: 'filter-permission'
},
{
type: 'select',
prop: 'question_type',
placeholder: '请选择题目类型',
options: [
{ label: '单选题', value: '1' },
{ label: '多选题', value: '2' },
{ label: '问答题', value: '3' },
{ label: '案例题', value: '5' },
{ label: '判断题', value: '6' },
{ label: '实操题', value: '7' },
{ label: '情景题', value: '8' }
],
label: '题目类型'
},
{
type: 'select',
prop: 'question_difficulty',
placeholder: '请选择题目难度等级',
options: [
{ label: '易', value: '1' },
{ label: '中', value: '2' },
{ label: '难', value: '3' }
],
label: '难度等级'
},
{
prop: 'question_category',
label: '试题分类',
slots: 'filter-category'
},
{
type: 'input',
prop: 'question_title',
label: '题目标题',
placeholder: '请输入题目标题'
},
{
type: 'input',
prop: 'name4',
label: '题干内容',
placeholder: '请输入题干内容'
},
{
type: 'input',
prop: 'name5',
label: '知识点',
placeholder: '请输入知识点'
}
],
columns: [
{ type: 'selection' },
{ type: 'index', label: '序号' },
{
label: '题目类型',
prop: 'question_type',
computed: ({ row }) => {
const map = { 1: '单选题', 2: '多选题', 3: '问答题', 5: '案例题', 6: '判断题', 7: '实操题', 8: '情景题' }
return map[row.question_type] || row.question_type
}
},
{ label: '试卷分类', prop: 'question_category.category_name' },
{ label: '题目标题', prop: 'question_title' },
{ label: '知识点', prop: 'knowledge_point.title' },
{
label: '难度等级',
prop: 'question_difficulty',
computed: ({ row }) => {
const map = { 1: '易', 2: '中', 3: '难' }
return map[row.question_difficulty] || row.question_difficulty
}
},
{ label: '更新人', prop: 'operator.realname' }
]
}
}
},
methods: {
// 刷新列表
refetchList() {
// 刷新列表
this.$refs.list.refetch()
}
}
}
</script>
<style></style>
......@@ -15,13 +15,13 @@ const routes = [
{
name: 'createPaper',
path: 'create',
component: () => import('./views/NewPaper.vue'),
component: () => import('./views/Update.vue'),
meta: { title: '新建试卷' }
},
{
name: 'editPaper',
path: 'update/:id',
component: () => import('./views/NewPaper.vue'),
component: () => import('./views/Update.vue'),
meta: { title: '编辑试卷' },
props: true
},
......
......@@ -8,7 +8,7 @@
>
</div>
<template v-slot:filter-category="{ params }">
<question-type-cascader v-model="params.paper_category"></question-type-cascader>
<question-type-cascader v-model="params.paper_category" @change="refetchList"></question-type-cascader>
</template>
<template v-slot:table-x="{ row }">
<el-button type="text" @click="handleUpdate(row)">编辑</el-button>
......@@ -74,10 +74,8 @@ export default {
placeholder: '请输入试卷标签',
label: '标签:'
},
{
type: 'select',
prop: 'paperType',
prop: 'paper_category',
label: '试卷分类:',
slots: 'filter-category'
}
......@@ -146,8 +144,13 @@ export default {
batchDeletePaper(ids) {
batchDeletePaper({ ids }).then(res => {
// 刷新列表
this.$refs.list.refetch()
this.refetchList()
})
},
// 刷新列表
refetchList() {
// 刷新列表
this.$refs.list.refetch()
}
}
}
......
......@@ -172,14 +172,6 @@ export default {
questionSelectVisible: false
}
},
watch: {
'$route.query.select': {
immediate: true,
handler(value) {
value && this.showSelectQuestion()
}
}
},
computed: {
isEdit() {
return !!this.id
......@@ -194,15 +186,21 @@ export default {
methods: {
// 取消
handleCancel() {
this.$router.replace('/paper/list')
this.$router.back()
},
// 保存
handleSubmit() {
this.$refs.form.validate().then(() => {
// 保存成功回到列表
this.createPaper().then(res => {
this.$router.replace('/paper/list')
})
if (this.isEdit) {
this.updatePaper().then(res => {
this.$router.back()
})
} else {
this.createPaper().then(res => {
this.$router.replace('/paper/list')
})
}
})
},
// 保存并选择试题
......@@ -214,7 +212,7 @@ export default {
})
} else {
this.createPaper(res => {
this.$router.replace({ path: '/paper/update/' + res.data.id, query: { select: true } })
this.$router.replace({ path: '/paper/detail/' + res.data.id, query: { select: true } })
})
}
})
......@@ -247,7 +245,8 @@ export default {
// 获取试卷详情
getDetail() {
getPaper({ id: this.id }).then(res => {
this.form = Object.assign({}, this.form, res.data)
const data = res.data
this.form = Object.assign({}, this.form, data, { paper_category: data.paper_category.id })
})
}
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论