NewSimulatedVolunteer.vue 5.8 KB

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