index-api2.js 1017 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. // import request from './request.js'
  2. const baseUrl = "https://data.cqna.gov.cn"
  3. const request = (options) => {
  4. return new Promise((resolve,reject) => {
  5. options.url = baseUrl + options.url
  6. wx.request({
  7. // 配置 "wx.request" 请求参数
  8. ...options,
  9. header: {
  10. 'content-type': 'application/json;charset=UTF-8'
  11. },
  12. success: function (res) {
  13. // console.log("network-res=>", res);
  14. // 返回成功信息
  15. resolve(res.data)
  16. },
  17. fail: function (error) {
  18. // console.log("network-err=>", error);
  19. // 返回错误信息
  20. reject(error)
  21. }
  22. })
  23. })
  24. }
  25. export function info(channelId,docId) {
  26. const params = {'channelId': channelId, 'docId': docId}
  27. return request({
  28. url: `/mini/hlw/info`,
  29. method: 'GET',
  30. data: params
  31. })
  32. }
  33. export function send(page,limit,channelId) {
  34. const params = {'page': page, 'limit': limit,'channelId': channelId}
  35. return request({
  36. url: `/mini/hlw/send`,
  37. method: 'GET',
  38. data: params
  39. })
  40. }