今日分享一个停车场的小程序,可以选择停车场,并根据地图导航,进入停车场,停车计时缴费。

停车场小程序功能:

1、查看附近停车场以及停车场剩余车位及收费情况
2、支持路线导航至停车场
3、输入车牌号预约取车

CSDN源码下载地址:https://download.csdn.net/download/u010978757/85496514
源码站下载地址:https://code.data5u.com/code/detail-610.html

分享部分代码app.js

//app.js
App({
  onLaunch: function () {
    //调用API从本地缓存中获取数据
    var logs = wx.getStorageSync('logs') || []
    logs.unshift(Date.now())
    wx.setStorageSync('logs', logs)

    try {
      var res = wx.getSystemInfoSync()
      console.log(res.model)
      console.log(res.pixelRatio)
      console.log(res.windowWidth)
      console.log(res.windowHeight)
      console.log(res.language)
      console.log(res.version)
      console.log(res.platform)
      this.globalData.windowWidth=res.windowWidth;
      this.globalData.windowHeight=res.windowHeight;
    } catch (e) {
      // Do something when catch error
    }

    
  },
  getUserInfo:function(cb){
    var that = this
    if(this.globalData.userInfo){
      typeof cb == "function" && cb(this.globalData.userInfo)
    }else{
      //调用登录接口
      wx.login({
        success: function () {
          wx.getUserInfo({
            success: function (res) {
              that.globalData.userInfo = res.userInfo
              typeof cb == "function" && cb(that.globalData.userInfo)
            }
          })
        }
      })
    }
  },
  globalData:{
    userInfo:null,
    windowWidth:0,
    windowHeight:50,
    serviceUrl:'http://localhost:53658/api'
  }
})

分享部分代码app.json

{
  "pages": [
    "pages/index/index",
    "pages/detail/detail",
    "pages/parkingLotList/parkingLotList",
    "pages/login/login",
    "pages/logs/logs",
    "pages/user/user",
    "pages/parkinglotMap/parkinglotMap",
    "pages/preOrder/preOrder",
    "pages/getCar/getCar",
    "pages/getCar/paidSuccess/paidSuccess",
    "pages/paymentPage/paymentPage",
    "pages/loadingPages/parkingLiftAwait/parkingLiftAwait"
  ],
  "tabBar": {
    "color": "#666",
    "selectedColor": "#268dcd",
    "borderStyle": "white",
    "backgroundColor": "#ffffff",
    "list": [
      {
        "pagePath": "pages/index/index",
        "iconPath": "images/icon/steering_wheel.png",
        "selectedIconPath": "images/icon/steering_wheel.active.png",
        "text": "预约停车"
      },
      {
        "pagePath": "pages/getCar/getCar",
        "iconPath": "images/icon/stopwatch.png",
        "selectedIconPath": "images/icon/stopwatch.active.png",
        "text": "我要取车"
      },
      {
        "pagePath": "pages/user/user",
        "iconPath": "images/icon/user_male3.png",
        "selectedIconPath": "images/icon/user_male3.active.png",
        "text": "个人中心"
      }
    ]
  },
  "window": {
    "backgroundTextStyle": "light",
    "navigationBarBackgroundColor": "#fff",
    "navigationBarTitleText": "停车厂+",
    "navigationBarTextStyle": "black",
    "enablePullDownRefresh": true,
    "backgroundColor": "#f7f7f7"
  }
}
Logo

有“AI”的1024 = 2048,欢迎大家加入2048 AI社区

更多推荐