code-elf-guide.vue 2.4 KB

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