detail.html 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. <script src="__CDN__/assets/libs/jquery/dist/jquery.min.js"></script>
  2. <script src="__CDN__/assets/addons/exam/js/vue.js"></script>
  3. <link rel="stylesheet" type="text/css" href="__CDN__/assets/addons/exam/css/common.css"></link>
  4. <link rel="stylesheet" type="text/css" href="__CDN__/assets/addons/exam/js/element-ui/index.css"/>
  5. <script src="__CDN__/assets/addons/exam/js/element-ui/index.js"></script>
  6. <div id="app">
  7. <el-card class="box-card" style="margin-bottom: 20px;">
  8. <div slot="header" class="clearfix">
  9. <span>用户提交情况</span>
  10. <!--<el-button style="float: right; padding: 3px 0" type="text">操作按钮</el-button>-->
  11. </div>
  12. <div v-for="(question, index) in row.questions" :key="index" class="question-item">
  13. <div class="el-descriptions">
  14. <div class="el-descriptions__body">
  15. <table class="el-descriptions__table is-bordered">
  16. <tbody>
  17. <tr class="el-descriptions-row">
  18. <th colspan="1" class="el-descriptions-item__cell el-descriptions-item__label is-bordered-label th-fix-width ">标题</th>
  19. <td colspan="9" class="el-descriptions-item__cell el-descriptions-item__content">{{index+1}}.<span v-html="question.title"></span></td>
  20. </tr>
  21. <tr class="el-descriptions-row">
  22. <th colspan="1" class="el-descriptions-item__cell el-descriptions-item__label is-bordered-label th-fix-width ">选项</th>
  23. <td colspan="9" class="el-descriptions-item__cell el-descriptions-item__content">
  24. <div v-if="question.kind !== 'FILL'">
  25. <div v-for="(option, indexOption) in question.options_json" :key="indexOption" class="option-item">
  26. {{option.key}}:{{option.value}}
  27. </div>
  28. </div>
  29. </td>
  30. </tr>
  31. </tbody>
  32. <tbody>
  33. <tr class="el-descriptions-row">
  34. <th colspan="1" class="el-descriptions-item__cell el-descriptions-item__label is-bordered-label th-fix-width">类型</th>
  35. <td colspan="1" class="el-descriptions-item__cell el-descriptions-item__content th-fix-width">
  36. <el-tag size="small" effect="plain" v-if="question.kind == 'JUDGE'">判断</el-tag>
  37. <el-tag size="small" effect="plain" v-else-if="question.kind == 'SINGLE'" type="success">单选</el-tag>
  38. <el-tag size="small" effect="plain" v-else-if="question.kind == 'MULTI'" type="info">多选</el-tag>
  39. </td>
  40. <th colspan="1" class="el-descriptions-item__cell el-descriptions-item__label is-bordered-label th-fix-width">用户选择</th>
  41. <td colspan="1" class="el-descriptions-item__cell el-descriptions-item__content" v-if="question.kind == 'JUDGE' || question.kind == 'SINGLE' || question.kind == 'MULTI'" :class="['answer-right']">
  42. <div>{{getUserAnswer(index) || '未答'}}</div>
  43. </td>
  44. </tr>
  45. </tbody>
  46. </table>
  47. </div>
  48. </div>
  49. </div>
  50. </el-card>
  51. </div>
  52. <script>
  53. var row = {:html_entity_decode(str_replace('&quot;', "'", json_encode($row)))};
  54. //console.log(row);
  55. var app = new Vue({
  56. el: '#app',
  57. data: {
  58. row: row,
  59. },
  60. computed: {
  61. /**
  62. * 获取用户答案
  63. * @returns {function(*): string|*}
  64. */
  65. getUserAnswer() {
  66. return function (questionIndex) {
  67. return this.row.user_answers && this.row.user_answers[questionIndex] ? this.row.user_answers[questionIndex].answer : '';
  68. }
  69. },
  70. },
  71. created() {
  72. },
  73. methods: {
  74. }
  75. })
  76. </script>
  77. <style>
  78. .answer-right {
  79. background: #E1F3D8;
  80. }
  81. .answer-fail {
  82. background: #FDE2E2;
  83. }
  84. .question-item {
  85. padding: 15px;
  86. }
  87. .option-item {
  88. margin-left: 10px;
  89. }
  90. .th-fix-width {
  91. width: 100px;
  92. text-align: center !important;
  93. }
  94. .fill-answer-item {
  95. margin-right: 20px;
  96. }
  97. </style>