NewSimulatedVolunteer.vue 5.2 KB

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