index-popup.vue 2.9 KB

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