|
@@ -1,5 +1,5 @@
|
|
|
<template>
|
|
|
- <div :class="['OptionComponents']">
|
|
|
+ <div :class="['OptionComponents', 'OptionComponents-' + judgeAnswer]">
|
|
|
<ul v-if="option && items">
|
|
|
<li
|
|
|
v-for="(item, index) in option"
|
|
@@ -9,31 +9,88 @@
|
|
|
? 'option-left-right'
|
|
|
: 'option' +
|
|
|
(type == 'radio' ? items.radioNumber : items.checkboxNumber),
|
|
|
- Bookanswer.radio === index || Bookanswer.checkbox.indexOf(index) != -1
|
|
|
- ? 'active'
|
|
|
- : '',
|
|
|
- items.Isexample ? 'example' : '',
|
|
|
+ !items.Isexample && TaskModel != 'ANSWER' ? 'li-hover' : '',
|
|
|
+ singleAnswerClass(index),
|
|
|
+ checkBoxAnswerClass(index),
|
|
|
]"
|
|
|
>
|
|
|
- <template v-if="type == 'checkbox'">
|
|
|
- <el-checkbox-group
|
|
|
- v-model="Bookanswer.checkbox"
|
|
|
- :class="
|
|
|
- item.detail && item.detail.pyNumber[0] > 0 ? 'radio-hasPy' : ''
|
|
|
- "
|
|
|
- :disabled="TaskModel == 'ANSWER' || items.Isexample"
|
|
|
- >
|
|
|
- <el-checkbox
|
|
|
+ <template v-if="judgeAnswer == 'standardAnswer'">
|
|
|
+ <template v-if="type == 'checkbox'">
|
|
|
+ <el-checkbox-group
|
|
|
+ v-model="correctAnswer.checkbox"
|
|
|
+ :class="
|
|
|
+ item.detail &&
|
|
|
+ item.detail.pyNumber &&
|
|
|
+ item.detail.pyNumber[0] > 0
|
|
|
+ ? 'radio-hasPy'
|
|
|
+ : ''
|
|
|
+ "
|
|
|
+ :disabled="TaskModel == 'ANSWER' || items.Isexample"
|
|
|
+ >
|
|
|
+ <el-checkbox
|
|
|
+ :label="index"
|
|
|
+ :style="{
|
|
|
+ 'margin-right': 0,
|
|
|
+ display: 'flex',
|
|
|
+ 'align-items': !row ? 'center' : 'center',
|
|
|
+ }"
|
|
|
+ >
|
|
|
+ <span
|
|
|
+ class="option_number"
|
|
|
+ :class="[
|
|
|
+ item.hasCn ? 'option_number_hasCn' : '',
|
|
|
+ item.detail.sentence ? '' : 'option_number_no',
|
|
|
+ ]"
|
|
|
+ v-if="item.number"
|
|
|
+ >{{ item.number }}</span
|
|
|
+ >
|
|
|
+ <template v-if="item.img_list && item.img_list.length > 0">
|
|
|
+ <div
|
|
|
+ v-for="(itemss, indexss) in item.img_list"
|
|
|
+ :key="indexss"
|
|
|
+ >
|
|
|
+ <img :src="itemss.id" style="width: 32px; height: 32px" />
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ <template v-else>
|
|
|
+ <div class="detail_word">
|
|
|
+ <SentenceTemp
|
|
|
+ :detail="item.detail"
|
|
|
+ :pyPosition="curQue.pyPosition"
|
|
|
+ :TaskModel="TaskModel"
|
|
|
+ :pyColor="curQue.pyColor"
|
|
|
+ :isInput="false"
|
|
|
+ sentType="option"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </el-checkbox>
|
|
|
+ </el-checkbox-group>
|
|
|
+ </template>
|
|
|
+ <template v-else>
|
|
|
+ <el-radio
|
|
|
+ v-model="correctAnswer.radio"
|
|
|
:label="index"
|
|
|
- :style="{
|
|
|
- 'margin-right': 0,
|
|
|
- display: 'flex',
|
|
|
- 'align-items': !row ? 'center' : 'flex-start',
|
|
|
- }"
|
|
|
+ style="margin-right: 0; display: flex; align-items: center"
|
|
|
+ :class="[
|
|
|
+ item.detail &&
|
|
|
+ item.detail.pyNumber &&
|
|
|
+ item.detail.pyNumber[0] > 0
|
|
|
+ ? 'radio-hasPy'
|
|
|
+ : '',
|
|
|
+ ]"
|
|
|
+ :disabled="true"
|
|
|
+ @input="changeSingle"
|
|
|
>
|
|
|
- <span class="option_number" v-if="item.number">{{
|
|
|
- item.number
|
|
|
- }}</span>
|
|
|
+ <span
|
|
|
+ class="option_number"
|
|
|
+ :class="[
|
|
|
+ item.hasCn ? 'option_number_hasCn' : '',
|
|
|
+ item.detail.sentence ? '' : 'option_number_no',
|
|
|
+ ]"
|
|
|
+ v-if="item.number"
|
|
|
+ >{{ item.number }}</span
|
|
|
+ >
|
|
|
<template v-if="item.img_list && item.img_list.length > 0">
|
|
|
<div v-for="(itemss, indexss) in item.img_list" :key="indexss">
|
|
|
<img :src="itemss.id" style="width: 32px; height: 32px" />
|
|
@@ -51,40 +108,106 @@
|
|
|
/>
|
|
|
</div>
|
|
|
</template>
|
|
|
- </el-checkbox>
|
|
|
- </el-checkbox-group>
|
|
|
+ </el-radio>
|
|
|
+ </template>
|
|
|
</template>
|
|
|
<template v-else>
|
|
|
- <el-radio
|
|
|
- v-model="Bookanswer.radio"
|
|
|
- :label="index"
|
|
|
- style="margin-right: 0; display: flex; align-items: flex-start"
|
|
|
- :class="
|
|
|
- item.detail && item.detail.pyNumber[0] > 0 ? 'radio-hasPy' : ''
|
|
|
- "
|
|
|
- :disabled="TaskModel == 'ANSWER' || items.Isexample"
|
|
|
- >
|
|
|
- <span class="option_number" v-if="item.number">{{
|
|
|
- item.number
|
|
|
- }}</span>
|
|
|
- <template v-if="item.img_list && item.img_list.length > 0">
|
|
|
- <div v-for="(itemss, indexss) in item.img_list" :key="indexss">
|
|
|
- <img :src="itemss.id" style="width: 32px; height: 32px" />
|
|
|
- </div>
|
|
|
- </template>
|
|
|
- <template v-else>
|
|
|
- <div class="detail_word">
|
|
|
- <SentenceTemp
|
|
|
- :detail="item.detail"
|
|
|
- :pyPosition="curQue.pyPosition"
|
|
|
- :TaskModel="TaskModel"
|
|
|
- :pyColor="curQue.pyColor"
|
|
|
- :isInput="false"
|
|
|
- sentType="option"
|
|
|
- />
|
|
|
- </div>
|
|
|
- </template>
|
|
|
- </el-radio>
|
|
|
+ <template v-if="type == 'checkbox'">
|
|
|
+ <el-checkbox-group
|
|
|
+ v-model="Bookanswer.checkbox.correct"
|
|
|
+ :class="
|
|
|
+ item.detail &&
|
|
|
+ item.detail.pyNumber &&
|
|
|
+ item.detail.pyNumber[0] > 0
|
|
|
+ ? 'radio-hasPy'
|
|
|
+ : ''
|
|
|
+ "
|
|
|
+ :disabled="TaskModel == 'ANSWER' || items.Isexample"
|
|
|
+ @change="changeCheckBox"
|
|
|
+ >
|
|
|
+ <el-checkbox
|
|
|
+ :label="index"
|
|
|
+ :style="{
|
|
|
+ 'margin-right': 0,
|
|
|
+ display: 'flex',
|
|
|
+ 'align-items': !row ? 'center' : 'center',
|
|
|
+ }"
|
|
|
+ >
|
|
|
+ <span
|
|
|
+ class="option_number"
|
|
|
+ :class="[
|
|
|
+ item.hasCn ? 'option_number_hasCn' : '',
|
|
|
+ item.detail.sentence ? '' : 'option_number_no',
|
|
|
+ ]"
|
|
|
+ v-if="item.number"
|
|
|
+ >{{ item.number }}</span
|
|
|
+ >
|
|
|
+ <template v-if="item.img_list && item.img_list.length > 0">
|
|
|
+ <div
|
|
|
+ v-for="(itemss, indexss) in item.img_list"
|
|
|
+ :key="indexss"
|
|
|
+ >
|
|
|
+ <img :src="itemss.id" style="width: 32px; height: 32px" />
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ <template v-else>
|
|
|
+ <div class="detail_word">
|
|
|
+ <SentenceTemp
|
|
|
+ :detail="item.detail"
|
|
|
+ :pyPosition="curQue.pyPosition"
|
|
|
+ :TaskModel="TaskModel"
|
|
|
+ :pyColor="curQue.pyColor"
|
|
|
+ :isInput="false"
|
|
|
+ sentType="option"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </el-checkbox>
|
|
|
+ </el-checkbox-group>
|
|
|
+ </template>
|
|
|
+ <template v-else>
|
|
|
+ <el-radio
|
|
|
+ v-model="Bookanswer.radio.correct"
|
|
|
+ :label="index"
|
|
|
+ style="margin-right: 0; display: flex; align-items: center"
|
|
|
+ :class="[
|
|
|
+ item.detail &&
|
|
|
+ item.detail.pyNumber &&
|
|
|
+ item.detail.pyNumber[0] > 0
|
|
|
+ ? 'radio-hasPy'
|
|
|
+ : '',
|
|
|
+ ]"
|
|
|
+ :disabled="TaskModel == 'ANSWER' || items.Isexample"
|
|
|
+ @input="changeSingle"
|
|
|
+ >
|
|
|
+ <span
|
|
|
+ class="option_number"
|
|
|
+ :class="[
|
|
|
+ item.hasCn ? 'option_number_hasCn' : '',
|
|
|
+ item.detail.sentence ? '' : 'option_number_no',
|
|
|
+ ]"
|
|
|
+ v-if="item.number"
|
|
|
+ >{{ item.number }}</span
|
|
|
+ >
|
|
|
+ <template v-if="item.img_list && item.img_list.length > 0">
|
|
|
+ <div v-for="(itemss, indexss) in item.img_list" :key="indexss">
|
|
|
+ <img :src="itemss.id" style="width: 32px; height: 32px" />
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ <template v-else>
|
|
|
+ <div class="detail_word">
|
|
|
+ <SentenceTemp
|
|
|
+ :detail="item.detail"
|
|
|
+ :pyPosition="curQue.pyPosition"
|
|
|
+ :TaskModel="TaskModel"
|
|
|
+ :pyColor="curQue.pyColor"
|
|
|
+ :isInput="false"
|
|
|
+ sentType="option"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </el-radio>
|
|
|
+ </template>
|
|
|
</template>
|
|
|
</li>
|
|
|
</ul>
|
|
@@ -110,17 +233,163 @@ export default {
|
|
|
"type",
|
|
|
"curQue",
|
|
|
"items",
|
|
|
+ "judgeAnswer",
|
|
|
+ "correctAnswer",
|
|
|
],
|
|
|
data() {
|
|
|
//这里存放数据
|
|
|
return {};
|
|
|
},
|
|
|
//计算属性 类似于data概念
|
|
|
- computed: {},
|
|
|
+ computed: {
|
|
|
+ singleAnswerClass() {
|
|
|
+ return function (index) {
|
|
|
+ let _this = this;
|
|
|
+ let classname = "";
|
|
|
+ if (_this.type == "radio") {
|
|
|
+ let answer = _this.Bookanswer.radio.correct;
|
|
|
+ let correct = _this.correctAnswer.radio;
|
|
|
+ if (_this.judgeAnswer == "standardAnswer") {
|
|
|
+ if ((correct || correct === 0) && index === correct) {
|
|
|
+ classname = "userRight";
|
|
|
+ }
|
|
|
+ } else if (
|
|
|
+ _this.judgeAnswer == "studentAnswer" ||
|
|
|
+ _this.judgeAnswer == "userAnswer"
|
|
|
+ ) {
|
|
|
+ if (!_this.items.Isexample) {
|
|
|
+ if (correct || correct === 0) {
|
|
|
+ if (answer === correct) {
|
|
|
+ if (correct === index) {
|
|
|
+ classname = "userRight";
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (answer === index) {
|
|
|
+ classname = "userError";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (correct === index) {
|
|
|
+ classname = "example";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (!_this.items.Isexample) {
|
|
|
+ if (answer === index) {
|
|
|
+ classname = "active";
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (correct === index) {
|
|
|
+ classname = "example";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return classname;
|
|
|
+ };
|
|
|
+ },
|
|
|
+ checkBoxAnswerClass() {
|
|
|
+ return function (index) {
|
|
|
+ let _this = this;
|
|
|
+ let classname = "";
|
|
|
+ if (_this.type == "checkbox") {
|
|
|
+ let answer = _this.Bookanswer.checkbox.correct;
|
|
|
+ let correct = _this.correctAnswer.checkbox;
|
|
|
+ if (_this.judgeAnswer == "standardAnswer") {
|
|
|
+ if (correct && correct.length > 0) {
|
|
|
+ if (correct.indexOf(index) > -1) {
|
|
|
+ classname = "userRight";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else if (
|
|
|
+ _this.judgeAnswer == "studentAnswer" ||
|
|
|
+ _this.judgeAnswer == "userAnswer"
|
|
|
+ ) {
|
|
|
+ if (!_this.items.Isexample) {
|
|
|
+ if (correct && correct.length > 0) {
|
|
|
+ if (correct.indexOf(index) > -1 && answer.indexOf(index) > -1) {
|
|
|
+ classname = "userRight";
|
|
|
+ } else if (
|
|
|
+ answer.indexOf(index) > -1 &&
|
|
|
+ correct.indexOf(index) < 0
|
|
|
+ ) {
|
|
|
+ classname = "userError";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (correct.indexOf(index) > -1) {
|
|
|
+ classname = "example";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (!_this.items.Isexample) {
|
|
|
+ if (answer.indexOf(index) > -1) {
|
|
|
+ classname = "active";
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (
|
|
|
+ correct &&
|
|
|
+ correct.length > 0 &&
|
|
|
+ correct.indexOf(index) > -1
|
|
|
+ ) {
|
|
|
+ classname = "example";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return classname;
|
|
|
+ };
|
|
|
+ },
|
|
|
+ },
|
|
|
//监控data中数据变化
|
|
|
watch: {},
|
|
|
//方法集合
|
|
|
- methods: {},
|
|
|
+ methods: {
|
|
|
+ changeSingle(value) {
|
|
|
+ let _this = this;
|
|
|
+ let correct = _this.correctAnswer.radio;
|
|
|
+ if (correct || correct === 0) {
|
|
|
+ if (value == correct) {
|
|
|
+ _this.$set(
|
|
|
+ _this.Bookanswer.radio,
|
|
|
+ "userAnswerJudge",
|
|
|
+ "[JUDGE##T##JUDGE]"
|
|
|
+ );
|
|
|
+ } else {
|
|
|
+ _this.$set(
|
|
|
+ _this.Bookanswer.radio,
|
|
|
+ "userAnswerJudge",
|
|
|
+ "[JUDGE##F##JUDGE]"
|
|
|
+ );
|
|
|
+ }
|
|
|
+ }
|
|
|
+ _this.$forceUpdate();
|
|
|
+ },
|
|
|
+ changeCheckBox() {
|
|
|
+ let _this = this;
|
|
|
+ let value = _this.Bookanswer.checkbox.correct;
|
|
|
+ let valueStr = value.sort().toString();
|
|
|
+ let correct = _this.correctAnswer.checkbox;
|
|
|
+ let correctStr = correct.sort().toString();
|
|
|
+ if (correct && correct.length > 0) {
|
|
|
+ if (valueStr == correctStr) {
|
|
|
+ _this.$set(
|
|
|
+ _this.Bookanswer.checkbox,
|
|
|
+ "userAnswerJudge",
|
|
|
+ "[JUDGE##T##JUDGE]"
|
|
|
+ );
|
|
|
+ } else {
|
|
|
+ _this.$set(
|
|
|
+ _this.Bookanswer.checkbox,
|
|
|
+ "userAnswerJudge",
|
|
|
+ "[JUDGE##F##JUDGE]"
|
|
|
+ );
|
|
|
+ }
|
|
|
+ }
|
|
|
+ _this.$forceUpdate();
|
|
|
+ },
|
|
|
+ },
|
|
|
//生命周期 - 创建完成(可以访问当前this实例)
|
|
|
created() {},
|
|
|
//生命周期 - 挂载完成(可以访问DOM元素)
|
|
@@ -158,14 +427,17 @@ ul {
|
|
|
padding: 1px 16px 1px 0;
|
|
|
border-radius: 4px;
|
|
|
box-sizing: border-box;
|
|
|
- &:hover {
|
|
|
+ &.li-hover:hover {
|
|
|
background: #ececec;
|
|
|
}
|
|
|
&.active {
|
|
|
// background: #fff;
|
|
|
- // background: rgba(157, 202, 255, 0.15);
|
|
|
+ // background: rgba(157, 202, 255, 0.15);
|
|
|
border-radius: 4px;
|
|
|
}
|
|
|
+ &.example {
|
|
|
+ background: #ececec;
|
|
|
+ }
|
|
|
&.option1 {
|
|
|
width: 100%;
|
|
|
margin-bottom: 8px;
|
|
@@ -188,6 +460,16 @@ ul {
|
|
|
&.option-left-right {
|
|
|
padding: 1px 16px;
|
|
|
}
|
|
|
+ &.userRight {
|
|
|
+ background: rgba(44, 167, 103, 0.1);
|
|
|
+ border: 1px solid #2ca767;
|
|
|
+ border-radius: 4px;
|
|
|
+ }
|
|
|
+ &.userError {
|
|
|
+ background: rgba(237, 52, 45, 0.1);
|
|
|
+ border: 1px solid #ed342d;
|
|
|
+ border-radius: 4px;
|
|
|
+ }
|
|
|
.el-radio {
|
|
|
width: 100%;
|
|
|
}
|
|
@@ -284,6 +566,9 @@ ul {
|
|
|
height: 16px;
|
|
|
margin-top: 12px;
|
|
|
}
|
|
|
+ .el-checkbox__inner {
|
|
|
+ margin-top: 4px;
|
|
|
+ }
|
|
|
.radio-hasPy {
|
|
|
.el-radio__inner {
|
|
|
margin-top: 24px;
|