index-popup.vue 2.5 KB

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