<!--连线题-->
<style>
  .v_matchingQuestion {
    width: 100%;
  }

  .v_matchingQuestion .team_tit {
    display: inline-block;
    font-size: 14px;
    color: #A8A8B3;
    padding-bottom: 20px;
    margin-left: 13px;
  }

  .line_center {
    display: inline-block;
    width: 28px;
    height: 10px;
    border-top: 1px solid #E1E1E5;
    margin: 13px 12px 0 0;
  }

  .v_matchingQuestionBold {
    font-weight: bold;
  }
</style>
<template>
  <div class="v_matchingQuestion">
    <table v-if="data&&data.QuestionContentObj&&data.QuestionContentObj.length>0" class="common_TiTable" style="width:360px;">
      <thead>
        <tr>
          <th colspan="2">第一组</th>
          <th colspan="2">第二组</th>
        </tr>
      </thead>
      <tr v-for="(item,index) in data.QuestionContentObj[0]" :key="index">
        <td style="width:40px;text-align:center;padding-top:10px;">
          {{item.Name}}
        </td>
        <td>
          <div class="InpDIV" style="width:100%;border:0;" v-html="item.Content"></div>
        </td>
        <td style="width:40px;text-align:center;padding-top:10px;">
          {{data.QuestionContentObj[1][index].Name}}
        </td>
        <td>
          <div class="InpDIV" style="width:100%;border:0;" v-html="data.QuestionContentObj[1][index].Content"></div>
        </td>
      </tr>
    </table>
    <table v-if="isOperate&&data&&data.QuestionContentObj&&data.QuestionContentObj.length>2" style="padding-left:13px;">
      <tr v-for="(item,index) in data.QuestionContentObj[0]" :key="index">
        <td style="width:30px;">
          {{item.Name}}
        </td>
        <td>
          <span class="line_center"></span>
        </td>
        <td>
          <el-select v-model="data.QuestionContentObj[2][index].Content" style="width:100px" size="small" placeholder="请选择">
            <el-option
              v-for="(cItem,cIndex) in data.QuestionContentObj[1]"
              :key="cIndex"
              :label="cItem.Name"
              :value="cItem.Name">
            </el-option>
          </el-select>
        </td>
      </tr>
    </table>
    <span class="team_tit" v-if="isShowAnswer">答案</span>
    <table v-if="isShowAnswer&&data&&data.QuestionContentObj&&data.QuestionContentObj.length>2"
      style="padding-left:13px;">
      <tr v-for="(item,index) in data.QuestionContentObj[0]" :key="index">
        <td style="width:30px;">
          {{item.Name}}
        </td>
        <td>
          <span class="line_center"></span>
        </td>
        <td>
          {{data.QuestionContentObj[2][index].Content}}
        </td>
      </tr>
      <tfoot>
        <tr v-if="isShowStudentAnswer">
          <td colspan="3" class="v_matchingQuestionBold"
            :style="{color:data.Answer ==data.StundetAnswer?'#67c23a':'red'}">
            考生答案：{{data.StundetAnswer}}
          </td>
        </tr>
        <tr v-if="isShowStudentAnswer">
          <td colspan="3">
            <q-input v-if="isEditStudentScore" standout="bg-primary text-white" v-model="data.StudentScore" label="得分："
              maxlength="20" @input="getQuestionScore" />
            <span v-else class="v_matchingQuestionBold">考生得分：{{data.StudentScore}}</span>
          </td>
        </tr>
        <tr>
          <td colspan="3">
            <span class="v_matchingQuestionBold">
              解析：
            </span>
            <span v-html="data.AnswerParse"></span>
          </td>
        </tr>
      </tfoot>
    </table>
  </div>
</template>
<script>
  export default {
    props: {
      questionObj: {
        type: Object,
      },
      //是否显示答案和解析
      isShowAnswer: {
        type: Boolean,
        default: false,
      },
      //是否可操作(PC端考试使用【可以点击选中】)
      isOperate: {
        type: Boolean,
        default: false,
      },
      //是否显示学生答案
      isShowStudentAnswer: {
        type: Boolean,
        default: false
      },
      //是否可以编辑学生得分
      isEditStudentScore: {
        type: Boolean,
        default: false,
      }
    },
    data() {
      return {
        data: this.questionObj,
      };
    },
    methods: {
      //调用父组件计算学生分数
      getQuestionScore() {
        this.$emit('getScore');
      },
    },
    mounted() {},
    watch: {
      isShowAnswer: {
        handler(newValue) {

        },
        deep: true
      },
    }
  };

</script>
