utils.js 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. import request from "../../../core/utils/request"; // 扫码通行api
  2. export const getCourtlistInfoUrl = 'api/v1/proxy/intelli_court/courtList';
  3. export const getServiceDynamicListUrl = 'api/v1/component/service/dynamic/list';
  4. export const reportCourtInfoUrl = 'api/v1/data/template/report';
  5. const openCardCaseUrl = '/api/v1/card/openCardCase'; // 获取小区列表(含小区列表/当前小区信息)
  6. export async function getCourtlistInfo(data) {
  7. const [err, res] = await request({
  8. url: getCourtlistInfoUrl,
  9. method: 'get',
  10. data
  11. });
  12. if (err || !res) return [err, null];
  13. return [null, res];
  14. } // 小区数据上报
  15. export async function reportCourtInfo(data) {
  16. const [err, res] = await request({
  17. url: reportCourtInfoUrl,
  18. headers: {
  19. 'content-type': 'application/json'
  20. },
  21. data
  22. });
  23. if (err || !res) return [err, null];
  24. return [null, res];
  25. } // 动态数据源
  26. export async function getServiceDynamicList(data) {
  27. try {
  28. const [err, res] = await request({
  29. url: getServiceDynamicListUrl,
  30. method: 'get',
  31. data: {
  32. componentUuid: data.componentUuid,
  33. current: data.current || 1,
  34. pageSize: data.pageSize || 10
  35. }
  36. });
  37. if (err) return [err, undefined]; // return [undefined, res];
  38. // } catch (error) {
  39. // return [error, undefined];
  40. // }
  41. return { ...res,
  42. index: data.index
  43. };
  44. } catch (error) {
  45. return {
  46. index: data.index,
  47. list: []
  48. };
  49. }
  50. } // 是否已经开卡
  51. export async function openCardCase(data) {
  52. const [err, res] = await request({
  53. url: openCardCaseUrl,
  54. headers: {
  55. 'content-type': 'application/json'
  56. },
  57. data
  58. });
  59. if (err || !res) return [err, null];
  60. return [null, res];
  61. }