guide.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. <template>
  2. <view class="pages">
  3. <view class="hold-status-bar show">
  4. <!-- 占据了状态栏位置 -->
  5. </view>
  6. <view class="guide-img" :class="{isheight:isheight}">
  7. <swiper class="swiper"
  8. :indicator-dots="swiper.indicatorDots"
  9. :indicator-color="swiper.indicatorColor"
  10. :indicator-active-color="swiper.indicatorActiveColor"
  11. :autoplay="swiper.autoplay"
  12. :interval="swiper.interval" :duration="swiper.duration">
  13. <swiper-item>
  14. <view class="adv-item"><image :src="$getimg +'guide01-s1.png'" class="pic" mode="widthFix"></image></view>
  15. </swiper-item>
  16. <swiper-item>
  17. <view class="adv-item" style="background-color: #26C896;"><image :src="$getimg +'guide02.png'" class="pic" mode="widthFix"></image></view>
  18. </swiper-item>
  19. <swiper-item>
  20. <view class="adv-item" style="background-color: #26C896;"><image :src="$getimg +'guide03.png'" class="pic" mode="widthFix"></image></view>
  21. </swiper-item>
  22. <swiper-item>
  23. <view class="adv-item" style="background-color: #26C896;" @click="goIndex">
  24. <image :src="$getimg +'guide04.png'" class="pic" mode="widthFix"></image>
  25. <view class="tip-btn-wrap">
  26. <text class="tip-btn">立即体验</text>
  27. </view>
  28. </view>
  29. </swiper-item>
  30. </swiper>
  31. <!-- <div id="universal-preloader">
  32. <div class="preloader">
  33. <span class="preloader-time"><i id="preloader-time-num">{{preloaderTime}}</i>秒后关闭</span>
  34. </div>
  35. </div> -->
  36. </view>
  37. </view>
  38. </template>
  39. <script>
  40. export default {
  41. data() {
  42. return {
  43. preloaderTime:5,
  44. $getimg:this.$getimg,
  45. isheight:false,
  46. swiper: {
  47. indicatorDots: true,
  48. autoplay: false,
  49. interval: 9000,
  50. duration: 500,
  51. indicatorColor:"rgba(171, 234, 213, 1)",
  52. indicatorActiveColor:"rgba(54, 206, 149, 1)",
  53. },
  54. }
  55. },
  56. onShow() {
  57. // console.log('config',this.$getimg);
  58. },
  59. onLoad() {
  60. // console.log(this.config.version);
  61. let self = this;
  62. uni.getSystemInfo({
  63. success: function (res) {
  64. console.log('getSystemInfo',res);
  65. let windowscale = res.windowHeight/res.screenWidth;//屏幕高宽比
  66. console.log('res.windowHeight',res.windowHeight);
  67. console.log('res.screenWidth',res.screenWidth);
  68. console.log('windowscale',windowscale);
  69. if(res.windowHeight>800){
  70. self.isheight = true;
  71. }
  72. }
  73. });
  74. },
  75. onReady() {
  76. // 从本地缓存中同步获取指定 key 对应的内容,用于判断是否是第一次打开应用
  77. const launch = uni.getStorageSync('launchFlag');
  78. console.log('launch',launch);
  79. const version = uni.getStorageSync('version');
  80. if(!version){
  81. uni.setStorage({
  82. key: 'version',
  83. data: this.config.version
  84. });
  85. }
  86. if (launch&&version==this.config.version) {
  87. // 如果已经有,直接去首页
  88. this.goIndex();
  89. } else {
  90. // 没有值,跳到引导页,并存储,下次打开就不会进去引导页
  91. // uni.setStorage({
  92. // key: 'launchFlag',
  93. // data: true
  94. // });
  95. // this.lxfEndtime();
  96. }
  97. },
  98. methods: {
  99. goIndex(){
  100. uni.setStorage({
  101. key: 'version',
  102. data: this.config.version
  103. });
  104. uni.setStorage({
  105. key: 'launchFlag',
  106. data: true
  107. });
  108. uni.redirectTo({
  109. url: '/pages/login/loginType',
  110. fail(err) {
  111. // console.log(err)
  112. }
  113. });
  114. },
  115. lxfEndtime(){
  116. let that = this;
  117. let $i;
  118. if(that.preloaderTime!=0){
  119. that.preloaderTime--;
  120. $i=setTimeout(function(){that.lxfEndtime()},1000);
  121. }else{
  122. clearTimeout($i);
  123. this.goIndex();
  124. }
  125. }
  126. }
  127. }
  128. </script>
  129. <style scoped>
  130. .guide-img{position: fixed;left: 0;right: 0;top:40rpx;bottom: 0;display: block;}
  131. .guide-img.isheight{top: 115rpx;}
  132. .swiper{height: 100%;}
  133. .adv-item{height: 100%;position: relative;}
  134. .guide-img .pic{width: 100%;height: 100%;/* max-height: 100%; */}
  135. .adv-item .tip-btn-wrap{position: fixed;left: 0;bottom: 60rpx;right: 0;text-align: center;}
  136. .adv-item .tip-btn{display: inline-block;width: 454rpx;height: 100rpx;line-height: 100rpx;font-size: 35rpx;font-weight: 600;letter-spacing: 6rpx;color: #24C696;background-color: #fff;border-radius: 100rpx;}
  137. /* #universal-preloader{position:fixed;top:0px;left:0px;width:100%;height:100%;opacity:1;background:rgba(0,0,0,0.1) !important;filter:Alpha(opacity=100);background:#000;z-index:1020;}
  138. #universal-preloader>.preloader{position: relative;width: 100%;height: 100%;}
  139. .universal-preloader-preloader{width: 100%;min-height: 100%;}
  140. .preloader-time{position: absolute;right: 24px;top: 24px;font-size: 24rpx;display: inline-block;background: #fff;padding: 3px 8px;border-radius: 10px;}
  141. #preloader-time-num{font-style: normal;margin-right: 5rpx;color: #57992c;} */
  142. </style>