homePage.vue 4.3 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" @click="goOe">OE查询</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" 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. width: 120rpx;
  114. }
  115. .zdyNavTitle {
  116. background: #FFFFFF;
  117. text-align: center;
  118. font-size: 32rpx;
  119. font-weight: bold;
  120. }
  121. .zdyNavRight {
  122. background: #FFFFFF;
  123. text-align: center;
  124. font-size: 28rpx;
  125. color: #3F90F7;
  126. width: 120rpx;
  127. }
  128. .mainBox {
  129. background: #FFFFFF;
  130. min-height: 100vh;
  131. width: 100vw;
  132. }
  133. .swiper,
  134. .swiper-item,
  135. .swpImg {
  136. width: 100%;
  137. height: 390rpx;
  138. }
  139. .btnBox{
  140. padding: 30rpx 24rpx;
  141. height: 92rpx;
  142. position: relative;
  143. }
  144. .searchBtn{
  145. width: calc(100vw - 48rpx);
  146. height: 92rpx;
  147. }
  148. .brand{
  149. color: #FFFFFF;
  150. font-size: 28rpx;
  151. width: 160rpx;
  152. height: 76rpx;
  153. line-height: 76rpx;
  154. background: #F4F5F7 linear-gradient(110deg, #48B9F9 0%, #3F90F7 100%);
  155. border-radius: 51rpx;
  156. text-align: center;
  157. position: absolute;
  158. top: 38rpx;
  159. right: 32rpx;
  160. }
  161. .centerBox{
  162. margin-top: 140rpx;
  163. margin-bottom: 100rpx;
  164. display: flex;
  165. justify-content: center;
  166. align-items: center;
  167. }
  168. .title{
  169. padding: 142rpx 116rpx 100rpx;
  170. width: calc(100vw - 232rpx);
  171. height: 40rpx;
  172. }
  173. .content{
  174. padding: 0 47rpx;
  175. width: calc(100vw - 94rpx);
  176. height: 224rpx;
  177. }
  178. </style>