answer.html 6.7 KB

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