homePage.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  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. <div @click="goback" class="uni-page-head-btn"><i class="uni-btn-icon"
  9. style="color: rgb(0, 0, 0); font-size: 27px;"></i></div>
  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. <view class="btnBox">
  26. <image @click="goIndex()" class="searchBtn" src="../../static/img/button_search.png" mode=""></image>
  27. <view @click="goSelectCarModel()" class="brand">选择品牌</view>
  28. </view>
  29. <image class="title" src="../../static/img/text_zhongjian.png" mode=""></image>
  30. <image class="content" @click="goOe" src="../../static/img/text_shuoming.png" mode=""></image>
  31. </view>
  32. </view>
  33. </template>
  34. <script>
  35. import searchBox from '@/components/searchBox/searchBox.vue'
  36. export default {
  37. components: {
  38. searchBox
  39. },
  40. data() {
  41. return {
  42. iStatusBarHeight: '',
  43. bannerArr:['../../static/img/home_banner1.png','../../static/img/home_banner2.png','../../static/img/home_banner3.png'],
  44. searchValue: '',
  45. }
  46. },
  47. onLoad() {
  48. this.iStatusBarHeight = uni.getSystemInfoSync().statusBarHeight;
  49. },
  50. methods: {
  51. search(val) {
  52. // console.log(val);
  53. this.searchValue = val
  54. },
  55. goOe(){
  56. uni.navigateTo({
  57. url: 'oeindex'
  58. })
  59. },
  60. goIndex() {
  61. uni.navigateTo({
  62. url: 'index'
  63. })
  64. },
  65. goSelectCarModel(){
  66. uni.navigateTo({
  67. url: 'SelectCarModel'
  68. })
  69. },
  70. goback() {
  71. console.log('返回');
  72. // uni.navigateBack({})
  73. //app交互
  74. var standalone = window.navigator.standalone
  75. var userAgent = window.navigator.userAgent.toLowerCase()
  76. var safari = /safari/.test(userAgent)
  77. var ios = /iphone|ipod|ipad|mac/.test(userAgent)
  78. var android = /android/.test(userAgent)
  79. if (ios) {
  80. if ( true) {//!standalone&& !safari
  81. window.webkit.messageHandlers.goMyNav.postMessage(null)
  82. }
  83. } else if (android) {
  84. window.android.postMessage()
  85. }
  86. },
  87. }
  88. }
  89. </script>
  90. <style>
  91. .box {
  92. min-height: 100vh;
  93. background: #ffffff;
  94. /* iOS 底部安全区 */
  95. padding-bottom: constant(safe-area-inset-bottom);
  96. padding-bottom: env(safe-area-inset-bottom);
  97. }
  98. .zdyNavBox {
  99. width: 100vw;
  100. background: #FFFFFF;
  101. position: fixed;
  102. top: 0;
  103. left: 0;
  104. z-index: 9999999;
  105. }
  106. .zdyNav {
  107. display: flex;
  108. justify-content: space-between;
  109. align-items: center;
  110. padding: 14rpx 6rpx;
  111. }
  112. .zdyNavLeft{
  113. }
  114. .zdyNavTitle {
  115. background: #FFFFFF;
  116. text-align: center;
  117. font-size: 32rpx;
  118. font-weight: bold;
  119. }
  120. .zdyNavRight {
  121. background: #FFFFFF;
  122. text-align: center;
  123. font-size: 28rpx;
  124. color: #3F90F7;
  125. width: 54rpx;
  126. }
  127. .mainBox {
  128. background: #FFFFFF;
  129. min-height: 100vh;
  130. width: 100vw;
  131. }
  132. .swiper,
  133. .swiper-item,
  134. .swpImg {
  135. width: 100%;
  136. height: 390rpx;
  137. }
  138. .btnBox{
  139. padding: 30rpx 24rpx;
  140. height: 92rpx;
  141. position: relative;
  142. }
  143. .searchBtn{
  144. width: calc(100vw - 48rpx);
  145. height: 92rpx;
  146. }
  147. .brand{
  148. color: #FFFFFF;
  149. font-size: 28rpx;
  150. width: 160rpx;
  151. height: 76rpx;
  152. line-height: 76rpx;
  153. background: #F4F5F7 linear-gradient(110deg, #48B9F9 0%, #3F90F7 100%);
  154. border-radius: 51rpx;
  155. text-align: center;
  156. position: absolute;
  157. top: 38rpx;
  158. right: 32rpx;
  159. }
  160. .centerBox{
  161. margin-top: 140rpx;
  162. margin-bottom: 100rpx;
  163. display: flex;
  164. justify-content: center;
  165. align-items: center;
  166. }
  167. .title{
  168. padding: 142rpx 116rpx 100rpx;
  169. width: calc(100vw - 232rpx);
  170. height: 40rpx;
  171. }
  172. .content{
  173. padding: 0 47rpx;
  174. width: calc(100vw - 94rpx);
  175. height: 224rpx;
  176. }
  177. </style>