http.api.js 4.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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 selectOtherExcptionList = (params = {}) => vm.$u.get(apiurl.selectOtherExcptionList,params);
  15. let reportDetail = (params = {}) => vm.$u.get(apiurl.reportDetail,params);
  16. let emergencyReportList = (params = {}) => vm.$u.get(apiurl.emergencyReportList,params);
  17. let reportEmergency = (params = {}) => vm.$u.post(apiurl.reportEmergency, params);
  18. let payeeReportList = (params = {}) => vm.$u.get(apiurl.payeeReportList,params);
  19. let payeeReportDetail = (params = {}) => vm.$u.get(apiurl.payeeReportDetail,params);
  20. let payeeReport = (params = {}) => vm.$u.post(apiurl.payeeReport, params);
  21. let payeeExceptionType = (params = {}) => vm.$u.get(apiurl.payeeExceptionType,params);
  22. let punchInfo = (params = {}) => vm.$u.get(apiurl.punchInfoUrl+params.roadNo);
  23. let punchIn = (params = {}) => vm.$u.post(apiurl.punchInUrl, params);
  24. let getDeviceList = (params = {}) => vm.$u.get(apiurl.getDeviceListUrl,params);
  25. let getRoadList = (params = {}) => vm.$u.get(apiurl.getRoadListUrl,params);
  26. let getSelectDeviceList = (params = {}) => vm.$u.get(apiurl.getSelectDeviceListUrl,params);
  27. let geoDeviceStatust = (params = {}) => vm.$u.get(apiurl.geoDeviceStatustUrl,params);
  28. let lockDeviceStatust = (params = {}) => vm.$u.get(apiurl.lockDeviceStatustUrl,params);
  29. let findRoadSpaceVoById = (params = {}) => vm.$u.get(apiurl.findRoadSpaceVoByIdUrl,params);
  30. let deviceLog = (params = {}) => vm.$u.get(apiurl.deviceLogUrl,params);
  31. let deviceexcptionprocess = (params = {}) => vm.$u.post(apiurl.deviceexcptionprocessUrl, params);
  32. let placeStatus = (params = {}) => vm.$u.get(apiurl.placeStatusUrl,params);
  33. let selectParkDeviceList = (params = {}) => vm.$u.get(apiurl.selectParkDeviceListUrl,params);
  34. let selectParkNum = (params = {}) => vm.$u.get(apiurl.selectParkNumUrl,params);
  35. let findParkDeviceById = (params = {}) => vm.$u.get(apiurl.findParkDeviceByIdUrl,params);
  36. let controlDevice = (params = {}) => vm.$u.post(apiurl.controlDeviceUrl, params);
  37. let inspecmsg = (params = {}) => vm.$u.get(apiurl.inspecmsgUrl,params);
  38. let inspecmsgDetails = (params = {}) => vm.$u.get(apiurl.inspecmsgDetailsUrl,params);
  39. let updateInspecMsgStatus = (params = {}) => vm.$u.put(apiurl.updateInspecMsgStatusUrl,params);
  40. let getUnreadMsgTotal = (params = {}) => vm.$u.get(apiurl.getUnreadMsgTotalUrl,params);
  41. let deviceLockStatus = (params = {}) => vm.$u.get(apiurl.deviceLockStatusUrl,params);
  42. let payeeList = (params = {}) => vm.$u.get(apiurl.payeeList,params);
  43. // 将各个定义的接口名称,统一放进对象挂载到vm.$u.api(因为vm就是this,也即this.$u.api)下
  44. vm.$u.api = {
  45. getLogin,
  46. getParkingRecord,
  47. getDeviceStatis,
  48. getDeviceTypeList,
  49. updatePwd,
  50. getLoginOut,
  51. getRoadAllList,
  52. report,
  53. selectOtherExcptionList,
  54. reportDetail,
  55. emergencyReportList,
  56. reportEmergency,
  57. payeeReport,
  58. payeeReportDetail,
  59. payeeReportList,
  60. payeeExceptionType,
  61. punchInfo,
  62. punchIn,
  63. getDeviceList,
  64. getRoadList,
  65. getSelectDeviceList,
  66. geoDeviceStatust,
  67. lockDeviceStatust,
  68. findRoadSpaceVoById,
  69. deviceLog,
  70. deviceexcptionprocess,
  71. placeStatus,
  72. selectParkDeviceList,
  73. selectParkNum,
  74. findParkDeviceById,
  75. controlDevice,
  76. inspecmsg,
  77. inspecmsgDetails,
  78. updateInspecMsgStatus,
  79. getUnreadMsgTotal,
  80. deviceLockStatus,
  81. payeeList
  82. };
  83. }
  84. export default {
  85. install
  86. }