step-paper.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. <template>
  2. <uv-transition v-if="welcomeShow" :show="welcomeShow">
  3. <view class="page-content h-screen">
  4. <mx-nav-bar :title="title"/>
  5. <view class="flex-1 fx-col">
  6. <view class="flex-1 tabs-swiper-content">
  7. <slot name="welcome"/>
  8. </view>
  9. <view class="p-40 fx-col gap-20">
  10. <uv-button v-bind="btnBinding" text="开始测评" @click="handleStart"/>
  11. <uv-button v-bind="btnBinding" plain text="测评结果" @click="handleHistory"/>
  12. </view>
  13. </view>
  14. </view>
  15. </uv-transition>
  16. <mx-paper v-if="!welcomeShow&&!resultShow">
  17. <template #top>
  18. <view>
  19. <mx-steps :step="step" :steps="steps" key-name="name" class="mt-20"/>
  20. <view class="p-30 text-sm text-content">{{ currentStep.title }}</view>
  21. </view>
  22. </template>
  23. <template #bottom>
  24. <mx-paper-progress/>
  25. <step-paper-navigator/>
  26. </template>
  27. </mx-paper>
  28. <uv-transition v-if="resultShow" :show="resultShow">
  29. <view class="page-content">
  30. <mx-nav-bar :title="title"/>
  31. <slot name="result"/>
  32. </view>
  33. </uv-transition>
  34. </template>
  35. <script setup>
  36. import {createPropDefine} from "@/utils";
  37. import {useTransfer} from "@/hooks/useTransfer";
  38. import {useInjectStepPaper} from "@/pages/test-center/components/step-paper/useStepPaperInjection";
  39. import StepPaperNavigator from "@/pages/test-center/components/step-paper/step-paper-navigator.vue";
  40. import MxPaperProgress from "@/components/mx-paper/components/mx-paper-progress.vue";
  41. // 目前holland与mbti是同一套行为
  42. const props = defineProps({
  43. history: createPropDefine('/pages/test-center/list/list'),
  44. type: createPropDefine(''),
  45. // transferTo中创建的URL中包含data参数,该参数会自动进入页面的props,
  46. // 这里申明一下防止多结点警告,并不需要使用它,useTransfer中包含使用方法。
  47. data: createPropDefine({}, [Object, Array, String])
  48. })
  49. const {transferTo} = useTransfer()
  50. const {
  51. title, welcomeShow, resultShow,
  52. step, steps, currentStep
  53. } = useInjectStepPaper()
  54. const btnBinding = {
  55. size: 'large',
  56. type: 'primary',
  57. shape: 'circle',
  58. customStyle: {height: '44px'}
  59. }
  60. const handleStart = () => {
  61. // welcomeShow 会驱动测评的数据变更
  62. welcomeShow.value = false
  63. }
  64. const handleHistory = () => {
  65. const {type} = props
  66. transferTo(props.history, {type})
  67. }
  68. </script>
  69. <style scoped>
  70. </style>