index.vue 2.5 KB

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