answer.html 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254
  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="base-info" v-show="active == 0">
  92. <h2 style="text-align: center;padding-bottom: 20px;">基础信息</h2>
  93. {include file="officer/answer_base"/}
  94. </div>
  95. <div class="evaluate" v-show="active == 1">
  96. <h2 style="text-align: center;padding-bottom: 20px;">测评试卷</h2>
  97. <div class="title">
  98. {{list[index].section}}
  99. </div>
  100. <div class="content">
  101. <el-row>
  102. <el-col :span="24">
  103. <fieldset style="height:600px;box-sizing: border-box;">
  104. <legend>测评条目</legend>
  105. <div class="detail-title">{{list[index].no}}、{{list[index].title}}</div>
  106. <el-radio-group v-model="answer_detail[list[index].no]">
  107. <el-radio
  108. :value="option.score"
  109. size="large"
  110. border
  111. :key="list[index].no + '_' + option.score"
  112. v-for="option in list[index].option"
  113. >{{option.title}}
  114. </el-radio>
  115. </el-radio-group>
  116. </fieldset>
  117. </el-col>
  118. <!-- <el-col :span="7" style="height:600px;">-->
  119. <!-- <div class="title-list">-->
  120. <!-- <ul>-->
  121. <!-- <li-->
  122. <!-- class="num"-->
  123. <!-- :class="{finish:answer_detail[item.no] > 0,current:i==index}"-->
  124. <!-- :key="item.id"-->
  125. <!-- v-for="(item,i) in list"-->
  126. <!-- @click="changeTitle(i)"-->
  127. <!-- >{{item.no}}-->
  128. <!-- </li>-->
  129. <!-- </ul>-->
  130. <!-- </div>-->
  131. <!-- </el-col>-->
  132. </el-row>
  133. </div>
  134. <div class="info-btn mt-50">
  135. <el-button type="primary" size="large" @click="onNext" v-show="index + 1 != list.length">下一题</el-button>
  136. <el-button type="primary" size="large" @click="onSubmit" v-loading="loading" v-show="index + 1 == list.length">
  137. 提交
  138. </el-button>
  139. </div>
  140. </div>
  141. {/block}
  142. {block name="script"}
  143. <script>
  144. function v_setup() {
  145. const base = answer_base();
  146. const aid = {$aid};
  147. if (aid > 0) {
  148. base.aid = Vue.ref(aid);
  149. base.active = Vue.ref(1);
  150. } else {
  151. base.active = Vue.ref(0);
  152. }
  153. base.list = {$list};
  154. base.answer_detail = Vue.ref({});
  155. base.index = Vue.ref(0);
  156. base.selectTile = () => {
  157. if (base.index.value + 1 == base.list.length) {
  158. return false;
  159. }
  160. base.index.value++;
  161. }
  162. base.changeTitle = (i) => {
  163. base.index.value = i;
  164. }
  165. base.loading = Vue.ref(false);
  166. base.onNext = () => {
  167. if (!base.answer_detail.value[base.list[base.index.value].no]) {
  168. ElementPlus.ElMessage.error('必须选择一个选项');
  169. return false;
  170. }
  171. postJson("{:url('officer/answerDetailPost')}", {
  172. id: {$id},
  173. index: base.answer_detail.value[base.list[base.index.value].no],
  174. aid: base.aid.value,
  175. no: base.list[base.index.value].no,
  176. })
  177. base.index.value++;
  178. }
  179. base.onSubmit = () => {
  180. if (base.loading.value) {
  181. return false;
  182. }
  183. if (!base.answer_detail.value[base.list[base.index.value].no]) {
  184. ElementPlus.ElMessage.error('必须选择一个选项');
  185. return false;
  186. }
  187. postJson("{:url('officer/answerDetailPost')}", {
  188. id: {$id},
  189. index: base.answer_detail.value[base.list[base.index.value].no],
  190. aid: base.aid.value,
  191. no: base.list[base.index.value].no,
  192. }).then(() => {
  193. postJson("{:url('officer/answerFinish')}", {
  194. id: {$id},
  195. aid: base.aid.value,
  196. }).then(({data}) => {
  197. base.loading.value = false;
  198. ElementPlus.ElMessage.success('提交成功');
  199. if (data > 0) {
  200. location.href = "{:url('officer/index')}?id=" + data + "&aid=" + base.aid.value;
  201. } else {
  202. location.href = "{:url('officer/finish')}";
  203. }
  204. })
  205. })
  206. }
  207. // base.onSubmit = () => {
  208. // if (base.loading.value) {
  209. // return false;
  210. // }
  211. // for (let i = 0; i < base.list.length; i++) {
  212. // if (base.answer_detail.value[i + 1] === undefined) {
  213. // ElementPlus.ElMessage.error(`第${i + 1}题未填写`);
  214. // return false;
  215. // }
  216. // }
  217. // base.answer.value.rid = {$id};
  218. // base.loading.value = true;
  219. // postJson("{:url('officer/answerPost')}", {
  220. // id: {$id},
  221. // answer: base.answer.value,
  222. // answer_detail: base.answer_detail.value
  223. // }).then((data) => {
  224. // base.loading.value = false;
  225. // ElementPlus.ElMessage.success('提交成功');
  226. // location.href = "{:url('officer/finish')}";
  227. // })
  228. // }
  229. return base;
  230. }
  231. </script>
  232. {/block}