homePage.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. <template>
  2. <view class="box">
  3. <!-- 自定义导航 -->
  4. <view class="zdyNavBox">
  5. <view class="status_bar" :style="{height: iStatusBarHeight + 'px'}"></view>
  6. <view class="zdyNav">
  7. <view class="zdyNavLeft">
  8. <image src="../../static/img/nav_icon_back.png" mode="aspectFit" class="backImg" @click="goback">
  9. </image>
  10. </view>
  11. <view class="zdyNavTitle">车型件</view>
  12. <view class="zdyNavRight"></view>
  13. </view>
  14. </view>
  15. <view class="status_bar" :style="{height: iStatusBarHeight + 'px'}"></view>
  16. <view style="height: 44px;"></view>
  17. <view class="mainBox">
  18. <!-- 轮播图 -->
  19. <swiper class="swiper" :circular="true" :indicator-dots="true" indicator-active-color="#FF4F00">
  20. <swiper-item v-for="(item,index) in bannerArr">
  21. <image :src="item" mode="" class="swpImg"></image>
  22. </image>
  23. </swiper-item>
  24. </swiper>
  25. <image @click="goIndex()" class="searchBtn" src="../../static/img/button_search.png" mode=""></image>
  26. <image class="title" src="../../static/img/text_zhongjian.png" mode=""></image>
  27. <image class="content" src="../../static/img/text_shuoming.png" mode=""></image>
  28. </view>
  29. </view>
  30. </template>
  31. <script>
  32. import searchBox from '@/components/searchBox/searchBox.vue'
  33. export default {
  34. components: {
  35. searchBox
  36. },
  37. data() {
  38. return {
  39. iStatusBarHeight: '',
  40. bannerArr:['../../static/img/home_banner1.png','../../static/img/home_banner2.png','../../static/img/home_banner3.png'],
  41. searchValue: '',
  42. }
  43. },
  44. onLoad() {
  45. this.iStatusBarHeight = uni.getSystemInfoSync().statusBarHeight;
  46. },
  47. methods: {
  48. search(val) {
  49. // console.log(val);
  50. this.searchValue = val
  51. },
  52. goIndex() {
  53. uni.navigateTo({
  54. url: 'index'
  55. })
  56. },
  57. goback() {
  58. console.log('返回');
  59. // uni.navigateBack({})
  60. //app交互
  61. var standalone = window.navigator.standalone
  62. var userAgent = window.navigator.userAgent.toLowerCase()
  63. var safari = /safari/.test(userAgent)
  64. var ios = /iphone|ipod|ipad|mac/.test(userAgent)
  65. var android = /android/.test(userAgent)
  66. if (ios) {
  67. if ( true) {//!standalone&& !safari
  68. window.webkit.messageHandlers.goMyNav.postMessage(null)
  69. }
  70. } else if (android) {
  71. window.android.postMessage()
  72. }
  73. },
  74. }
  75. }
  76. </script>
  77. <style>
  78. .box {
  79. min-height: 100vh;
  80. background: #ffffff;
  81. /* iOS 底部安全区 */
  82. padding-bottom: constant(safe-area-inset-bottom);
  83. padding-bottom: env(safe-area-inset-bottom);
  84. }
  85. .zdyNavBox {
  86. width: 100vw;
  87. background: #FFFFFF;
  88. position: fixed;
  89. top: 0;
  90. left: 0;
  91. z-index: 9999999;
  92. }
  93. .zdyNav {
  94. height: 44px;
  95. display: flex;
  96. justify-content: space-between;
  97. align-items: center;
  98. padding: 0 24rpx;
  99. }
  100. .backImg {
  101. width: 22rpx;
  102. height: 40rpx;
  103. }
  104. .homeImg {
  105. width: 44rpx;
  106. height: 44rpx;
  107. }
  108. .zdyNavLeft {
  109. display: flex;
  110. align-items: center;
  111. width: 44rpx;
  112. }
  113. .zdyNavTitle {
  114. height: 44px;
  115. background: #FFFFFF;
  116. text-align: center;
  117. font-size: 34rpx;
  118. line-height: 44px;
  119. }
  120. .zdyNavRight {
  121. height: 44px;
  122. background: #FFFFFF;
  123. text-align: center;
  124. font-size: 28rpx;
  125. line-height: 44px;
  126. color: #3F90F7;
  127. width: 44rpx;
  128. }
  129. .mainBox {
  130. background: #FFFFFF;
  131. min-height: 100vh;
  132. width: 100vw;
  133. }
  134. .swiper,
  135. .swiper-item,
  136. .swpImg {
  137. width: 100%;
  138. height: 390rpx;
  139. }
  140. .searchBtn{
  141. padding: 30rpx 24rpx 0;
  142. width: calc(100vw - 48rpx);
  143. height: 92rpx;
  144. }
  145. .centerBox{
  146. margin-top: 140rpx;
  147. margin-bottom: 100rpx;
  148. display: flex;
  149. justify-content: center;
  150. align-items: center;
  151. }
  152. .title{
  153. padding: 142rpx 116rpx 100rpx;
  154. width: calc(100vw - 232rpx);
  155. height: 40rpx;
  156. }
  157. .content{
  158. padding: 0 47rpx;
  159. width: calc(100vw - 94rpx);
  160. height: 224rpx;
  161. }
  162. </style>