index.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <template>
  2. <view class="page-content">
  3. <mx-nav-bar v-bind="navBinding"/>
  4. <view ref="container" class="flex-1 min-h-1">
  5. <swiper :current="currentStep" disable-touch :style="{height: height+'px'}">
  6. <swiper-item>
  7. <score-step/>
  8. </swiper-item>
  9. <swiper-item>
  10. <batch-step/>
  11. </swiper-item>
  12. <swiper-item>
  13. <cart-step/>
  14. </swiper-item>
  15. </swiper>
  16. </view>
  17. </view>
  18. </template>
  19. <script setup>
  20. import {ref} from 'vue';
  21. import {useProvideTransfer} from "@/hooks/useTransfer";
  22. import {useProvideVoluntaryStep} from "@/pages/voluntary/hooks/useVoluntaryStepInjection";
  23. import {useProvideVoluntaryData} from "@/hooks/useVoluntaryDataInjection";
  24. import {useProvideVoluntaryForm} from "@/pages/voluntary/hooks/useVoluntaryFormInjection";
  25. import {useProvideVoluntaryCart} from "@/pages/voluntary/hooks/useVoluntaryCartInjection";
  26. import {useProvideVoluntaryAssistant} from "@/pages/voluntary/hooks/useVoluntaryAssistantInjection";
  27. import ScoreStep from "@/pages/voluntary/index/components/score-step.vue";
  28. import {useElementSize} from "@vueuse/core";
  29. import {useProvideUserSnapshot} from "@/pages/ie/hooks/useUserSnapshotInjection";
  30. import BatchStep from "@/pages/voluntary/index/components/batch-step.vue";
  31. import CartStep from "@/pages/voluntary/index/components/cart-step.vue";
  32. import {useProvideVoluntaryMajorHighlight} from "@/pages/voluntary/hooks/useVoluntaryMajorHighlightInjection";
  33. import {useProvideVoluntaryHeader} from "@/pages/voluntary/hooks/useVoluntaryHeaderInjection";
  34. useProvideUserSnapshot()
  35. const {transferTo} = useProvideTransfer()
  36. const stepSvc = useProvideVoluntaryStep()
  37. const dataSvc = useProvideVoluntaryData()
  38. const formSvc = useProvideVoluntaryForm()
  39. const cartSvc = useProvideVoluntaryCart()
  40. const highlightSvc = useProvideVoluntaryMajorHighlight()
  41. useProvideVoluntaryHeader()
  42. const {currentStep} = stepSvc
  43. const container = ref(null) // swiper必须指定明确的高度,所以多包了一层
  44. const {height} = useElementSize(container)
  45. const assistantSvc = useProvideVoluntaryAssistant(stepSvc, dataSvc, formSvc, cartSvc, highlightSvc, height)
  46. const {navBinding, onComplete, resetAll} = assistantSvc
  47. onComplete((id) => {
  48. transferTo('/pages/voluntary/detail/detail', {id})
  49. currentStep.value = 0
  50. resetAll()
  51. })
  52. </script>
  53. <style scoped lang="scss">
  54. </style>