guide_old.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. <template>
  2. <view class="swiper-container">
  3. <swiper class="guide_swiper" :autoplay="autoplay" :interval="interval" :duration="duration"
  4. @change="swiperChange">
  5. <block v-for="(item, index) in imgUrls" :key="index">
  6. <swiper-item>
  7. <image :src="item" mode="aspectFit" class="slide-image"></image>
  8. <button class="button-img" @tap="goto_next" v-if="index == imgUrls.length - 1">立即体验</button>
  9. </swiper-item>
  10. </block>
  11. </swiper>
  12. <view class="dots">
  13. <block v-for="(item, index) in imgUrls" :key="index">
  14. <view :class="'dot' + (index == swiperCurrent ? ' active' : '')"></view>
  15. </block>
  16. </view>
  17. </view>
  18. </template>
  19. <script>
  20. var app = getApp()
  21. export default {
  22. data() {
  23. return {
  24. imgUrls: ["https://szsq.nxzhsq.cn/community/miniofile/image/guide_rl.png", "https://szsq.nxzhsq.cn/community/miniofile/image/guide_sq.png", "https://szsq.nxzhsq.cn/community/miniofile/image/guide_jr.png", "https://szsq.nxzhsq.cn/community/miniofile/image/guide_km.png"],
  25. //广告轮播图
  26. autoplay: false,
  27. interval: 5000,
  28. duration: 300,
  29. swiperCurrent: 0
  30. };
  31. },
  32. components: {},
  33. props: {},
  34. /**
  35. * 生命周期函数--监听页面加载
  36. */
  37. onReady: function (options) {
  38. console.log("onready");
  39. //调用API从本地缓存中获取数据
  40. var isFir = uni.getStorageSync('isFirst');
  41. if (isFir == 'true') {
  42. uni.reLaunch({
  43. url: "/pages/index/index?isFlush=true"
  44. })
  45. }
  46. },
  47. onLoad() {
  48. },
  49. methods: {
  50. goto_next: function (val) {
  51. uni.setStorageSync("isFirst", 'true');
  52. uni.reLaunch({
  53. url: "/pages/index/index?isFlush=true"
  54. })
  55. },
  56. swiperChange: function (e) {
  57. this.swiperCurrent = e.detail.current
  58. }
  59. }
  60. };
  61. </script>
  62. <style>
  63. page {
  64. background-color: #fff;
  65. }
  66. .swiper-container {
  67. position: relative;
  68. }
  69. .guide_swiper {
  70. width: 100%;
  71. height: 100vh;
  72. }
  73. .slide-image {
  74. margin: 0 auto;
  75. height: 100vh;
  76. width: 100%;
  77. }
  78. .button-img {
  79. position: fixed;
  80. z-index: 1000;
  81. bottom: 220 rpx;
  82. width: 210 rpx;
  83. height: 60 rpx;
  84. line-height: 60 rpx;
  85. left: 270 rpx;
  86. font-size: 30 rpx;
  87. text-align: center;
  88. box-sizing: border-box;
  89. background-color: #33b6ea;
  90. opacity: 0.7;
  91. color: #fff;
  92. border-radius: 30 rpx;
  93. }
  94. .dots {
  95. position: absolute;
  96. left: 50%;
  97. transform: translate(-50%, 0);
  98. right: 0;
  99. bottom: 150 rpx;
  100. display: flex;
  101. justify-content: center;
  102. }
  103. .dot {
  104. margin: 0 8 rpx;
  105. width: 14 rpx;
  106. height: 14 rpx;
  107. background: #33b6ea;
  108. border-radius: 8 rpx;
  109. transition: all .6s;
  110. }
  111. .dot.active {
  112. width: 24 rpx;
  113. background: #f80;
  114. }
  115. </style>