answer.html 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. {extend name="public/base_el"/}
  2. {block name="css"}
  3. <style>
  4. #app {
  5. width: 1200px;
  6. margin: 0 auto;
  7. }
  8. .step {
  9. width: 100%;
  10. display: flex;
  11. align-items: center;
  12. justify-content: center;
  13. }
  14. .base-info {
  15. margin-top: 50px;
  16. }
  17. .title {
  18. text-indent: 2em;
  19. background: white;
  20. padding-top: 20px;
  21. font-size: 14px;
  22. }
  23. .info-btn {
  24. display: flex;
  25. align-items: center;
  26. justify-content: flex-end;
  27. }
  28. .evaluate .el-radio-group {
  29. display: flex;
  30. flex-direction: column;
  31. justify-content: center;
  32. align-items: flex-start;
  33. }
  34. .evaluate .el-radio-group .el-radio {
  35. margin-top: 20px;
  36. width: 500px;
  37. }
  38. .evaluate .content {
  39. box-sizing: border-box;
  40. width: 1200px;
  41. height: 600px;
  42. margin-top: 50px;
  43. }
  44. .evaluate .detail-title {
  45. padding-top: 50px;
  46. padding-right: 50px;
  47. }
  48. .mt-50 {
  49. margin-top: 30px;
  50. }
  51. .title-list {
  52. padding-top: 10px;
  53. overflow-y: auto;
  54. overflow-x: hidden;
  55. box-sizing: border-box;
  56. height: 600px;
  57. }
  58. .title-list ul {
  59. width: 100%;
  60. box-sizing: border-box;
  61. padding: 0;
  62. margin: 0;
  63. list-style: none;
  64. }
  65. .title-list li {
  66. float: left;
  67. width: 10%;
  68. height: 35px;
  69. line-height: 35px;
  70. border: 1px solid #999;
  71. text-align: center;
  72. box-sizing: border-box;
  73. }
  74. .title-list .num.finish {
  75. color: white;
  76. background: #3da600;
  77. }
  78. .title-list .num.current {
  79. color: white;
  80. background: #1D6BD0;
  81. }
  82. </style>
  83. {/block}
  84. {block name="body"}
  85. <div class="step">
  86. <el-steps style="width: 600px" :active="active" align-center>
  87. <el-step title="基础信息"></el-step>
  88. <el-step title="测评试卷"></el-step>
  89. </el-steps>
  90. </div>
  91. <div class="base-info" v-show="active == 0">
  92. {include file="officer/answer_base"/}
  93. </div>
  94. <div class="evaluate" v-show="active == 1">
  95. <div class="title">
  96. {{list[index].section}}
  97. </div>
  98. <div class="content">
  99. <el-row>
  100. <el-col :span="17">
  101. <fieldset style="height:600px;box-sizing: border-box;">
  102. <legend>考试题目</legend>
  103. <div class="detail-title">{{list[index].no}}、{{list[index].title}}</div>
  104. <el-radio-group v-model="answer_detail[list[index].no]">
  105. <el-radio
  106. :value="option.score"
  107. size="large"
  108. border
  109. :key="list[index].no + '_' + option.score"
  110. v-for="option in list[index].option"
  111. @change="selectTile"
  112. >{{option.title}}
  113. </el-radio>
  114. </el-radio-group>
  115. </fieldset>
  116. </el-col>
  117. <el-col :span="7" style="height:600px;">
  118. <div class="title-list">
  119. <ul>
  120. <li
  121. class="num"
  122. :class="{finish:answer_detail[item.no] > 0,current:i==index}"
  123. :key="item.id"
  124. v-for="(item,i) in list"
  125. @click="changeTitle(i)"
  126. >{{item.no}}
  127. </li>
  128. </ul>
  129. </div>
  130. </el-col>
  131. </el-row>
  132. </div>
  133. <div class="info-btn mt-50">
  134. <el-button type="primary" size="large" @click="onSubmit" v-loading="loading">提交</el-button>
  135. </div>
  136. </div>
  137. {/block}
  138. {block name="script"}
  139. <script>
  140. function v_setup() {
  141. const base = answer_base();
  142. base.list = {$list};
  143. base.active = Vue.ref(0);
  144. base.answer_detail = Vue.ref({});
  145. base.index = Vue.ref(0);
  146. base.selectTile = () => {
  147. if (base.index.value + 1 == base.list.length) {
  148. return false;
  149. }
  150. base.index.value++;
  151. }
  152. base.changeTitle = (i) => {
  153. base.index.value = i;
  154. }
  155. base.loading = Vue.ref(false);
  156. base.onSubmit = () => {
  157. if (base.loading.value) {
  158. return false;
  159. }
  160. for (let i = 0; i < base.list.length; i++) {
  161. if (base.answer_detail.value[i + 1] === undefined) {
  162. ElementPlus.ElMessage.error(`第${i + 1}题未填写`);
  163. return false;
  164. }
  165. }
  166. base.answer.value.rid = {$id};
  167. base.loading.value = true;
  168. postJson("{:url('officer/answerPost')}", {
  169. id: {$id},
  170. answer: base.answer.value,
  171. answer_detail: base.answer_detail.value
  172. }).then((data) => {
  173. base.loading.value = false;
  174. ElementPlus.ElMessage.success('提交成功');
  175. location.href = "{:url('officer/finish')}";
  176. })
  177. }
  178. return base;
  179. }
  180. </script>
  181. {/block}