api.js 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. import {http} from './service.js'
  2. //文件上传
  3. let uploadFileUrl='/upload/putfile'
  4. const uploadFile={
  5. submit:p => http.upload(uploadFileUrl, {name:'file',filePath:p}),
  6. }
  7. //短信Url
  8. let SMSUrl={
  9. sendSms:'huawei/sms/sendSms',
  10. validCode:'huawei/sms/validCode'
  11. }
  12. //短信api
  13. const SMSApi = {
  14. sendSms:p => http.post(SMSUrl.sendSms+p),
  15. validCode:p => http.post(SMSUrl.validCode+p),
  16. }
  17. //微信基本参数
  18. let wxData={
  19. //国信的
  20. appId:'wx988577c5a9061283',
  21. secret:'5013c82bf72e6266dfb2720757433e74',
  22. //园区的
  23. // appId:'wxcfb2b48079ca59e4',
  24. // secret:'30f9cf566aa57892e55aee0406356b9e',
  25. subscribe_grant_type:'client_credential', //订阅消息的grant_type
  26. }
  27. //微信url
  28. let wxUrl={
  29. subscribe:'/wx/msgSend',
  30. getAccessToken:'/wx/getAccessToken',
  31. getOpenId:'/wx/getOpenId',
  32. getAppletStatus:'appconf/appconf/getById',
  33. }
  34. //微信api
  35. const wxApi = {
  36. subscribe:p => http.post(wxUrl.subscribe, p),
  37. getAccessToken:p => http.get(wxUrl.getAccessToken, {params:p}),
  38. getOpenId:p => http.get(wxUrl.getOpenId, {params:p}),
  39. //获取小程序的audit状态
  40. getAppletStatus:p => http.get(wxUrl.getAppletStatus, {params:p}),
  41. }
  42. //园区api
  43. let agencyUrl={
  44. page:'/agency/agency/getAgencyList'
  45. }
  46. const agency = {
  47. page:p => http.get(agencyUrl.page, {params:p}),
  48. }
  49. //区域api
  50. let residentialUrl={
  51. page:'/community/residential/listByAgencyId'
  52. }
  53. const residential = {
  54. page:p => http.get(residentialUrl.page, {params:p}),
  55. }
  56. //企业api
  57. let enterpriseUrl={
  58. page:'/enterprise/enterprise/list',
  59. detail:'/enterprise/enterprise/detail',
  60. submit:'/enterprise/enterprise/submit'
  61. }
  62. const enterprise = {
  63. page:p => http.get(enterpriseUrl.page, {params:p}),
  64. detail:p => http.get(enterpriseUrl.detail, {params:p}),
  65. submit:p => http.post(enterpriseUrl.submit, p),
  66. }
  67. //企业员工
  68. let enterprisestaffUrl={
  69. page:'/community/enterprisestaff/getEnterpriseList',
  70. submit:'/community/enterprisestaff/submit',
  71. detail:'/community/enterprisestaff/detail'
  72. }
  73. const enterprisestaff = {
  74. page:p => http.get(enterprisestaffUrl.page, {params:p}),
  75. detail:p => http.get(enterprisestaffUrl.detail, {params:p}),
  76. submit:p => http.post(enterprisestaffUrl.submit, p),
  77. }
  78. //CMS
  79. let CMSUrl={
  80. page:'/estate/article/list',
  81. detail:'/estate/article/detail',
  82. addReaderCount:'/estate/article/addReaderCount'
  83. }
  84. let CMS={
  85. page:p => http.get(CMSUrl.page, {params:p}),
  86. detail:p => http.get(CMSUrl.detail, {params:p}),
  87. addReaderCount:p => http.post(CMSUrl.addReaderCount, p),
  88. }
  89. //消防设备
  90. let fireDeviceUrl={
  91. page:'/smartapplication/smartdevice/list',
  92. alarmRecord:'/smartapplication/smartdevice/getAlarmRecord'
  93. }
  94. let fireDevice={
  95. page:p => http.get(fireDeviceUrl.page, {params:p}),
  96. alarmRecord:p => http.get(fireDeviceUrl.alarmRecord, {params:p}),
  97. }
  98. //用户反馈
  99. let feedbackUrl={
  100. submit:'/estate/feedback/submit'
  101. }
  102. const feedback = {
  103. submit:p => http.post(feedbackUrl.submit, p),
  104. }
  105. //园区公告
  106. let noticeUrl={
  107. page:'/estate/parknotice/list'
  108. }
  109. const notice = {
  110. page:p => http.get(noticeUrl.page, {params:p}),
  111. }
  112. //测温记录
  113. let temperatureRecordUrl={
  114. page:'/smartapplication/temperaturerecord/getTemperatureRecord'
  115. }
  116. const temperatureRecord = {
  117. page:p => http.get(temperatureRecordUrl.page, {params:p}),
  118. }
  119. export const api={
  120. //上传文件
  121. uploadFile,
  122. //短信
  123. SMSApi,
  124. //微信基本参数
  125. wxData,
  126. //微信api
  127. wxApi,
  128. //园区
  129. agency,
  130. //区域
  131. residential,
  132. //企业
  133. enterprise,
  134. //企业员工
  135. enterprisestaff,
  136. //CMS
  137. CMS,
  138. //消防设备
  139. fireDevice,
  140. //用户反馈
  141. feedback,
  142. //园区公告
  143. notice,
  144. //测温记录
  145. temperatureRecord
  146. }