NewSimulatedVolunteer.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259
  1. <template>
  2. <div class="zhiyuan-wrapper">
  3. <div class="bar">
  4. <!-- 步骤条-->
  5. <div class="step-list line">
  6. <div class="step-item right" v-for="(item, index) in topStep" :key="index">
  7. <div class="step-number" :class="active.name == item.label ? 'curindex' : ''"
  8. v-if="active.index < item.index">
  9. {{ item.index + 1 }}
  10. </div>
  11. <i v-else class="el-icon-check"></i>
  12. <div class="step-label">{{ item.label }}</div>
  13. </div>
  14. </div>
  15. <div>
  16. <h1 class="text-center f-primary">{{ active.title }}</h1>
  17. </div>
  18. </div>
  19. <div class="content">
  20. <score ref="score" :form="this.form" v-show="active.index == 0"></score>
  21. <phase @onFillIn="onFillIn" v-if="active.index == 1" :list="zytbBatchesList" :formSubject="form"></phase>
  22. <recommend :batch="batch" v-if="active.index == 2" :formSubject="form"></recommend>
  23. </div>
  24. <div class="text-center mt15">
  25. <el-button plain @click="toReport">查看记录</el-button>
  26. <el-button type="primary" @click="toBackPage" :disabled="currentStep == 0">上一步</el-button>
  27. <el-button type="primary" @click="next" v-if="currentStep <= 1">下一步</el-button>
  28. </div>
  29. </div>
  30. </template>
  31. <script>
  32. import Score from './components/score'
  33. import Phase from './components/phase'
  34. import Recommend from './components/recommend'
  35. import { zytbBatches } from '@/api/webApi/webQue'
  36. export default {
  37. components: {
  38. Recommend,
  39. Phase,
  40. Score
  41. },
  42. data() {
  43. return {
  44. input: '',
  45. show: false,
  46. topStep: [
  47. { index: 0, label: '高考分数', title: '(一)输入高考的成绩' },
  48. { index: 1, label: '填报批次', title: '(二)选择填报批次' },
  49. { index: 2, label: '院校专业', title: '(三)选择院校专业' },
  50. { index: 3, label: '保存志愿', title: '(四)我的志愿' }
  51. ],
  52. batch: {},
  53. form: {
  54. score: '',
  55. firstSubject: '',
  56. lastSubject: [],
  57. rank: ''
  58. },
  59. zytbBatchesList: [],
  60. currentStep: 0
  61. }
  62. },
  63. computed: {
  64. active() {
  65. return this.topStep.find(item => {
  66. return item.index == this.currentStep
  67. })
  68. }
  69. },
  70. methods: {
  71. toReport() {
  72. this.$router.push({ name: 'VolunteerList' })
  73. },
  74. save() {
  75. console.log('保存志愿')
  76. },
  77. onFillIn(item) {
  78. console.log(item)
  79. this.batch = item
  80. this.currentStep = 2
  81. },
  82. next() {
  83. const currentActive = this.currentStep
  84. switch (currentActive) {
  85. case 0:
  86. this.submitScore()
  87. break
  88. case 1:
  89. this.$message.warning('请点击批次按钮进行填写')
  90. break
  91. }
  92. },
  93. submitScore() {
  94. this.$refs.score.validate().then(() => this.httpzytbBatches())
  95. },
  96. toBackPage() {
  97. if (this.currentStep <= 0) {
  98. return
  99. }
  100. this.currentStep--
  101. // this.$refs.score.init(this.form)
  102. },
  103. httpzytbBatches() {
  104. const mode = [this.form.firstSubject, ...this.form.lastSubject].filter(i => i != '').toString()
  105. console.log(mode)
  106. zytbBatches({
  107. score: this.form.score,
  108. mode: mode
  109. }).then((res) => {
  110. this.zytbBatchesList = res.rows
  111. this.currentStep = 1
  112. })
  113. }
  114. }
  115. }
  116. </script>
  117. <style scoped>
  118. .zhiyuan-wrapper {
  119. padding: 20px 0;
  120. margin: 30px auto;
  121. background-color: #fff;
  122. }
  123. .bar {
  124. padding: 0 100px 20px;
  125. border-bottom: 1px solid #d6d6d6;
  126. }
  127. .step-list {
  128. display: flex;
  129. justify-content: space-between;
  130. position: relative;
  131. margin-bottom: 50px;
  132. }
  133. .step-list.line::before {
  134. position: absolute;
  135. content: "";
  136. width: 100%;
  137. height: 2px;
  138. top: 50%;
  139. background: #6cd1b5;
  140. z-index: 0;
  141. }
  142. .step-item {
  143. position: relative;
  144. background: #fff;
  145. z-index: 2;
  146. border: 1px solid #6cd1b5;
  147. border-radius: 50%;
  148. color: #6cd1b5;
  149. width: 48px;
  150. height: 48px;
  151. line-height: 46px;
  152. display: flex;
  153. align-items: center;
  154. justify-content: center;
  155. }
  156. .step-label {
  157. font-weight: bolder;
  158. color: #555555;
  159. width: 100px;
  160. text-align: center;
  161. font-size: 14px;
  162. position: absolute;
  163. bottom: -40px;
  164. }
  165. .step-number {
  166. line-height: 48px;
  167. text-align: center;
  168. }
  169. .step-number.curindex {
  170. width: 48px;
  171. height: 48px;
  172. flex-shrink: 0;
  173. background: #6cd1b5;
  174. border-radius: 50%;
  175. color: #fff;
  176. }
  177. .right_cart {
  178. position: fixed;
  179. top: 50%;
  180. right: -320px;
  181. transform: translate(0%, -50%);
  182. transition: all 1s ease;
  183. }
  184. .active {
  185. right: 0;
  186. }
  187. .right_cart {
  188. display: flex;
  189. z-index: 9999;
  190. }
  191. .right_cart .btn-wrap {
  192. cursor: pointer;
  193. align-self: baseline;
  194. border-radius: 5px 0 0 5px;
  195. color: white;
  196. background: #42b983;
  197. width: 30px;
  198. text-align: center;
  199. font-size: 16px;
  200. margin-top: 10px;
  201. padding: 7px;
  202. }
  203. .content-wrap {
  204. padding: 10px 0;
  205. background: #fff;
  206. width: 320px;
  207. min-height: 268px;
  208. display: flex;
  209. flex-direction: column;
  210. border: 1px solid #f2f2f2;
  211. }
  212. .content {
  213. height: 100%;
  214. }
  215. .content .list {
  216. min-height: 188px;
  217. }
  218. .content-wrap .input {
  219. padding: 0 15px;
  220. }
  221. .content-wrap .btn {
  222. width: 100%;
  223. padding: 0 15px;
  224. }
  225. .mask {
  226. z-index: 2009;
  227. position: absolute;
  228. top: 0;
  229. right: 0;
  230. bottom: 0;
  231. left: 0;
  232. overflow: auto;
  233. opacity: 0.5;
  234. margin: 0;
  235. }
  236. </style>