[测评系统]--前端(用户答题页面)
linzhijie
2023-05-22 09849a3fbe456ac307d167d4d65d7d68e19ad410
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
<template>
  <div style="line-height:1.8">
    <div v-if="qType==1" v-loading="qLoading">
      <div class="q-title" v-html="qLabel+'&nbsp;&nbsp;'+question.title" style="font-size: x-large"/>
      <div class="q-content" :hidden="question.template==='intelligence_title'">
        <el-radio-group v-model="answer.content" @change="answer.completed = true">
          <el-radio class="intelligence-el_radio"  v-for="(item, index) in question.items"  :key="item.prefix"  :label="item.prefix" @change="jumpNext" :disabled="answer.readOnly" :style="{display:displayVal}">
            <span class="question-prefix" style="font-size: 18px">{{abcValue[index+1]}}.</span>
            <span v-html="item.content" class="q-item-span-content" style="font-size: 18px"></span>
            <br>
          </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: 'QuestionIntelligenceShow',
  data () {
    return {
      abcValue: { 1: 'A', 2: 'B', 3: 'C', 4: 'D', 5: 'E', 6: 'F' }
      // abcValue: { '1': 'A', '2': 'B', '3': 'C', '4': 'D', '5': 'E', '6': 'F' }
    }
  },
  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: ''
    },
    order: {
      type: Number,
      default: 0
    },
    displayVal: {
      type: String,
      default: 'block'
    }
  },
  methods: {
    jumpNext () {
      let _this = this
      // this.answer.readOnly = true
      // if (this.answer.content === null || this.answer.content.trim() === '') {
      //   return
      // }
      setTimeout(function () {
        _this.$emit('callNextSubject', [_this.order])
      }, 500)
    }
  }
}
</script>
 
<style lang="scss" scoped>
  span:hover {
    font-weight: bold;
  }
  .intelligence-el_radio {
    margin-right: 60px;
  }
</style>