http.api.js 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. import {apiurl} from "./apiurl.js"
  2. // 此处第二个参数vm,就是我们在页面使用的this,你可以通过vm获取vuex等操作,更多内容详见uView对拦截器的介绍部分:
  3. // https://uviewui.com/js/http.html#%E4%BD%95%E8%B0%93%E8%AF%B7%E6%B1%82%E6%8B%A6%E6%88%AA%EF%BC%9F
  4. const install = (Vue, vm) => {
  5. // 登录
  6. let getLogin = (params = {}) => vm.$u.post(apiurl.loginUrl, params);
  7. let getParkingRecord = (params = {}) => vm.$u.get(apiurl.getParkingRecordUrl,params);
  8. let getDeviceStatis = (params = {}) => vm.$u.get(apiurl.getDeviceStatisUrl,params);
  9. let getDeviceTypeList = (params = {}) => vm.$u.get(apiurl.getDeviceTypeListUrl,params);
  10. let updatePwd = (params = {}) => vm.$u.put(apiurl.updatePwdUrl,params);
  11. let getLoginOut = (params = {}) => vm.$u.get(apiurl.getLoginOutUrl,params);
  12. let getRoadAllList = (params = {}) => vm.$u.get(apiurl.getRoadAllListUrl,params);
  13. let report = (params = {}) => vm.$u.post(apiurl.reportUrl, params);
  14. let punchInfo = (params = {}) => vm.$u.get(apiurl.punchInfoUrl+params.roadNo);
  15. let punchIn = (params = {}) => vm.$u.post(apiurl.punchInUrl, params);
  16. let getDeviceList = (params = {}) => vm.$u.get(apiurl.getDeviceListUrl,params);
  17. let getRoadList = (params = {}) => vm.$u.get(apiurl.getRoadListUrl,params);
  18. let getSelectDeviceList = (params = {}) => vm.$u.get(apiurl.getSelectDeviceListUrl,params);
  19. let geoDeviceStatust = (params = {}) => vm.$u.get(apiurl.geoDeviceStatustUrl,params);
  20. let findRoadSpaceVoById = (params = {}) => vm.$u.get(apiurl.findRoadSpaceVoByIdUrl,params);
  21. let deviceLog = (params = {}) => vm.$u.get(apiurl.deviceLogUrl,params);
  22. let deviceexcptionprocess = (params = {}) => vm.$u.post(apiurl.deviceexcptionprocessUrl, params);
  23. let placeStatus = (params = {}) => vm.$u.get(apiurl.placeStatusUrl,params);
  24. // 将各个定义的接口名称,统一放进对象挂载到vm.$u.api(因为vm就是this,也即this.$u.api)下
  25. vm.$u.api = {
  26. getLogin,
  27. getParkingRecord,
  28. getDeviceStatis,
  29. getDeviceTypeList,
  30. updatePwd,
  31. getLoginOut,
  32. getRoadAllList,
  33. report,
  34. punchInfo,
  35. punchIn,
  36. getDeviceList,
  37. getRoadList,
  38. getSelectDeviceList,
  39. geoDeviceStatust,
  40. findRoadSpaceVoById,
  41. deviceLog,
  42. deviceexcptionprocess,
  43. placeStatus
  44. };
  45. }
  46. export default {
  47. install
  48. }