index-popup.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <template>
  2. <!-- #ifdef H5 -->
  3. <teleport to="body">
  4. <!-- #endif -->
  5. <!-- #ifdef MP-WEIXIN -->
  6. <root-portal externalClass="theme-ie">
  7. <!-- #endif -->
  8. <uv-popup ref="popupRef" mode="bottom" :round="16" :closeOnClickOverlay="false">
  9. <view class="popup-content">
  10. <view class="p-40">
  11. <view class="text-32 text-fore-title font-bold">请确认信息</view>
  12. <view class="mt-10 text-26 text-fore-light">让我们开始体验升学备考之旅吧!</view>
  13. </view>
  14. <view class="mx-30 pb-50">
  15. <view class="flex items-center px-42 bg-back rounded-40 h-104 box-border">
  16. <view class="flex-shrink-0">所在省份</view>
  17. <ie-picker ref="pickerRef" v-model="form.location" :list="provinceList" :customStyle="customStyle"
  18. placeholder="请选择" key-label="dictLabel" key-value="dictValue">
  19. </ie-picker>
  20. </view>
  21. <view class="mt-30 flex items-center px-42 bg-back rounded-40 h-104 box-border">
  22. <view class="flex-shrink-0">考生类别</view>
  23. <ie-picker ref="pickerRef" v-model="form.examType" :list="examTypeList" :disabled="!form.location"
  24. :customStyle="customStyle" placeholder="请选择" key-label="dictLabel" key-value="dictValue">
  25. </ie-picker>
  26. </view>
  27. <view class="mt-140">
  28. <ie-button type="primary" @click="handleConfirm">立即体验</ie-button>
  29. </view>
  30. </view>
  31. </view>
  32. </uv-popup>
  33. <!-- #ifdef MP-WEIXIN -->
  34. </root-portal>
  35. <!-- #endif -->
  36. <!-- #ifdef H5 -->
  37. </teleport>
  38. <!-- #endif -->
  39. </template>
  40. <script lang="ts" setup>
  41. import { useExamType } from '@/composables/useExamType';
  42. import { useUserStore } from '@/store/userStore';
  43. const userStore = useUserStore();
  44. const popupRef = ref();
  45. const { form, provinceList, examTypeList } = useExamType();
  46. const customStyle = {
  47. textAlign: 'right'
  48. }
  49. const handleConfirm = () => {
  50. const { location, examType } = form.value
  51. if (!location) {
  52. uni.$ie.showToast('请选择省份');
  53. return;
  54. }
  55. if (!examType) {
  56. uni.$ie.showToast('请选择考生类别');
  57. return;
  58. }
  59. userStore.tempInfo = {
  60. location,
  61. examType
  62. }
  63. popupRef.value.close();
  64. }
  65. const open = () => {
  66. if (userStore.tempInfo) {
  67. console.log()
  68. form.value.location = userStore.tempInfo.location;
  69. setTimeout(() => {
  70. form.value.examType = userStore.tempInfo!.examType;
  71. }, 0);
  72. }
  73. popupRef.value.open();
  74. }
  75. const close = () => {
  76. popupRef.value.close();
  77. }
  78. defineExpose({ open, close })
  79. </script>
  80. <style lang="scss" scoped></style>