index.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. <template>
  2. <view class="content">
  3. <swiper class="swiper" :autoplay="autoplay" :duration="duration">
  4. <swiper-item v-for="(item,index) in advList" :key="index">
  5. <view class="swiper-item">
  6. <view class="swiper-item-img">
  7. <image :src="item" mode="aspectFit"></image>
  8. </view>
  9. </view>
  10. </swiper-item>
  11. </swiper>
  12. <view class="jump-over" @tap="launchFlag()">跳过 {{time}}</view>
  13. </view>
  14. </template>
  15. <script>
  16. export default {
  17. data() {
  18. return {
  19. autoplay: false,
  20. duration: 500,
  21. jumpover: '跳过',
  22. experience: '立即体验',
  23. time: 5,
  24. timecount:undefined
  25. }
  26. },
  27. props: {
  28. advList: {
  29. type: Array,
  30. default: () => {
  31. []
  32. }
  33. }
  34. },
  35. mounted() {
  36. this.timer()
  37. },
  38. methods: {
  39. timer() {
  40. var t = 5
  41. this.timecount = setInterval(() => {
  42. t--
  43. this.time = t
  44. if (t <= 0) {
  45. clearInterval(this.timecount)
  46. this.launchFlag()
  47. }
  48. }, 1000)
  49. },
  50. launchFlag: function() {
  51. /**
  52. * 向本地存储中设置launchFlag的值,即启动标识;
  53. */
  54. clearInterval(this.timecount)
  55. // uni.setStorage({
  56. // key: 'launchFlag',
  57. // data: true,
  58. // });
  59. uni.switchTab({
  60. url: '/pages/index/index'
  61. });
  62. }
  63. }
  64. }
  65. </script>
  66. <style>
  67. page,
  68. .content {
  69. width: 100%;
  70. height: 100%;
  71. background-size: 100% auto;
  72. padding: 0;
  73. z-index: 999;
  74. }
  75. .swiper {
  76. width: 100%;
  77. height: 100vh;
  78. background: #FFFFFF;
  79. }
  80. .swiper-item {
  81. width: 100%;
  82. height: 100%;
  83. text-align: center;
  84. position: relative;
  85. display: flex;
  86. /* justify-content: center; */
  87. align-items: flex-end;
  88. flex-direction: column-reverse
  89. }
  90. .swiper-item-img {
  91. width: 100%;
  92. height: 100vh;
  93. margin: 0 auto;
  94. }
  95. .swiper-item-img image {
  96. width: 100%;
  97. height: 100%;
  98. }
  99. .uniapp-img {
  100. height: 50%;
  101. background: #FFFFFF;
  102. display: flex;
  103. justify-content: center;
  104. align-items: center;
  105. overflow: hidden;
  106. }
  107. .uniapp-img image {
  108. width: 40%;
  109. }
  110. .jump-over,
  111. .experience {
  112. position: absolute;
  113. height: 45rpx;
  114. line-height: 45rpx;
  115. padding: 0 15rpx;
  116. border-radius: 30rpx;
  117. font-size: 24rpx;
  118. color: #b09e9a;
  119. border: 1px solid #b09e9a;
  120. z-index: 999;
  121. }
  122. .jump-over {
  123. right: 30rpx;
  124. top: 80rpx;
  125. }
  126. .experience {
  127. right: 50%;
  128. margin-right: -105upx;
  129. bottom: 80rpx;
  130. }
  131. </style>