api.js 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. import { http } from "@/common/service/service.js";
  2. import configService from "@/common/service/config.service.js";
  3. const apiService = {
  4. /**
  5. * 登录
  6. */
  7. login(params) {
  8. return http.post("/sys/mLogin", params);
  9. },
  10. /**
  11. * 手机号码登录
  12. */
  13. phoneNoLogin(params) {
  14. return http.post("/sys/phoneLogin", params);
  15. },
  16. /**
  17. * 退出
  18. */
  19. logout(params) {
  20. return http.post("/sys/logout", params);
  21. },
  22. // 按系统查询设备分类信息
  23. getDeviceType(params) {
  24. return http.get(
  25. "/safety/ventanalyDeviceInfo/DeviceKind/queryBySystem",
  26. params
  27. );
  28. },
  29. // 查询各类设备的列表表头信息
  30. getShowColum(params) {
  31. return http.get("/safety/ventanalyShowColum/show_colum", params);
  32. },
  33. // 按系统查询设备监测信息
  34. getDeviceMonitor(params) {
  35. return http.post("/monitor/device", params);
  36. },
  37. //查询分页列表信息 通过分类查询 各类设备在app上是否展示的字段
  38. getShowColumList(params) {
  39. const urlParams = new URLSearchParams(params);
  40. const url = "/safety/ventanalyShowColum/list?" + urlParams.toString();
  41. return http.get(url);
  42. },
  43. //设备控制
  44. controlDevice(params) {
  45. return http.put(
  46. "/ventanaly-device/safety/ventanalyMonitorData/devicecontrol",
  47. params
  48. );
  49. },
  50. //根据设备id 查询该设备关联的视频流url
  51. getCameraById(params) {
  52. const urlParams = new URLSearchParams(params);
  53. const url = "/safety/ventanalyCamera/list?" + urlParams.toString();
  54. return http.get(url);
  55. },
  56. //如果上面这个接口返回code码 则使用这个接口获取url
  57. getCameraByCode(params) {
  58. const urlParams = new URLSearchParams(params);
  59. const url =
  60. "/ventanaly-device/camera/queryByCameraCode?" + urlParams.toString();
  61. return http.get(url);
  62. },
  63. //获取设备历史数据
  64. getDeviceHistory(params) {
  65. const urlParams = new URLSearchParams(params);
  66. const url =
  67. "/ventanaly-device/safety/ventanalyMonitorData/listdays?" +
  68. urlParams.toString();
  69. return http.get(url);
  70. },
  71. //获取操作历史
  72. getOpreateHistory(params) {
  73. const urlParams = new URLSearchParams(params);
  74. const url =
  75. "/ventanaly-device/safety/ventanalyDevicesetLog/list?" +
  76. urlParams.toString();
  77. return http.get(url);
  78. },
  79. /**
  80. * 获取文件访问路径
  81. * @param avatar
  82. * @param subStr
  83. * @returns {*}
  84. */
  85. getFileAccessHttpUrl(avatar, subStr) {
  86. if (!subStr) subStr = "http";
  87. if (avatar && avatar.startsWith(subStr)) {
  88. return avatar;
  89. } else {
  90. return configService.staticDomainURL + "/" + avatar;
  91. }
  92. },
  93. };
  94. export default apiService;