index.vue 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <template>
  2. <view >
  3. <uni-popup ref="inputDialog" class="pop" :mask-click="false" @close="closeAdd">
  4. <view class="popup-content" >
  5. <swiper class="swiper-box" @change="swiperChange">
  6. <swiper-item v-for="(item ,index) in swiperList" :key="index" class="f-straight">
  7. <image class="img-item" :src="item.url" @click="skipLink()" mode="widthFix"></image>
  8. <view @click="closeAdd" class="f-horizon-center">
  9. <uni-icons style="display: flex;justify-content: flex-end;" type="closeempty" size="40" color="#fff"/>
  10. </view>
  11. </swiper-item>
  12. </swiper>
  13. </view>
  14. </uni-popup>
  15. </view>
  16. </template>
  17. <script setup>
  18. import { ref, onMounted } from 'vue'
  19. const emit = defineEmits(['login'])
  20. const current = ref(0)
  21. const inputDialog = ref()
  22. const swiperList = [{ url: 'https://minio.menduner.com/dev/menduner/advertisement.jpg', path: '' }]
  23. const currentPage = getCurrentPages()[0].route
  24. const closeAdd = () => {
  25. inputDialog.value.close()
  26. uni.removeStorageSync('firstOpen')
  27. }
  28. const openDialog = () => {
  29. inputDialog.value.open()
  30. }
  31. const skipLink = () => {
  32. closeAdd()
  33. if (currentPage !== 'pages/login/index') emit('login')
  34. }
  35. const swiperChange = (e) => {
  36. current.value = e.detail.current
  37. }
  38. onMounted(() => {
  39. if(uni.getStorageSync('firstOpen')) openDialog()
  40. })
  41. </script>
  42. <style scoped lang="scss">
  43. .popup-content {
  44. align-items: center;
  45. justify-content: center;
  46. width: 80vw;
  47. height: 100vh;
  48. }
  49. .img-item{
  50. width: 100%;
  51. height: 60vh;
  52. margin: 0;
  53. border-radius: 20px;
  54. }
  55. .swiper-box{
  56. height: 100vh;
  57. }
  58. .f-straight{
  59. display: flex;
  60. justify-content: center;
  61. flex-direction: column;
  62. }
  63. </style>