homePage.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  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" 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. goIndex() {
  56. uni.navigateTo({
  57. url: 'index'
  58. })
  59. },
  60. goSelectCarModel(){
  61. uni.navigateTo({
  62. url: 'SelectCarModel'
  63. })
  64. },
  65. goback() {
  66. console.log('返回');
  67. // uni.navigateBack({})
  68. //app交互
  69. var standalone = window.navigator.standalone
  70. var userAgent = window.navigator.userAgent.toLowerCase()
  71. var safari = /safari/.test(userAgent)
  72. var ios = /iphone|ipod|ipad|mac/.test(userAgent)
  73. var android = /android/.test(userAgent)
  74. if (ios) {
  75. if ( true) {//!standalone&& !safari
  76. window.webkit.messageHandlers.goMyNav.postMessage(null)
  77. }
  78. } else if (android) {
  79. window.android.postMessage()
  80. }
  81. },
  82. }
  83. }
  84. </script>
  85. <style>
  86. .box {
  87. min-height: 100vh;
  88. background: #ffffff;
  89. /* iOS 底部安全区 */
  90. padding-bottom: constant(safe-area-inset-bottom);
  91. padding-bottom: env(safe-area-inset-bottom);
  92. }
  93. .zdyNavBox {
  94. width: 100vw;
  95. background: #FFFFFF;
  96. position: fixed;
  97. top: 0;
  98. left: 0;
  99. z-index: 9999999;
  100. }
  101. .zdyNav {
  102. display: flex;
  103. justify-content: space-between;
  104. align-items: center;
  105. padding: 14rpx 6rpx;
  106. }
  107. .zdyNavLeft{
  108. }
  109. .zdyNavTitle {
  110. background: #FFFFFF;
  111. text-align: center;
  112. font-size: 32rpx;
  113. font-weight: bold;
  114. }
  115. .zdyNavRight {
  116. background: #FFFFFF;
  117. text-align: center;
  118. font-size: 28rpx;
  119. color: #3F90F7;
  120. width: 54rpx;
  121. }
  122. .mainBox {
  123. background: #FFFFFF;
  124. min-height: 100vh;
  125. width: 100vw;
  126. }
  127. .swiper,
  128. .swiper-item,
  129. .swpImg {
  130. width: 100%;
  131. height: 390rpx;
  132. }
  133. .btnBox{
  134. padding: 30rpx 24rpx;
  135. height: 92rpx;
  136. position: relative;
  137. }
  138. .searchBtn{
  139. width: calc(100vw - 48rpx);
  140. height: 92rpx;
  141. }
  142. .brand{
  143. color: #FFFFFF;
  144. font-size: 28rpx;
  145. width: 160rpx;
  146. height: 76rpx;
  147. line-height: 76rpx;
  148. background: #F4F5F7 linear-gradient(110deg, #48B9F9 0%, #3F90F7 100%);
  149. border-radius: 51rpx;
  150. text-align: center;
  151. position: absolute;
  152. top: 38rpx;
  153. right: 32rpx;
  154. }
  155. .centerBox{
  156. margin-top: 140rpx;
  157. margin-bottom: 100rpx;
  158. display: flex;
  159. justify-content: center;
  160. align-items: center;
  161. }
  162. .title{
  163. padding: 142rpx 116rpx 100rpx;
  164. width: calc(100vw - 232rpx);
  165. height: 40rpx;
  166. }
  167. .content{
  168. padding: 0 47rpx;
  169. width: calc(100vw - 94rpx);
  170. height: 224rpx;
  171. }
  172. </style>