homePage.vue 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306
  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. <!--
  26. <view class="btnBox">
  27. <image @click="goIndex()" class="searchBtn" src="../../static/img/button_search.png" mode=""></image>
  28. <view @click="goSelectCarModel()" class="brand">选择品牌</view>
  29. </view>
  30. <image class="content" src="../../static/img/text_shuoming.png" mode=""></image> -->
  31. <view class="vinSbimgBox" >
  32. <img src="../../static/img/icon_home_scan@2x.png" alt="" @click="ScanVin" class="vinSbimg">
  33. <image class="titleiMG" src="../../static/img/text_zhongjian.png" mode=""></image>
  34. </view>
  35. <view class="contBox">
  36. <view class="contLine" @click="ImgVin">
  37. <image src="../../static/img/icon_home_1@2x.png" mode="" class="contLineImg"></image>
  38. <view class="contLineTxt">VIN相册</view>
  39. </view>
  40. <view class="contLine" @click="goSelectCarModel()">
  41. <image src="../../static/img/icon_home_2@2x.png" mode="" class="contLineImg"></image>
  42. <view class="contLineTxt">车型查询</view>
  43. </view>
  44. <view class="contLine" @click="goIndex()">
  45. <image src="../../static/img/icon_home_3@2x.png" mode="" class="contLineImg"></image>
  46. <view class="contLineTxt">手输VIN</view>
  47. </view>
  48. <view class="contLine" @click="goOe">
  49. <image src="../../static/img/icon_home_4@2x.png" mode="" class="contLineImg"></image>
  50. <view class="contLineTxt">OE查询</view>
  51. </view>
  52. </view>
  53. </view>
  54. </view>
  55. </template>
  56. <script>
  57. import searchBox from '@/components/searchBox/searchBox.vue'
  58. export default {
  59. components: {
  60. searchBox
  61. },
  62. data() {
  63. return {
  64. iStatusBarHeight: '',
  65. bannerArr:['../../static/img/home_banner1.png','../../static/img/home_banner2.png','../../static/img/home_banner3.png'],
  66. searchValue: '',
  67. vin:'',
  68. }
  69. },
  70. onLoad(opt) {
  71. this.vin=opt.Vin;
  72. if(this.vin){
  73. uni.navigateTo({
  74. url:'index?vin='+this.vin
  75. })
  76. }
  77. this.iStatusBarHeight = uni.getSystemInfoSync().statusBarHeight;
  78. },
  79. methods: {
  80. search(val) {
  81. // console.log(val);
  82. this.searchValue = val
  83. },
  84. goOe(){
  85. uni.navigateTo({
  86. url: 'oeindex'
  87. })
  88. },
  89. goIndex() {
  90. uni.navigateTo({
  91. url: 'index'
  92. })
  93. },
  94. goSelectCarModel(){
  95. uni.navigateTo({
  96. url: 'SelectCarModel'
  97. })
  98. },
  99. ImgVin(){
  100. var standalone = window.navigator.standalone
  101. var userAgent = window.navigator.userAgent.toLowerCase()
  102. var safari = /safari/.test(userAgent)
  103. var ios = /iphone|ipod|ipad|mac/.test(userAgent)
  104. var android = /android/.test(userAgent)
  105. if (ios) {
  106. window.webkit.messageHandlers.goImgVin.postMessage(null)
  107. } else if (android) {
  108. window.android.goImgVin()
  109. }
  110. },
  111. ScanVin(){
  112. var standalone = window.navigator.standalone
  113. var userAgent = window.navigator.userAgent.toLowerCase()
  114. var safari = /safari/.test(userAgent)
  115. var ios = /iphone|ipod|ipad|mac/.test(userAgent)
  116. var android = /android/.test(userAgent)
  117. if (ios) {
  118. window.webkit.messageHandlers.goScanVin.postMessage(null)
  119. } else if (android) {
  120. window.android.goScanVin()
  121. }
  122. },
  123. goback() {
  124. console.log('返回');
  125. // uni.navigateBack({})
  126. //app交互
  127. var standalone = window.navigator.standalone
  128. var userAgent = window.navigator.userAgent.toLowerCase()
  129. var safari = /safari/.test(userAgent)
  130. var ios = /iphone|ipod|ipad|mac/.test(userAgent)
  131. var android = /android/.test(userAgent)
  132. if (ios) {
  133. if ( true) {//!standalone&& !safari
  134. window.webkit.messageHandlers.goMyNav.postMessage(null)
  135. }
  136. } else if (android) {
  137. window.android.postMessage()
  138. }
  139. },
  140. }
  141. }
  142. </script>
  143. <style scoped>
  144. .vinSbimg{
  145. width: 484rpx;
  146. height: 484rpx;
  147. }
  148. .titleiMG{
  149. width: 518rpx;
  150. height: 40rpx;
  151. }
  152. .vinSbimgBox{
  153. text-align: center;
  154. padding-top: 32rpx;
  155. }
  156. .contBox{
  157. display: flex;
  158. flex-wrap: wrap;
  159. justify-content: space-around;
  160. }
  161. .contLine{
  162. width: 331rpx;
  163. height: 74rpx;
  164. background: #F4F5F7;
  165. border-radius: 20rpx;
  166. display: flex;
  167. justify-content: center;
  168. margin-top: 40rpx;
  169. padding: 30rpx 0;
  170. }
  171. .contLineImg{
  172. width: 73rpx;height: 73rpx;
  173. }
  174. .contLineTxt{
  175. font-size: 30rpx;
  176. font-family: PingFangSC-Regular, PingFang SC;
  177. font-weight: 400;
  178. color: #333333;
  179. line-height: 73rpx;
  180. padding-left: 20rpx;
  181. }
  182. .box {
  183. min-height: 100vh;
  184. background: #ffffff;
  185. /* iOS 底部安全区 */
  186. padding-bottom: constant(safe-area-inset-bottom);
  187. padding-bottom: env(safe-area-inset-bottom);
  188. }
  189. .zdyNavBox {
  190. width: 100vw;
  191. background: #FFFFFF;
  192. position: fixed;
  193. top: 0;
  194. left: 0;
  195. z-index: 9999999;
  196. }
  197. .zdyNav {
  198. display: flex;
  199. justify-content: space-between;
  200. align-items: center;
  201. padding: 14rpx 6rpx;
  202. }
  203. .zdyNavLeft{
  204. width: 120rpx;
  205. }
  206. .zdyNavTitle {
  207. background: #FFFFFF;
  208. text-align: center;
  209. font-size: 32rpx;
  210. font-weight: bold;
  211. }
  212. .zdyNavRight {
  213. background: #FFFFFF;
  214. text-align: center;
  215. font-size: 28rpx;
  216. color: #3F90F7;
  217. width: 120rpx;
  218. }
  219. .mainBox {
  220. background: #FFFFFF;
  221. min-height: 100vh;
  222. width: 100vw;
  223. }
  224. .swiper,
  225. .swiper-item,
  226. .swpImg {
  227. width: 100%;
  228. height: 390rpx;
  229. }
  230. .btnBox{
  231. padding: 30rpx 24rpx;
  232. height: 92rpx;
  233. position: relative;
  234. }
  235. .searchBtn{
  236. width: calc(100vw - 48rpx);
  237. height: 92rpx;
  238. }
  239. .brand{
  240. color: #FFFFFF;
  241. font-size: 28rpx;
  242. width: 160rpx;
  243. height: 76rpx;
  244. line-height: 76rpx;
  245. background: #F4F5F7 linear-gradient(110deg, #48B9F9 0%, #3F90F7 100%);
  246. border-radius: 51rpx;
  247. text-align: center;
  248. position: absolute;
  249. top: 38rpx;
  250. right: 32rpx;
  251. }
  252. .centerBox{
  253. margin-top: 140rpx;
  254. margin-bottom: 100rpx;
  255. display: flex;
  256. justify-content: center;
  257. align-items: center;
  258. }
  259. .title{
  260. padding: 142rpx 116rpx 100rpx;
  261. width: calc(100vw - 232rpx);
  262. height: 40rpx;
  263. }
  264. .content{
  265. padding: 0 47rpx;
  266. width: calc(100vw - 94rpx);
  267. height: 224rpx;
  268. }
  269. </style>