homePage.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  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. <div @click="goback" class="uni-page-head-btn"><i class="uni-btn-icon" style="color: rgb(0, 0, 0); font-size: 27px;"></i></div>
  8. <view class="zdyNavTitle">车型件</view>
  9. <view class="zdyNavRight"></view>
  10. </view>
  11. </view>
  12. <view class="status_bar" :style="{height: iStatusBarHeight + 'px'}"></view>
  13. <view style="height: 44px;"></view>
  14. <view class="mainBox">
  15. <!-- 轮播图 -->
  16. <swiper class="swiper" :circular="true" :indicator-dots="true" indicator-active-color="#FF4F00">
  17. <swiper-item v-for="(item,index) in bannerArr">
  18. <image :src="item" mode="" class="swpImg"></image>
  19. </image>
  20. </swiper-item>
  21. </swiper>
  22. <view class="btnBox">
  23. <image @click="goIndex()" class="searchBtn" src="../../static/img/button_search.png" mode=""></image>
  24. <view @click="goSelectCarModel()" class="brand">选择品牌</view>
  25. </view>
  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. goSelectCarModel(){
  58. uni.navigateTo({
  59. url: 'SelectCarModel'
  60. })
  61. },
  62. goback() {
  63. console.log('返回');
  64. // uni.navigateBack({})
  65. //app交互
  66. var standalone = window.navigator.standalone
  67. var userAgent = window.navigator.userAgent.toLowerCase()
  68. var safari = /safari/.test(userAgent)
  69. var ios = /iphone|ipod|ipad|mac/.test(userAgent)
  70. var android = /android/.test(userAgent)
  71. if (ios) {
  72. if ( true) {//!standalone&& !safari
  73. window.webkit.messageHandlers.goMyNav.postMessage(null)
  74. }
  75. } else if (android) {
  76. window.android.postMessage()
  77. }
  78. },
  79. }
  80. }
  81. </script>
  82. <style>
  83. .box {
  84. min-height: 100vh;
  85. background: #ffffff;
  86. /* iOS 底部安全区 */
  87. padding-bottom: constant(safe-area-inset-bottom);
  88. padding-bottom: env(safe-area-inset-bottom);
  89. }
  90. .zdyNavBox {
  91. width: 100vw;
  92. background: #FFFFFF;
  93. position: fixed;
  94. top: 0;
  95. left: 0;
  96. z-index: 9999999;
  97. }
  98. .zdyNav {
  99. display: flex;
  100. justify-content: space-between;
  101. align-items: center;
  102. padding: 14rpx 6rpx;
  103. }
  104. .zdyNavTitle {
  105. background: #FFFFFF;
  106. text-align: center;
  107. font-size: 32rpx;
  108. font-weight: bold;
  109. }
  110. .zdyNavRight {
  111. background: #FFFFFF;
  112. text-align: center;
  113. font-size: 28rpx;
  114. color: #3F90F7;
  115. width: 54rpx;
  116. }
  117. .mainBox {
  118. background: #FFFFFF;
  119. min-height: 100vh;
  120. width: 100vw;
  121. }
  122. .swiper,
  123. .swiper-item,
  124. .swpImg {
  125. width: 100%;
  126. height: 390rpx;
  127. }
  128. .btnBox{
  129. padding: 30rpx 24rpx;
  130. width: 100%;
  131. height: 92rpx;
  132. position: relative;
  133. }
  134. .searchBtn{
  135. width: calc(100vw - 48rpx);
  136. height: 92rpx;
  137. }
  138. .brand{
  139. color: #FFFFFF;
  140. font-size: 28rpx;
  141. width: 160rpx;
  142. height: 76rpx;
  143. line-height: 76rpx;
  144. background: #F4F5F7 linear-gradient(110deg, #48B9F9 0%, #3F90F7 100%);
  145. border-radius: 51rpx;
  146. text-align: center;
  147. position: absolute;
  148. top: 38rpx;
  149. right: 80rpx;
  150. }
  151. .centerBox{
  152. margin-top: 140rpx;
  153. margin-bottom: 100rpx;
  154. display: flex;
  155. justify-content: center;
  156. align-items: center;
  157. }
  158. .title{
  159. padding: 142rpx 116rpx 100rpx;
  160. width: calc(100vw - 232rpx);
  161. height: 40rpx;
  162. }
  163. .content{
  164. padding: 0 47rpx;
  165. width: calc(100vw - 94rpx);
  166. height: 224rpx;
  167. }
  168. </style>