homePage.vue 7.0 KB

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