| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318 | <template>  <div style="padding: 20px" class=".answer-details-container">    <!-- 头部 -->    <el-card>      <div class="header">        <div class="header_tit">          <span>答题情况</span>          <span class="more" @click="onShowJuYiFanSan" v-if="knowledgeId"            >举一反三</span          >        </div>        <!-- 基本信息 -->        <table class="basic_info">          <tr>            <th>科目</th>            <th>正确</th>            <th>错误</th>            <th>正确率</th>            <th>用时</th>            <th>日期</th>          </tr>          <tbody>            <td>{{ topInfo.coursename || "" }}</td>            <td>{{ topInfo.rights || 0 }}</td>            <td>{{ topInfo.wrongs || 0 }}</td>            <td>{{ topInfo.rate || 0 }}</td>            <td>{{ topInfo.seconds || 0 }} 秒</td>            <td>{{ topInfo.day || "0000-00-00" }}</td>          </tbody>        </table>      </div>    </el-card>    <!-- 做题详情 -->    <el-card class="info" id="question_list">      <el-table        ref="expandstable"        :data="items"        style="width: 100%"        align="center"        @expand-change="expandChange"      >        <el-table-column type="index" label="序号" width="150px">        </el-table-column>        <el-table-column          label="章节"          width="500"        ><template>          {{topInfo.chapterName}}        </template></el-table-column>        <el-table-column prop="detail.answer" label="你的答案">        </el-table-column>        <el-table-column prop="detail.correct" label="正确答案">        </el-table-column>        <el-table-column label="对错">          <template slot-scope="scope">            <img              v-if="scope.row.detail.answer == scope.row.detail.correct"              src="@/assets/images/icon_right.png"            />            <img v-else src="@/assets/images/icon_wrong.png" />          </template>        </el-table-column>        <el-table-column type="expand" label="操作">          <template slot-scope="scope">            <!-- 题目解析 -->            <div class="que_info">              <div class="collect">                <img src="" alt="" />              </div>              <div class="info_right">                <div class="que_tit">                  <div>【题文】</div>                  <div class="center" v-html="scope.row.title"></div>                  <div class="fix">                    <span>正确答案</span>                    <span>{{ scope.row.answer1 }}</span>                  </div>                </div>                <div class="option-list">                  <div class="option-item">                    <span class="option-symbol">A</span>                    <span v-html="scope.row.optionA"></span>                  </div>                  <div class="option-item">                    <span class="option-symbol">B</span>                    <span v-html="scope.row.optionB"></span>                  </div>                  <div class="option-item">                    <span class="option-symbol">C</span>                    <span v-html="scope.row.optionC"></span>                  </div>                  <div class="option-item">                    <span class="option-symbol">D</span>                    <span v-html="scope.row.optionD"></span>                  </div>                </div>                <div class="que_options"></div>                <div class="prase">                  <div class="jiexi">解析</div>                  <div v-html="scope.row.parse"></div>                </div>              </div>            </div>          </template>        </el-table-column>        <template slot="empty">          <div class="empty-box">            <img src="@/assets/images/icon_data.png" />            <span>没有信息</span>          </div>        </template>      </el-table>    </el-card>    <div class="btn">      <span @click="backPractice">{{returnText}}</span>    </div>    <!-- 弹出警告 -->    <el-dialog title="举一反三" :visible.sync="isShowJuYiFanSan" width="80%">      <div class="paper_questions" id="question_simulate">        <div class="que_item" v-for="(item, index) in queList" :key="item.id">          <!-- 题目 -->          <div class="que_content" style="display: flex">            <div>{{ index + 1 }}.</div>            <span v-html="item.title"></span>          </div>          <!-- 选项 -->          <div class="options">            <el-radio-group              text-color="#ccc"              v-model="item['group']"              @change="onOptionClick(item)"            >              <div class="option" v-if="item.optionA">                <el-radio label="A">                  <span class="option-symbol">A</span>                  <span v-html="item.optionA"></span>                </el-radio>              </div>              <div class="option" v-if="item.optionB">                <el-radio label="B">                  <span class="option-symbol">B</span>                  <span v-html="item.optionB"></span>                </el-radio>              </div>              <div class="option" v-if="item.optionC">                <el-radio label="C">                  <span class="option-symbol">C</span>                  <span v-html="item.optionC"></span>                </el-radio>              </div>              <div class="option" v-if="item.optionD">                <el-radio label="D">                  <span class="option-symbol">D</span>                  <span v-html="item.optionD"></span>                </el-radio>              </div>            </el-radio-group>          </div>          <!-- :class="item['group'][0]==item.answer1?'success':'error'" -->          <div class="is-correct" v-if="item['group'].length > 0">            <div class="correct-text" :class="item['group'][0]==item.answer1?'success':'error'">正确答案:{{ item.answer1 }}</div>            <div class="prase">              <div class="jiexi">解析</div>              <div v-html="item.parse"></div>            </div>          </div>        </div>        <el-button @click="onShowJuYiFanSan">确定</el-button>      </div>    </el-dialog>  </div></template><script>import {  diagnosticRecordsDetail,  getQuestionsByIds,  drawInferences,} from "@/api/webApi/webQue.js";export default {  data() {    return {      returnText: '返回练习',      topInfo: {},      subjectName: "",      wrongNum: 0,      seconds: 0,      isShowJuYiFanSan: false,      date: "",      correctPercent: "",      correctNum: 0,      items: [],      chapterName: "",      batchno: 0,      knowledgeId: 0,      recordsDetail: {},      queList: [],      answerForm: [],    };  },  created() {    let query = this.$route.query;    let info = query.info;    if (query.hasOwnProperty("knowledgeId")) {      this.knowledgeId = query.knowledgeId;    }    if (query.hasOwnProperty("batchno")) {      this.batchno = query.batchno;    }    if (query.hasOwnProperty("type") && query.type == 1) {      this.formatData(JSON.parse(decodeURIComponent(info)));      return;    } else {      this.topInfo = JSON.parse(decodeURIComponent(info));      if (this.topInfo.hasOwnProperty("rate")) {        this.topInfo["rate"] = this.topInfo["rate"] + "%";      }      console.log("topInfo", this.topInfo);      this.httpDiagnosticRecordsDetail();    }  },  methods: {    onShowJuYiFanSan() {      this.isShowJuYiFanSan = !this.isShowJuYiFanSan;      if (this.isShowJuYiFanSan) {        this.httpDrawInferences();        this.$nextTick(_=>this.mxGlobal.MathQueue('question_simulate'))      }    },    httpDiagnosticRecordsDetail() {      diagnosticRecordsDetail({        batchno: this.batchno,      }).then((res) => {        this.getQuestionIds(res.rows);      });    },    httpDrawInferences() {      drawInferences({        knowledgeId: this.knowledgeId,      }).then((res) => {        this.queList = this.formatQueData(res.data);        console.log(res);      });    },    formatQueData(data) {      let len = data.length;      for (let i = 0; i < len; i++) {        data[i]["group"] = [];      }      return data;    },    onOptionClick(res, row) {      console.log(res);      console.log(row);    },    formatData(data) {      data["coursename"] = data["subjectName"];      data["rights"] = data["correctNum"];      data["wrongs"] = data["wrongNum"];      data["rate"] = data["correctPercent"];      data["day"] = data["date"];      let list = data.items;      let len = list.length;      let qList = [];      for (let i = 0; i < len; i++) {        let data = list[i]["question"];        data["detail"] = list[i]["question"];        data["detail"]["answer"] = list[i]["yourAnswer"];        data["detail"]["correct"] = list[i]["correctAnswer"];        qList.push(data);      }      this.items = qList;      this.topInfo = data;    },    getQuestionIds(data) {      let len = data.length;      let ids = [];      for (let i = 0; i < len; i++) {        let id = data[i]["questionid"];        ids.push(id);        this.recordsDetail[id] = data[i];      }      getQuestionsByIds({        ids: ids.toString(),      }).then((res) => {        this.formatQusestion(res.data);      });    },    formatQusestion(questionList) {      let len = questionList.length;      for (let i = 0; i < len; i++) {        let qid = questionList[i]["id"];        if (this.recordsDetail[qid]) {          questionList[i]["detail"] = this.recordsDetail[qid];        }      }      console.log(questionList);      this.items = questionList;      this.$nextTick(_=>this.mxGlobal.MathQueue('question_list'))    },    expandChange(item, rows) {      this.$nextTick(_=>this.mxGlobal.MathQueue('question_list'))    },    expandsHandle(row) {      this.$refs.expandstable.toggleRowExpansion(row, true);      this.$nextTick(_=>this.mxGlobal.MathQueue('question_list'))    },    backPractice() {      this.$router.push({        path: "/question-center/smartExercise",      });    },  },};</script><style scoped>@import "~@/views/questioncenter/practice-answer-detail.scss";</style>
 |