guide_old.vue 2.5 KB

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