homePage.vue 3.6 KB

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