<template>
|
<div style="line-height:1.3">
|
<div v-if="qType==1" v-loading="qLoading">
|
<div class="q-title" v-html="qLabel+' '+question.title" style="font-size: 23px"/>
|
<div class="q-content">
|
<el-radio-group v-model="answer.content" @change="answer.completed = true">
|
<el-radio v-for="item in question.items" :key="item.prefix" :label="item.prefix" @change="jumpNext" :disabled="answer.readOnly" style="display:block;border:1px solid #b3b5ba;margin:5px 0px 5px 0px;padding:0px 25px 0px 15px;border-radius:5px;">
|
<span class="question-prefix" style="font-size: 18px">{{abcValue[item.prefix]}}.</span>
|
<span v-html="item.content" class="q-item-span-content" style="font-size: 18px"></span>
|
</el-radio>
|
</el-radio-group>
|
</div>
|
</div>
|
<div v-else-if="qType==2" v-loading="qLoading">
|
<div class="q-title" v-html="question.title"/>
|
<div class="q-content">
|
<el-checkbox-group v-model="answer.contentArray" @change="answer.completed = true" >
|
<el-checkbox v-for="item in question.items" :label="item.prefix" :key="item.prefix" @change="jumpNext" >
|
<span class="question-prefix">{{item.prefix}}.</span>
|
<span v-html="item.content" class="q-item-span-content"></span>
|
</el-checkbox>
|
</el-checkbox-group>
|
</div>
|
</div>
|
<div v-else-if="qType==3" v-loading="qLoading">
|
<div class="q-title" v-html="question.title" style="display: inline;margin-right: 10px"/>
|
<span style="padding-right: 10px;">(</span>
|
<el-radio-group v-model="answer.content" @change="answer.completed = true" >
|
<el-radio v-for="item in question.items" :key="item.prefix" :label="item.prefix" @change="jumpNext" >
|
<span v-html="item.content" class="q-item-span-content"></span>
|
</el-radio>
|
</el-radio-group>
|
<span style="padding-left: 10px;">)</span>
|
</div>
|
<div v-else-if="qType==4" v-loading="qLoading">
|
<div class="q-title" v-html="question.title"/>
|
<div>
|
<el-form-item :label="item.prefix" :key="item.prefix" v-for="item in question.items" label-width="50px" style="margin-top: 10px;margin-bottom: 10px;">
|
<el-input v-model="answer.contentArray[item.prefix-1]" @change="answer.completed = true" />
|
</el-form-item>
|
</div>
|
</div>
|
<div v-else-if="qType==5" v-loading="qLoading">
|
<div class="q-title" v-html="question.title"/>
|
<div>
|
<el-input v-model="answer.content" type="textarea" rows="5" @change="answer.completed = true"/>
|
</div>
|
</div>
|
<div v-else>
|
</div>
|
</div>
|
|
</template>
|
|
<script>
|
export default {
|
name: 'QuestionShow',
|
data () {
|
return {
|
abcValue: { '1': 'A', '2': 'B', '3': 'C', '4': 'D', '5': 'E', '6': 'F', '7': 'G', '8': 'H', '9': 'I', '10': 'J' }
|
}
|
},
|
props: {
|
question: {
|
type: Object,
|
default: function () {
|
return {}
|
}
|
},
|
answer: {
|
type: Object,
|
default: function () {
|
return { id: null, content: '', contentArray: [] }
|
}
|
},
|
qLoading: {
|
type: Boolean,
|
default: false
|
},
|
qType: {
|
type: Number,
|
default: 0
|
},
|
qLabel: {
|
type: String,
|
default: ''
|
}
|
},
|
methods: {
|
jumpNext () {
|
let _this = this
|
this.answer.readOnly = true
|
if (this.answer.content === null || this.answer.content.trim() === '') {
|
return
|
}
|
setTimeout(function () {
|
_this.$emit('callNextSubject')
|
}, 500)
|
}
|
}
|
}
|
</script>
|
|
<style lang="scss" scoped>
|
span:hover {
|
font-weight: bold;
|
}
|
|
.q-content {
|
margin: 10px 10px 15px 25px;
|
|
p {
|
display: inline !important;
|
}
|
|
.el-checkbox__input {
|
line-height: 1.8;
|
vertical-align: top;
|
}
|
}
|
</style>
|